Skip to content
This repository was archived by the owner on Jun 27, 2022. It is now read-only.

Commit aaa235f

Browse files
committed
Supports isolating tests
1 parent fba0ea3 commit aaa235f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

test/setup/runner.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Path, match } from '../../src/match'
33
export interface Scenario {
44
given: Path
55
when: Array<{
6+
only?: boolean
67
actual: string
78
it: {
89
[key: string]: any
@@ -16,14 +17,11 @@ export const runner = (name: string, scenarios: Scenario[]) => {
1617
describe(`given "${scenario.given}" path`, () => {
1718
scenario.when.forEach((data) => {
1819
describe(`and "${data.actual}" url`, () => {
19-
let result: ReturnType<typeof match>
20-
21-
beforeAll(() => {
22-
result = match(scenario.given, data.actual)
23-
})
20+
const test = data.only ? it.only : it
2421

2522
Object.entries(data.it).forEach(([key, expectedValue]) => {
26-
it(`"${key}": "${JSON.stringify(expectedValue)}"`, () => {
23+
test(`"${key}": "${JSON.stringify(expectedValue)}"`, () => {
24+
const result = match(scenario.given, data.actual)
2725
expect(result).toHaveProperty(key, expectedValue)
2826
})
2927
})

0 commit comments

Comments
 (0)