Per-worker setup/teardown
## 🚀 Feature Proposal Jest provides _[once-global](https://jestjs.io/docs/en/configuration#globalsetup-string)_ setup and teardown, and _[per-file](https://jestjs.io/docs/en/api#beforeallfn-timeout)_ setup and teardown, but conspicuously absent is _per-worker_ setup and teardown. ## Motivation One worker's set of tests runs serially, and is ideally suited to reusing an exclusive resource like a database or redis connection. ## Example Sue has a test suite that uses a database. She can create _multiple_ databases, but there is a time cost associated with spinning one up before it can be used. From her test suite she'd like to get maximum concurrency with minimum database setup time. Currently possible approaches: 1) One database, run all the tests serially. * This is unacceptably slow. Concurrency is one of Jest's killer features and it's sad to lose it. 2) Multiple databases, created on fly at runtime, per-file. (in e.g. `beforeAll()`) * This pays the database setup cost many more times than is necessary, slowing down the test suite. 3) Multiple databases, created upfront. (e.g., make 20 databases, once, in `globalSetup`) * This requires you to choose a constant (e.g. **20**) according to how many workers you want to run. * Choose the wrong number for `-w` (or get the wrong number inferred by your CPU core count), and it will either do too much work or not have enough databases. * Also it's painful to wait on a large upfront cost when you're running,
Posted by jrr on Jul 17, 2019, 7:06 PM
Tags
Related issues
- >Beef is already too expensive for most people.
- I gave this a go a couple of years ago.
- I haven't seen any use cases around me, although I'm not that advanced user.
- [BUG] Pro Max 5x Quota Exhausted in 1.5 Hours Despite Moderate Usage
- > Unfortunately it doesn't offer free hosting for hobbyists.
- Still the same HID remapping project from last month (I was hoping to be done by now, but hardware is hard): https://github.co...
Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments
pricing (Software)
>Beef is already too expensive for most people.
I gave this a go a couple of years ago.
I haven't seen any use cases around me, although I'm not that advanced user.
[BUG] Pro Max 5x Quota Exhausted in 1.5 Hours Despite Moderate Usage
> Unfortunately it doesn't offer free hosting for hobbyists.
Still the same HID remapping project from last month (I was hoping to be done by now, but hardware is hard): https://github.co...
This criticism seems like a complete non-sequitur to me.
Bring back the GitHub Copilot in the CLI commands to not break workflows
Per-worker setup/teardown
## 🚀 Feature Proposal Jest provides _[once-global](https://jestjs.io/docs/en/configuration#globalsetup-string)_ setup and teardown, and _[per-file](https://jestjs.io/docs/en/api#beforeallfn-timeout)_ setup and teardown, but conspicuously absent is _per-worker_ setup and teardown. ## Motivation One worker's set of tests runs serially, and is ideally suited to reusing an exclusive resource like a database or redis connection. ## Example Sue has a test suite that uses a database. She can create _multiple_ databases, but there is a time cost associated with spinning one up before it can be used. From her test suite she'd like to get maximum concurrency with minimum database setup time. Currently possible approaches: 1) One database, run all the tests serially. * This is unacceptably slow. Concurrency is one of Jest's killer features and it's sad to lose it. 2) Multiple databases, created on fly at runtime, per-file. (in e.g. `beforeAll()`) * This pays the database setup cost many more times than is necessary, slowing down the test suite. 3) Multiple databases, created upfront. (e.g., make 20 databases, once, in `globalSetup`) * This requires you to choose a constant (e.g. **20**) according to how many workers you want to run. * Choose the wrong number for `-w` (or get the wrong number inferred by your CPU core count), and it will either do too much work or not have enough databases. * Also it's painful to wait on a large upfront cost when you're running,
Comments (0)
No comments yet. Start the discussion.