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
fix(jest-runner): Support Jest v27 #2861
Conversation
…he jasmine env doesn't exist
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.
Thanks @Garethp
Did you still want to do the e2e testing in this branch as well?
We currently have an explicit list of defaults defined here:
/** | |
* Jest's defaults. | |
* @see https://jestjs.io/docs/en/configuration | |
*/ | |
const jestDefaults = Object.freeze({ | |
testRunner: 'jest-jasmine2', | |
testEnvironment: 'jsdom', | |
}); |
Would there be a way to extract the defaults from jest? I can see it is exported from jest here:
If we want to get at it, we should try to resolve it from jest
. Kind of tricky, but could be done.
The benefit would be that we can choose to not include jasmine explicitly. The idea is that it would still crash if something else is wrong with jasmine, since coverage analysis perTest
would be broken.
…atly tested in e2e tests
In Jest version 27 they're changing the default test runner to
jest-circus
instead ofjasmine
, which means that theglobal.jasmine
variables never get set up. Since we've already implementedperTest
coverage forjest-circus
, all we need to do is not try to attach a reporter to thegloba.jasmine
if it doesn't exist.I don't see any tests for this bit of code already, and I'm not keen on creating a new e2e test for an alpha release of jest. That being said, optional chaining here doesn't change the behavior, so I think this should be a safe fix. What do you think @nicojs
Fixes #2923