Version 1.0.0 breaks Typescript/Mocha Workflow
See original GitHub issueChecklist
- 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:
- Created a year ago
- Comments:12 (5 by maintainers)
Top 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 >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
@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.Thanks for the fix. I can confirm that
v2.0.0-beta.2
did fix this issue for me.