Skip to content

Commit 67d13b9

Browse files
committed
refactor: adding test setup
1 parent d61157d commit 67d13b9

File tree

4 files changed

+109
-127
lines changed

4 files changed

+109
-127
lines changed

jest.config.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
process.env.TZ = "UTC"; // Tests should always run in UTC, no time zone dependencies
2+
3+
module.exports = {
4+
rootDir: ".",
5+
globals: {
6+
"ts-jest": {
7+
tsconfig: "<rootDir>/tsconfig.spec.json",
8+
stringifyContentPathRegex: "\\.html$",
9+
},
10+
},
11+
reporters: [
12+
"default",
13+
[
14+
"jest-junit",
15+
{
16+
outputDirectory: "test-results/traceable-ui",
17+
},
18+
],
19+
[
20+
"jest-html-reporter",
21+
{
22+
outputPath: "test-results/traceable-ui/test-report.html",
23+
},
24+
],
25+
],
26+
watchPathIgnorePatterns: ["test-results"],
27+
collectCoverageFrom: ["src/**/*.ts", "projects/*/src/**/*.ts", "!**/*.d.ts"],
28+
coverageDirectory: "coverage/your-app-name",
29+
modulePathIgnorePatterns: ["<rootDir>/dist/"], // Need to reset from app project, but empty is merged
30+
testMatch: ["<rootDir>/(src|projects)/**/+(*.)+(spec|test).ts"],
31+
moduleNameMapper: {
32+
"@org/your-library-name": "<rootDir>/dist/your-library-name",
33+
},
34+
};

package-lock.json

Lines changed: 57 additions & 126 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
"jest-config": "^26.6.3",
4040
"jest-html-reporter": "^3.3.0",
4141
"jest-junit": "^12.0.0",
42+
"@types/jest": "^26.0.4",
43+
"ts-jest": "^26.5.3",
4244
"path": "^0.12.7",
4345
"prettier": "^2.2.1",
4446
"pretty-quick": "^3.1.0",
@@ -47,7 +49,6 @@
4749
"rollup-plugin-scss": "^2.6.1",
4850
"semantic-release": "^17.4.2",
4951
"style-loader": "^2.0.0",
50-
"ts-jest": "^26.5.3",
5152
"ts-loader": "^8.0.18",
5253
"tsconfig-paths-webpack-plugin": "^3.5.1",
5354
"tslib": "^2.1.0",

tsconfig.spec.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "./out-tsc/spec",
5+
"types": ["jest", "webpack-env"],
6+
"module": "commonjs"
7+
},
8+
"include": [
9+
"src/**/*.spec.ts",
10+
"src/**/*.test.ts",
11+
"src/**/*.d.ts",
12+
"projects/**/*.d.ts",
13+
"projects/**/*.spec.ts",
14+
"projects/**/*.test.ts"
15+
]
16+
}

0 commit comments

Comments
 (0)