Skip to content

Commit

Permalink
misc/ unit-test : replace Karma & Jasmine with Jest
Browse files Browse the repository at this point in the history
  • Loading branch information
maximegris committed Aug 16, 2023
1 parent 0c38c03 commit 03c41ad
Show file tree
Hide file tree
Showing 9 changed files with 14,217 additions and 27,972 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
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;
}
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 03c41ad

Please sign in to comment.