Testing in a fake browser environment is a fool’s errand. Use Jest for unit tests that are actually unit tests. Otherwise, use Mocha in the browser or Cypress. You can’t efficiently diagnose test failures in JSDom and it doesn’t give you the level of assurance you’d get from testing in a real browser.
Thanks for the input! Because Jest comes with React, I assumed it was the test framework most widely used. Do you think taking the time to write unit tests in Jest is worth it if you move integration tests to Mocha, or would you write all tests in one framework?
Having used both Jest and Mocha extensively, I’d move all front-end tests to Mocha and run them in a browser. Having two different test runners is a hassle.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Testing in a fake browser environment is a fool’s errand. Use Jest for unit tests that are actually unit tests. Otherwise, use Mocha in the browser or Cypress. You can’t efficiently diagnose test failures in JSDom and it doesn’t give you the level of assurance you’d get from testing in a real browser.
Thanks for the input! Because Jest comes with React, I assumed it was the test framework most widely used. Do you think taking the time to write unit tests in Jest is worth it if you move integration tests to Mocha, or would you write all tests in one framework?
Having used both Jest and Mocha extensively, I’d move all front-end tests to Mocha and run them in a browser. Having two different test runners is a hassle.