-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(runner):
test.extend
doesn't work in hooks without test (#4065)
- Loading branch information
Showing
5 changed files
with
77 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { afterEach, beforeEach, expect, test } from 'vitest' | ||
|
||
interface Fixture { foo: number } | ||
|
||
const test1 = test.extend<Fixture>({ | ||
foo: 1, | ||
}) | ||
|
||
const test2 = test.extend<Fixture>({ | ||
foo: 2, | ||
}) | ||
|
||
test1('the foo should be 1', ({ foo }) => { | ||
expect(foo).toBe(1) | ||
}) | ||
|
||
test2('the foo should be 2', ({ foo }) => { | ||
expect(foo).toBe(2) | ||
}) | ||
|
||
let nextFoo = 1 | ||
beforeEach<Fixture>(({ foo }) => { | ||
expect(foo).toBe(nextFoo) | ||
}) | ||
|
||
afterEach<Fixture>(({ foo }) => { | ||
expect(foo).toBe(nextFoo) | ||
nextFoo++ | ||
}) |