summaryrefslogtreecommitdiff
path: root/test/fixtures
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2019-12-25 18:02:16 +0100
committerRuben Bridgewater <ruben@bridgewater.de>2020-01-03 17:47:37 +0100
commitefa0bd8e25469f23e1d7d65ed1abfa6f6438e503 (patch)
tree421fab7e5e4ff1b65cbdf7815617c911d17b4c63 /test/fixtures
parent10f7169d5826c581d46c85af20c3be9337aab4c7 (diff)
downloadnode-new-efa0bd8e25469f23e1d7d65ed1abfa6f6438e503.tar.gz
test: refactor common.expectsError
This completely refactors the `expectsError` behavior: so far it's almost identical to `assert.throws(fn, object)` in case it was used with a function as first argument. It had a magical property check that allowed to verify a functions `type` in case `type` was passed used in the validation object. This pattern is now completely removed and `assert.throws()` should be used instead. The main intent for `common.expectsError()` is to verify error cases for callback based APIs. This is now more flexible by accepting all validation possibilites that `assert.throws()` accepts as well. No magical properties exist anymore. This reduces surprising behavior for developers who are not used to the Node.js core code base. This has the side effect that `common` is used significantly less frequent. PR-URL: https://github.com/nodejs/node/pull/31092 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'test/fixtures')
-rw-r--r--test/fixtures/require-resolve.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/fixtures/require-resolve.js b/test/fixtures/require-resolve.js
index 66521d12e9..e3a4886bce 100644
--- a/test/fixtures/require-resolve.js
+++ b/test/fixtures/require-resolve.js
@@ -86,11 +86,11 @@ assert.throws(() => {
}
// Test paths option validation
-common.expectsError(() => {
+assert.throws(() => {
require.resolve('.\\three.js', { paths: 'foo' })
}, {
code: 'ERR_INVALID_OPT_VALUE',
- type: TypeError,
+ name: 'TypeError',
});
// Verify that the default require.resolve() is used for empty options.