Skip to content

Commit cf7082e

Browse files
committed
add test
1 parent 265a35b commit cf7082e

File tree

6 files changed

+63
-0
lines changed

6 files changed

+63
-0
lines changed

e2e/__tests__/esmConfigFile.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,15 @@ test('reads config from ts file when package.json#type=module', () => {
5454
name: 'Config from ts file',
5555
});
5656
});
57+
58+
test('reads config from ts file with modern resolution when package.json#type=module', () => {
59+
const {configs} = getConfig('esm-config/ts-modern', [], {
60+
skipPkgJsonCheck: true,
61+
});
62+
63+
expect(configs).toHaveLength(1);
64+
expect(configs[0].displayName).toEqual({
65+
color: 'white',
66+
name: 'Config from modern ts file',
67+
});
68+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
test('dummy test', () => {
9+
expect(1).toBe(1);
10+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
import config from './some-other-file.js';
9+
10+
export default () => config;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "module"
3+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
// allows to make sure that `ts-node` compiles the config file without a need to build Jest types
9+
// integration tests of Jest types run in a separate CI job through `jest.config.ts.mjs`
10+
type DummyConfig = {
11+
displayName: string;
12+
testEnvironment: string;
13+
};
14+
15+
const config: DummyConfig = {
16+
displayName: 'Config from modern ts file',
17+
testEnvironment: 'node',
18+
};
19+
20+
export default config;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"compilerOptions": {
3+
"target": "esnext",
4+
"module": "ESNext",
5+
"moduleResolution": "bundler",
6+
"strict": true
7+
}
8+
}

0 commit comments

Comments
 (0)