-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[Bug]: Strange uncovered branches after upgrade jest #14066
Comments
I'm also seeing a similar issue since updating from
If I revert to the old version ( I'd offer up a reproducible repo but I'm not sure how easy this will be to reproduce as it's quite odd behaviour. My assumption is that this commit is behind the issue, as it seems the most fitting from the release notes, but I might be wrong. My const { defaults } = require("jest-config");
module.exports = {
testEnvironment: "jsdom",
setupFilesAfterEnv: ["./tests/jest.setupAfterEnv.ts"],
setupFiles: ["./tests/jest.setup.ts"],
clearMocks: true,
collectCoverageFrom: [
"**/*.{js,jsx,ts,tsx}",
"!**/constants/**",
"!**/jest-report/**",
"!**/node_modules/**",
"!**/pages/_*.tsx",
"!**/tests/**",
"!**/types/**",
"!**/.next/**",
"!.*",
"!**.d.ts",
"!*.config.js",
"!eslint-local-rules.js",
],
coverageDirectory: "jest-report/coverage_html_report",
coverageProvider: "v8",
coverageReporters: [...defaults.coverageReporters, "html", "cobertura"],
coverageThreshold: {
global: {
branches: 97,
functions: 97,
lines: 97,
statements: 97,
},
},
reporters: [
"default",
[
"jest-junit",
{
suiteName: "jest tests",
outputDirectory: "jest-report",
outputName: "jest-tests.xml",
uniqueOutputName: "false",
classNameTemplate: "{classname}-{title}",
titleTemplate: "{classname}-{title}",
ancestorSeparator: " › ",
usePathForSuiteName: "true",
},
],
],
rootDir: "./",
moduleNameMapper: {
// enable absolute links to root files (e.g. `~/rootfile.ext`)
"~/(.*)": "<rootDir>/$1",
},
modulePaths: ["<rootDir>"],
}; |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
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. |
Version
29.5.0
Steps to reproduce
I have tests with all statements branches function and line covered with jest 29.3.1.
Result of the coverage:
Then
npm i -D jest
to install the29.5.0
version of jest, the the branches coverage dropped:And got strange uncovered branches:
The funny thing is that When I downgrade to jest
29.3.1
, the branches coverage did not recovered to 100%, still78.12
.Expected behavior
The branches coverage should be still 100% after upgrade jest library from 29.3.1 to 29.5.0.
It should not report the strange uncovered branches as attached above.
Even there is a bug in 29.5.0, while I downgrade it to 29.3.1 as before, the branches coverage should back to 100%.
Actual behavior
After upgrade from 29.3.1 to 29.5.0, the branches coverage drops and reports strange uncovered branches in the HTML report as attached in the steps.
And it does not help fix the issue when I downgrade to 29.3.1.
Additional context
Changes made to package-lock.json after upgrade and downgrade:
diff.patch
My guess:
As it does not help when downgrade back to 29.3.1, so I think the bug is introduced by one of the jest dependencies.
And the downgrade of dependencies does not downgrade the dependencies.
Environment
The text was updated successfully, but these errors were encountered: