-
-
Notifications
You must be signed in to change notification settings - Fork 527
/
1778.spec.ts
38 lines (35 loc) · 984 Bytes
/
1778.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { createExec } from '../exec-helpers';
import {
ctxTsNode,
nodeSupportsEsmHooks,
TEST_DIR,
tsSupportsStableNodeNextNode16,
CMD_TS_NODE_WITHOUT_PROJECT_FLAG,
nodeSupportsSpawningChildProcess,
} from '../helpers';
import { context, expect } from '../testlib';
import { join } from 'path';
const exec = createExec({
cwd: TEST_DIR,
});
const test = context(ctxTsNode);
test.suite(
'Issue #1778: typechecker resolver should take importer\'s module type -- cjs or esm -- into account when resolving package.json "exports"',
(test) => {
test.runIf(
nodeSupportsEsmHooks &&
nodeSupportsSpawningChildProcess &&
tsSupportsStableNodeNextNode16
);
test('test', async () => {
const { err, stdout } = await exec(
`${CMD_TS_NODE_WITHOUT_PROJECT_FLAG} ./index.ts`,
{
cwd: join(TEST_DIR, '1778'),
}
);
expect(err).toBe(null);
expect(stdout).toBe('{ esm: true }\n');
});
}
);