question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@types/mocha dependency in 2.3.6 breaks when using jest

See original GitHub issue

What are you trying to achieve?

I am using jest as my unit test framework for a typescript project and wish to use codeceptjs to run browser tests. I am able to run both with codeceptjs@2.3.5 but upgrading to codeceptjs@2.3.6 causes breaks when building my application.

It looks like the inclusion of @types/mocha as a dependency in the 2.3.6 release is conflicting with my local @types/jest definitions.

What do you get instead?

When attempting to build the project I get lots of the following errors:

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

2680 declare var beforeEach: Mocha.HookFunction;
                 ~~~~~~~~~~

  node_modules/@types/jest/index.d.ts:34:13
    34 declare var beforeEach: jest.Lifecycle;
                   ~~~~~~~~~~
    'beforeEach' was also declared here.

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

2698 declare var afterEach: Mocha.HookFunction;
                 ~~~~~~~~~

  node_modules/@types/jest/index.d.ts:36:13
    36 declare var afterEach: jest.Lifecycle;
                   ~~~~~~~~~
    'afterEach' was also declared here.

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

2714 declare var describe: Mocha.SuiteFunction;

Provide test source code if related

branch using 2.3.6 https://github.com/diversemix/bootstrap-typescript-starter/tree/codeceptjs-2.3.6-upgrade

branch using 2.3.5 https://github.com/diversemix/bootstrap-typescript-starter/tree/master

run: yarn yarn build

Details

  • CodeceptJS version: 2.3.6
  • NodeJS Version: v10.15.3
  • Operating System: OSX10.15.1
  • Configuration file:
exports.config = {
  tests: './tests/*.js',
  output: './output',
  helpers: {
    Puppeteer: {
      url: 'http://localhost:8080',
      show: true
    }
  },
  include: {
    I: './steps_file.js'
  },
  bootstrap: null,
  mocha: {},
  name: 'bootstrap-typescript-starter'
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
oceandramacommented, Dec 31, 2019

There is not even about different package.json. @types/... should not be in dependencies section, it’s used only to builing package, not in runtime So, it’s definitely a bug

3reactions
Vorobeykocommented, Dec 19, 2019

I open this issue because if the tests are in different folders (next to the component as an example) the package.json won’t help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

types/mocha dependency in 2.3.6 breaks when using jest #2055
I am using jest as my unit test framework for a typescript project and wish to use codeceptjs to run browser tests. I...
Read more >
npm ERESOLVE unable to resolve dependency tree NestJs ...
this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ...
Read more >
第三方软件和许可证 - JetBrains
软件 授权许可 版本 .babelrc JSON Schema (.babelrc‑schema.json) Apache 2.0 JSON schema for Babel 6+ con... .eslintrc JSON Schema (.eslintrc‑schema.json) Apache 2.0 JSON schema for ESLint...
Read more >
Keysight KCOS 9.30 Third Party & Open-Source License ...
AND ISC License AND GNU Lesser General Public License v2.0 with Exceptions ... jest-resolve-dependencies 27.5.1 : MIT License ...
Read more >
third party component notices - Grammarly
These Third-Party Component notices are provided according to your. Agreement with Grammarly,(such as the Grammarly Terms of Service and License.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found