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

[@types/jest-when] Including jest-when types always adds global jest types #68605

Open
nickiepucel opened this issue Feb 12, 2024 Discussed in #68604 · 0 comments
Open

[@types/jest-when] Including jest-when types always adds global jest types #68605

nickiepucel opened this issue Feb 12, 2024 Discussed in #68604 · 0 comments

Comments

@nickiepucel
Copy link

Discussed in #68604

Originally posted by nickiepucel February 12, 2024

The problem

@types/jest-when always adds the global jest types (@types/jest) to the TypeScript global namespace. I believe this is happening here.

This makes importing @types/jest-when incompatible with using @jest/globals/injectGlobals: false because it will result in TypeScript test files compiling when they should not.

Example

Assume I have installed jest-when, @type/jest-when, jest and @jest/globals.

// jest.config.js
module.exports = {
  // ...
  injectGlobals: false
};
// something.test.ts

// import { describe } from "@jest/globals";

// This compiles after I install `@types/jest-when` because it automatically includes `@types/jest`
// It should not compile until I uncomment the above import statement.
describe("Something", () => {});
```</div>
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

1 participant