Skip to content

Typings are incompatible with jest #16

@mdnorman

Description

@mdnorman

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions