-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
/
resolveConditions.test.ts
35 lines (31 loc) · 1.03 KB
/
resolveConditions.test.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
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {resolve} from 'path';
import {onNodeVersions} from '@jest/test-utils';
import {runYarnInstall} from '../Utils';
import runJest from '../runJest';
const dir = resolve(__dirname, '..', 'resolve-conditions');
beforeAll(() => {
runYarnInstall(dir);
});
// The versions where vm.Module exists and commonjs with "exports" is not broken
onNodeVersions('^12.16.0 || >=13.7.0', () => {
test('resolves package exports correctly with custom resolver', () => {
// run multiple times to ensure there are no caching errors
for (let i = 0; i < 5; i++) {
const {exitCode} = runJest(dir, [], {
nodeOptions: '--experimental-vm-modules',
});
try {
expect(exitCode).toBe(0);
} catch (error) {
console.log(`Test failed on iteration ${i + 1}`);
throw error;
}
}
});
});