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

Migration to v6 broke the tsc command #534

Open
mickael-h opened this issue Sep 12, 2023 · 1 comment
Open

Migration to v6 broke the tsc command #534

mickael-h opened this issue Sep 12, 2023 · 1 comment

Comments

@mickael-h
Copy link

mickael-h commented Sep 12, 2023

  • @testing-library/jest-dom version: 6.1.3
  • node version: 18.0.0
  • jest (or vitest) version: 29.6.2
  • npm (or yarn) version: 9.5.1
  • react-testing-library version: 14.0.0

Relevant code or config:

tsconfig.json (for NextJS project):

{
  "compilerOptions": {
    "target": "ES2020",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "allowUnreachableCode": false,
    "allowUnusedLabels": false,
    "declaration": true,
    "noFallthroughCasesInSwitch": true,
    "noImplicitReturns": true,
    "pretty": true,
    "sourceMap": true,
    "plugins": [
      {
        "name": "next"
      }
    ],
    "paths": {
      "@/*": ["./src/*"]
    }
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
  "exclude": ["node_modules", "stories"]
}

What you did:

We updated jest-dom to v6 from v5.
Then we run tsc --pretty --noEmit.

What happened:

All test statements were no longer recognized:
image

I really don't have the time to make a new repo with minimal repro steps, but I hope the information I gave will suffice.

@swaroopsm
Copy link

FWIW:
I had a similar issue and I had to add the include vitest/globals as part of the compilerOptions.types.
Here's my tsconfig.json.

{
  "compilerOptions": {
    "target": "esnext",
    "useDefineForClassFields": true,
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": false,
    "skipLibCheck": true,
    "esModuleInterop": false,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx",
    "baseUrl": "src",
    "types": [
      "vitest/globals",
      "vite/client",
      "node",
      "@testing-library/jest-dom"
    ]
  },
  "include": ["src"]
}

Hope it's helpful :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants