Skip to content

Commit 5a33f75

Browse files
committed
jest.config.js
1 parent 15a6058 commit 5a33f75

3 files changed

Lines changed: 32 additions & 28 deletions

File tree

elisa/jest.config.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module.exports = {
2+
globals: {
3+
LABKEY: {
4+
contextPath: ''
5+
}
6+
},
7+
moduleFileExtensions: [
8+
'tsx',
9+
'ts',
10+
'js'
11+
],
12+
preset: 'ts-jest',
13+
setupFilesAfterEnv: [
14+
'<rootDir>/test/js/setup.ts'
15+
],
16+
testEnvironment: 'jsdom',
17+
testMatch: null,
18+
testRegex: '(\\.(test))\\.(ts|tsx)$',
19+
testResultsProcessor: 'jest-teamcity-reporter',
20+
transform: {
21+
'^.+\\.tsx?$': [
22+
'ts-jest',
23+
{
24+
tsconfig: 'node_modules/@labkey/build/webpack/tsconfig.test.json',
25+
}
26+
]
27+
}
28+
};

elisa/package.json

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,6 @@
1212
"clean": "rimraf resources/web/elisa/gen && rimraf resources/web/gen",
1313
"test": "cross-env NODE_ENV=test jest --silent"
1414
},
15-
"jest": {
16-
"globals": {
17-
"LABKEY": {
18-
"contextPath": ""
19-
}
20-
},
21-
"moduleFileExtensions": [
22-
"tsx",
23-
"ts",
24-
"js"
25-
],
26-
"preset": "ts-jest",
27-
"setupFilesAfterEnv": [
28-
"<rootDir>/test/js/setup.ts"
29-
],
30-
"testEnvironment": "jsdom",
31-
"testMatch": null,
32-
"testRegex": "(\\.(test))\\.(ts|tsx)$",
33-
"testResultsProcessor": "jest-teamcity-reporter",
34-
"transform": {
35-
"^.+\\.tsx?$": [
36-
"ts-jest",
37-
{
38-
"tsconfig": "node_modules/@labkey/build/webpack/tsconfig.test.json"
39-
}
40-
]
41-
}
42-
},
4315
"dependencies": {
4416
"@labkey/components": "6.54.3-fb-nodejs-22.0"
4517
},

elisa/test/js/setup.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
import "@testing-library/jest-dom"; // add custom jest matchers from jest-dom
2+
import { App } from "@labkey/components";
3+
4+
// Configure @labkey/components to recognize this as a testing environment
5+
App.setIsTestEnv(true);

0 commit comments

Comments
 (0)