Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoffreyBooth committed Oct 3, 2023
1 parent 2041ddd commit bd374f8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
6 changes: 4 additions & 2 deletions test/es-module/test-esm-extensionless-esm-and-wasm.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ describe('extensionless ES modules within a "type": "module" package scope', { c

it('should be importable from a module scope under node_modules', async () => {
const { default: defaultExport } =
await import(fixtures.fileURL('es-modules/package-type-module/node_modules/dep-with-package-json-type-module/noext-esm'));
await import(fixtures.fileURL(
'es-modules/package-type-module/node_modules/dep-with-package-json-type-module/noext-esm'));
strictEqual(defaultExport, 'module');
});
});
Expand All @@ -48,7 +49,8 @@ describe('extensionless Wasm modules within a "type": "module" package scope', {
});

it('should be importable from a module scope under node_modules', async () => {
const { add } = await import(fixtures.fileURL('es-modules/package-type-module/node_modules/dep-with-package-json-type-module/noext-wasm'));
const { add } = await import(fixtures.fileURL(
'es-modules/package-type-module/node_modules/dep-with-package-json-type-module/noext-wasm'));
strictEqual(add(1, 2), 3);
});
});
Expand Down
28 changes: 17 additions & 11 deletions test/es-module/test-esm-type-flag-package-scopes.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ describe('the type flag should change the interpretation of certain files within
strictEqual(defaultExport, 'module');
});

it('should import an extensionless JavaScript file within a "type": "module" scope under node_modules', async () => {
const { default: defaultExport } =
await import(fixtures.fileURL('es-modules/package-type-module/node_modules/dep-with-package-json-type-module/noext-esm'));
strictEqual(defaultExport, 'module');
});
it('should import an extensionless JavaScript file within a "type": "module" scope under node_modules',
async () => {
const { default: defaultExport } =
await import(fixtures.fileURL(
'es-modules/package-type-module/node_modules/dep-with-package-json-type-module/noext-esm'));
strictEqual(defaultExport, 'module');
});

it('should run as Wasm an extensionless Wasm file within a "type": "module" scope', async () => {
const { code, signal, stdout, stderr } = await spawnPromisified(process.execPath, [
Expand All @@ -49,10 +51,12 @@ describe('the type flag should change the interpretation of certain files within
strictEqual(add(1, 2), 3);
});

it('should import an extensionless Wasm file within a "type": "module" scope under node_modules', async () => {
const { add } = await import(fixtures.fileURL('es-modules/package-type-module/node_modules/dep-with-package-json-type-module/noext-wasm'));
strictEqual(add(1, 2), 3);
});
it('should import an extensionless Wasm file within a "type": "module" scope under node_modules',
async () => {
const { add } = await import(fixtures.fileURL(
'es-modules/package-type-module/node_modules/dep-with-package-json-type-module/noext-wasm'));
strictEqual(add(1, 2), 3);
});
});

describe(`the type flag should change the interpretation of certain files within a package scope that lacks a
Expand Down Expand Up @@ -135,7 +139,8 @@ describe(`the type flag should NOT change the interpretation of certain files wi
it(`should import as CommonJS a .js file within a package scope that has no defined "type" and is under
node_modules`, async () => {
const { default: defaultExport } =
await import(fixtures.fileURL('es-modules/package-type-module/node_modules/dep-with-package-json-without-type/run.js'));
await import(fixtures.fileURL(
'es-modules/package-type-module/node_modules/dep-with-package-json-without-type/run.js'));
strictEqual(defaultExport, 42);
});

Expand All @@ -155,7 +160,8 @@ describe(`the type flag should NOT change the interpretation of certain files wi
it(`should import as CommonJS an extensionless JavaScript file within a package scope that has no defined "type" and
is under node_modules`, async () => {
const { default: defaultExport } =
await import(fixtures.fileURL('es-modules/package-type-module/node_modules/dep-with-package-json-without-type/noext-cjs'));
await import(fixtures.fileURL(
'es-modules/package-type-module/node_modules/dep-with-package-json-without-type/noext-cjs'));
strictEqual(defaultExport, 42);
});
});

0 comments on commit bd374f8

Please sign in to comment.