racejar 1.0.2 → 1.0.3

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,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.0.3](https://github.com/portabletext/editor/compare/racejar-v1.0.2...racejar-v1.0.3) (2024-12-01)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * fix type error when defining inline steps without using generics ([d371044](https://github.com/portabletext/editor/commit/d371044dae46e87188bfc52cbadd8708748bb0ce))
9
+
3
10
  ## [1.0.2](https://github.com/portabletext/editor/compare/racejar-v1.0.1...racejar-v1.0.2) (2024-11-29)
4
11
 
5
12
 
package/README.md CHANGED
@@ -130,13 +130,13 @@ Feature({
130
130
  When greeting the person
131
131
  Then the greeting is "Hello, Herman!"`,
132
132
  stepDefinitions: [
133
- Given<Context, string>('the person {string}', (context, person) => {
133
+ Given('the person {string}', (context: Context, person: string) => {
134
134
  context.person = person
135
135
  }),
136
- When<Context>('greeting the person', (context) => {
136
+ When('greeting the person', (context: Context) => {
137
137
  context.greeting = greet(context.person)
138
138
  }),
139
- Then<Context, string>('the greeting is {string}', (context, greeting) => {
139
+ Then('the greeting is {string}', (context: Context, greeting: string) => {
140
140
  expect(context.greeting).toBe(greeting)
141
141
  }),
142
142
  ],
@@ -19,13 +19,13 @@ Feature({
19
19
  When greeting the person
20
20
  Then the greeting is "Hello, Herman!"`,
21
21
  stepDefinitions: [
22
- Given<Context, string>('the person {string}', (context, person) => {
22
+ Given('the person {string}', (context: Context, person: string) => {
23
23
  context.person = person
24
24
  }),
25
- When<Context>('greeting the person', (context) => {
25
+ When('greeting the person', (context: Context) => {
26
26
  context.greeting = greet(context.person)
27
27
  }),
28
- Then<Context, string>('the greeting is {string}', (context, greeting) => {
28
+ Then('the greeting is {string}', (context: Context, greeting: string) => {
29
29
  expect(context.greeting).toBe(greeting)
30
30
  }),
31
31
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "racejar",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "A testing framework agnostic Gherkin driver",
5
5
  "keywords": [
6
6
  "cucumber",
@@ -5,10 +5,7 @@ import {
5
5
  } from '@cucumber/cucumber-expressions'
6
6
  import * as Gherkin from '@cucumber/gherkin'
7
7
  import * as Messages from '@cucumber/messages'
8
- import type {
9
- StepDefinition,
10
- StepDefinitionCallbackParameters,
11
- } from './step-definitions'
8
+ import type {StepDefinition} from './step-definitions'
12
9
 
13
10
  /**
14
11
  * @public
@@ -116,11 +113,9 @@ export function compileFeature<TContext extends Record<string, any> = object>({
116
113
  throw new Error(`Multiple implementations found for step: ${step.text}`)
117
114
  }
118
115
 
119
- const args = matchingStep.args.map((arg) =>
120
- arg.getValue(matchingStep),
121
- ) as StepDefinitionCallbackParameters<any, any, any>
116
+ const args = matchingStep.args.map((arg) => arg.getValue(matchingStep))
122
117
 
123
- return () => matchingStep.callback(context, ...args)
118
+ return () => matchingStep.callback(context, args[0], args[1], args[2])
124
119
  })
125
120
 
126
121
  return {
@@ -1,30 +1,27 @@
1
1
  /**
2
2
  * @public
3
3
  */
4
- export type StepDefinitionCallbackParameters<
4
+ export type StepDefinitionCallback<
5
+ TContext extends Record<string, any> = object,
5
6
  TParamA = undefined,
6
7
  TParamB = undefined,
7
8
  TParamC = undefined,
8
9
  > = TParamA extends undefined
9
- ? []
10
+ ? (context: TContext) => Promise<void> | void
10
11
  : TParamB extends undefined
11
- ? [TParamA]
12
+ ? (context: TContext, paramA: TParamA) => Promise<void> | void
12
13
  : TParamC extends undefined
13
- ? [TParamA, TParamB]
14
- : [TParamA, TParamB, TParamC]
15
-
16
- /**
17
- * @public
18
- */
19
- export type StepDefinitionCallback<
20
- TContext extends Record<string, any> = object,
21
- TParamA = undefined,
22
- TParamB = undefined,
23
- TParamC = undefined,
24
- > = (
25
- context: TContext,
26
- ...args: StepDefinitionCallbackParameters<TParamA, TParamB, TParamC>
27
- ) => Promise<void> | void
14
+ ? (
15
+ context: TContext,
16
+ paramA: TParamA,
17
+ paramB: TParamB,
18
+ ) => Promise<void> | void
19
+ : (
20
+ context: TContext,
21
+ paramA: TParamA,
22
+ paramB: TParamB,
23
+ paramC: TParamC,
24
+ ) => Promise<void> | void
28
25
 
29
26
  /**
30
27
  * @public