knex no longer spyable by jest ?
See original GitHub issueEnvironment
Knex version: 0.20.11 OS: macos
Bug
When updating from 0.20.10 to 0.20.11, test suite breaks because Jest spies cannot be applied.
For example, jest.spyOn(db, 'destroy')
or jest.spyOn(db, 'transaction')
throw the following error :
TypeError: Cannot assign to read only property 'transaction' of function 'function knex(tableName, options) {
return createQueryBuilder(knex.context, tableName, options);
}'
Is this intentional ? Is there a new way of doing things to get around this problem ? I’d be happy o provide additional information if needed
Issue Analytics
- State:
- Created 3 years ago
- Comments:10
Top Results From Across the Web
Knex leaves open server when using Jest (recommendation)
Jest did not exit one second after the test run has completed. This usually means that there are asynchronous operations that weren't >stopped ......
Read more >A step-by-step intro to end-point testing - freeCodeCamp
Jest runs each test file asynchronously. You won't know which file comes first. You don't want tests to share the same database. You...
Read more >How To Fix: Jest Did Not Exit - DONN FELKER
JS project and I decided to use Knex.js with Objection.js for my data ... Jest did not exit one second after the test...
Read more >Double Your Income as a JavaScript/TypeScript Developer ...
If you are a professional developer who earns money by writing JavaScript/TypeScript code, then this article will show you how to double ...
Read more >Installation | Knex.js
destroy([callback]) . You may use knex.destroy by passing a callback, or by chaining as a promise, just not both. To manually initialize a...
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 Free
Top 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
thank you for the update 😃
Fix for the uuid change was released in 0.21.10