Skip to content

Commit

Permalink
test: run eslint on test file and fix errors
Browse files Browse the repository at this point in the history
This removes two entries from the eslint ignore file. One file does
not exist anymore and the other one could easily be fixed.

PR-URL: #25009
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
BridgeAR authored and BethGriggs committed Dec 18, 2018
1 parent 110fd39 commit ddff644
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
node_modules
lib/internal/v8.js
lib/internal/v8_prof_polyfill.js
lib/punycode.js
test/addons/??_*
test/es-module/test-esm-dynamic-import.js
test/fixtures
test/message/esm_display_syntax_error.mjs
tools/icu
Expand Down
19 changes: 10 additions & 9 deletions test/es-module/test-esm-dynamic-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ targetURL.pathname = absolutePath;

function expectErrorProperty(result, propertyKey, value) {
Promise.resolve(result)
.catch(common.mustCall(error => {
.catch(common.mustCall((error) => {
assert.strictEqual(error[propertyKey], value);
}));
}
Expand All @@ -22,15 +22,16 @@ function expectMissingModuleError(result) {

function expectOkNamespace(result) {
Promise.resolve(result)
.then(common.mustCall(ns => {
.then(common.mustCall((ns) => {
// Can't deepStrictEqual because ns isn't a normal object
// eslint-disable-next-line no-restricted-properties
assert.deepEqual(ns, { default: true });
}));
}

function expectFsNamespace(result) {
Promise.resolve(result)
.then(common.mustCall(ns => {
.then(common.mustCall((ns) => {
assert.strictEqual(typeof ns.default.writeFile, 'function');
assert.strictEqual(typeof ns.writeFile, 'function');
}));
Expand All @@ -41,19 +42,19 @@ function expectFsNamespace(result) {
(function testScriptOrModuleImport() {
// Importing another file, both direct & via eval
// expectOkNamespace(import(relativePath));
expectOkNamespace(eval.call(null, `import("${relativePath}")`));
expectOkNamespace(eval(`import("${relativePath}")`));
expectOkNamespace(eval.call(null, `import("${targetURL}")`));
expectOkNamespace(eval(`import("${relativePath}")`));
expectOkNamespace(eval(`import("${targetURL}")`));

// Importing a built-in, both direct & via eval
expectFsNamespace(import("fs"));
expectFsNamespace(import('fs'));
expectFsNamespace(eval('import("fs")'));
expectFsNamespace(eval('import("fs")'));
expectFsNamespace(eval.call(null, 'import("fs")'));

expectMissingModuleError(import("./not-an-existing-module.mjs"));
expectMissingModuleError(import('./not-an-existing-module.mjs'));
// TODO(jkrems): Right now this doesn't hit a protocol error because the
// module resolution step already rejects it. These arguably should be
// protocol errors.
expectMissingModuleError(import("node:fs"));
expectMissingModuleError(import('node:fs'));
expectMissingModuleError(import('http://example.com/foo.js'));
})();

0 comments on commit ddff644

Please sign in to comment.