Skip to content

Commit

Permalink
fix: missing collectCoverage after init (#11348) (#11353)
Browse files Browse the repository at this point in the history
  • Loading branch information
davc0n committed Apr 30, 2021
1 parent 1a977d9 commit c900f59
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -52,6 +52,7 @@
- `[jest-cli]` Use testFailureExitCode when bailing from a failed test ([#10958](https://github.com/facebook/jest/pull/10958))
- `[jest-cli]` Print custom error if error thrown from global hooks is not an error already ([#11003](https://github.com/facebook/jest/pull/11003))
- `[jest-cli]` Allow running multiple "projects" from programmatic API ([#11307](https://github.com/facebook/jest/pull/11307))
- `[jest-cli]` Fix missing collectCoverage after init ([#11353](https://github.com/facebook/jest/pull/11353))
- `[jest-config]` [**BREAKING**] Change default file extension order by moving json behind ts and tsx ([10572](https://github.com/facebook/jest/pull/10572))
- `[jest-console]` `console.dir` now respects the second argument correctly ([#10638](https://github.com/facebook/jest/pull/10638))
- `[jest-core]` Don't report PerformanceObserver as open handle ([#11123](https://github.com/facebook/jest/pull/11123))
Expand Down
5 changes: 4 additions & 1 deletion packages/jest-cli/src/init/__tests__/init.test.js
Expand Up @@ -92,7 +92,10 @@ describe('init', () => {
const writtenJestConfig = fs.writeFileSync.mock.calls[0][1];
const evaluatedConfig = eval(writtenJestConfig);

expect(evaluatedConfig).toEqual({coverageDirectory: 'coverage'});
expect(evaluatedConfig).toEqual({
collectCoverage: true,
coverageDirectory: 'coverage',
});
});

it('should create configuration for {coverageProvider: "babel"}', async () => {
Expand Down
1 change: 1 addition & 0 deletions packages/jest-cli/src/init/generateConfigFile.ts
Expand Up @@ -47,6 +47,7 @@ const generateConfigFile = (

if (coverage) {
Object.assign(overrides, {
collectCoverage: true,
coverageDirectory: 'coverage',
});
}
Expand Down

0 comments on commit c900f59

Please sign in to comment.