-
Notifications
You must be signed in to change notification settings - Fork 150
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
Testing v1 with Jest #96
Comments
Thats a strange one. CircleCI isn't failing on it. Have you tried removing and reinstalling your node_modules? Remember when you do that you have to also install peerDependencies manually. |
Can you get together a repro case, or at least post the code from the test? |
Here's a repo with a repro. lol. Seems like the error is related to setting state when the component received props. |
Found and fixed the issue :). It's the same problem as the dataset issue. When using the full mount API, enzyme tries to recreate the full DOM with JSDom, and MDCs full javascript code will run. Since the DOM is infinitely complex, a lot of features are missing or incorrect. In a real DOM, HTMLInput.validity is always available. In JSDom, it's undefined. Same thing with HTMLElement.dataset. Change your setupTests file to this, and I'll add it into the documentation. import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import 'babel-polyfill';
// Add these two lines
window.HTMLElement.prototype.dataset = {};
window.HTMLInputElement.prototype.validity = {};
configure({ adapter: new Adapter() });
window.matchMedia =
window.matchMedia ||
function() {
return {
matches: true,
addListener: function() {},
removeListener: function() {},
};
}; |
Cool thanks. |
Have the following issues with my test with
v1
:The text was updated successfully, but these errors were encountered: