Skip to content

Commit f36aa91

Browse files
committed
misc/ unit-test : replace Karma & Jasmine with Jest
1 parent c20bd62 commit f36aa91

12 files changed

+11542
-25800
lines changed

Diff for: .gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
/release
99
main.js
1010
src/**/*.js
11-
!src/karma.conf.js
1211
*.js.map
1312

1413
# dependencies

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ With this sample, you can:
2525

2626
- Run your app in a local development environment with Electron & Hot reload
2727
- Run your app in a production environment
28+
- Execute your tests with Jest and Playwright (E2E)
2829
- Package your app into an executable file for Linux, Windows & Mac
2930

3031
/!\ Hot reload only pertains to the renderer process. The main electron process is not able to be hot reloaded, only restarted.

Diff for: angular.json

+3-17
Original file line numberDiff line numberDiff line change
@@ -138,25 +138,11 @@
138138
}
139139
},
140140
"test": {
141-
"builder": "@angular-builders/custom-webpack:karma",
141+
"builder": "@angular-builders/jest:run",
142142
"options": {
143-
"main": "src/test.ts",
144-
"polyfills": "src/polyfills-test.ts",
143+
"polyfills": ["src/polyfills-test.ts"],
145144
"tsConfig": "src/tsconfig.spec.json",
146-
"karmaConfig": "src/karma.conf.js",
147-
"inlineStyleLanguage": "scss",
148-
"scripts": [],
149-
"styles": [
150-
"src/styles.scss"
151-
],
152-
"assets": [
153-
"src/favicon.ico",
154-
"src/assets"
155-
],
156-
"customWebpackConfig": {
157-
"path": "./angular.webpack.js",
158-
"replaceDuplicatePlugins": true
159-
}
145+
"globalMocks": ["styleTransform", "matchMedia", "getComputedStyle"],
160146
}
161147
},
162148
"lint": {

Diff for: angular.webpack.js

-3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,5 @@ module.exports = (config, options) => {
2828
})
2929
];
3030

31-
// https://github.com/ryanclark/karma-webpack/issues/497
32-
config.output.globalObject = 'globalThis';
33-
3431
return config;
3532
}

Diff for: app/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "Maxime GRIS",
66
"email": "[email protected]"
77
},
8-
"version": "13.0.0",
8+
"version": "14.0.0",
99
"main": "main.js",
1010
"private": true,
1111
"dependencies": {

Diff for: jest.config.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const esModules = [].join('|');
2+
3+
module.exports = {
4+
rootDir : './src',
5+
transformIgnorePatterns: [`<rootDir>/node_modules/(?!${esModules})`],
6+
transform: {
7+
'^.+\\.tsx?$': [
8+
'ts-jest',
9+
{
10+
allowSyntheticDefaultImports: true,
11+
},
12+
],
13+
'^.+\\.js$': 'babel-jest',
14+
},
15+
};

0 commit comments

Comments
 (0)