Skip to content

Commit

Permalink
feat(jest): allow output of json report of jest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evansiroky committed Jul 2, 2019
1 parent 6dbb4c4 commit 0281213
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ Options:
-u, --update-snapshots Force update of snapshots. USE WITH CAUTION.
--coverage Run Jest with coverage reporting
--coverage-paths <paths> Extra paths to collect code coverage from
--json-output-file <path> Export a json report of the tests to the path
--no-cache Run Jest without cache (defaults to using cache)
--run-in-band Run all tests serially in the current process
--setup-files <paths> Setup files to run before each test
Expand Down
1 change: 1 addition & 0 deletions bin/mastarm-test
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ commander
'Extra paths to collect code coverage from'
)
.option('--force-exit', 'Force Jest to exit after all tests have completed running.')
.option('--json-output-file <path>', 'Output Jest test results to this file')
.option('--no-cache', 'Run Jest without cache (defaults to using cache)')
.option('--run-in-band', 'Run all tests serially in the current process')
.option('--setup-files <paths>', 'Setup files to run before each test')
Expand Down
5 changes: 5 additions & 0 deletions lib/jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ module.exports.generateTestConfig = (patterns, options) => {
jestArguments.push('--forceExit')
}

if (options.jsonOutputFile) {
jestArguments.push('--json')
jestArguments.push(`--outputFile=${options.jsonOutputFile}`)
}

if (options.updateSnapshots) {
jestArguments.push('--updateSnapshot')
}
Expand Down

0 comments on commit 0281213

Please sign in to comment.