Skip to content

Commit 11e82e9

Browse files
Kent C. Doddssindresorhus
authored andcommitted
Close #562 PR: Add note about running tests in serial.
1 parent 7d108aa commit 11e82e9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ test.skip('will not be run', t => {
261261
When setup and/or teardown is required, you can use `test.before()` and `test.after()`,
262262
used in the same manner as `test()`. The test function given to `test.before()` and `test.after()` is called before/after all tests. You can also use `test.beforeEach()` and `test.afterEach()` if you need setup/teardown for each test. Hooks are run serially in the test file. Add as many of these as you want. You can optionally specify a title that is shown on failure.
263263

264+
If you need to set up some global state between tests using `test.beforeEach()` and `test.afterEach()` (like spying on `console.log` [for example](https://github.com/sindresorhus/ava/issues/560)), you'll need to make sure the tests are run serially (using either [test.serial](#serial-tests) or [`--serial`](#cli)).
265+
264266

265267
```js
266268
test.before(t => {

0 commit comments

Comments
 (0)