diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2019-03-13 22:43:00 +0800 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2019-04-25 01:29:48 +0200 |
commit | b9f1e572017c146da66077331260bac0e60c0928 (patch) | |
tree | 94813ea917a49cb573d141f225922534770e6eed /test/parallel/test-internal-assert.js | |
parent | 237d9f97165da39d1e540699294cf2dc83bbc2d3 (diff) | |
download | android-node-v8-b9f1e572017c146da66077331260bac0e60c0928.tar.gz android-node-v8-b9f1e572017c146da66077331260bac0e60c0928.tar.bz2 android-node-v8-b9f1e572017c146da66077331260bac0e60c0928.zip |
lib: throw a special error in internal/assert
Instead of using the public AssertionError, use a simplified
error that describes potential causes of these assertions
and suggests the user to open an issue.
PR-URL: https://github.com/nodejs/node/pull/26635
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'test/parallel/test-internal-assert.js')
-rw-r--r-- | test/parallel/test-internal-assert.js | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/test/parallel/test-internal-assert.js b/test/parallel/test-internal-assert.js index 4fd443864b..18528e9b27 100644 --- a/test/parallel/test-internal-assert.js +++ b/test/parallel/test-internal-assert.js @@ -1,17 +1,13 @@ // Flags: --expose-internals 'use strict'; +// This tests that the internal assert module works as expected. +// The failures are tested in test/message. + require('../common'); -const assert = require('assert'); const internalAssert = require('internal/assert'); // Should not throw. internalAssert(true); internalAssert(true, 'fhqwhgads'); - -assert.throws(() => { internalAssert(false); }, assert.AssertionError); -assert.throws(() => { internalAssert(false, 'fhqwhgads'); }, - { code: 'ERR_ASSERTION', message: 'fhqwhgads' }); -assert.throws(() => { internalAssert.fail('fhqwhgads'); }, - { code: 'ERR_ASSERTION', message: 'fhqwhgads' }); |