-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
knex-mock can not work correctly #36
Comments
const mockDb = require('mock-knex'); then later.. I use this mock/unmock in my unit tests and it's fine. Do you see some other problem? |
How are you unmocking?
… On Sep 25, 2020, at 5:08 PM, Dadiorchen ***@***.***> wrote:
Thanks, Zaven, yes, my unit tests works well, the problem is, after the unit test, if I run the integration test in the same process, then the tests will fail, because the DB object can not unmock correctly, I guess.
<https://user-images.githubusercontent.com/5744708/94325085-56ee6a80-ffcf-11ea-86ed-9b2f2ab9220c.png>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#36 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AACZATSP2YQRBQ7O4B5IFM3SHUWHHANCNFSM4R2QQJIA>.
|
one thing I notice is that you can just do mock and unmock in before() and after(), that than in beforeEach() afterEach(). I also don't uninstall the tracker, and everything is working. Try it?? before( function(done) { after( function(done) { |
Currently, we are using knex-mock to mock the knex, now we can use it to mock the db without problem, the problem is: once we mocked it, we can not UNMOCK it correctly. So, it would lead to test after the DB test (mocked) fail, it's because the previous DB tests break the real knex DB object.
How to reproduce the problem: modify the npm command:
to
Actually, just because of the problem, we must ignore the repository tests, they would affect others.
The text was updated successfully, but these errors were encountered: