-
Notifications
You must be signed in to change notification settings - Fork 306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I could not use MaterialModule #52
Comments
You're probably hitting this: jestjs/jest#3299 Use it in your jest config like: {
"testEnvironment": "path/to/your/custom_test_env.js"
} |
thanks reply! It is harder than I thought. I'm trying |
Yea it's not a regular thing you do with Jest, but it's definitely possible to adjust :) |
I try it. but not working
|
See how it's done here: https://github.com/Micromeritics/jest-environment-jsdom-11.0.0. You can also send them a PR and use it. |
Thanks @thymikee . I will try. |
Also hitting this, after first having hit the bug with merging |
@luke-emmental can you send a PR to example in this repo with usage if Material module, so I can test new environment? |
Hmm. maybe there is a way to mock material components, seems like the material design guys would do that to test their own nested components 🤔 |
Same deal here. |
adding Object.defineProperty(window, 'CSS', {value: mock()}); to my |
nice @ollwenjones ! I can at least get JEST to pass a basic component spec using material design icons. I do still get the following warnings / errors: 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
console.log node_modules/@angular/material/bundles/material.umd.js:13754
Loading icon set URL: [object Object] failed: SyntaxError
console.log node_modules/@angular/material/bundles/material.umd.js:14108
Error retrieving icon: Unable to find icon with the name "security-outline" which are probably still related to the Jsdom document type setting |
I add some mock Object.defineProperty(document, 'doctype', {
value: '<!DOCTYPE html>'
});
Object.defineProperty(window, 'getComputedStyle', {
value: () => {
return {
display: 'none',
appearance: ['-webkit-appearance']
};
}
}); and warning messages
are gone |
@zack9433 nice! Thank you for sharing :) |
Would you mind adding PR to the example, so it's there by default? |
Awesome! going to try that right now, thanks for sharing @zack9433 ! |
But I think this has the same effect as using the I'm still getting the following warning types though:
|
@thymikee sorry for lately reply. I already created a PR for this issue. |
Fixed with #61 |
I think the following is still missing in
|
What should i do?
The text was updated successfully, but these errors were encountered: