-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathjest.config.node.ts
More file actions
38 lines (30 loc) · 911 Bytes
/
jest.config.node.ts
File metadata and controls
38 lines (30 loc) · 911 Bytes
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
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
import type { Config } from "@jest/types";
const testDirectory = getTestDirectory();
console.log(`\nRunning tests in node/${testDirectory} directory\n`);
const config: Config.InitialOptions = {
testMatch: [
`**/node/${testDirectory}/**/(*.)+(test).+(ts|tsx)`,
],
transform: {
"^.+\\.(ts|tsx)?$": [
"ts-jest",
{
tsconfig: "./tests/compat/node/tsconfig.json",
},
],
"^.+\\.(js|jsx)$": "babel-jest",
},
};
export default config;
function getTestDirectory() {
console.log(`\nNode version: ${process.version}\n`);
const matchedVersion = process.version.match(/v[0-9]+/);
if (!matchedVersion) {
console.log(
`\nFailed to get test directory. \`process.version\` match returned ${matchedVersion}.\n`,
);
process.exit(1);
}
return "node-" + matchedVersion[0] + ".x";
}