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.

Version 1.0.0 breaks Typescript/Mocha Workflow

See original GitHub issue

Checklist

  • I have read Caveats documentation and didn’t find a solution for this problem there.

Bug description

We use this library in our tests using Typescript and Mocha as a test runner. We recently wanted to update to version 1.0.0, however, the newly added Jest dependency breaks compatibility with Mocha.

Reproduction

Doing

yarn init
yarn add -D typescript aws-sdk-client-mock @types/jest @types/mocha ts-jest
echo "import {mockClient} from 'aws-sdk-client-mock';" >> index.ts
node_modules/typescript/bin/tsc index.ts

will result in a lot of errors of the form

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

2642 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.

Environment

  • Node version: v16.13.2
  • Testing lib and version: Mocha 10
  • Typescript version: 4.7.4
  • AWS SDK v3 Client mock version: 1.0.0
  • AWS JS SDK libs and versions: doesn’t matter

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
m-radzikowskicommented, Jun 27, 2022

@hzzzln, @rbargholz - please check out the 2.0.0-beta.1 release - it includes @types/jest as a dependency which should eliminate those errors without you having to install it yourself.

0reactions
timvlaercommented, Aug 29, 2022

Thanks for the fix. I can confirm that v2.0.0-beta.2 did fix this issue for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

BREAKING-CHANGE in release 1.0.0 affects dependencies in an ...
I use fs-monkey as a devDependency for mocha unit test and the change from 0.3.3 to 1.0.0 is at issue. The error is:...
Read more >
Changelog | Meteor API Docs
It's important to test your app with these changes. typescript was updated to 4.2.2, make sure your read the breaking changes. Meteor Version...
Read more >
Testing A Node/Express Application With Mocha & Chai
In this article, we'll be writing a simple Node/Express API application while incorporating testing using the mocha & chai JavaScript testing packages.
Read more >
Run your Tests using Node.js and Mocha frameworks
I've truncated the output again for simplicity but you can see that our tests are run and passed. Let's break one of the...
Read more >
Changelog - Cypress Documentation
Fixed an issue where the incorrect Cypress version could be shown in the migration ... the migration workflow would error and hang for...
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