summaryrefslogtreecommitdiff
path: root/test/parallel/test-assert.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2018-04-11 03:28:35 +0200
committerRuben Bridgewater <ruben@bridgewater.de>2018-04-13 20:01:10 +0200
commit710110788b92311a9a012ede812ac87ffa00cad2 (patch)
treee592257f11f2e1a81a47ea7e168bf461f2a3225e /test/parallel/test-assert.js
parentdca7fb2225ea5bd8452c51d4167962f2838389f8 (diff)
downloadandroid-node-v8-710110788b92311a9a012ede812ac87ffa00cad2.tar.gz
android-node-v8-710110788b92311a9a012ede812ac87ffa00cad2.tar.bz2
android-node-v8-710110788b92311a9a012ede812ac87ffa00cad2.zip
assert: fix actual & expected input
This makes sure the actual and expected values on the error thrown by `assert.throws` etc. are always as they should be. PR-URL: https://github.com/nodejs/node/pull/19925 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-assert.js')
-rw-r--r--test/parallel/test-assert.js34
1 files changed, 21 insertions, 13 deletions
diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js
index c061551604..478945156e 100644
--- a/test/parallel/test-assert.js
+++ b/test/parallel/test-assert.js
@@ -192,32 +192,40 @@ a.throws(() => thrower(TypeError), (err) => {
const noop = () => {};
assert.throws(
() => { a.throws((noop)); },
- common.expectsError({
+ {
code: 'ERR_ASSERTION',
- message: /^Missing expected exception\.$/,
- operator: 'throws'
- }));
+ message: 'Missing expected exception.',
+ operator: 'throws',
+ actual: undefined,
+ expected: undefined
+ });
assert.throws(
() => { a.throws(noop, TypeError); },
- common.expectsError({
+ {
code: 'ERR_ASSERTION',
- message: /^Missing expected exception \(TypeError\)\.$/
- }));
+ message: 'Missing expected exception (TypeError).',
+ actual: undefined,
+ expected: TypeError
+ });
assert.throws(
() => { a.throws(noop, 'fhqwhgads'); },
- common.expectsError({
+ {
code: 'ERR_ASSERTION',
- message: /^Missing expected exception: fhqwhgads$/
- }));
+ message: 'Missing expected exception: fhqwhgads',
+ actual: undefined,
+ expected: undefined
+ });
assert.throws(
() => { a.throws(noop, TypeError, 'fhqwhgads'); },
- common.expectsError({
+ {
code: 'ERR_ASSERTION',
- message: /^Missing expected exception \(TypeError\): fhqwhgads$/
- }));
+ message: 'Missing expected exception (TypeError): fhqwhgads',
+ actual: undefined,
+ expected: TypeError
+ });
let threw = false;
try {