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

Add runInBand to the config object passed into the Test Environment constructor #9231

Closed
johncmunson opened this issue Nov 25, 2019 · 4 comments · May be fixed by joseroubert08/jest#96
Closed

Comments

@johncmunson
Copy link

🚀 Feature Proposal

Add runInBand to the config object passed into the Test Environment constructor. Is there a specific reason this property is excluded, while other properties such detectOpenHandles are not?

Motivation

Setup/Teardown can be subtly different depending on the mode that tests are being executed.

Example

async teardown() {
  // Tests will all use the same connection if running in sequence, but they
  // will each have their own connection if running in parallel. This is due
  // to the app using a shared singleton to connect to the database. If tests
  // are running in sequence, defer closing knex to the global teardown file.
  if (!this.config.runInBand) {
    await knex.destroy()
  }
  await super.teardown()
}
@WeiAnAn
Copy link
Contributor

WeiAnAn commented Dec 7, 2019

We can set JEST_RUN_IN_BAND environment variable to do the same thing!.
I create a PR.

@github-actions
Copy link

This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the Stale label Feb 25, 2022
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

@github-actions
Copy link

github-actions bot commented May 4, 2022

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants