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.

knex no longer spyable by jest ?

See original GitHub issue

Environment

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:closed
  • Created 3 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
mlarchercommented, Oct 31, 2020

thank you for the update 😃

1reaction
kibertoadcommented, Oct 31, 2020

Fix for the uuid change was released in 0.21.10

Read more comments on GitHub >

github_iconTop 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 >

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