-
-
Notifications
You must be signed in to change notification settings - Fork 170
/
Copy pathindex.ts
71 lines (61 loc) · 1.37 KB
/
index.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { describe } from 'manten';
import { createNode } from './utils/tsx';
import { createFixture } from './utils/create-fixture';
const isWin = process.platform === 'win32';
const packageTypes = [
'commonjs',
'module',
] as const;
const nodeVersions = [
'12.20.0', // CJS named export detection added
'12.22.11',
...(
(process.env.CI && !isWin)
? [
'14.19.1',
'16.13.2',
'17.8.0',
'18.1.0',
]
: []
),
];
(async () => {
for (const packageType of packageTypes) {
await describe(`Package type: ${packageType}`, async ({ describe }) => {
const fixture = await createFixture('./tests/fixtures/');
await fixture.writeJson('package.json', {
type: packageType,
});
await describe('tsx', ({ runTestSuite }) => {
runTestSuite(
import('./specs/cli'),
fixture.path,
);
runTestSuite(
import('./specs/watch'),
fixture.path,
);
});
for (const nodeVersion of nodeVersions) {
const node = await createNode(nodeVersion, fixture.path);
node.packageType = packageType;
await describe(`Node ${node.version}`, ({ runTestSuite }) => {
runTestSuite(
import('./specs/javascript'),
node,
);
runTestSuite(
import('./specs/typescript'),
node,
);
runTestSuite(
import('./specs/json'),
node,
);
});
}
await fixture.cleanup();
});
}
})();