-
-
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
Refactor runner #3166
Refactor runner #3166
Conversation
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.
Nice cleanup
const timing = cache[filePath] && cache[filePath][1]; | ||
if (timing) { | ||
timings.push(timing); | ||
tests.forEach(test => { |
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.
Just a minor nit, but I think we can change this for
const timings = tests.map(test => test.duration).filter(duration => !!duration)
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.
Glad you are bringing this up! I actually can't simplify because flow isn't smart enough to realize that the filter call filters out falsy values. It types timings
as Array<?number>
instead of Array<number>
:(
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.
Got it, that is interesting
* Improve runJest by breaking up the promise chain into functions. * Use async/await. * Add a TestSequencer and “Test” type to clarify responsibilities and improve type interfaces. * async/await in runTests. * Minor cleanups * Fix the test. * Move `runCLI` into the cli folder. * Updates to TestSequencer + test the code.
* Improve runJest by breaking up the promise chain into functions. * Use async/await. * Add a TestSequencer and “Test” type to clarify responsibilities and improve type interfaces. * async/await in runTests. * Minor cleanups * Fix the test. * Move `runCLI` into the cli folder. * Updates to TestSequencer + test the code.
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 is the preparatory work I did for the multi-config runner. It splits up the test performance cache into a TestSequencer class, uses async/await and moves a few things around. No behavior changes expected. Before merging, I will add a test for the TestSequencer.
See #3156
Test plan
jest