Skip to content

Commit

Permalink
fixup! add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
izaakschroeder committed Jul 22, 2023
1 parent 329d3df commit 5e617f5
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions test/es-module/test-esm-loader-hooks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -645,4 +645,48 @@ describe('Loader hooks', { concurrency: true }, () => {
assert.strictEqual(code, 0);
assert.strictEqual(signal, null);
});

it('`register` should work with `require`', {skip: 'hangs forever'}, async () => {

Check failure on line 649 in test/es-module/test-esm-loader-hooks.mjs

View workflow job for this annotation

GitHub Actions / lint-js-and-md

A space is required after '{'

Check failure on line 649 in test/es-module/test-esm-loader-hooks.mjs

View workflow job for this annotation

GitHub Actions / lint-js-and-md

A space is required before '}'
const { code, signal, stdout, stderr } = await spawnPromisified(execPath, [
'--no-warnings',
'--require',
fixtures.path('/es-module-loaders/register-loader.cjs'),
'--input-type=module',
'--eval',
`
import 'node:os';
`,
]);

const lines = stdout.split('\n');

assert.strictEqual(lines[0], 'resolve passthru');

assert.strictEqual(stderr, '');

assert.strictEqual(code, 0);
assert.strictEqual(signal, null);
});

it('`register` should work with `import`', async () => {
const { code, signal, stdout, stderr } = await spawnPromisified(execPath, [
'--no-warnings',
'--import',
fixtures.fileURL('/es-module-loaders/register-loader.mjs'),
'--input-type=module',
'--eval',
`
import 'node:os';
`,
]);

const lines = stdout.split('\n');

assert.strictEqual(lines[0], 'resolve passthru');

assert.strictEqual(stderr, '');

assert.strictEqual(code, 0);
assert.strictEqual(signal, null);
});
});

0 comments on commit 5e617f5

Please sign in to comment.