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

Use jest-matchers for assertions instead of expect #5027

Closed
wants to merge 1 commit into from

Conversation

skovhus
Copy link

@skovhus skovhus commented Apr 24, 2017

Currently [email protected] is being integrated into Jest (see more background in jestjs/jest#1679).

In jest-codemods I'm working on a codemod to automate the process of going from mjackson/expect to jest-matchers (if running in a browser) or plain Jest (if running in node). 🤖

I've tested the codemod on this project and everything should still work.

Let me know what you think.

Blocked: currently fails in older browsers 💣

Seems like jest-matchers have untranspiled code SyntaxError: Unexpected keyword 'const'. Const declarations are not supported in strict mode..

Will look into a solution for this.

@skovhus skovhus force-pushed the use-jest branch 3 times, most recently from feee850 to 7b3f9c6 Compare April 24, 2017 21:48
@timdorr
Copy link
Member

timdorr commented Apr 25, 2017

There was talk of turning off some browser tests. @pshrmn did a trial run in #4884, but we haven't actually implemented it yet. We could probably stand to review the browser set too.

@timdorr
Copy link
Member

timdorr commented Apr 25, 2017

And for the browser-based tests, those run on karma and mocha, so should we be switching to jest-matchers (which are presumably built for node) for tests that need a DOM anyways?

@skovhus
Copy link
Author

skovhus commented Apr 25, 2017

If you want node test you can basically just run Jest (that internally sets up Jest matchers). I can do another PR showing this... will remove a lot of confirguration.

@timdorr
Copy link
Member

timdorr commented Apr 25, 2017

Well, it's more that I'm thinking this should only apply to DOM-less packages (react-router, react-router-native, react-router-redux, react-router-config). Basically everything except react-router-dom.

@mjackson
Copy link
Member

I'd love to just convert everything over to using Jest and ditch all of our custom karma + (flaky) BrowserStack integration. The history package should provide an abstraction over any behavior that requires browser-specific tests.

@timdorr
Copy link
Member

timdorr commented Jul 13, 2017

I'd be totally down with that. react-router-redux already uses it and it works great.

@mjackson mjackson self-requested a review July 14, 2017 18:18
@mjackson
Copy link
Member

I converted all our tests to use Jest in 172dc16. Thanks for the push here, @skovhus :) I relied on some of the code in this PR to know how to do the conversions.

@mjackson mjackson closed this Jul 14, 2017
@skovhus
Copy link
Author

skovhus commented Jul 15, 2017

@mjackson glad to hear this and thanks for letting me use this repo for testing jest-codemods. ; )

@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants