Skip to content

Commit

Permalink
Destructure error code in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalton committed Sep 17, 2018
1 parent ab1aba5 commit b73ca44
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test/cjs/ext/no-ext.mjs
Expand Up @@ -3,5 +3,5 @@ import assert from "assert"
export default () => {
return import("../../fixture/cjs/ext/no-ext-esm")
.then(assert.fail)
.catch((e) => assert.strictEqual(e.code, "ERR_UNKNOWN_FILE_EXTENSION"))
.catch(({ code }) => assert.strictEqual(code, "ERR_UNKNOWN_FILE_EXTENSION"))
}
2 changes: 1 addition & 1 deletion test/cjs/ext/unknown.mjs
Expand Up @@ -3,5 +3,5 @@ import assert from "assert"
export default () => {
return import("../../fixture/cjs/ext/a.mjs.unknown")
.then(assert.fail)
.catch((e) => assert.strictEqual(e.code, "ERR_UNKNOWN_FILE_EXTENSION"))
.catch(({ code }) => assert.strictEqual(code, "ERR_UNKNOWN_FILE_EXTENSION"))
}
2 changes: 1 addition & 1 deletion test/ext/no-ext.js
Expand Up @@ -5,5 +5,5 @@ const assert = require("assert")
module.exports = () => {
return import("../fixture/ext/no-ext-cjs")
.then(assert.fail)
.catch((e) => assert.strictEqual(e.code, "ERR_UNKNOWN_FILE_EXTENSION"))
.catch(({ code }) => assert.strictEqual(code, "ERR_UNKNOWN_FILE_EXTENSION"))
}
2 changes: 1 addition & 1 deletion test/ext/unknown.js
Expand Up @@ -5,5 +5,5 @@ const assert = require("assert")
module.exports = () => {
return import("../fixture/ext/a.js.unknown")
.then(assert.fail)
.catch((e) => assert.strictEqual(e.code, "ERR_UNKNOWN_FILE_EXTENSION"))
.catch(({ code }) => assert.strictEqual(code, "ERR_UNKNOWN_FILE_EXTENSION"))
}
4 changes: 2 additions & 2 deletions test/file-extension-tests.mjs
Expand Up @@ -25,7 +25,7 @@ describe("file extension tests", () => {
it("should error loading extensionless files with dynamic import in ESM", () =>
import("./fixture/ext/no-ext-esm")
.then(assert.fail)
.catch((e) => assert.strictEqual(e.code, "ERR_UNKNOWN_FILE_EXTENSION"))
.catch(({ code }) => assert.strictEqual(code, "ERR_UNKNOWN_FILE_EXTENSION"))
)

it("should error loading extensionless files with dynamic import in ESM with `options.cjs.paths`", () =>
Expand All @@ -46,7 +46,7 @@ describe("file extension tests", () => {
it("should error loading unknown extensions with dynamic import in ESM", () =>
import("./fixture/ext/a.mjs.unknown")
.then(assert.fail)
.catch((e) => assert.strictEqual(e.code, "ERR_UNKNOWN_FILE_EXTENSION"))
.catch(({ code }) => assert.strictEqual(code, "ERR_UNKNOWN_FILE_EXTENSION"))
)

it("should error loading unknown extensions with dynamic import in ESM with `options.cjs.paths`", () =>
Expand Down
2 changes: 1 addition & 1 deletion test/url-tests.mjs
Expand Up @@ -84,7 +84,7 @@ describe("URL tests", () => {
.map((request) =>
import(request)
.then(assert.fail)
.catch((e) => assert.strictEqual(e.code, "ERR_INVALID_PROTOCOL"))
.catch(({ code }) => assert.strictEqual(code, "ERR_INVALID_PROTOCOL"))
))
)
})
Expand Down

0 comments on commit b73ca44

Please sign in to comment.