racejar 1.2.4 → 1.2.6

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.2.6](https://github.com/portabletext/editor/compare/racejar-v1.2.5...racejar-v1.2.6) (2025-06-12)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **deps:** update dependency @jest/globals to v30 ([3f92f15](https://github.com/portabletext/editor/commit/3f92f15fa399dbc19705bf0d680f53069333f355))
9
+ * **deps:** update dependency @playwright/test to ^1.53.0 ([6a0e159](https://github.com/portabletext/editor/commit/6a0e15902bce2d13abe011bbf4f70bff8b9573e7))
10
+
11
+ ## [1.2.5](https://github.com/portabletext/editor/compare/racejar-v1.2.4...racejar-v1.2.5) (2025-05-14)
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * scope hooks to each Feature ([1f153ae](https://github.com/portabletext/editor/commit/1f153ae19b2509663a32a1a26838b4ece53226ff))
17
+
3
18
  ## [1.2.4](https://github.com/portabletext/editor/compare/racejar-v1.2.3...racejar-v1.2.4) (2025-04-19)
4
19
 
5
20
 
@@ -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('Hello Herman')
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.4",
3
+ "version": "1.2.6",
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.1.0",
44
+ "@cucumber/gherkin": "^32.1.2",
45
45
  "@cucumber/messages": "^27.2.0",
46
- "@jest/globals": "^29.7.0",
47
- "@playwright/test": "^1.52.0",
48
- "@sanity/pkg-utils": "^7.2.2",
46
+ "@jest/globals": "^30.0.0",
47
+ "@playwright/test": "^1.53.0",
48
+ "@sanity/pkg-utils": "^7.2.4",
49
49
  "typescript": "5.8.3",
50
- "vitest": "^3.1.1"
50
+ "vitest": "^3.2.3"
51
51
  },
52
52
  "peerDependencies": {
53
- "@jest/globals": "^29.7.0",
54
- "@playwright/test": "^1.52.0",
55
- "vitest": "^3.1.1"
53
+ "@jest/globals": "^30.0.0",
54
+ "@playwright/test": "^1.53.0",
55
+ "vitest": "^3.2.3"
56
56
  },
57
57
  "scripts": {
58
58
  "check:lint": "biome lint .",
@@ -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
- const context = {} as TContext
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 scenario of feature.scenarios) {
37
- for (const before of scenario.beforeHooks) {
38
- beforeEach(before)
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
- for (const after of scenario.afterHooks) {
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 scenario of feature.scenarios) {
57
- for (const before of scenario.beforeHooks) {
58
- test.beforeEach(async (playwrightOptions) => {
59
- await before({
60
- playwright: playwrightOptions,
61
- } as TContext)
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
- for (const after of scenario.afterHooks) {
66
- test.afterEach(async (playwrightOptions) => {
67
- await after({
68
- playwright: playwrightOptions,
69
- } as TContext)
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 scenario of feature.scenarios) {
37
- for (const before of scenario.beforeHooks) {
38
- beforeEach(before)
39
- }
36
+ for (const before of feature.beforeHooks) {
37
+ beforeEach(before)
38
+ }
40
39
 
41
- for (const after of scenario.afterHooks) {
42
- afterEach(after)
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