A library for running jest in watch-mode within a system and record the test-output.
This can be used to intergrate jest into your development tool.
yarn add jest-observer
npm install jest-observer
const observer = require('jest-observer');
observer({
config: path.join(__dirname, './jest.json')
}, (results) => {
console.log('\n', results);
});
The observer supports these options:
Path to a jest config file same as in jest -c <configfile>
Node Stream of jest's normal terminal output (stdout)
Node Stream of jest's err terminal output (stderr)
TODO
The callback will receive the jest test-result json identical as jest --json
.
The json will only contain data on the tests jest has run, which will only be what is staged. I plan to add an 'run-all-on-first-run' option.
I'm interested in adding real-time jest test-results to react-storybook. And I wanted to learn how to do some process management and communication in nodeJS.
If you use the jest config option: testResultsProcessor
, it will be ignored, since this is what's being used to capture the test-results.