racejar 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/example/{hooks.test.ts → vitest.hooks.test.ts} +9 -2
- package/package.json +8 -8
- package/src/compile-feature.ts +17 -15
- package/src/jest/jest-gherkin-driver.ts +8 -10
- package/src/playwright/playwright-gherkin-driver.ts +15 -15
- package/src/vitest/vitest-gherkin-driver.ts +7 -7
- /package/example/{hello-herman.test.ts → vitest.hello-herman.test.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.2.5](https://github.com/portabletext/editor/compare/racejar-v1.2.4...racejar-v1.2.5) (2025-05-14)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* scope hooks to each Feature ([1f153ae](https://github.com/portabletext/editor/commit/1f153ae19b2509663a32a1a26838b4ece53226ff))
|
|
9
|
+
|
|
10
|
+
## [1.2.4](https://github.com/portabletext/editor/compare/racejar-v1.2.3...racejar-v1.2.4) (2025-04-19)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **deps:** update dependency @playwright/test to ^1.52.0 ([889ee63](https://github.com/portabletext/editor/commit/889ee638f0dccd473f361979fa6dfd1d8d3e216b))
|
|
16
|
+
|
|
3
17
|
## [1.2.3](https://github.com/portabletext/editor/compare/racejar-v1.2.2...racejar-v1.2.3) (2025-03-21)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -19,13 +19,20 @@ Feature({
|
|
|
19
19
|
Scenario: Greeting a person
|
|
20
20
|
Given the person "Herman"
|
|
21
21
|
When greeting the person
|
|
22
|
-
Then the greeting is "Hello Herman"
|
|
22
|
+
Then the greeting is "Hello Herman"
|
|
23
|
+
|
|
24
|
+
Scenario: Greeting another person
|
|
25
|
+
Given the person "Pauline"
|
|
26
|
+
When greeting the person
|
|
27
|
+
Then the greeting is "Hello Pauline"`,
|
|
23
28
|
hooks: [
|
|
24
29
|
Before((context: Context) => {
|
|
25
30
|
context.greetingPrefix = 'Hello'
|
|
26
31
|
}),
|
|
27
32
|
After((context: Context) => {
|
|
28
|
-
expect(context.greeting).toBe(
|
|
33
|
+
expect(context.greeting).toBe(
|
|
34
|
+
`${context.greetingPrefix} ${context.person}`,
|
|
35
|
+
)
|
|
29
36
|
}),
|
|
30
37
|
],
|
|
31
38
|
stepDefinitions: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "racejar",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "A testing framework agnostic Gherkin driver",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cucumber",
|
|
@@ -41,18 +41,18 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@cucumber/cucumber-expressions": "^18.0.1",
|
|
44
|
-
"@cucumber/gherkin": "^32.
|
|
44
|
+
"@cucumber/gherkin": "^32.1.0",
|
|
45
45
|
"@cucumber/messages": "^27.2.0",
|
|
46
46
|
"@jest/globals": "^29.7.0",
|
|
47
|
-
"@playwright/test": "^1.
|
|
48
|
-
"@sanity/pkg-utils": "^7.
|
|
49
|
-
"typescript": "5.8.
|
|
50
|
-
"vitest": "^3.
|
|
47
|
+
"@playwright/test": "^1.52.0",
|
|
48
|
+
"@sanity/pkg-utils": "^7.2.2",
|
|
49
|
+
"typescript": "5.8.3",
|
|
50
|
+
"vitest": "^3.1.3"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@jest/globals": "^29.7.0",
|
|
54
|
-
"@playwright/test": "^1.
|
|
55
|
-
"vitest": "^3.
|
|
54
|
+
"@playwright/test": "^1.52.0",
|
|
55
|
+
"vitest": "^3.1.3"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"check:lint": "biome lint .",
|
package/src/compile-feature.ts
CHANGED
|
@@ -19,9 +19,9 @@ export type CompiledFeature<TStepContext extends Record<string, any> = object> =
|
|
|
19
19
|
name: string
|
|
20
20
|
tag?: 'only' | 'skip'
|
|
21
21
|
steps: Array<(stepContext?: TStepContext) => Promise<void> | void>
|
|
22
|
-
beforeHooks: Array<(stepContext?: TStepContext) => Promise<void> | void>
|
|
23
|
-
afterHooks: Array<(stepContext?: TStepContext) => Promise<void> | void>
|
|
24
22
|
}>
|
|
23
|
+
beforeHooks: Array<(stepContext?: TStepContext) => Promise<void> | void>
|
|
24
|
+
afterHooks: Array<(stepContext?: TStepContext) => Promise<void> | void>
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -89,10 +89,12 @@ export function compileFeature<
|
|
|
89
89
|
throw new Error('Feature cannot have both @skip and @only tags')
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
let context = {} as TContext
|
|
93
|
+
|
|
92
94
|
const scenarios = pickles.map((pickle) => {
|
|
93
95
|
const skippedPickle = pickle.tags.some((tag) => tag.name === '@skip')
|
|
94
96
|
const onlyPickle = pickle.tags.some((tag) => tag.name === '@only')
|
|
95
|
-
|
|
97
|
+
context = {} as TContext
|
|
96
98
|
|
|
97
99
|
const steps = pickle.steps.map((step) => {
|
|
98
100
|
const matchingSteps = stepImplementations
|
|
@@ -153,18 +155,6 @@ export function compileFeature<
|
|
|
153
155
|
? ('only' as const)
|
|
154
156
|
: undefined,
|
|
155
157
|
steps,
|
|
156
|
-
beforeHooks: (hooks ?? [])
|
|
157
|
-
.filter((hook) => hook.type === 'Before')
|
|
158
|
-
.map(
|
|
159
|
-
(hook) => (stepContext: TStepContext | undefined) =>
|
|
160
|
-
hook.callback(Object.assign(context, stepContext)),
|
|
161
|
-
),
|
|
162
|
-
afterHooks: (hooks ?? [])
|
|
163
|
-
.filter((hook) => hook.type === 'After')
|
|
164
|
-
.map(
|
|
165
|
-
(hook) => (stepContext: TStepContext | undefined) =>
|
|
166
|
-
hook.callback(Object.assign(context, stepContext)),
|
|
167
|
-
),
|
|
168
158
|
}
|
|
169
159
|
})
|
|
170
160
|
|
|
@@ -172,5 +162,17 @@ export function compileFeature<
|
|
|
172
162
|
tag: skippedFeature ? 'skip' : onlyFeature ? 'only' : undefined,
|
|
173
163
|
name: gherkinDocument.feature.name,
|
|
174
164
|
scenarios,
|
|
165
|
+
beforeHooks: (hooks ?? [])
|
|
166
|
+
.filter((hook) => hook.type === 'Before')
|
|
167
|
+
.map(
|
|
168
|
+
(hook) => (stepContext: TStepContext | undefined) =>
|
|
169
|
+
hook.callback(Object.assign(context, stepContext)),
|
|
170
|
+
),
|
|
171
|
+
afterHooks: (hooks ?? [])
|
|
172
|
+
.filter((hook) => hook.type === 'After')
|
|
173
|
+
.map(
|
|
174
|
+
(hook) => (stepContext: TStepContext | undefined) =>
|
|
175
|
+
hook.callback(Object.assign(context, stepContext)),
|
|
176
|
+
),
|
|
175
177
|
}
|
|
176
178
|
}
|
|
@@ -33,14 +33,15 @@ export function Feature<TContext extends Record<string, any> = object>({
|
|
|
33
33
|
: describe
|
|
34
34
|
|
|
35
35
|
describeFn(feature.name, () => {
|
|
36
|
-
for (const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
for (const before of feature.beforeHooks) {
|
|
37
|
+
beforeEach(before)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
for (const after of feature.afterHooks) {
|
|
41
|
+
afterEach(after)
|
|
42
|
+
}
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
afterEach(after)
|
|
43
|
-
}
|
|
44
|
+
for (const scenario of feature.scenarios) {
|
|
44
45
|
const testFn =
|
|
45
46
|
scenario.tag === 'only'
|
|
46
47
|
? test.only
|
|
@@ -49,9 +50,6 @@ export function Feature<TContext extends Record<string, any> = object>({
|
|
|
49
50
|
: test
|
|
50
51
|
|
|
51
52
|
testFn(scenario.name, async () => {
|
|
52
|
-
for (const before of scenario.beforeHooks) {
|
|
53
|
-
await before()
|
|
54
|
-
}
|
|
55
53
|
for (const step of scenario.steps) {
|
|
56
54
|
await step()
|
|
57
55
|
}
|
|
@@ -53,23 +53,23 @@ export function Feature<
|
|
|
53
53
|
: test.describe
|
|
54
54
|
|
|
55
55
|
describeFn(feature.name, () => {
|
|
56
|
-
for (const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
56
|
+
for (const before of feature.beforeHooks) {
|
|
57
|
+
test.beforeEach(async (playwrightOptions) => {
|
|
58
|
+
await before({
|
|
59
|
+
playwright: playwrightOptions,
|
|
60
|
+
} as TContext)
|
|
61
|
+
})
|
|
62
|
+
}
|
|
64
63
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
64
|
+
for (const after of feature.afterHooks) {
|
|
65
|
+
test.afterEach(async (playwrightOptions) => {
|
|
66
|
+
await after({
|
|
67
|
+
playwright: playwrightOptions,
|
|
68
|
+
} as TContext)
|
|
69
|
+
})
|
|
70
|
+
}
|
|
72
71
|
|
|
72
|
+
for (const scenario of feature.scenarios) {
|
|
73
73
|
const testFn =
|
|
74
74
|
scenario.tag === 'only'
|
|
75
75
|
? test.only
|
|
@@ -33,15 +33,15 @@ export function Feature<TContext extends Record<string, any> = object>({
|
|
|
33
33
|
: describe
|
|
34
34
|
|
|
35
35
|
describeFn(feature.name, () => {
|
|
36
|
-
for (const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
36
|
+
for (const before of feature.beforeHooks) {
|
|
37
|
+
beforeEach(before)
|
|
38
|
+
}
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
for (const after of feature.afterHooks) {
|
|
41
|
+
afterEach(after)
|
|
42
|
+
}
|
|
44
43
|
|
|
44
|
+
for (const scenario of feature.scenarios) {
|
|
45
45
|
const testFn =
|
|
46
46
|
scenario.tag === 'only'
|
|
47
47
|
? test.only
|
|
File without changes
|