Comparing version 4.16.1 to 4.16.2
@@ -545,6 +545,8 @@ 'use strict'; | ||
caught = { error: err }; | ||
if (Object(err) === err && (!isEnumerable(err, 'message') || !has(err, 'message'))) { | ||
var message = err.message; | ||
delete err.message; | ||
err.message = message; | ||
if (Object(err) === err && 'message' in err && (!isEnumerable(err, 'message') || !has(err, 'message'))) { | ||
try { | ||
var message = err.message; | ||
delete err.message; | ||
err.message = message; | ||
} catch (e) { /**/ } | ||
} | ||
@@ -551,0 +553,0 @@ } |
{ | ||
"name": "tape", | ||
"version": "4.16.1", | ||
"version": "4.16.2", | ||
"description": "tap-producing test harness for node and browsers", | ||
@@ -17,3 +17,3 @@ "main": "index.js", | ||
"deep-equal": "~1.1.1", | ||
"defined": "~1.0.0", | ||
"defined": "~1.0.1", | ||
"dotignore": "~0.1.2", | ||
@@ -25,13 +25,13 @@ "for-each": "~0.3.3", | ||
"is-regex": "~1.1.4", | ||
"minimist": "~1.2.6", | ||
"object-inspect": "~1.12.2", | ||
"minimist": "~1.2.7", | ||
"object-inspect": "~1.12.3", | ||
"resolve": "~1.22.1", | ||
"resumer": "~0.0.0", | ||
"string.prototype.trim": "~1.2.6", | ||
"string.prototype.trim": "~1.2.7", | ||
"through": "~2.3.8" | ||
}, | ||
"devDependencies": { | ||
"@ljharb/eslint-config": "^21.0.0", | ||
"array.prototype.flatmap": "^1.3.0", | ||
"aud": "^2.0.0", | ||
"@ljharb/eslint-config": "^21.0.1", | ||
"array.prototype.flatmap": "^1.3.1", | ||
"aud": "^2.0.2", | ||
"auto-changelog": "^2.4.0", | ||
@@ -38,0 +38,0 @@ "concat-stream": "^1.6.2", |
@@ -179,6 +179,15 @@ 'use strict'; | ||
' ...', | ||
'# non-extensible throw match', | ||
'ok 15 error is non-extensible', | ||
'ok 16 non-extensible error matches', | ||
'ok 17 errorWithMessage is non-extensible', | ||
'ok 18 non-extensible error with message matches', | ||
'# frozen `message` property', | ||
'ok 19 error is non-writable', | ||
'ok 20 error is non-configurable', | ||
'ok 21 non-writable error matches', | ||
'', | ||
'1..14', | ||
'# tests 14', | ||
'# pass 4', | ||
'1..21', | ||
'# tests 21', | ||
'# pass 11', | ||
'# fail 10', | ||
@@ -225,2 +234,30 @@ '' | ||
}); | ||
test('non-extensible throw match', { skip: !Object.seal }, function (t) { | ||
var error = { foo: 1 }; | ||
Object.seal(error); | ||
t.throws(function () { error.x = 1; }, TypeError, 'error is non-extensible'); | ||
t.throws(function () { throw error; }, error, 'non-extensible error matches'); | ||
var errorWithMessage = { message: 'abc' }; | ||
Object.seal(errorWithMessage); | ||
t.throws(function () { errorWithMessage.x = 1; }, TypeError, 'errorWithMessage is non-extensible'); | ||
t.throws(function () { throw errorWithMessage; }, error, 'non-extensible error with message matches'); | ||
t.end(); | ||
}); | ||
test('frozen `message` property', { skip: !Object.defineProperty }, function (t) { | ||
var error = { message: 'abc' }; | ||
Object.defineProperty(error, 'message', { configurable: false, enumerable: false, writable: false }); | ||
t.throws(function () { error.message = 'def'; }, TypeError, 'error is non-writable'); | ||
t.throws(function () { delete error.message; }, TypeError, 'error is non-configurable'); | ||
t.throws(function () { throw error; }, { message: 'abc' }, 'non-writable error matches'); | ||
t.end(); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
325755
5560
Updateddefined@~1.0.1
Updatedminimist@~1.2.7
Updatedobject-inspect@~1.12.3
Updatedstring.prototype.trim@~1.2.7