-
Notifications
You must be signed in to change notification settings - Fork 838
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
test: replace karma with jest #302
Conversation
"start": "npm run watch", | ||
"stats": "webpack --config ./spec/webpack.config.js --json > spec/stats.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not find a way to keep this stats
script without maintaining a webpack config merely to generate it... seems not worth it.
) | ||
let tree = component.toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a test for the <NotFound>
component for the heck of it
this.top = 0 | ||
this.maxMargin = 0 | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes me wince; maybe eventually we can use NODE_ENV
to remove this
@@ -28,7 +28,8 @@ export default class Search extends React.PureComponent { | |||
|
|||
componentDidMount() { | |||
// in some cases (e.g. preact) the input may already be pre-populated | |||
if (this.input.value) { | |||
// this.input is undefined in Jest tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
This moves our tests from karma to jest. This offers a few benefits:
I had to make some small tweaks to get this to work, but I managed to preserve our existing tests.