| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 74f0d1a commit d3c2534
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,7 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | 23 | const { isDeepEqual, isDeepStrictEqual } = | |
| 24 | 24 | require('internal/util/comparisons'); | |
| 25 | - const errors = require('internal/errors'); | ||
| 25 | + const { AssertionError, TypeError } = require('internal/errors'); | ||
| 26 | 26 | const { inspect } = require('util'); | |
| 27 | 27 | ||
| 28 | 28 | const ERR_DIFF_DEACTIVATED = 0; | |
@@ -46,7 +46,7 @@ const NO_EXCEPTION_SENTINEL = {}; | |||
| 46 | 46 | function innerFail(obj) { | |
| 47 | 47 | if (obj.message instanceof Error) throw obj.message; | |
| 48 | 48 | ||
| 49 | - throw new errors.AssertionError(obj); | ||
| 49 | + throw new AssertionError(obj); | ||
| 50 | 50 | } | |
| 51 | 51 | ||
| 52 | 52 | function fail(actual, expected, message, operator, stackStartFn) { | |
@@ -76,7 +76,7 @@ assert.fail = fail; | |||
| 76 | 76 | // new assert.AssertionError({ message: message, | |
| 77 | 77 | // actual: actual, | |
| 78 | 78 | // expected: expected }); | |
| 79 | - assert.AssertionError = errors.AssertionError; | ||
| 79 | + assert.AssertionError = AssertionError; | ||
| 80 | 80 | ||
| 81 | 81 | ||
| 82 | 82 | // Pure assertion tests whether a value is truthy, as determined | |
@@ -220,8 +220,8 @@ function expectedException(actual, expected, msg) { | |||
| 220 | 220 | return expected.test(actual); | |
| 221 | 221 | // assert.doesNotThrow does not accept objects. | |
| 222 | 222 | if (arguments.length === 2) { | |
| 223 | - throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'expected', | ||
| 224 | - ['Function', 'RegExp'], expected); | ||
| 223 | + throw new TypeError('ERR_INVALID_ARG_TYPE', 'expected', | ||
| 224 | + ['Function', 'RegExp'], expected); | ||
| 225 | 225 | } | |
| 226 | 226 | // The name and message could be non enumerable. Therefore test them | |
| 227 | 227 | // explicitly. | |
@@ -258,8 +258,8 @@ function expectedException(actual, expected, msg) { | |||
| 258 | 258 | ||
| 259 | 259 | function getActual(block) { | |
| 260 | 260 | if (typeof block !== 'function') { | |
| 261 | - throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'block', 'Function', | ||
| 262 | - block); | ||
| 261 | + throw new TypeError('ERR_INVALID_ARG_TYPE', 'block', 'Function', | ||
| 262 | + block); | ||
| 263 | 263 | } | |
| 264 | 264 | try { | |
| 265 | 265 | block(); | |
@@ -275,10 +275,10 @@ assert.throws = function throws(block, error, message) { | |||
| 275 | 275 | ||
| 276 | 276 | if (typeof error === 'string') { | |
| 277 | 277 | if (arguments.length === 3) | |
| 278 | - throw new errors.TypeError('ERR_INVALID_ARG_TYPE', | ||
| 279 | - 'error', | ||
| 280 | - ['Function', 'RegExp'], | ||
| 281 | - error); | ||
| 278 | + throw new TypeError('ERR_INVALID_ARG_TYPE', | ||
| 279 | + 'error', | ||
| 280 | + ['Function', 'RegExp'], | ||
| 281 | + error); | ||
| 282 | 282 | ||
| 283 | 283 | message = error; | |
| 284 | 284 | error = null; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | Exiting with code=1 | |
| 2 | 2 | assert.js:* | |
| 3 | - throw new errors.AssertionError(obj); | ||
| 3 | + throw new AssertionError(obj); | ||
| 4 | 4 | ^ | |
| 5 | 5 | ||
| 6 | 6 | AssertionError [ERR_ASSERTION]: 1 === 2 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments