🐛 Not generating outputFile provided in jest CLI
See original GitHub issue🐛 Bug Report
Unable to genrate outputFile for jest.
Following is my configuration:
jest.config.js file:
module.exports = {
collectCoverage: true,
collectCoverageFrom: ['./src/**/*.js'],
coverageReporters: ['json-summary', 'text', 'lcov'],
globalSetup: './__tests__/global/test-setup-globals.js',
globalTeardown: './__tests__/global/test-teardown-globals.js',
roots: ['<rootDir>/__tests__'],
testMatch: ['**/?(*.)+(spec|test).js'],
testEnvironment: 'node',
verbose: true,
};
package.json
{
"name": "my-project",
"version": "1.0.0",
"main": "src/index.js",
"scripts": {
"start": "node src/index.js",
"test": "jest --detectOpenHandles --json --outputFile=output.json"
},
"license": "ISC",
"dependencies": {
},
"devDependencies": {
"jest": "^26.6.3",
"nock": "^13.0.5",
"supertest": "^6.0.1"
}
}
Running test with following command
npm test
To Reproduce
Steps to reproduce the behavior is make above mentioned configuration.
Also, tried many more combination of configuration. Anyone here facing same issue?
Expected behavior
Should generate output.json
file
envinfo
System:
OS: Linux 5.4 Ubuntu 20.04.1 LTS (Focal Fossa)
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
Node: 12.19.1 - /usr/bin/node
npm: 6.14.9 - /usr/bin/npm
npmPackages:
jest: ^26.6.3 => 26.6.3
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Jest CLI Options
Jest CLI Options. The jest command line runner has a number of useful options. You can run jest --help to view all available...
Read more >Jest ---outputFile removes CLI coverage output - Stack Overflow
With --outputFile specified code coverage is still run and results are put in the coverage directory, but the CLI output doesn't include ...
Read more >Jest CLI Options - GitHub Pages
The jest command line runner has a number of useful options. You can run jest --help to view all available options. Many of...
Read more >jest-html-reporter - npm
Jest test results processor for generating a summary in HTML. Latest version: 3.7.0, last published: 3 months ago.
Read more >Jest CLI Options - w3resource
To view all the available options, you can run jest ?help. Most of the options that are shown below can also be used...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
One of our issues (jest-community/vscode-jest#730) seems to bump into the same problem - the json file was not generated. After poking around for a bit, it seems related to the
globalTeardown
that forced the process to exit:If I disable the globalTeardown config or comment out the
process.exit()
, JSON file is generated as expected, but of course, the jest run did not close as that is what theprocess.exit()
aim to resolve.This might shed some light… maybe JSON is generated after the teardown? You can use the sample repo there to debug this issue.
This issue 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.