0.1.2-alpha • Published 2 years ago
@shaped/json-reporter v0.1.2-alpha
json reporter for node:test
json output reporter for Node.js's built in test runner (node:test)
Outputs a JSON object of your test results.
See https://nodejs.org/api/test.html for more information about the built in test runner.
Usage:
From the CLI, using --test and outputting to stdout:
$ node --test-reporter=@shaped/json-reporter --test-reporter-destination=stdout --testOr, if using your own test script to launch tests, outputting to stdout:
$ node --test-reporter=@shaped/json-reporter --test-reporter-destination=stdout test/your_test_script.jsYou can also set --test-reporter-destination to a file to have the output saved to that file instead.
From Code when using the run() method of node:test, piped to stdout:
import jsonReporter from '@paytrie/json-reporter';
run({ files: [
path.resolve('./test/your_test_script.js')
]}).pipe(jsonReporter).pipe(stdout);