-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Jest global setup does not set a global #5424
Comments
The globals are "sandboxed" between test suites by design. |
@xfumihiro if so, is there anyway to create DB connection and share it between all of the test files or it should be done by connection every file to the DB again and again? |
@idangozlan sharing states between tests is an anti-pattern. |
@xfumihiro |
@idangozlan Again, I think it's bad practice to couple tests with states(data). Best having a fresh state on every test suite. |
Got it! Thanks for helping!
…On Feb 5, 2018 20:07, "Fumihiro Xue" ***@***.***> wrote:
@idangozlan <https://github.com/idangozlan> Again, I think it's bad
practice to couple tests with states(data). Best having a fresh state on
every test suite.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5424 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AB5hbRfprdHrEPkEzSEOkTROHcMqOo4Dks5tR8__gaJpZM4RyibQ>
.
|
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Do you want to request a feature or report a bug?
bug
What is the current behavior?
Not able to set a global from globalSetup.js
If the current behavior is a bug, please provide the steps to reproduce and
either a repl.it demo through https://repl.it/languages/jest or a minimal
repository on GitHub that we can
yarn install
andyarn test
.https://repl.it/@vijayst/CornsilkHonorableKakapo
What is the expected behavior?
the session key (global.sessionKey) should be available in the tests!
Please provide your exact Jest configuration and mention your Jest, node,
yarn/npm version and operating system.
latest jest version - 22.1.4
Mac Sierra High, yarn 1.3
The text was updated successfully, but these errors were encountered: