-
-
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
Add --listTests flag #3441
Add --listTests flag #3441
Conversation
packages/jest-cli/src/runJest.js
Outdated
// With --listTests, simply print the test info as JSON and exit. | ||
if (globalConfig.listTests) { | ||
const testsJson = JSON.stringify(allTests, null, ' '); | ||
new Console(pipe, pipe).log(testsJson); |
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.
I think we can directly use console.log
here.
packages/jest-cli/src/runJest.js
Outdated
if (globalConfig.listTests) { | ||
const testsJson = JSON.stringify(allTests, null, ' '); | ||
new Console(pipe, pipe).log(testsJson); | ||
process.exit(0); |
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.
I know I mentioned exiting earlier but I think it would be better if we could instead return {success: true};
which will allow Jest to exit cleanly. Can you try to see if that works? :)
Codecov Report
@@ Coverage Diff @@
## master #3441 +/- ##
==========================================
- Coverage 64.02% 63.96% -0.06%
==========================================
Files 177 177
Lines 6580 6586 +6
Branches 5 5
==========================================
Hits 4213 4213
- Misses 2365 2371 +6
Partials 2 2
Continue to review full report at Codecov.
|
0f68b39
to
3a154f5
Compare
In the interest of time, I made a few adjustments to ship this. Thanks @Xion. |
* Add --listTests flag * Fixes.
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
Add a --listTests flag that lists all test info as JSON to stdout and exits.
Fixes issue #3338
Test plan
Integration test.