Angular 15 Unit Testing Not Working
- #Angular
- #Unit Test
Angular 15 Unit Testing Not Working
Getting an error typically thrown when there's an issue with webpack or one of its plugins.
Problem:
Try to run a unit test ng test
Error message:
Uncaught TypeError: __webpack_require__(...).context is not a functionResolution
Edit angular.json test project
Change from
"test": {
...
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
...
...
}
},To
"test": {
...
"options": {
"polyfills": ["zone.js", "zone.js/testing"],
"tsConfig": "tsconfig.spec.json",
...
...
}
},0 Comments
Sign in to join the conversation.