jest-preset-angular: I could not use MaterialModule
console.warn node_modules/@angular/material/bundles/material.umd.js:146
Current document does not have a doctype. This may cause some Angular Material components not to behave as expected.
console.warn node_modules/@angular/material/bundles/material.umd.js:159
Could not find Angular Material core theme. Most Material components may not work as expected. For more info refer to the theming guide: https://material.angular.io/guide/theming
ReferenceError: CSS is not defined
What should i do?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 20 (9 by maintainers)
adding
to my
jestGlobalMocks.tsseems to have cleared up theCSS is not definedissue for me.I add some mock
and warning messages
are gone
You’re probably hitting this: https://github.com/facebook/jest/issues/3299 I’ll be implementing new testEnvironment for this preset, so I can keep that in mind and add support for doctype. If you don’t have time, you can create your own testEnvironment (copy-paste existing one and adjust it as I commented in mentioned issue)
Use it in your jest config like: