Skip to content

Commit

Permalink
test(esm): confirm cjsInterop effectiveness
Browse files Browse the repository at this point in the history
  • Loading branch information
privatenumber committed Jun 13, 2024
1 parent 5166122 commit 4c53853
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/specs/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,20 @@ export default testSuite(({ describe }, node: NodeApis) => {
expect(stdout).toContain('index.ts:3:27');
});

test('cli - cjsInterop', async () => {
await using fixture = await createFixture({
'index.mts': 'import "./file"',
...tsFiles,
});

const { stderr } = await execaNode(fixture.getPath('index.mts'), {
nodePath: node.path,
nodeOptions: [node.supports.moduleRegister ? '--import' : '--loader', tsxEsmPath],
reject: false,
});
expect(stderr).not.toContain('data:text/javascript');
});

if (node.supports.moduleRegister) {
test('module.register', async () => {
await using fixture = await createFixture({
Expand Down

0 comments on commit 4c53853

Please sign in to comment.