Skip to content
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

Merged
merged 1 commit into from Mar 14, 2019

Conversation

Projects
None yet
1 participant
@nolanlawson
Copy link
Collaborator

commented Mar 14, 2019

This moves our tests from karma to jest. This offers a few benefits:

  • no need for a browser or even a headless browser or jsdom; our tests can run in pure Node
  • alignment with React community
  • fewer deps, faster tests

I had to make some small tweaks to get this to work, but I managed to preserve our existing tests.

"start": "npm run watch",
"stats": "webpack --config ./spec/webpack.config.js --json > spec/stats.json",

This comment has been minimized.

Copy link
@nolanlawson

nolanlawson Mar 14, 2019

Author Collaborator

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()
})

This comment has been minimized.

Copy link
@nolanlawson

nolanlawson Mar 14, 2019

Author Collaborator

I added a test for the <NotFound> component for the heck of it

this.top = 0
this.maxMargin = 0
return
}

This comment has been minimized.

Copy link
@nolanlawson

nolanlawson Mar 14, 2019

Author Collaborator

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

This comment has been minimized.

Copy link
@nolanlawson

nolanlawson Mar 14, 2019

Author Collaborator

Ditto

@nolanlawson nolanlawson merged commit 9b6676a into missive:master Mar 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.