@angular-devkit/build-angular 12.2.1 unit test failures - TypeError: Cannot read property 'match' of undefined
See original GitHub issue🐞 Bug report
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- extract-i18n
- run
- config
- help
- version
- doc
Is this a regression?
No, this was introduced after upgrading from 12.1.4 to 12.2.1
Description
After updating unit test will fail:
Failed: Cannot read property 'match' of undefined
TypeError: Cannot read property 'match' of undefined
at extractCommentsWithHash (node_modules/@angular/compiler/fesm2015/compiler.js:9555:1)
at ShadowCss.shimCssText (node_modules/@angular/compiler/fesm2015/compiler.js:9118:1)
at node_modules/@angular/compiler/fesm2015/compiler.js:22336:1
at Array.map (<anonymous>)
at compileStyles (node_modules/@angular/compiler/fesm2015/compiler.js:22335:1)
at compileComponentFromMetadata (node_modules/@angular/compiler/fesm2015/compiler.js:21882:1)
at CompilerFacadeImpl.compileComponentFromMeta (node_modules/@angular/compiler/fesm2015/compiler.js:22492:1)
at CompilerFacadeImpl.compileComponent (node_modules/@angular/compiler/fesm2015/compiler.js:22482:1)
at Function.get (node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:27388:1)
at getComponentDef (node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:1108:1)
🌍 Your Environment
Angular CLI: 12.2.1
Node: 14.16.1
Package Manager: npm 7.12.0
OS: darwin x64
Angular: 12.2.1
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker
Package Version
--------------------------------------------------------------------
@angular-devkit/architect 0.1202.1
@angular-devkit/build-angular 12.2.1
@angular-devkit/core 12.2.1
@angular-devkit/schematics 12.1.4
@nguniversal/express-engine 12.1.0
@nguniversal/module-map-ngfactory-loader 9.0.0-next.9
@schematics/angular 12.1.4
rxjs 6.6.7
typescript 4.3.5
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:10
Top Results From Across the Web
Angular 11 > 12 TypeError: Cannot read property 'match' of ...
spec.json overrides the module property from es2020 to commonjs . As such, by removing the override property, my tests are running again.
Read more >cannot read property 'value' of undefined angular unit test ...
I'm new to Angular and Typescript and cannot get to the bottom of this console error: "ERROR TypeError: Cannot read property 'value' of...
Read more >Unit tests - Mattermost Developers
Review our guidelines for unit testing for your Mattermost webapp, including a guide on how to do ... TypeError: Cannot read property 'filter'...
Read more >Cannot read property 'subscribe' of undefined in unit test
// Get rid of app's Router configuration otherwise many failures. // Doing so removes Router declarations; add the Router stubs
Read more >angular-builders/custom-webpack - npm
Custom Webpack browser. Extended @angular-devkit/build-angular:browser builder that allows to specify additional webpack configuration (on top ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey - can anyone let me know what changed? We’ve used
CommonJS
as a module as part of our tsconfig.spec.json in order to allow Jasmine to spyOn exported functions until now, and this hasn’t been a problem.Since this feels like something has changed, I’m curious if there is another solution - a fix for one thing is breaking something else.
While in this case you shouldn’t be using
CommonJS
as module, this seems to be a regression.