Skip to content

Commit

Permalink
Merge pull request #771 from maximegris/misc/replace-karma-with-jest
Browse files Browse the repository at this point in the history
misc/ unit-test : replace Karma & Jasmine with Jest
  • Loading branch information
maximegris committed Dec 28, 2023
2 parents c20bd62 + f36aa91 commit b3d1934
Show file tree
Hide file tree
Showing 12 changed files with 11,542 additions and 25,800 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
/release
main.js
src/**/*.js
!src/karma.conf.js
*.js.map

# dependencies
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ With this sample, you can:

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

/!\ Hot reload only pertains to the renderer process. The main electron process is not able to be hot reloaded, only restarted.
Expand Down
20 changes: 3 additions & 17 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,25 +138,11 @@
}
},
"test": {
"builder": "@angular-builders/custom-webpack:karma",
"builder": "@angular-builders/jest:run",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills-test.ts",
"polyfills": ["src/polyfills-test.ts"],
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"inlineStyleLanguage": "scss",
"scripts": [],
"styles": [
"src/styles.scss"
],
"assets": [
"src/favicon.ico",
"src/assets"
],
"customWebpackConfig": {
"path": "./angular.webpack.js",
"replaceDuplicatePlugins": true
}
"globalMocks": ["styleTransform", "matchMedia", "getComputedStyle"],
}
},
"lint": {
Expand Down
3 changes: 0 additions & 3 deletions angular.webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,5 @@ module.exports = (config, options) => {
})
];

// https://github.com/ryanclark/karma-webpack/issues/497
config.output.globalObject = 'globalThis';

return config;
}
4 changes: 2 additions & 2 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Maxime GRIS",
"email": "maxime.gris@gmail.com"
},
"version": "13.0.0",
"version": "14.0.0",
"main": "main.js",
"private": true,
"dependencies": {
Expand Down
15 changes: 15 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const esModules = [].join('|');

module.exports = {
rootDir : './src',
transformIgnorePatterns: [`<rootDir>/node_modules/(?!${esModules})`],
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
allowSyntheticDefaultImports: true,
},
],
'^.+\\.js$': 'babel-jest',
},
};
Loading

0 comments on commit b3d1934

Please sign in to comment.