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.

clearMocks throws error on large test suite

See original GitHub issue

After creating over 30 tests with 3 transactions each, I started getting a Parent database is not open error. I have clearMocks flag enabled. When I disable it, error doesn’t appear but my tests are no longer valid.

I have an 8 core linux machine and I tried to reduce concurrency to 1 and still got the same error.

See this log:

events.js:287
      throw er; // Unhandled 'error' event
      ^
Error [OpenError]: Parent database is not open
    at .../project/node_modules/levelup/lib/levelup.js:119:23
    at .../project/node_modules/abstract-leveldown/abstract-leveldown.js:38:14
    at .../project/node_modules/deferred-leveldown/deferred-leveldown.js:31:21
    at .../project/node_modules/encoding-down/node_modules/abstract-leveldown/abstract-leveldown.js:38:14
    at .../project/node_modules/subleveldown/node_modules/abstract-leveldown/abstract-leveldown.js:38:14
    at onopen (.../project/node_modules/subleveldown/leveldown.js:141:35)
    at processTicksAndRejections (internal/process/task_queues.js:79:11)
    at runNextTicks (internal/process/task_queues.js:66:3)
    at processImmediate (internal/timers.js:429:9)
    at process.topLevelDomainCallback (domain.js:137:15)
Emitted 'error' event on LevelUP instance at:
    at .../project/node_modules/levelup/lib/levelup.js:60:19
    at .../project/node_modules/levelup/lib/levelup.js:119:14
    at .../project/node_modules/abstract-leveldown/abstract-leveldown.js:38:14
    [... lines matching original stack trace ...]
    at processImmediate (internal/timers.js:429:9)

I tried to reproduce with minimal code but it is hard.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
napsta32commented, Aug 6, 2020

Last time it worked with my 80 tests test suite. Now that I started using test.each (and some other changes) it stops working at 39 tests (it is working fine with 38 tests).

I will try to simplify more my test code.

0reactions
corollaricommented, Aug 8, 2020

Yep, the package definitely needs better error messages.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to resolve jest error when attempting to run test suite?
Issue resolved. Issue was caused by running the tests by using the "jest" command in the terminal which is different from using the...
Read more >
Clean Unit Tests with Mockito - Reflectoring
The test case consists of the system under test CityService and its dependencies. ... @Test void find() throws Exception { City expected ...
Read more >
Configuring Jest
By default, Jest runs all tests and produces all errors into the ... Jest will run .mjs and .js files with nearest package.json...
Read more >
API Reference | Vitest
Use test.only to only run certain tests in a given suite. ... If it's not, assertion will throw an error, and the test...
Read more >
MockK | mocking library for Kotlin
A class cast exception is usually thrown in this case. Opt for stubbing manually in the case of a generic return type. Workaround:...
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