Skip to content

Commit

Permalink
Fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpojer committed May 3, 2017
1 parent 7755849 commit 533885b
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/en/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Will run all tests affected by file changes in the last commit made.

### `--listTests`

Lists all tests Jest will run given the other arguments, and exits.
Lists all tests as JSON that Jest will run given the arguments, and exits. This can be used together with `--findRelatedTests` to know which tests Jest will run.

### `--logHeapUsage`

Expand Down
4 changes: 3 additions & 1 deletion packages/jest-cli/src/cli/runCLI.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ module.exports = async (
return watch(globalConfig, contexts, argv, pipe, hasteMapInstances);
} else {
const startRun = () => {
preRunMessage.print(pipe);
if (!argv.listTests) {
preRunMessage.print(pipe);
}
runJest(
globalConfig,
contexts,
Expand Down
11 changes: 5 additions & 6 deletions packages/jest-cli/src/runJest.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const runJest = async (
pipe: stream$Writable | tty$WriteStream,
testWatcher: TestWatcher,
startRun: () => *,
onComplete: (testResults: any) => void,
onComplete: (testResults: any) => any,
) => {
const maxWorkers = getMaxWorkers(argv);
const pattern = getTestPathPattern(argv);
Expand All @@ -176,11 +176,10 @@ const runJest = async (

allTests = sequencer.sort(allTests);

// 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);
process.exit(0);
if (argv.listTests) {
console.log(JSON.stringify(allTests.map(test => test.path)));
onComplete && onComplete({success: true});
return null;
}

if (!allTests.length) {
Expand Down
1 change: 0 additions & 1 deletion packages/jest-config/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ const getConfigs = (
coverageThreshold: options.coverageThreshold,
expand: options.expand,
forceExit: options.forceExit,
listTests: options.listTests,
logHeapUsage: options.logHeapUsage,
mapCoverage: options.mapCoverage,
noStackTrace: options.noStackTrace,
Expand Down
1 change: 0 additions & 1 deletion packages/jest-config/src/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,6 @@ function normalize(options: InitialOptions, argv: Object = {}) {
case 'coverageThreshold':
case 'expand':
case 'globals':
case 'listTests':
case 'logHeapUsage':
case 'mapCoverage':
case 'moduleDirectories':
Expand Down
1 change: 0 additions & 1 deletion packages/jest-config/src/validConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ module.exports = ({
haste: {
providesModuleNodeModules: ['react', 'react-native'],
},
listTests: false,
logHeapUsage: true,
mapCoverage: false,
moduleDirectories: ['node_modules'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ const validConfig = {
haste: {
providesModuleNodeModules: ['react', 'react-native'],
},
listTests: true,
logHeapUsage: true,
moduleDirectories: ['node_modules'],
moduleFileExtensions: ['js', 'json', 'jsx', 'node'],
Expand Down
1 change: 0 additions & 1 deletion types/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ export type GlobalConfig = {|
coverageThreshold: {global: {[key: string]: number}},
expand: boolean,
forceExit: boolean,
listTests: boolean,
logHeapUsage: boolean,
mapCoverage: boolean,
noStackTrace: boolean,
Expand Down

0 comments on commit 533885b

Please sign in to comment.