Skip to content
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

Merged
merged 2 commits into from
May 3, 2017
Merged

Add --listTests flag #3441

merged 2 commits into from
May 3, 2017

Conversation

Xion
Copy link
Contributor

@Xion Xion commented May 2, 2017

Summary
Add a --listTests flag that lists all test info as JSON to stdout and exits.

Fixes issue #3338

Test plan
Integration test.

// 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);
Copy link
Member

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.

if (globalConfig.listTests) {
const testsJson = JSON.stringify(allTests, null, ' ');
new Console(pipe, pipe).log(testsJson);
process.exit(0);
Copy link
Member

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-io
Copy link

Codecov Report

Merging #3441 into master will decrease coverage by 0.05%.
The diff coverage is 0%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
packages/jest-config/src/validConfig.js 100% <ø> (ø) ⬆️
packages/jest-config/src/index.js 26.08% <ø> (ø) ⬆️
packages/jest-config/src/normalize.js 89.93% <ø> (ø) ⬆️
packages/jest-cli/src/runJest.js 0% <0%> (ø) ⬆️
packages/jest-config/src/setFromArgv.js 2.32% <0%> (-0.12%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 643d9a8...9cac95c. Read the comment docs.

@cpojer cpojer added this to the Jest 20 milestone May 3, 2017
@cpojer cpojer force-pushed the master branch 2 times, most recently from 0f68b39 to 3a154f5 Compare May 3, 2017 07:30
@cpojer
Copy link
Member

cpojer commented May 3, 2017

In the interest of time, I made a few adjustments to ship this. Thanks @Xion.

@cpojer cpojer merged commit 65834c6 into jestjs:master May 3, 2017
tushardhole pushed a commit to tushardhole/jest that referenced this pull request Aug 21, 2017
* Add --listTests flag

* Fixes.
@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants