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.

Testing DB in multiple test suites results in exception

See original GitHub issue

Each test suite with db-related tests executed separately runs fine. But when I run them all the first one runs fine and every another throws this exception:

TypeError: Cannot redefine property: join
        at Function.defineProperties (native)

      at Object.<anonymous> (node_modules/realm/lib/index.js:41:8)

My package.json

  "jest": {
    "preset": "jest-react-native",
    "moduleNameMapper": {
      "\\./datepicker$": "<rootDir>/node_modules/tcomb-form-native/lib/templates/bootstrap/datepicker.ios.js"
    },
    "preprocessorIgnorePatterns": [
      "node_modules/(?!react-native|tcomb-form-native|apsl-react-native-button)"
    ],
    "testRegex": "(/__tests__/.*|\\.(test))\\.js$",
    "collectCoverage": true,
    "verbose": true
  },
...
    "jest": "15.1.1",
    "jest-cli": "15.1.1",
    "jest-react-native": "15.0.0",
    "realm": "git+https://git@github.com/realm/realm-js.git",

As a workaround I might alias npm test script to run files with db tests separately, but as I described in #521 Jest hangs after finishing any db tests 😦

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
alaziercommented, Sep 8, 2016

I ran into this yesterday and have a fix in the works but need to make sure it doesn’t break anything else.

0reactions
johannesschirrmeistercommented, Nov 15, 2016

@alazier I hope this is an acceptable place to leave this feedback, but I imagine this is a pretty huge issue for people and I wonder why the fix hasn’t been released yet as a new minor version.

In my understanding, this means one can’t really run tests with the default react native setup when there is a fix for two months already. I feel bad to complain, but I feel like this would cause a lot of react native developers to give up on Realm before they really get started with it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handle exceptions with tests and test suites - OpenClassrooms
For cases where different kinds of exceptions may occur in your program, you can set multiple test cases from multiple classes. As mentioned ......
Read more >
SQL Unit Testing: Working with exceptions
In this SQL unit testing article, we will go through how to test the behavior of the exceptions in the SQL unit tests....
Read more >
Dynamically generating rackunit test-suite: tests pass and also ...
I am trying to dynamically generate a bunch of test cases. Basically I want to run the same tests several times with different...
Read more >
Java Unit Testing with JUnit and TestNG
To test if the code throws a desired exception, use annotation @Test(expected = exception.class) , as illustrated in the previous example. 3.5 JUnit...
Read more >
Build with Confidence: A Guide to JUnit Tests - Toptal
For doing regression testing, there are many tests that should be carried out ... then our motive should be to check whether the...
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