jestjs / jest

Delightful JavaScript Testing.
https://jestjs.io
MIT License
44.08k stars 6.45k forks source link

[Bug]: Jest showing wrong coverage report #15229

Open lucaslacerdacl opened 1 month ago

lucaslacerdacl commented 1 month ago

Version

29.7.0

Steps to reproduce

Jest dependencies:

"jest-environment-jsdom": "^29.7.0",
"@jest/types": "^29.6.3",
"@testing-library/jest-dom": "^6.4.2",
"@types/jest": "^29.5.12",
"jest": "^29.7.0",
"ts-jest": "^29.2.3",

Jest config:

import type {Config} from '@jest/types';

const baseConfig: Config.InitialOptions = {
  rootDir: '../../',
  preset: 'ts-jest',
  reporters: ['default'],
  clearMocks: true,
  testEnvironment: 'jest-environment-jsdom',
  transform: {
    '^.+\\.(ts|tsx)$': 'ts-jest',
  },
  moduleNameMapper: {
    'styled-components/macro': '<rootDir>/node_modules/styled-components',
  },
};

export default baseConfig;

Expected behavior

All lines coverage.

Actual behavior

Display wrong coverage since no lines are remaining to cover. Screenshot 2024-08-01 at 10 05 18

Screenshot 2024-08-01 at 10 03 19 b7e0)

Additional context

No response

Environment

System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Max
  Binaries:
    Node: 20.15.1 - ~/.nvm/versions/node/v20.15.1/bin/node
    Yarn: 1.22.22 - ~/.yarn/bin/yarn
    npm: 10.8.2 - ~/.nvm/versions/node/v20.15.1/bin/npm
  npmPackages:
    jest: ^29.7.0 => 29.7.0
krishnabrq commented 1 month ago

Facing the same issue.

Screenshot 2024-08-18 at 7 36 22 AM
github-actions[bot] commented 4 days ago

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.