You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am using rewiremock for the first time in my project. There is a dependency on mysql in my project for pool creation and execution of a query. I have an import statement of :
import mysql from 'mysql2/promise' ;
....
mysql.createPool(conectionConfiguration);
In my test class how can I go about creating mock for the mysql import so that I can control the flow of code and execution of query.
I tried to use rewiremock.enable() ; But got error prompt: Not a function..something like that.
Note : My main code is in .mjs extension.
Error img :
The text was updated successfully, but these errors were encountered:
@Subham-dury How about your test code? I was encountering this in a test suite, read the docs again, realised I had to switch to require('rewiremock/node'), and now it's gone. There are a few other alternatives in the docs as well.
Hi,
I am using rewiremock for the first time in my project. There is a dependency on mysql in my project for pool creation and execution of a query. I have an import statement of :
import mysql from 'mysql2/promise' ;
....
mysql.createPool(conectionConfiguration);
In my test class how can I go about creating mock for the mysql import so that I can control the flow of code and execution of query.
I tried to use rewiremock.enable() ; But got error prompt: Not a function..something like that.
Note : My main code is in .mjs extension.
Error img :
The text was updated successfully, but these errors were encountered: