jest.Global incorrectly extends interface 'NodeJS.Global'?
See original GitHub issueHello dear Jest fellows, i’ve been doing some maintenance stuff in stryker-mutator and came into this error:
packages/jest-runner/node_modules/@jest/types/build/Global.d.ts:54:18 - error TS2430: Interface 'import("/home/travis/build/stryker-mutator/stryker/packages/jest-runner/node_modules/@jest/types/build/Global").Global' incorrectly extends interface 'NodeJS.Global'.
Types of property 'describe' are incompatible.
Type 'Describe' is not assignable to type 'SuiteFunction'.
Types of property 'only' are incompatible.
Type 'DescribeBase' is not assignable to type 'ExclusiveSuiteFunction'.
Type 'void' is not assignable to type 'Suite'.
54 export interface Global extends NodeJS.Global {
We don’t get any other error related to that so I am not sure why is it occurring (all i have done is to change dependencies from jest: ^24.9.0 to ~24.9)
Do you have any idea why it happened?
link to a PR: https://github.com/stryker-mutator/stryker/pull/1706 link to a one of travis jobs: https://travis-ci.org/stryker-mutator/stryker/jobs/582083380
Issue Analytics
- State:
- Created 4 years ago
- Comments:13
Top Results From Across the Web
node.js - Interface 'JestImportMeta' incorrectly extends ...
This error occurs when trying to compile using tsc . Related packages in my package.json: "devDependencies": { "@types/jest" ...
Read more >Configuring Jest
useFakeTimers() in each test file, you can enable fake timers globally for all tests in your Jest configuration: JavaScript; TypeScript. /** @ ...
Read more >Jest — How to Use Extend with TypeScript | by Moon
If you want to toss some parameters to toBeOdd , then the configurations should be like below. // index.d.ts declare global { ......
Read more >Extend the Node.js Global (globalThis) object in TypeScript
Copied! /* eslint-disable no-var */ interface Employee { name: string; age: number; } declare global { var myObj: Employee; function sum(a: number, b:...
Read more >Node.js v19.3.0 Documentation
node :buffer module APIs ... Native abstractions for Node.js; Node-API; Addon examples ... readSync legacy String interface; DEP0016: GLOBAL / root ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We ran into this recently. Ultimately it was because:
mocha
as a test runner.expect
, which depends on@jest
.@jest
definesdescribe
, here: https://github.com/facebook/jest/blob/master/packages/jest-types/src/Global.ts#L76@types/mocha
definesdescribe
as well, here: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/mocha/index.d.ts#L598describe
s aren’t compatible, so TypeScript ends up being unhappy.Our solution was to replace
expect
withchai
, as it doesn’t depend upon@jest
. We could’ve also likely replacedmocha
withjest
, but that felt like a larger effort.I had a similar issue because there was another
node_modules
folder on top of my project’s folder. The errors disappeared, when I removed thosenode_modules
.