@lynxwall/cucumber-tsflow 7.4.1 → 7.5.0
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/lib/support_code_library_builder/index.d.ts +80 -0
- package/lib/support_code_library_builder/index.js +337 -0
- package/lib/support_code_library_builder/index.js.map +1 -0
- package/lib/transpilers/esm/loader-utils.mjs +14 -3
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +3 -6
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { IdGenerator } from '@cucumber/messages';
|
|
2
|
+
import * as messages from '@cucumber/messages';
|
|
3
|
+
import TestCaseHookDefinition from '@cucumber/cucumber/lib/models/test_case_hook_definition';
|
|
4
|
+
import TestStepHookDefinition from '@cucumber/cucumber/lib/models/test_step_hook_definition';
|
|
5
|
+
import TestRunHookDefinition from '@cucumber/cucumber/lib/models/test_run_hook_definition';
|
|
6
|
+
import StepDefinition from '@cucumber/cucumber/lib/models/step_definition';
|
|
7
|
+
import { GherkinStepKeyword } from '@cucumber/cucumber/lib/models/gherkin_step_keyword';
|
|
8
|
+
import { IDefineSupportCodeMethods, IDefineTestCaseHookOptions, IDefineTestStepHookOptions, IDefineTestRunHookOptions, IParameterTypeDefinition, SupportCodeLibrary, TestCaseHookFunction, TestStepHookFunction, ISupportCodeCoordinates, IDefineStep, CanonicalSupportCodeIds } from '@cucumber/cucumber/lib/support_code_library_builder/types';
|
|
9
|
+
interface IStepDefinitionConfig {
|
|
10
|
+
code: Function;
|
|
11
|
+
line: number;
|
|
12
|
+
options: any;
|
|
13
|
+
keyword: GherkinStepKeyword;
|
|
14
|
+
pattern: string | RegExp;
|
|
15
|
+
uri: string;
|
|
16
|
+
}
|
|
17
|
+
interface ITestCaseHookDefinitionConfig {
|
|
18
|
+
code: any;
|
|
19
|
+
line: number;
|
|
20
|
+
options: any;
|
|
21
|
+
uri: string;
|
|
22
|
+
}
|
|
23
|
+
interface ITestStepHookDefinitionConfig {
|
|
24
|
+
code: Function;
|
|
25
|
+
line: number;
|
|
26
|
+
options: any;
|
|
27
|
+
uri: string;
|
|
28
|
+
}
|
|
29
|
+
interface ITestRunHookDefinitionConfig {
|
|
30
|
+
code: Function;
|
|
31
|
+
line: number;
|
|
32
|
+
options: any;
|
|
33
|
+
uri: string;
|
|
34
|
+
}
|
|
35
|
+
export declare class SupportCodeLibraryBuilder {
|
|
36
|
+
readonly methods: IDefineSupportCodeMethods;
|
|
37
|
+
private originalCoordinates;
|
|
38
|
+
private afterTestCaseHookDefinitionConfigs;
|
|
39
|
+
private afterTestRunHookDefinitionConfigs;
|
|
40
|
+
private afterTestStepHookDefinitionConfigs;
|
|
41
|
+
private beforeTestCaseHookDefinitionConfigs;
|
|
42
|
+
private beforeTestRunHookDefinitionConfigs;
|
|
43
|
+
private beforeTestStepHookDefinitionConfigs;
|
|
44
|
+
private cwd;
|
|
45
|
+
private defaultTimeout;
|
|
46
|
+
private definitionFunctionWrapper;
|
|
47
|
+
private newId;
|
|
48
|
+
private parameterTypeRegistry;
|
|
49
|
+
private stepDefinitionConfigs;
|
|
50
|
+
private World;
|
|
51
|
+
private parallelCanAssign;
|
|
52
|
+
private status;
|
|
53
|
+
/**
|
|
54
|
+
* Gets the SupportCodeLibraryBuilder singleton.
|
|
55
|
+
*
|
|
56
|
+
* @returns A [[SupportCodeLibraryBuilder]].
|
|
57
|
+
*/
|
|
58
|
+
static get instance(): SupportCodeLibraryBuilder;
|
|
59
|
+
constructor();
|
|
60
|
+
defineParameterType(options: IParameterTypeDefinition<any>): void;
|
|
61
|
+
defineStep(keyword: GherkinStepKeyword, getCollection: () => IStepDefinitionConfig[]): IDefineStep;
|
|
62
|
+
defineTestCaseHook(getCollection: () => ITestCaseHookDefinitionConfig[]): <WorldType>(options: string | IDefineTestCaseHookOptions | TestCaseHookFunction<WorldType>, code?: TestCaseHookFunction<WorldType>) => void;
|
|
63
|
+
defineTestStepHook(getCollection: () => ITestStepHookDefinitionConfig[]): <WorldType>(options: string | IDefineTestStepHookOptions | TestStepHookFunction<WorldType>, code?: TestStepHookFunction<WorldType>) => void;
|
|
64
|
+
defineTestRunHook(getCollection: () => ITestRunHookDefinitionConfig[]): (options: IDefineTestRunHookOptions | Function, code?: Function) => void;
|
|
65
|
+
wrapCode({ code, wrapperOptions }: {
|
|
66
|
+
code: Function;
|
|
67
|
+
wrapperOptions: any;
|
|
68
|
+
}): Function;
|
|
69
|
+
buildTestCaseHookDefinitions(configs: ITestCaseHookDefinitionConfig[], canonicalIds?: string[]): TestCaseHookDefinition[];
|
|
70
|
+
buildTestStepHookDefinitions(configs: ITestStepHookDefinitionConfig[]): TestStepHookDefinition[];
|
|
71
|
+
buildTestRunHookDefinitions(configs: ITestRunHookDefinitionConfig[]): TestRunHookDefinition[];
|
|
72
|
+
buildStepDefinitions(canonicalIds?: string[]): {
|
|
73
|
+
stepDefinitions: StepDefinition[];
|
|
74
|
+
undefinedParameterTypes: messages.UndefinedParameterType[];
|
|
75
|
+
};
|
|
76
|
+
finalize(canonicalIds?: CanonicalSupportCodeIds): SupportCodeLibrary;
|
|
77
|
+
reset(cwd: string, newId: IdGenerator.NewId, originalCoordinates?: ISupportCodeCoordinates): void;
|
|
78
|
+
}
|
|
79
|
+
declare const _default: SupportCodeLibraryBuilder;
|
|
80
|
+
export default _default;
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SupportCodeLibraryBuilder = void 0;
|
|
7
|
+
const util_arity_1 = __importDefault(require("util-arity"));
|
|
8
|
+
const cucumber_expressions_1 = require("@cucumber/cucumber-expressions");
|
|
9
|
+
const test_case_hook_definition_1 = __importDefault(require("@cucumber/cucumber/lib/models/test_case_hook_definition"));
|
|
10
|
+
const test_step_hook_definition_1 = __importDefault(require("@cucumber/cucumber/lib/models/test_step_hook_definition"));
|
|
11
|
+
const test_run_hook_definition_1 = __importDefault(require("@cucumber/cucumber/lib/models/test_run_hook_definition"));
|
|
12
|
+
const step_definition_1 = __importDefault(require("@cucumber/cucumber/lib/models/step_definition"));
|
|
13
|
+
const index_1 = require("@cucumber/cucumber/lib/formatter/helpers/index");
|
|
14
|
+
const value_checker_1 = require("@cucumber/cucumber/lib/value_checker");
|
|
15
|
+
const validate_arguments_1 = __importDefault(require("@cucumber/cucumber/lib/support_code_library_builder/validate_arguments"));
|
|
16
|
+
const world_1 = __importDefault(require("@cucumber/cucumber/lib/support_code_library_builder/world"));
|
|
17
|
+
const get_definition_line_and_uri_1 = require("@cucumber/cucumber/lib/support_code_library_builder/get_definition_line_and_uri");
|
|
18
|
+
const build_parameter_type_1 = require("@cucumber/cucumber/lib/support_code_library_builder/build_parameter_type");
|
|
19
|
+
const sourced_parameter_type_registry_1 = require("@cucumber/cucumber/lib/support_code_library_builder/sourced_parameter_type_registry");
|
|
20
|
+
class SupportCodeLibraryBuilder {
|
|
21
|
+
methods;
|
|
22
|
+
originalCoordinates;
|
|
23
|
+
afterTestCaseHookDefinitionConfigs;
|
|
24
|
+
afterTestRunHookDefinitionConfigs;
|
|
25
|
+
afterTestStepHookDefinitionConfigs;
|
|
26
|
+
beforeTestCaseHookDefinitionConfigs;
|
|
27
|
+
beforeTestRunHookDefinitionConfigs;
|
|
28
|
+
beforeTestStepHookDefinitionConfigs;
|
|
29
|
+
cwd;
|
|
30
|
+
defaultTimeout;
|
|
31
|
+
definitionFunctionWrapper;
|
|
32
|
+
newId;
|
|
33
|
+
parameterTypeRegistry;
|
|
34
|
+
stepDefinitionConfigs;
|
|
35
|
+
World;
|
|
36
|
+
parallelCanAssign;
|
|
37
|
+
status = 'PENDING';
|
|
38
|
+
/**
|
|
39
|
+
* Gets the SupportCodeLibraryBuilder singleton.
|
|
40
|
+
*
|
|
41
|
+
* @returns A [[SupportCodeLibraryBuilder]].
|
|
42
|
+
*/
|
|
43
|
+
static get instance() {
|
|
44
|
+
const SUPPORT_CODE_BUILDER_SLOTNAME = '__CUCUMBER_TSFLOW_SUPPORTCODEBUILDER';
|
|
45
|
+
const builder = global[SUPPORT_CODE_BUILDER_SLOTNAME];
|
|
46
|
+
if (!builder) {
|
|
47
|
+
global[SUPPORT_CODE_BUILDER_SLOTNAME] = new SupportCodeLibraryBuilder();
|
|
48
|
+
}
|
|
49
|
+
return builder || global[SUPPORT_CODE_BUILDER_SLOTNAME];
|
|
50
|
+
}
|
|
51
|
+
constructor() {
|
|
52
|
+
const methods = {
|
|
53
|
+
After: this.defineTestCaseHook(() => this.afterTestCaseHookDefinitionConfigs),
|
|
54
|
+
AfterAll: this.defineTestRunHook(() => this.afterTestRunHookDefinitionConfigs),
|
|
55
|
+
AfterStep: this.defineTestStepHook(() => this.afterTestStepHookDefinitionConfigs),
|
|
56
|
+
Before: this.defineTestCaseHook(() => this.beforeTestCaseHookDefinitionConfigs),
|
|
57
|
+
BeforeAll: this.defineTestRunHook(() => this.beforeTestRunHookDefinitionConfigs),
|
|
58
|
+
BeforeStep: this.defineTestStepHook(() => this.beforeTestStepHookDefinitionConfigs),
|
|
59
|
+
defineParameterType: this.defineParameterType.bind(this),
|
|
60
|
+
defineStep: this.defineStep('Unknown', () => this.stepDefinitionConfigs),
|
|
61
|
+
Given: this.defineStep('Given', () => this.stepDefinitionConfigs),
|
|
62
|
+
setDefaultTimeout: milliseconds => {
|
|
63
|
+
this.defaultTimeout = milliseconds;
|
|
64
|
+
},
|
|
65
|
+
setDefinitionFunctionWrapper: fn => {
|
|
66
|
+
this.definitionFunctionWrapper = fn;
|
|
67
|
+
},
|
|
68
|
+
setWorldConstructor: fn => {
|
|
69
|
+
this.World = fn;
|
|
70
|
+
},
|
|
71
|
+
setParallelCanAssign: (fn) => {
|
|
72
|
+
this.parallelCanAssign = fn;
|
|
73
|
+
},
|
|
74
|
+
Then: this.defineStep('Then', () => this.stepDefinitionConfigs),
|
|
75
|
+
When: this.defineStep('When', () => this.stepDefinitionConfigs)
|
|
76
|
+
};
|
|
77
|
+
const checkInstall = (method) => {
|
|
78
|
+
if (this.status === 'PENDING') {
|
|
79
|
+
throw new Error(`
|
|
80
|
+
You're calling functions (e.g. "${method}") on an instance of Cucumber that isn't running (status: ${this.status}).
|
|
81
|
+
This means you may have an invalid installation, potentially due to:
|
|
82
|
+
- Cucumber being installed globally
|
|
83
|
+
- A project structure where your support code is depending on a different instance of Cucumber
|
|
84
|
+
Either way, you'll need to address this in order for Cucumber to work.
|
|
85
|
+
See https://github.com/cucumber/cucumber-js/blob/main/docs/installation.md#invalid-installations
|
|
86
|
+
`);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
this.methods = new Proxy(methods, {
|
|
90
|
+
get(target, method) {
|
|
91
|
+
return (...args) => {
|
|
92
|
+
checkInstall(method);
|
|
93
|
+
// @ts-expect-error difficult to type this correctly
|
|
94
|
+
return target[method](...args);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
defineParameterType(options) {
|
|
100
|
+
const parameterType = (0, build_parameter_type_1.buildParameterType)(options);
|
|
101
|
+
const source = (0, get_definition_line_and_uri_1.getDefinitionLineAndUri)(this.cwd);
|
|
102
|
+
this.parameterTypeRegistry.defineSourcedParameterType(parameterType, source);
|
|
103
|
+
}
|
|
104
|
+
defineStep(keyword, getCollection) {
|
|
105
|
+
return (pattern, options, code) => {
|
|
106
|
+
if (typeof options === 'function') {
|
|
107
|
+
code = options;
|
|
108
|
+
options = {};
|
|
109
|
+
}
|
|
110
|
+
const { line, uri } = (0, get_definition_line_and_uri_1.getDefinitionLineAndUri)(this.cwd);
|
|
111
|
+
(0, validate_arguments_1.default)({
|
|
112
|
+
args: { code, pattern, options },
|
|
113
|
+
fnName: 'defineStep',
|
|
114
|
+
location: (0, index_1.formatLocation)({ line, uri })
|
|
115
|
+
});
|
|
116
|
+
getCollection().push({
|
|
117
|
+
code,
|
|
118
|
+
line,
|
|
119
|
+
options,
|
|
120
|
+
keyword,
|
|
121
|
+
pattern,
|
|
122
|
+
uri
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
defineTestCaseHook(getCollection) {
|
|
127
|
+
return (options, code) => {
|
|
128
|
+
if (typeof options === 'string') {
|
|
129
|
+
options = { tags: options };
|
|
130
|
+
}
|
|
131
|
+
else if (typeof options === 'function') {
|
|
132
|
+
code = options;
|
|
133
|
+
options = {};
|
|
134
|
+
}
|
|
135
|
+
const { line, uri } = (0, get_definition_line_and_uri_1.getDefinitionLineAndUri)(this.cwd);
|
|
136
|
+
(0, validate_arguments_1.default)({
|
|
137
|
+
args: { code, options },
|
|
138
|
+
fnName: 'defineTestCaseHook',
|
|
139
|
+
location: (0, index_1.formatLocation)({ line, uri })
|
|
140
|
+
});
|
|
141
|
+
getCollection().push({
|
|
142
|
+
code,
|
|
143
|
+
line,
|
|
144
|
+
options,
|
|
145
|
+
uri
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
defineTestStepHook(getCollection) {
|
|
150
|
+
return (options, code) => {
|
|
151
|
+
if (typeof options === 'string') {
|
|
152
|
+
options = { tags: options };
|
|
153
|
+
}
|
|
154
|
+
else if (typeof options === 'function') {
|
|
155
|
+
code = options;
|
|
156
|
+
options = {};
|
|
157
|
+
}
|
|
158
|
+
const { line, uri } = (0, get_definition_line_and_uri_1.getDefinitionLineAndUri)(this.cwd);
|
|
159
|
+
(0, validate_arguments_1.default)({
|
|
160
|
+
args: { code, options },
|
|
161
|
+
fnName: 'defineTestStepHook',
|
|
162
|
+
location: (0, index_1.formatLocation)({ line, uri })
|
|
163
|
+
});
|
|
164
|
+
getCollection().push({
|
|
165
|
+
code,
|
|
166
|
+
line,
|
|
167
|
+
options,
|
|
168
|
+
uri
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
defineTestRunHook(getCollection) {
|
|
173
|
+
return (options, code) => {
|
|
174
|
+
if (typeof options === 'function') {
|
|
175
|
+
code = options;
|
|
176
|
+
options = {};
|
|
177
|
+
}
|
|
178
|
+
const { line, uri } = (0, get_definition_line_and_uri_1.getDefinitionLineAndUri)(this.cwd);
|
|
179
|
+
(0, validate_arguments_1.default)({
|
|
180
|
+
args: { code, options },
|
|
181
|
+
fnName: 'defineTestRunHook',
|
|
182
|
+
location: (0, index_1.formatLocation)({ line, uri })
|
|
183
|
+
});
|
|
184
|
+
getCollection().push({
|
|
185
|
+
code,
|
|
186
|
+
line,
|
|
187
|
+
options,
|
|
188
|
+
uri
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
wrapCode({ code, wrapperOptions }) {
|
|
193
|
+
if ((0, value_checker_1.doesHaveValue)(this.definitionFunctionWrapper)) {
|
|
194
|
+
const codeLength = code.length;
|
|
195
|
+
const wrappedCode = this.definitionFunctionWrapper(code, wrapperOptions);
|
|
196
|
+
if (wrappedCode !== code) {
|
|
197
|
+
return (0, util_arity_1.default)(codeLength, wrappedCode);
|
|
198
|
+
}
|
|
199
|
+
return wrappedCode;
|
|
200
|
+
}
|
|
201
|
+
return code;
|
|
202
|
+
}
|
|
203
|
+
buildTestCaseHookDefinitions(configs, canonicalIds) {
|
|
204
|
+
return configs.map(({ code, line, options, uri }, index) => {
|
|
205
|
+
const wrappedCode = this.wrapCode({
|
|
206
|
+
code,
|
|
207
|
+
wrapperOptions: options.wrapperOptions
|
|
208
|
+
});
|
|
209
|
+
return new test_case_hook_definition_1.default({
|
|
210
|
+
code: wrappedCode,
|
|
211
|
+
id: canonicalIds ? canonicalIds[index] : this.newId(),
|
|
212
|
+
line,
|
|
213
|
+
options,
|
|
214
|
+
unwrappedCode: code,
|
|
215
|
+
uri
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
buildTestStepHookDefinitions(configs) {
|
|
220
|
+
return configs.map(({ code, line, options, uri }) => {
|
|
221
|
+
const wrappedCode = this.wrapCode({
|
|
222
|
+
code,
|
|
223
|
+
wrapperOptions: options.wrapperOptions
|
|
224
|
+
});
|
|
225
|
+
return new test_step_hook_definition_1.default({
|
|
226
|
+
code: wrappedCode,
|
|
227
|
+
id: this.newId(),
|
|
228
|
+
line,
|
|
229
|
+
options,
|
|
230
|
+
unwrappedCode: code,
|
|
231
|
+
uri
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
buildTestRunHookDefinitions(configs) {
|
|
236
|
+
return configs.map(({ code, line, options, uri }) => {
|
|
237
|
+
const wrappedCode = this.wrapCode({
|
|
238
|
+
code,
|
|
239
|
+
wrapperOptions: options.wrapperOptions
|
|
240
|
+
});
|
|
241
|
+
return new test_run_hook_definition_1.default({
|
|
242
|
+
code: wrappedCode,
|
|
243
|
+
id: this.newId(),
|
|
244
|
+
line,
|
|
245
|
+
options,
|
|
246
|
+
unwrappedCode: code,
|
|
247
|
+
uri
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
buildStepDefinitions(canonicalIds) {
|
|
252
|
+
const stepDefinitions = [];
|
|
253
|
+
const undefinedParameterTypes = [];
|
|
254
|
+
this.stepDefinitionConfigs.forEach(({ code, line, options, keyword, pattern, uri }, index) => {
|
|
255
|
+
let expression;
|
|
256
|
+
if (typeof pattern === 'string') {
|
|
257
|
+
try {
|
|
258
|
+
expression = new cucumber_expressions_1.CucumberExpression(pattern, this.parameterTypeRegistry);
|
|
259
|
+
}
|
|
260
|
+
catch (e) {
|
|
261
|
+
if ((0, value_checker_1.doesHaveValue)(e.undefinedParameterTypeName)) {
|
|
262
|
+
undefinedParameterTypes.push({
|
|
263
|
+
name: e.undefinedParameterTypeName,
|
|
264
|
+
expression: pattern
|
|
265
|
+
});
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
throw e;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
expression = new cucumber_expressions_1.RegularExpression(pattern, this.parameterTypeRegistry);
|
|
273
|
+
}
|
|
274
|
+
const wrappedCode = this.wrapCode({
|
|
275
|
+
code,
|
|
276
|
+
wrapperOptions: options.wrapperOptions
|
|
277
|
+
});
|
|
278
|
+
stepDefinitions.push(new step_definition_1.default({
|
|
279
|
+
code: wrappedCode,
|
|
280
|
+
expression,
|
|
281
|
+
id: canonicalIds ? canonicalIds[index] : this.newId(),
|
|
282
|
+
line,
|
|
283
|
+
options,
|
|
284
|
+
keyword,
|
|
285
|
+
pattern,
|
|
286
|
+
unwrappedCode: code,
|
|
287
|
+
uri
|
|
288
|
+
}));
|
|
289
|
+
});
|
|
290
|
+
return { stepDefinitions, undefinedParameterTypes };
|
|
291
|
+
}
|
|
292
|
+
finalize(canonicalIds) {
|
|
293
|
+
this.status = 'FINALIZED';
|
|
294
|
+
const stepDefinitionsResult = this.buildStepDefinitions(canonicalIds?.stepDefinitionIds);
|
|
295
|
+
return {
|
|
296
|
+
originalCoordinates: this.originalCoordinates,
|
|
297
|
+
afterTestCaseHookDefinitions: this.buildTestCaseHookDefinitions(this.afterTestCaseHookDefinitionConfigs, canonicalIds?.afterTestCaseHookDefinitionIds),
|
|
298
|
+
afterTestRunHookDefinitions: this.buildTestRunHookDefinitions(this.afterTestRunHookDefinitionConfigs),
|
|
299
|
+
afterTestStepHookDefinitions: this.buildTestStepHookDefinitions(this.afterTestStepHookDefinitionConfigs),
|
|
300
|
+
beforeTestCaseHookDefinitions: this.buildTestCaseHookDefinitions(this.beforeTestCaseHookDefinitionConfigs, canonicalIds?.beforeTestCaseHookDefinitionIds),
|
|
301
|
+
beforeTestRunHookDefinitions: this.buildTestRunHookDefinitions(this.beforeTestRunHookDefinitionConfigs),
|
|
302
|
+
beforeTestStepHookDefinitions: this.buildTestStepHookDefinitions(this.beforeTestStepHookDefinitionConfigs),
|
|
303
|
+
defaultTimeout: this.defaultTimeout,
|
|
304
|
+
parameterTypeRegistry: this.parameterTypeRegistry,
|
|
305
|
+
undefinedParameterTypes: stepDefinitionsResult.undefinedParameterTypes,
|
|
306
|
+
stepDefinitions: stepDefinitionsResult.stepDefinitions,
|
|
307
|
+
World: this.World,
|
|
308
|
+
parallelCanAssign: this.parallelCanAssign
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
reset(cwd, newId, originalCoordinates = {
|
|
312
|
+
requireModules: [],
|
|
313
|
+
requirePaths: [],
|
|
314
|
+
importPaths: [],
|
|
315
|
+
loaders: []
|
|
316
|
+
}) {
|
|
317
|
+
this.cwd = cwd;
|
|
318
|
+
this.newId = newId;
|
|
319
|
+
this.originalCoordinates = originalCoordinates;
|
|
320
|
+
this.afterTestCaseHookDefinitionConfigs = [];
|
|
321
|
+
this.afterTestRunHookDefinitionConfigs = [];
|
|
322
|
+
this.afterTestStepHookDefinitionConfigs = [];
|
|
323
|
+
this.beforeTestCaseHookDefinitionConfigs = [];
|
|
324
|
+
this.beforeTestRunHookDefinitionConfigs = [];
|
|
325
|
+
this.beforeTestStepHookDefinitionConfigs = [];
|
|
326
|
+
this.definitionFunctionWrapper = null;
|
|
327
|
+
this.defaultTimeout = 5000;
|
|
328
|
+
this.parameterTypeRegistry = new sourced_parameter_type_registry_1.SourcedParameterTypeRegistry();
|
|
329
|
+
this.stepDefinitionConfigs = [];
|
|
330
|
+
this.parallelCanAssign = () => true;
|
|
331
|
+
this.World = world_1.default;
|
|
332
|
+
this.status = 'OPEN';
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
exports.SupportCodeLibraryBuilder = SupportCodeLibraryBuilder;
|
|
336
|
+
exports.default = SupportCodeLibraryBuilder.instance;
|
|
337
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/support_code_library_builder/index.ts"],"names":[],"mappings":";;;;;;AAEA,4DAA+B;AAC/B,yEAAuF;AACvF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C;AAED,kBAAe,yBAAyB,CAAC,QAAQ,CAAC","sourcesContent":["import { IdGenerator } from '@cucumber/messages';\r\nimport * as messages from '@cucumber/messages';\r\nimport arity from 'util-arity';\r\nimport { CucumberExpression, RegularExpression } from '@cucumber/cucumber-expressions';\r\nimport TestCaseHookDefinition from '@cucumber/cucumber/lib/models/test_case_hook_definition';\r\nimport TestStepHookDefinition from '@cucumber/cucumber/lib/models/test_step_hook_definition';\r\nimport TestRunHookDefinition from '@cucumber/cucumber/lib/models/test_run_hook_definition';\r\nimport StepDefinition from '@cucumber/cucumber/lib/models/step_definition';\r\nimport { formatLocation } from '@cucumber/cucumber/lib/formatter/helpers/index';\r\nimport { doesHaveValue } from '@cucumber/cucumber/lib/value_checker';\r\nimport { GherkinStepKeyword } from '@cucumber/cucumber/lib/models/gherkin_step_keyword';\r\nimport validateArguments from '@cucumber/cucumber/lib/support_code_library_builder/validate_arguments';\r\n\r\nimport {\r\n\tDefineStepPattern,\r\n\tIDefineStepOptions,\r\n\tIDefineSupportCodeMethods,\r\n\tIDefineTestCaseHookOptions,\r\n\tIDefineTestStepHookOptions,\r\n\tIDefineTestRunHookOptions,\r\n\tIParameterTypeDefinition,\r\n\tSupportCodeLibrary,\r\n\tTestCaseHookFunction,\r\n\tTestStepHookFunction,\r\n\tParallelAssignmentValidator,\r\n\tISupportCodeCoordinates,\r\n\tIDefineStep,\r\n\tCanonicalSupportCodeIds\r\n} from '@cucumber/cucumber/lib/support_code_library_builder/types';\r\nimport World from '@cucumber/cucumber/lib/support_code_library_builder/world';\r\nimport { getDefinitionLineAndUri } from '@cucumber/cucumber/lib/support_code_library_builder/get_definition_line_and_uri';\r\nimport { buildParameterType } from '@cucumber/cucumber/lib/support_code_library_builder/build_parameter_type';\r\nimport { SourcedParameterTypeRegistry } from '@cucumber/cucumber/lib/support_code_library_builder/sourced_parameter_type_registry';\r\n\r\ninterface IStepDefinitionConfig {\r\n\tcode: Function;\r\n\tline: number;\r\n\toptions: any;\r\n\tkeyword: GherkinStepKeyword;\r\n\tpattern: string | RegExp;\r\n\turi: string;\r\n}\r\n\r\ninterface ITestCaseHookDefinitionConfig {\r\n\tcode: any;\r\n\tline: number;\r\n\toptions: any;\r\n\turi: string;\r\n}\r\n\r\ninterface ITestStepHookDefinitionConfig {\r\n\tcode: Function;\r\n\tline: number;\r\n\toptions: any;\r\n\turi: string;\r\n}\r\n\r\ninterface ITestRunHookDefinitionConfig {\r\n\tcode: Function;\r\n\tline: number;\r\n\toptions: any;\r\n\turi: string;\r\n}\r\n\r\ntype LibraryStatus = 'PENDING' | 'OPEN' | 'FINALIZED';\r\n\r\nexport class SupportCodeLibraryBuilder {\r\n\tpublic readonly methods: IDefineSupportCodeMethods;\r\n\tprivate originalCoordinates: ISupportCodeCoordinates;\r\n\tprivate afterTestCaseHookDefinitionConfigs: ITestCaseHookDefinitionConfig[];\r\n\tprivate afterTestRunHookDefinitionConfigs: ITestRunHookDefinitionConfig[];\r\n\tprivate afterTestStepHookDefinitionConfigs: ITestStepHookDefinitionConfig[];\r\n\tprivate beforeTestCaseHookDefinitionConfigs: ITestCaseHookDefinitionConfig[];\r\n\tprivate beforeTestRunHookDefinitionConfigs: ITestRunHookDefinitionConfig[];\r\n\tprivate beforeTestStepHookDefinitionConfigs: ITestStepHookDefinitionConfig[];\r\n\tprivate cwd: string;\r\n\tprivate defaultTimeout: number;\r\n\tprivate definitionFunctionWrapper: any;\r\n\tprivate newId: IdGenerator.NewId;\r\n\tprivate parameterTypeRegistry: SourcedParameterTypeRegistry;\r\n\tprivate stepDefinitionConfigs: IStepDefinitionConfig[];\r\n\tprivate World: any;\r\n\tprivate parallelCanAssign: ParallelAssignmentValidator;\r\n\tprivate status: LibraryStatus = 'PENDING';\r\n\r\n\t/**\r\n\t * Gets the SupportCodeLibraryBuilder singleton.\r\n\t *\r\n\t * @returns A [[SupportCodeLibraryBuilder]].\r\n\t */\r\n\tpublic static get instance(): SupportCodeLibraryBuilder {\r\n\t\tconst SUPPORT_CODE_BUILDER_SLOTNAME = '__CUCUMBER_TSFLOW_SUPPORTCODEBUILDER';\r\n\r\n\t\tconst builder = (global as any)[SUPPORT_CODE_BUILDER_SLOTNAME];\r\n\r\n\t\tif (!builder) {\r\n\t\t\t(global as any)[SUPPORT_CODE_BUILDER_SLOTNAME] = new SupportCodeLibraryBuilder();\r\n\t\t}\r\n\r\n\t\treturn builder || (global as any)[SUPPORT_CODE_BUILDER_SLOTNAME];\r\n\t}\r\n\r\n\tconstructor() {\r\n\t\tconst methods: IDefineSupportCodeMethods = {\r\n\t\t\tAfter: this.defineTestCaseHook(() => this.afterTestCaseHookDefinitionConfigs),\r\n\t\t\tAfterAll: this.defineTestRunHook(() => this.afterTestRunHookDefinitionConfigs),\r\n\t\t\tAfterStep: this.defineTestStepHook(() => this.afterTestStepHookDefinitionConfigs),\r\n\t\t\tBefore: this.defineTestCaseHook(() => this.beforeTestCaseHookDefinitionConfigs),\r\n\t\t\tBeforeAll: this.defineTestRunHook(() => this.beforeTestRunHookDefinitionConfigs),\r\n\t\t\tBeforeStep: this.defineTestStepHook(() => this.beforeTestStepHookDefinitionConfigs),\r\n\t\t\tdefineParameterType: this.defineParameterType.bind(this),\r\n\t\t\tdefineStep: this.defineStep('Unknown', () => this.stepDefinitionConfigs),\r\n\t\t\tGiven: this.defineStep('Given', () => this.stepDefinitionConfigs),\r\n\t\t\tsetDefaultTimeout: milliseconds => {\r\n\t\t\t\tthis.defaultTimeout = milliseconds;\r\n\t\t\t},\r\n\t\t\tsetDefinitionFunctionWrapper: fn => {\r\n\t\t\t\tthis.definitionFunctionWrapper = fn;\r\n\t\t\t},\r\n\t\t\tsetWorldConstructor: fn => {\r\n\t\t\t\tthis.World = fn;\r\n\t\t\t},\r\n\t\t\tsetParallelCanAssign: (fn: ParallelAssignmentValidator): void => {\r\n\t\t\t\tthis.parallelCanAssign = fn;\r\n\t\t\t},\r\n\t\t\tThen: this.defineStep('Then', () => this.stepDefinitionConfigs),\r\n\t\t\tWhen: this.defineStep('When', () => this.stepDefinitionConfigs)\r\n\t\t};\r\n\t\tconst checkInstall = (method: string) => {\r\n\t\t\tif (this.status === 'PENDING') {\r\n\t\t\t\tthrow new Error(\r\n\t\t\t\t\t`\r\n You're calling functions (e.g. \"${method}\") on an instance of Cucumber that isn't running (status: ${this.status}).\r\n This means you may have an invalid installation, potentially due to:\r\n - Cucumber being installed globally\r\n - A project structure where your support code is depending on a different instance of Cucumber\r\n Either way, you'll need to address this in order for Cucumber to work.\r\n See https://github.com/cucumber/cucumber-js/blob/main/docs/installation.md#invalid-installations\r\n `\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t};\r\n\t\tthis.methods = new Proxy(methods, {\r\n\t\t\tget(target: IDefineSupportCodeMethods, method: keyof IDefineSupportCodeMethods): any {\r\n\t\t\t\treturn (...args: any[]) => {\r\n\t\t\t\t\tcheckInstall(method);\r\n\t\t\t\t\t// @ts-expect-error difficult to type this correctly\r\n\t\t\t\t\treturn target[method](...args);\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tdefineParameterType(options: IParameterTypeDefinition<any>): void {\r\n\t\tconst parameterType = buildParameterType(options);\r\n\t\tconst source = getDefinitionLineAndUri(this.cwd);\r\n\t\tthis.parameterTypeRegistry.defineSourcedParameterType(parameterType, source);\r\n\t}\r\n\r\n\tdefineStep(keyword: GherkinStepKeyword, getCollection: () => IStepDefinitionConfig[]): IDefineStep {\r\n\t\treturn (pattern: DefineStepPattern, options: IDefineStepOptions | Function, code?: Function) => {\r\n\t\t\tif (typeof options === 'function') {\r\n\t\t\t\tcode = options;\r\n\t\t\t\toptions = {};\r\n\t\t\t}\r\n\t\t\tconst { line, uri } = getDefinitionLineAndUri(this.cwd);\r\n\t\t\tvalidateArguments({\r\n\t\t\t\targs: { code, pattern, options },\r\n\t\t\t\tfnName: 'defineStep',\r\n\t\t\t\tlocation: formatLocation({ line, uri })\r\n\t\t\t});\r\n\t\t\tgetCollection().push({\r\n\t\t\t\tcode,\r\n\t\t\t\tline,\r\n\t\t\t\toptions,\r\n\t\t\t\tkeyword,\r\n\t\t\t\tpattern,\r\n\t\t\t\turi\r\n\t\t\t});\r\n\t\t};\r\n\t}\r\n\r\n\tdefineTestCaseHook(\r\n\t\tgetCollection: () => ITestCaseHookDefinitionConfig[]\r\n\t): <WorldType>(\r\n\t\toptions: string | IDefineTestCaseHookOptions | TestCaseHookFunction<WorldType>,\r\n\t\tcode?: TestCaseHookFunction<WorldType>\r\n\t) => void {\r\n\t\treturn <WorldType>(\r\n\t\t\toptions: string | IDefineTestCaseHookOptions | TestCaseHookFunction<WorldType>,\r\n\t\t\tcode?: TestCaseHookFunction<WorldType>\r\n\t\t) => {\r\n\t\t\tif (typeof options === 'string') {\r\n\t\t\t\toptions = { tags: options };\r\n\t\t\t} else if (typeof options === 'function') {\r\n\t\t\t\tcode = options;\r\n\t\t\t\toptions = {};\r\n\t\t\t}\r\n\t\t\tconst { line, uri } = getDefinitionLineAndUri(this.cwd);\r\n\t\t\tvalidateArguments({\r\n\t\t\t\targs: { code, options },\r\n\t\t\t\tfnName: 'defineTestCaseHook',\r\n\t\t\t\tlocation: formatLocation({ line, uri })\r\n\t\t\t});\r\n\t\t\tgetCollection().push({\r\n\t\t\t\tcode,\r\n\t\t\t\tline,\r\n\t\t\t\toptions,\r\n\t\t\t\turi\r\n\t\t\t});\r\n\t\t};\r\n\t}\r\n\r\n\tdefineTestStepHook(\r\n\t\tgetCollection: () => ITestStepHookDefinitionConfig[]\r\n\t): <WorldType>(\r\n\t\toptions: string | IDefineTestStepHookOptions | TestStepHookFunction<WorldType>,\r\n\t\tcode?: TestStepHookFunction<WorldType>\r\n\t) => void {\r\n\t\treturn <WorldType>(\r\n\t\t\toptions: string | IDefineTestStepHookOptions | TestStepHookFunction<WorldType>,\r\n\t\t\tcode?: TestStepHookFunction<WorldType>\r\n\t\t) => {\r\n\t\t\tif (typeof options === 'string') {\r\n\t\t\t\toptions = { tags: options };\r\n\t\t\t} else if (typeof options === 'function') {\r\n\t\t\t\tcode = options;\r\n\t\t\t\toptions = {};\r\n\t\t\t}\r\n\t\t\tconst { line, uri } = getDefinitionLineAndUri(this.cwd);\r\n\t\t\tvalidateArguments({\r\n\t\t\t\targs: { code, options },\r\n\t\t\t\tfnName: 'defineTestStepHook',\r\n\t\t\t\tlocation: formatLocation({ line, uri })\r\n\t\t\t});\r\n\t\t\tgetCollection().push({\r\n\t\t\t\tcode,\r\n\t\t\t\tline,\r\n\t\t\t\toptions,\r\n\t\t\t\turi\r\n\t\t\t});\r\n\t\t};\r\n\t}\r\n\r\n\tdefineTestRunHook(\r\n\t\tgetCollection: () => ITestRunHookDefinitionConfig[]\r\n\t): (options: IDefineTestRunHookOptions | Function, code?: Function) => void {\r\n\t\treturn (options: IDefineTestRunHookOptions | Function, code?: Function) => {\r\n\t\t\tif (typeof options === 'function') {\r\n\t\t\t\tcode = options;\r\n\t\t\t\toptions = {};\r\n\t\t\t}\r\n\t\t\tconst { line, uri } = getDefinitionLineAndUri(this.cwd);\r\n\t\t\tvalidateArguments({\r\n\t\t\t\targs: { code, options },\r\n\t\t\t\tfnName: 'defineTestRunHook',\r\n\t\t\t\tlocation: formatLocation({ line, uri })\r\n\t\t\t});\r\n\t\t\tgetCollection().push({\r\n\t\t\t\tcode,\r\n\t\t\t\tline,\r\n\t\t\t\toptions,\r\n\t\t\t\turi\r\n\t\t\t});\r\n\t\t};\r\n\t}\r\n\r\n\twrapCode({ code, wrapperOptions }: { code: Function; wrapperOptions: any }): Function {\r\n\t\tif (doesHaveValue(this.definitionFunctionWrapper)) {\r\n\t\t\tconst codeLength = code.length;\r\n\t\t\tconst wrappedCode = this.definitionFunctionWrapper(code, wrapperOptions);\r\n\t\t\tif (wrappedCode !== code) {\r\n\t\t\t\treturn arity(codeLength, wrappedCode);\r\n\t\t\t}\r\n\t\t\treturn wrappedCode;\r\n\t\t}\r\n\t\treturn code;\r\n\t}\r\n\r\n\tbuildTestCaseHookDefinitions(\r\n\t\tconfigs: ITestCaseHookDefinitionConfig[],\r\n\t\tcanonicalIds?: string[]\r\n\t): TestCaseHookDefinition[] {\r\n\t\treturn configs.map(({ code, line, options, uri }, index) => {\r\n\t\t\tconst wrappedCode = this.wrapCode({\r\n\t\t\t\tcode,\r\n\t\t\t\twrapperOptions: options.wrapperOptions\r\n\t\t\t});\r\n\t\t\treturn new TestCaseHookDefinition({\r\n\t\t\t\tcode: wrappedCode,\r\n\t\t\t\tid: canonicalIds ? canonicalIds[index] : this.newId(),\r\n\t\t\t\tline,\r\n\t\t\t\toptions,\r\n\t\t\t\tunwrappedCode: code,\r\n\t\t\t\turi\r\n\t\t\t});\r\n\t\t});\r\n\t}\r\n\r\n\tbuildTestStepHookDefinitions(configs: ITestStepHookDefinitionConfig[]): TestStepHookDefinition[] {\r\n\t\treturn configs.map(({ code, line, options, uri }) => {\r\n\t\t\tconst wrappedCode = this.wrapCode({\r\n\t\t\t\tcode,\r\n\t\t\t\twrapperOptions: options.wrapperOptions\r\n\t\t\t});\r\n\t\t\treturn new TestStepHookDefinition({\r\n\t\t\t\tcode: wrappedCode,\r\n\t\t\t\tid: this.newId(),\r\n\t\t\t\tline,\r\n\t\t\t\toptions,\r\n\t\t\t\tunwrappedCode: code,\r\n\t\t\t\turi\r\n\t\t\t});\r\n\t\t});\r\n\t}\r\n\r\n\tbuildTestRunHookDefinitions(configs: ITestRunHookDefinitionConfig[]): TestRunHookDefinition[] {\r\n\t\treturn configs.map(({ code, line, options, uri }) => {\r\n\t\t\tconst wrappedCode = this.wrapCode({\r\n\t\t\t\tcode,\r\n\t\t\t\twrapperOptions: options.wrapperOptions\r\n\t\t\t});\r\n\t\t\treturn new TestRunHookDefinition({\r\n\t\t\t\tcode: wrappedCode,\r\n\t\t\t\tid: this.newId(),\r\n\t\t\t\tline,\r\n\t\t\t\toptions,\r\n\t\t\t\tunwrappedCode: code,\r\n\t\t\t\turi\r\n\t\t\t});\r\n\t\t});\r\n\t}\r\n\r\n\tbuildStepDefinitions(canonicalIds?: string[]): {\r\n\t\tstepDefinitions: StepDefinition[];\r\n\t\tundefinedParameterTypes: messages.UndefinedParameterType[];\r\n\t} {\r\n\t\tconst stepDefinitions: StepDefinition[] = [];\r\n\t\tconst undefinedParameterTypes: messages.UndefinedParameterType[] = [];\r\n\t\tthis.stepDefinitionConfigs.forEach(({ code, line, options, keyword, pattern, uri }, index) => {\r\n\t\t\tlet expression;\r\n\t\t\tif (typeof pattern === 'string') {\r\n\t\t\t\ttry {\r\n\t\t\t\t\texpression = new CucumberExpression(pattern, this.parameterTypeRegistry);\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tif (doesHaveValue(e.undefinedParameterTypeName)) {\r\n\t\t\t\t\t\tundefinedParameterTypes.push({\r\n\t\t\t\t\t\t\tname: e.undefinedParameterTypeName,\r\n\t\t\t\t\t\t\texpression: pattern\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthrow e;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\texpression = new RegularExpression(pattern, this.parameterTypeRegistry);\r\n\t\t\t}\r\n\r\n\t\t\tconst wrappedCode = this.wrapCode({\r\n\t\t\t\tcode,\r\n\t\t\t\twrapperOptions: options.wrapperOptions\r\n\t\t\t});\r\n\t\t\tstepDefinitions.push(\r\n\t\t\t\tnew StepDefinition({\r\n\t\t\t\t\tcode: wrappedCode,\r\n\t\t\t\t\texpression,\r\n\t\t\t\t\tid: canonicalIds ? canonicalIds[index] : this.newId(),\r\n\t\t\t\t\tline,\r\n\t\t\t\t\toptions,\r\n\t\t\t\t\tkeyword,\r\n\t\t\t\t\tpattern,\r\n\t\t\t\t\tunwrappedCode: code,\r\n\t\t\t\t\turi\r\n\t\t\t\t})\r\n\t\t\t);\r\n\t\t});\r\n\t\treturn { stepDefinitions, undefinedParameterTypes };\r\n\t}\r\n\r\n\tfinalize(canonicalIds?: CanonicalSupportCodeIds): SupportCodeLibrary {\r\n\t\tthis.status = 'FINALIZED';\r\n\t\tconst stepDefinitionsResult = this.buildStepDefinitions(canonicalIds?.stepDefinitionIds);\r\n\t\treturn {\r\n\t\t\toriginalCoordinates: this.originalCoordinates,\r\n\t\t\tafterTestCaseHookDefinitions: this.buildTestCaseHookDefinitions(\r\n\t\t\t\tthis.afterTestCaseHookDefinitionConfigs,\r\n\t\t\t\tcanonicalIds?.afterTestCaseHookDefinitionIds\r\n\t\t\t),\r\n\t\t\tafterTestRunHookDefinitions: this.buildTestRunHookDefinitions(this.afterTestRunHookDefinitionConfigs),\r\n\t\t\tafterTestStepHookDefinitions: this.buildTestStepHookDefinitions(this.afterTestStepHookDefinitionConfigs),\r\n\t\t\tbeforeTestCaseHookDefinitions: this.buildTestCaseHookDefinitions(\r\n\t\t\t\tthis.beforeTestCaseHookDefinitionConfigs,\r\n\t\t\t\tcanonicalIds?.beforeTestCaseHookDefinitionIds\r\n\t\t\t),\r\n\t\t\tbeforeTestRunHookDefinitions: this.buildTestRunHookDefinitions(this.beforeTestRunHookDefinitionConfigs),\r\n\t\t\tbeforeTestStepHookDefinitions: this.buildTestStepHookDefinitions(this.beforeTestStepHookDefinitionConfigs),\r\n\t\t\tdefaultTimeout: this.defaultTimeout,\r\n\t\t\tparameterTypeRegistry: this.parameterTypeRegistry,\r\n\t\t\tundefinedParameterTypes: stepDefinitionsResult.undefinedParameterTypes,\r\n\t\t\tstepDefinitions: stepDefinitionsResult.stepDefinitions,\r\n\t\t\tWorld: this.World,\r\n\t\t\tparallelCanAssign: this.parallelCanAssign\r\n\t\t};\r\n\t}\r\n\r\n\treset(\r\n\t\tcwd: string,\r\n\t\tnewId: IdGenerator.NewId,\r\n\t\toriginalCoordinates: ISupportCodeCoordinates = {\r\n\t\t\trequireModules: [],\r\n\t\t\trequirePaths: [],\r\n\t\t\timportPaths: [],\r\n\t\t\tloaders: []\r\n\t\t}\r\n\t): void {\r\n\t\tthis.cwd = cwd;\r\n\t\tthis.newId = newId;\r\n\t\tthis.originalCoordinates = originalCoordinates;\r\n\t\tthis.afterTestCaseHookDefinitionConfigs = [];\r\n\t\tthis.afterTestRunHookDefinitionConfigs = [];\r\n\t\tthis.afterTestStepHookDefinitionConfigs = [];\r\n\t\tthis.beforeTestCaseHookDefinitionConfigs = [];\r\n\t\tthis.beforeTestRunHookDefinitionConfigs = [];\r\n\t\tthis.beforeTestStepHookDefinitionConfigs = [];\r\n\t\tthis.definitionFunctionWrapper = null;\r\n\t\tthis.defaultTimeout = 5000;\r\n\t\tthis.parameterTypeRegistry = new SourcedParameterTypeRegistry();\r\n\t\tthis.stepDefinitionConfigs = [];\r\n\t\tthis.parallelCanAssign = () => true;\r\n\t\tthis.World = World;\r\n\t\tthis.status = 'OPEN';\r\n\t}\r\n}\r\n\r\nexport default SupportCodeLibraryBuilder.instance;\r\n"]}
|
|
@@ -108,6 +108,7 @@ export function resolveTsconfigPaths(specifier) {
|
|
|
108
108
|
if (mapped) {
|
|
109
109
|
const result = {
|
|
110
110
|
url: pathToFileURL(mapped).href,
|
|
111
|
+
format: 'module',
|
|
111
112
|
shortCircuit: true
|
|
112
113
|
};
|
|
113
114
|
pathResolutionCache.set(specifier, result);
|
|
@@ -121,6 +122,7 @@ export function resolveTsconfigPaths(specifier) {
|
|
|
121
122
|
if (mappedWithExt) {
|
|
122
123
|
const result = {
|
|
123
124
|
url: pathToFileURL(mappedWithExt).href,
|
|
125
|
+
format: 'module',
|
|
124
126
|
shortCircuit: true
|
|
125
127
|
};
|
|
126
128
|
pathResolutionCache.set(specifier, result);
|
|
@@ -272,7 +274,11 @@ export async function resolveSpecifier(specifier, context, options = {}) {
|
|
|
272
274
|
// Try to resolve with extensions
|
|
273
275
|
const resolved = await resolveWithExtensions(mappedUrl, context.parentURL);
|
|
274
276
|
if (resolved) {
|
|
275
|
-
return {
|
|
277
|
+
return {
|
|
278
|
+
url: resolved,
|
|
279
|
+
format: 'module',
|
|
280
|
+
shortCircuit: true
|
|
281
|
+
};
|
|
276
282
|
}
|
|
277
283
|
}
|
|
278
284
|
|
|
@@ -282,7 +288,8 @@ export async function resolveSpecifier(specifier, context, options = {}) {
|
|
|
282
288
|
// 2. Handle TypeScript files if requested
|
|
283
289
|
if (handleTsFiles && tsNodeHooks && (specifier.endsWith('.ts') || specifier.endsWith('.tsx'))) {
|
|
284
290
|
try {
|
|
285
|
-
|
|
291
|
+
const resolved = await tsNodeHooks.resolve(specifier, context, nextResolve);
|
|
292
|
+
return { ...resolved, format: 'module' };
|
|
286
293
|
} catch (error) {
|
|
287
294
|
// Fall through to extension resolution
|
|
288
295
|
}
|
|
@@ -295,7 +302,11 @@ export async function resolveSpecifier(specifier, context, options = {}) {
|
|
|
295
302
|
if (!hasExtension && context.parentURL) {
|
|
296
303
|
const resolved = await resolveWithExtensions(specifier, context.parentURL);
|
|
297
304
|
if (resolved) {
|
|
298
|
-
return {
|
|
305
|
+
return {
|
|
306
|
+
url: resolved,
|
|
307
|
+
format: 'module',
|
|
308
|
+
shortCircuit: true
|
|
309
|
+
};
|
|
299
310
|
}
|
|
300
311
|
}
|
|
301
312
|
}
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "7.
|
|
1
|
+
export declare const version = "7.5.0";
|
package/lib/version.js
CHANGED
package/lib/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,OAAO,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '7.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,OAAO,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '7.5.0'\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynxwall/cucumber-tsflow",
|
|
3
|
-
"description": "Provides 'specflow' like bindings for CucumberJS
|
|
4
|
-
"version": "7.
|
|
3
|
+
"description": "Provides 'specflow' like bindings for CucumberJS 12.2.0 in TypeScript 5.9+.",
|
|
4
|
+
"version": "7.5.0",
|
|
5
5
|
"author": "Lonnie Wall <lynxdev@lynxwall.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
},
|
|
58
58
|
"types": "./lib/index.d.ts",
|
|
59
59
|
"dependencies": {
|
|
60
|
+
"@cucumber/cucumber": "~12.2.0",
|
|
60
61
|
"@jeanbenitez/logical-expression-parser": "~1.0.0",
|
|
61
62
|
"@types/node": "~22.13.10",
|
|
62
63
|
"ansis": "~3.17.0",
|
|
@@ -81,7 +82,6 @@
|
|
|
81
82
|
"underscore": "~1.13.7"
|
|
82
83
|
},
|
|
83
84
|
"devDependencies": {
|
|
84
|
-
"@cucumber/cucumber": "~12.2.0",
|
|
85
85
|
"@rollup/pluginutils": "~5.3.0",
|
|
86
86
|
"@types/debug": "~4.1.12",
|
|
87
87
|
"@types/hash-sum": "~1.0.2",
|
|
@@ -91,9 +91,6 @@
|
|
|
91
91
|
"genversion": "~3.2.0",
|
|
92
92
|
"shx": "0.4.0"
|
|
93
93
|
},
|
|
94
|
-
"peerDependencies": {
|
|
95
|
-
"@cucumber/cucumber": ">=12.2.0 <13.0.0"
|
|
96
|
-
},
|
|
97
94
|
"scripts": {
|
|
98
95
|
"build": "genversion --es6 src/version.ts && tsc --build tsconfig.node.json && yarn build:copy-mjs && yarn build:transpiler",
|
|
99
96
|
"build:transpiler": "node src/scripts/build-esm-transpiler-cjs.js",
|