Skip to content

Commit c0ae38c

Browse files
agirornljharb
authored andcommitted
[Tests] add more Error tests
1 parent ffb2522 commit c0ae38c

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"devDependencies": {
2626
"@ljharb/eslint-config": "^13.1.1",
2727
"eslint": "^5.16.0",
28+
"object.assign": "^4.1.0",
2829
"tape": "^4.11.0"
2930
},
3031
"repository": {

test/cmp.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var test = require('tape');
22
require('./_tape');
3+
var assign = require('object.assign');
34

45
var equal = require('../');
56

@@ -348,5 +349,23 @@ test('Errors', function (t) {
348349
t.deepEqualTest(new Error('xyz'), new TypeError('xyz'), 'two errors of different types with the same message', false, false);
349350
t.deepEqualTest(new Error('xyz'), new Error('zyx'), 'two errors of the same type with a different message', false, false);
350351

352+
t.deepEqualTest(
353+
new Error('a'),
354+
assign(new Error('a'), { code: 10 }),
355+
'two otherwise equal errors with different own properties',
356+
false,
357+
false
358+
);
359+
360+
t.end();
361+
});
362+
363+
test('errors', function (t) {
364+
365+
t.end();
366+
});
367+
368+
test('error = Object', function (t) {
369+
t.notOk(equal(new Error('a'), { message: 'a' }));
351370
t.end();
352371
});

0 commit comments

Comments
 (0)