Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: missing collectCoverage after init (#11348) #11353

Merged
merged 4 commits into from Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -51,6 +51,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