dethcrypto / dethcrypto/truffle-typings

Typings are incompatible with jest

Open
#16 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
11
Forks
9
PR merge metrics
No merged PRs in 30d

Description

Because `truffle-typings` includes `chai` and `mocha` constants, the same project can't use `jest` for tests.

Build errors:
```
node_modules/@types/jest/index.d.ts:33:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'beforeEach' must be of type 'HookFunction', but here has type 'Lifecycle'.

33 declare var beforeEach: jest.Lifecycle;
~~~~~~~~~~

node_modules/@types/mocha/index.d.ts:2680:13
2680 declare var beforeEach: Mocha.HookFunction;
~~~~~~~~~~
'beforeEach' was also declared here.

node_modules/@types/jest/index.d.ts:35:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'afterEach' must be of type 'HookFunction', but here has type 'Lifecycle'.

35 declare var afterEach: jest.Lifecycle;
~~~~~~~~~

node_modules/@types/mocha/index.d.ts:2698:13
2698 declare var afterEach: Mocha.HookFunction;
~~~~~~~~~
'afterEach' was also declared here.

node_modules/@types/jest/index.d.ts:36:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'describe' must be of type 'SuiteFunction', but here has type 'Describe'.

36 declare var describe: jest.Describe;
~~~~~~~~

node_modules/@types/mocha/index.d.ts:2714:13
2714 declare var describe: Mocha.SuiteFunction;
~~~~~~~~
'describe' was also declared here.

node_modules/@types/jest/index.d.ts:38:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'xdescribe' must be of type 'PendingSuiteFunction', but here has type 'Describe'.

38 declare var xdescribe: jest.Describe;
~~~~~~~~~

node_modules/@types/mocha/index.d.ts:2735:13
2735 declare var xdescribe: Mocha.PendingSuiteFunction;
~~~~~~~~~
'xdescribe' was also declared here.

node_modules/@types/jest/index.d.ts:39:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'it' must be of type 'TestFunction', but here has type 'It'.

39 declare var it: jest.It;
~~

node_modules/@types/mocha/index.d.ts:2749:13
2749 declare var it: Mocha.TestFunction;
~~
'it' was also declared here.

node_modules/@types/jest/index.d.ts:41:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'xit' must be of type 'PendingTestFunction', but here has type 'It'.

41 declare var xit: jest.It;
~~~

node_modules/@types/mocha/index.d.ts:2770:13
2770 declare var xit: Mocha.PendingTestFunction;
~~~
'xit' was also declared here.

node_modules/@types/jest/index.d.ts:42:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'test' must be of type 'TestFunction', but here has type 'It'.

42 declare var test: jest.It;
~~~~

node_modules/@types/mocha/index.d.ts:2763:13
2763 declare var test: Mocha.TestFunction;
~~~~
'test' was also declared here.

node_modules/@types/jest/index.d.ts:45:15 - error TS2451: Cannot redeclare block-scoped variable 'expect'.

45 declare const expect: jest.Expect;
~~~~~~

node_modules/truffle-typings/index.d.ts:11:15
11 declare const expect: Chai.ExpectStatic;
~~~~~~
'expect' was also declared here.

node_modules/truffle-typings/index.d.ts:11:15 - error TS2451: Cannot redeclare block-scoped variable 'expect'.

11 declare const expect: Chai.ExpectStatic;
~~~~~~

node_modules/@types/jest/index.d.ts:45:15
45 declare const expect: jest.Expect;
~~~~~~
'expect' was also declared here.
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the TypeScript build errors involving node_modules/truffle-typings/index.d.ts, @types/jest/index.d.ts, and @types/mocha/index.d.ts. Trace how the typings expose global test declarations, then verify that a project using Jest no longer gets the reported declaration conflicts while Truffle typings remain usable.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.