Open BorntraegerMarc opened 7 years ago
Apparently this PR fixes it: https://github.com/powmedia/pow-mongodb-fixtures/pull/31 but the repo owner isn't around anymore...
I've forked the project and published an own package: https://www.npmjs.com/package/mongodb_fixtures
Feel free to use it 😄
So I'm running integration (REST-API) tests with mocha & chai. Every time before the tests start I reset my database & load some sample data in it with pow-mongodb-fixtures. Like this in the
beforeEach
method:I load this fixture in every
beforeEach
method from every test case.I got three docker containers: 1) MongoDB container 2) Web-App container 3) Mocha-tests container
I run the tests separately after the mongodb & webapp has started up. But sometimes (every 4th time or so) I get the following error:
komed-test-integration | Uncaught Error: MongoError: cannot perform operation: a background operation is currently running for collection komed-health.users
I guess mocha tries to execute too many db fixtures at once. Does anybody know how I can tell mocha to wait to execute them after the first beforeEach method has finished?
Here is the full stack trace: