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

Add a section on integrating Jest into popular frameworks #2714

Closed
5 of 6 tasks
thymikee opened this issue Jan 27, 2017 · 24 comments · Fixed by #3243
Closed
5 of 6 tasks

Add a section on integrating Jest into popular frameworks #2714

thymikee opened this issue Jan 27, 2017 · 24 comments · Fixed by #3243

Comments

@thymikee
Copy link
Collaborator

thymikee commented Jan 27, 2017

While speaking with some devs on a JS meetup I got this feeling, that many of them are struggling with testing JS with specific frameworks like Angular 1.x/2 Ember or Vue.

I think it would be a good idea to find some reliable blog posts on successful integrations with these frameworks and link it from our documentation.

Tutorials on Jest + framework / lib:

  • Vue.js
  • Angular 1.x
  • Angular
  • Ember – This is tough, because it runs on QUnit and there's lot of magic going on, but I'll try to revisit this somewhere soon. No luck finding anything relevant in the wild
  • MobX
  • Redux
@thymikee
Copy link
Collaborator Author

@hwclass
Copy link

hwclass commented Feb 2, 2017

+1 for MobX

@abdulhannanali
Copy link
Contributor

@thymikee Can I find some reliable blog posts from people using Jest with these frameworks and add them here. Afterwards, I can also make a PR for these tutorial links

@thymikee
Copy link
Collaborator Author

@abdulhannanali you're more than welcome!

@abdulhannanali
Copy link
Contributor

abdulhannanali commented Mar 2, 2017

@thymikee We can include Redux's Documentation part Writing Tests as it prefers Jest for JavaScript Testing. However, It uses enzyme for testing React Components.

@oieduardorabelo
Copy link

any lucky with an Ember example? I've tried, but the QUnit looks like a black-box-magic 😅

@thymikee
Copy link
Collaborator Author

I've also tried it couple of months ago without luck, but will try to tackle it some time soon, although I'm not so optimistic. We'll see!

@chriskrycho
Copy link

chriskrycho commented Jul 13, 2017

Hailing @trentmwillis and @Turbo87, who might at least know who else might be interested in exploring this for Ember.

@Turbo87
Copy link

Turbo87 commented Aug 24, 2017

@chriskrycho I am quite interested in this, but since jest only targets nodejs (and jsdom) it doesn't fit well for running frontend tests. In Ember it would need to replace testem+qunit but it seems like the tradeoffs are not worth it at this point.

@cpojer
Copy link
Member

cpojer commented Aug 24, 2017

Actually, this is not true any longer. Jest's runner can now (as of jest@test, Jest 21) run or drive any other test framework (See https://github.com/cpojer/pyjest for running Python tests) and jest-matchers was renamed to expect and will work in browsers. All that's needed is for somebody to hook up the glue code to run a test in a browser.

@Turbo87
Copy link

Turbo87 commented Aug 25, 2017

jest-matchers was renamed to expect and will work in browsers

that part sounds like it could easily be used in Ember tests, just like we integrate Chai (https://github.com/ember-cli/ember-cli-chai)

Jest's runner can now (as of jest@test, Jest 21) run or drive any other test framework

that sounds interesting. the runner is certainly nice to use, but on the other hand I don't see too many advantages of using it for Ember tests at this point. I'd be happy to chat about the details though if anyone is interested in learning about the testing story in Ember and teaching me about Jest and the possible integration points.

@Turbo87
Copy link

Turbo87 commented Aug 29, 2017

@cpojer is it possible to use multiple runners? I would like to integrate ESLint into Jest so that it generates tests per linted file and using a custom runner for that might make this viable, but if only a single runner can be used I would still need to run multiple instances of Jest which defeats the purpose.

@cpojer
Copy link
Member

cpojer commented Aug 29, 2017

@Turbo87 yes, it will be possible. Here is an experimental runner for eslint, by @rogeliog: https://github.com/jest-community/jest-runner-eslint

@bj-mcduck
Copy link

@thymikee ember-cli-mocha is another popular testing setup in Ember.
A lot of people use mocha through that.

Not sure if that helps you

@thymikee
Copy link
Collaborator Author

@brandonjmckay thanks for your interest, but I don't have the bandwidth to tackle Ember integration. Hopefully someone from the community will make it one day :)

@jasonworden
Copy link

jasonworden commented Feb 21, 2019

Coming from Ember world and Mocha world. My team is looking to move our backend from mocha to jest. Where would I get started if I wanted to begin writing the ember jest integration?

cc @brandonjmckay @thymikee

@thymikee
Copy link
Collaborator Author

Are you saying you have something working already? That would be lovely! I remember trying this some time ago and aligning Quint with Jest Jasmine style was a nightmare and I left it as it was not a priority.

If you do have it, feel free to open a PR with the link to the article or repo :)

@jasonworden
Copy link

I do not yet, but I'm interested in taking a stab in the near future!

@Turbo87
Copy link

Turbo87 commented Feb 21, 2019

@thymikee @jasonworden the problem remains the same: Jest does not run in the browser. I would love to see Jest support this use case, but until that is the case using it to properly test Ember apps seems problematic.

while it's true that Jest can drive other test runners it would AFAICT still be responsible for test file discovery and need deep build system integration.

@jasonworden
Copy link

@Turbo87 Is there an existing issue dedicated to running in the browser?

@dzaman
Copy link

dzaman commented Feb 21, 2019

@jasonworden you may be interested in #139 and #848

@jasonworden
Copy link

@thymikee FYI Ember has worked towards being test-framework agnostic, and my team is already using it with Mocha, not QUnit! So an Ember-Jest marriage is forseeable 👓

@kvendrik
Copy link

kvendrik commented Jul 22, 2019

@jasonworden @Turbo87 you might like jest-lite which lets you run Jest tests in the browser. 🙂

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.