Skip to content
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

setupTest.js run repetatly #2539

Closed
shai32 opened this issue Jun 15, 2017 · 4 comments
Closed

setupTest.js run repetatly #2539

shai32 opened this issue Jun 15, 2017 · 4 comments

Comments

@shai32
Copy link

shai32 commented Jun 15, 2017

I am initiating my database in setupTest.js for testing
the problem is that it rerun for every test file
why is that, can I have a global init script that would run once before any test?

@gaearon
Copy link
Contributor

gaearon commented Jun 22, 2017

Test runs are isolated, so any global shared mutable state needs to be set up from scratch. I don't recommend to use a real database for JavaScript unit tests since watcher can re-run them individually at any point in time.

@shai32
Copy link
Author

shai32 commented Jun 25, 2017

It's only for running testing in CI, it's an integration testing.
it's testing the client communication to a real server.
it has no watcher because it's a CI testing, only run once
all tests need to wait for a real server to be up and running.

@gaearon
Copy link
Contributor

gaearon commented Jun 26, 2017

Does something like jestjs/jest#949 (comment) work for you?

@shai32
Copy link
Author

shai32 commented Jul 29, 2017

sadly no

@lock lock bot locked and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants