-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Make Jest's Test Runner configurable. #4240
Conversation
contexts.forEach(({config}) => { | ||
if (!testRunners[config.runner]) { | ||
// $FlowFixMe | ||
testRunners[config.runner] = new (require(config.runner))( |
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.
Maybe not at this point, but eventually it would be nice to guard that expression and throw a human readable error.
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.
Also, maybe we can cast a TestRunner type here?
} | ||
}); | ||
|
||
const testRuns = this._partitionTests(testRunners, tests); |
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.
testsByRunner
seems more appropriate to me.
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.
looks good
You need to update the config snapshot |
a4cddb0
to
2ddb379
Compare
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
This change adds a
runner
option toProjectConfig
that points tojest-runner
but can be customized per project to any test runner. To ensure performance doesn't suffer with this new feature when using the MPR, multiple contexts that point to the same runner are merged and tests are run in the same runner instance, rather than creating a new instance per context. This means that there should be no performance penalty for existing MPR projects.This is conflicting somewhat with the
testRunner
option that allows to pickjest-jasmine2
orjest-circus
, however in this new world ProjectConfigs will be entirely jest-runner specific and variadic, and out of Jest's immediate control, so I don't think this matters long term and there are pending changes to be made to configs to support that. I think it makes more sense to consider this option therunner
, add an optionlibrary
(for lack of a better name) which replacestestRunner
. I think we can make this decision later and I expect there to be morerunner
s thantestRunner
s going forward, so we may even want to kill the setting entirely and make therunner
as compose-able as possible.Test plan
jest + manual verification that it only creates one runner for the MPR right now.