@lynxwall/cucumber-tsflow 7.5.0 → 7.5.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/bin/cucumber-tsflow +3 -3
- package/bin/cucumber-tsflow.js +0 -0
- package/lib/api/convert-configuration.d.ts +1 -1
- package/lib/api/convert-configuration.js +62 -19
- package/lib/api/convert-configuration.js.map +1 -1
- package/lib/api/load-configuration.js +226 -101
- package/lib/api/load-configuration.js.map +1 -1
- package/lib/cli/index.js +61 -13
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/run.js +29 -15
- package/lib/cli/run.js.map +1 -1
- package/lib/transpilers/esm/esbuild-transpiler-cjs.js +118 -15
- package/lib/transpilers/esm/esbuild-transpiler.mjs +27 -6
- package/lib/transpilers/esm/esbuild.mjs +70 -26
- package/lib/transpilers/esm/esnode-loader.mjs +7 -0
- package/lib/transpilers/esm/esvue-loader.mjs +7 -0
- package/lib/transpilers/esm/loader-utils.mjs +283 -157
- package/lib/transpilers/esm/tsnode-loader.mjs +84 -38
- package/lib/transpilers/esm/tsnode-service.mjs +50 -6
- package/lib/transpilers/esm/vue-jsdom-setup.mjs +36 -7
- package/lib/transpilers/esm/vue-loader.mjs +48 -62
- package/lib/transpilers/esm/vue-sfc-compiler.mjs +194 -65
- package/lib/tsconfig.node.tsbuildinfo +1 -1
- package/lib/utils/tsflow-logger.d.ts +29 -0
- package/lib/utils/tsflow-logger.js +79 -0
- package/lib/utils/tsflow-logger.js.map +1 -0
- package/lib/utils/tsflow-logger.mjs +78 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +4 -3
- package/lib/support_code_library_builder/index.d.ts +0 -80
- package/lib/support_code_library_builder/index.js +0 -337
- package/lib/support_code_library_builder/index.js.map +0 -1
- package/lib/transpilers/esm/esmbuild-transpiler.d.ts +0 -4
- package/lib/transpilers/esm/esmbuild-transpiler.js +0 -19
- package/lib/transpilers/esm/esmbuild-transpiler.js.map +0 -1
- package/lib/transpilers/esm/esmbuild.d.ts +0 -12
- package/lib/transpilers/esm/esmbuild.js +0 -72
- package/lib/transpilers/esm/esmbuild.js.map +0 -1
- package/lib/transpilers/esm/esmnode.d.ts +0 -1
- package/lib/transpilers/esm/esmnode.js +0 -8
- package/lib/transpilers/esm/esmnode.js.map +0 -1
- package/lib/transpilers/esm/esmvue.d.ts +0 -1
- package/lib/transpilers/esm/esmvue.js +0 -29
- package/lib/transpilers/esm/esmvue.js.map +0 -1
- package/lib/transpilers/esm/tsnode-esm.d.ts +0 -1
- package/lib/transpilers/esm/tsnode-esm.js +0 -25
- package/lib/transpilers/esm/tsnode-esm.js.map +0 -1
- package/lib/transpilers/esm/tsnode-exp-esm.d.ts +0 -1
- package/lib/transpilers/esm/tsnode-exp-esm.js +0 -19
- package/lib/transpilers/esm/tsnode-exp-esm.js.map +0 -1
- package/lib/transpilers/esm/tsvue-esm.d.ts +0 -1
- package/lib/transpilers/esm/tsvue-esm.js +0 -40
- package/lib/transpilers/esm/tsvue-esm.js.map +0 -1
- package/lib/transpilers/esm/tsvue-exp-esm.d.ts +0 -1
- package/lib/transpilers/esm/tsvue-exp-esm.js +0 -40
- package/lib/transpilers/esm/tsvue-exp-esm.js.map +0 -1
|
@@ -1,80 +0,0 @@
|
|
|
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;
|
|
@@ -1,337 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/support_code_library_builder/index.ts"],"names":[],"mappings":";;;;;;AAEA,4DAA+B;AAC/B,yEAAuF;AACvF,wHAA6F;AAC7F,wHAA6F;AAC7F,sHAA2F;AAC3F,oGAA2E;AAC3E,0EAAgF;AAChF,wEAAqE;AAErE,gIAAuG;AAkBvG,sGAA8E;AAC9E,iIAA0H;AAC1H,mHAA8G;AAC9G,yIAAmI;AAkCnI,MAAa,yBAAyB;IACrB,OAAO,CAA4B;IAC3C,mBAAmB,CAA0B;IAC7C,kCAAkC,CAAkC;IACpE,iCAAiC,CAAiC;IAClE,kCAAkC,CAAkC;IACpE,mCAAmC,CAAkC;IACrE,kCAAkC,CAAiC;IACnE,mCAAmC,CAAkC;IACrE,GAAG,CAAS;IACZ,cAAc,CAAS;IACvB,yBAAyB,CAAM;IAC/B,KAAK,CAAoB;IACzB,qBAAqB,CAA+B;IACpD,qBAAqB,CAA0B;IAC/C,KAAK,CAAM;IACX,iBAAiB,CAA8B;IAC/C,MAAM,GAAkB,SAAS,CAAC;IAE1C;;;;OAIG;IACI,MAAM,KAAK,QAAQ;QACzB,MAAM,6BAA6B,GAAG,sCAAsC,CAAC;QAE7E,MAAM,OAAO,GAAI,MAAc,CAAC,6BAA6B,CAAC,CAAC;QAE/D,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAc,CAAC,6BAA6B,C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G,EAAE,CAAC;QAC9C,IAAI,CAAC,kCAAkC,GAAG,EAAE,CAAC;QAC7C,IAAI,CAAC,mCAAmC,GAAG,EAAE,CAAC;QAC9C,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC;QACtC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,qBAAqB,GAAG,IAAI,8DAA4B,EAAE,CAAC;QAChE,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC,iBAAiB,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,eAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;CACD;AA9WD,8DA8WC;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"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EsmbuildTranspiler = void 0;
|
|
4
|
-
const esmbuild_1 = require("./esmbuild");
|
|
5
|
-
const create = (_createOptions) => {
|
|
6
|
-
return new EsmbuildTranspiler();
|
|
7
|
-
};
|
|
8
|
-
class EsmbuildTranspiler {
|
|
9
|
-
transpile = (input, options) => {
|
|
10
|
-
const result = (0, esmbuild_1.transpileCode)(input, options.fileName);
|
|
11
|
-
return {
|
|
12
|
-
outputText: result.output,
|
|
13
|
-
sourceMapText: result.sourceMap
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
exports.EsmbuildTranspiler = EsmbuildTranspiler;
|
|
18
|
-
exports.create = create;
|
|
19
|
-
//# sourceMappingURL=esmbuild-transpiler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"esmbuild-transpiler.js","sourceRoot":"","sources":["../../../src/transpilers/esm/esmbuild-transpiler.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAE3C,MAAM,MAAM,GAAG,CAAC,cAAuC,EAAc,EAAE;IACtE,OAAO,IAAI,kBAAkB,EAAE,CAAC;AACjC,CAAC,CAAC;AAEF,MAAa,kBAAkB;IAC9B,SAAS,GAAG,CAAC,KAAa,EAAE,OAAyB,EAAmB,EAAE;QACzE,MAAM,MAAM,GAAG,IAAA,wBAAa,EAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEtD,OAAO;YACN,UAAU,EAAE,MAAM,CAAC,MAAM;YACzB,aAAa,EAAE,MAAM,CAAC,SAAS;SACZ,CAAC;IACtB,CAAC,CAAC;CACF;AATD,gDASC;AAED,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC","sourcesContent":["import { CreateTranspilerOptions, TranspileOptions, Transpiler, TranspileOutput } from 'ts-node';\r\nimport { transpileCode } from './esmbuild';\r\n\r\nconst create = (_createOptions: CreateTranspilerOptions): Transpiler => {\r\n\treturn new EsmbuildTranspiler();\r\n};\r\n\r\nexport class EsmbuildTranspiler implements Transpiler {\r\n\ttranspile = (input: string, options: TranspileOptions): TranspileOutput => {\r\n\t\tconst result = transpileCode(input, options.fileName);\r\n\r\n\t\treturn {\r\n\t\t\toutputText: result.output,\r\n\t\t\tsourceMapText: result.sourceMap\r\n\t\t} as TranspileOutput;\r\n\t};\r\n}\r\n\r\nexports.create = create;\r\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Loader, CommonOptions, TransformOptions, BuildOptions } from 'esbuild';
|
|
2
|
-
export type TranspileOptions = {
|
|
3
|
-
debug: boolean;
|
|
4
|
-
esbuild?: CommonOptions & TransformOptions & BuildOptions;
|
|
5
|
-
};
|
|
6
|
-
export type TranspileResults = {
|
|
7
|
-
output: string;
|
|
8
|
-
sourceMap?: string;
|
|
9
|
-
};
|
|
10
|
-
export declare const loaders: Record<string, Loader>;
|
|
11
|
-
export declare const supports: (filename: string) => boolean;
|
|
12
|
-
export declare const transpileCode: (code: string, filename: string, ext?: string, _options?: Partial<TranspileOptions>) => TranspileResults;
|
|
@@ -1,72 +0,0 @@
|
|
|
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.transpileCode = exports.supports = exports.loaders = void 0;
|
|
7
|
-
const esbuild_1 = require("esbuild");
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const defaultOptions = {
|
|
10
|
-
debug: true
|
|
11
|
-
};
|
|
12
|
-
const commonOptions = {
|
|
13
|
-
format: 'esm',
|
|
14
|
-
logLevel: 'info',
|
|
15
|
-
target: [`esnext`],
|
|
16
|
-
minify: false,
|
|
17
|
-
sourcemap: 'external'
|
|
18
|
-
};
|
|
19
|
-
if (global.experimentalDecorators) {
|
|
20
|
-
commonOptions.tsconfigRaw = {
|
|
21
|
-
compilerOptions: {
|
|
22
|
-
experimentalDecorators: true,
|
|
23
|
-
importsNotUsedAsValues: 'remove',
|
|
24
|
-
strict: true
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
commonOptions.tsconfigRaw = {
|
|
30
|
-
compilerOptions: {
|
|
31
|
-
importsNotUsedAsValues: 'remove',
|
|
32
|
-
strict: true
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
exports.loaders = {
|
|
37
|
-
'.js': 'js',
|
|
38
|
-
'.mjs': 'js',
|
|
39
|
-
'.cjs': 'js',
|
|
40
|
-
'.jsx': 'jsx',
|
|
41
|
-
'.ts': 'ts',
|
|
42
|
-
'.tsx': 'tsx',
|
|
43
|
-
'.json': 'json'
|
|
44
|
-
};
|
|
45
|
-
const supports = (filename) => {
|
|
46
|
-
if (filename.includes('node_modules') || filename.includes('cucumber-tsflow/lib'))
|
|
47
|
-
return false;
|
|
48
|
-
return path_1.default.extname(filename) in exports.loaders;
|
|
49
|
-
};
|
|
50
|
-
exports.supports = supports;
|
|
51
|
-
const getLoaders = (options) => {
|
|
52
|
-
const ret = { ...exports.loaders };
|
|
53
|
-
if (typeof options.esbuild?.loader == 'object') {
|
|
54
|
-
for (const [e, l] of Object.entries(options.esbuild.loader))
|
|
55
|
-
ret[e] = l;
|
|
56
|
-
}
|
|
57
|
-
return ret;
|
|
58
|
-
};
|
|
59
|
-
const transpileCode = (code, filename, ext, _options) => {
|
|
60
|
-
const options = { ...defaultOptions, ..._options };
|
|
61
|
-
const loaders = getLoaders(options);
|
|
62
|
-
const loaderExt = ext != undefined ? ext : path_1.default.extname(filename);
|
|
63
|
-
const ret = (0, esbuild_1.transformSync)(code, {
|
|
64
|
-
...commonOptions,
|
|
65
|
-
...options.esbuild,
|
|
66
|
-
loader: loaders[loaderExt],
|
|
67
|
-
sourcefile: filename
|
|
68
|
-
});
|
|
69
|
-
return { output: ret.code, sourceMap: ret.map };
|
|
70
|
-
};
|
|
71
|
-
exports.transpileCode = transpileCode;
|
|
72
|
-
//# sourceMappingURL=esmbuild.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"esmbuild.js","sourceRoot":"","s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AAE,CAAC;IAC3B,IAAI,OAAO,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,CAAC;QAChD,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAW,CAAC;IACnF,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC,CAAC;AAEK,MAAM,aAAa,GAAG,CAC5B,IAAY,EACZ,QAAgB,EAChB,GAAY,EACZ,QAAoC,EACjB,EAAE;IACrB,MAAM,OAAO,GAAqB,EAAE,GAAG,cAAc,EAAE,GAAG,QAAQ,EAAE,CAAC;IACrE,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAElE,MAAM,GAAG,GAAG,IAAA,uBAAa,EAAC,IAAI,EAAE;QAC/B,GAAG,aAAa;QAChB,GAAI,OAAO,CAAC,OAAwC;QACpD,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC;QAC1B,UAAU,EAAE,QAAQ;KACpB,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC;AACjD,CAAC,CAAC;AAjBW,QAAA,aAAa,iBAiBxB","sourcesContent":["import { Loader, transformSync, CommonOptions, TransformOptions, BuildOptions } from 'esbuild';\r\nimport path from 'path';\r\n\r\nexport type TranspileOptions = {\r\n\tdebug: boolean;\r\n\tesbuild?: CommonOptions & TransformOptions & BuildOptions;\r\n};\r\nconst defaultOptions: TranspileOptions = {\r\n\tdebug: true\r\n};\r\n\r\nconst commonOptions: CommonOptions = {\r\n\tformat: 'esm',\r\n\tlogLevel: 'info',\r\n\ttarget: [`esnext`],\r\n\tminify: false,\r\n\tsourcemap: 'external'\r\n};\r\n\r\nif (global.experimentalDecorators) {\r\n\tcommonOptions.tsconfigRaw = {\r\n\t\tcompilerOptions: {\r\n\t\t\texperimentalDecorators: true,\r\n\t\t\timportsNotUsedAsValues: 'remove',\r\n\t\t\tstrict: true\r\n\t\t}\r\n\t};\r\n} else {\r\n\tcommonOptions.tsconfigRaw = {\r\n\t\tcompilerOptions: {\r\n\t\t\timportsNotUsedAsValues: 'remove',\r\n\t\t\tstrict: true\r\n\t\t}\r\n\t};\r\n}\r\n\r\nexport type TranspileResults = {\r\n\toutput: string;\r\n\tsourceMap?: string;\r\n};\r\n\r\nexport const loaders: Record<string, Loader> = {\r\n\t'.js': 'js',\r\n\t'.mjs': 'js',\r\n\t'.cjs': 'js',\r\n\t'.jsx': 'jsx',\r\n\t'.ts': 'ts',\r\n\t'.tsx': 'tsx',\r\n\t'.json': 'json'\r\n};\r\n\r\nexport const supports = (filename: string) => {\r\n\tif (filename.includes('node_modules') || filename.includes('cucumber-tsflow/lib')) return false;\r\n\treturn path.extname(filename) in loaders;\r\n};\r\n\r\nconst getLoaders = (options: TranspileOptions) => {\r\n\tconst ret = { ...loaders };\r\n\tif (typeof options.esbuild?.loader == 'object') {\r\n\t\tfor (const [e, l] of Object.entries(options.esbuild.loader)) ret[e] = l as Loader;\r\n\t}\r\n\treturn ret;\r\n};\r\n\r\nexport const transpileCode = (\r\n\tcode: string,\r\n\tfilename: string,\r\n\text?: string,\r\n\t_options?: Partial<TranspileOptions>\r\n): TranspileResults => {\r\n\tconst options: TranspileOptions = { ...defaultOptions, ..._options };\r\n\tconst loaders = getLoaders(options);\r\n\tconst loaderExt = ext != undefined ? ext : path.extname(filename);\r\n\r\n\tconst ret = transformSync(code, {\r\n\t\t...commonOptions,\r\n\t\t...(options.esbuild as TransformOptions | undefined),\r\n\t\tloader: loaders[loaderExt],\r\n\t\tsourcefile: filename\r\n\t});\r\n\treturn { output: ret.code, sourceMap: ret.map };\r\n};\r\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require('ts-node/esm').register({
|
|
4
|
-
transpileOnly: true,
|
|
5
|
-
transpiler: '@lynxwall/cucumber-tsflow/lib/transpilers/esm/esmbuild-transpiler'
|
|
6
|
-
});
|
|
7
|
-
require('tsconfig-paths').register();
|
|
8
|
-
//# sourceMappingURL=esmnode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"esmnode.js","sourceRoot":"","sources":["../../../src/transpilers/esm/esmnode.ts"],"names":[],"mappings":";;AAAA,OAAO,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC;IAC/B,aAAa,EAAE,IAAI;IACnB,UAAU,EAAE,mEAAmE;CAC/E,CAAC,CAAC;AAEH,OAAO,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE,CAAC","sourcesContent":["require('ts-node/esm').register({\r\n\ttranspileOnly: true,\r\n\ttranspiler: '@lynxwall/cucumber-tsflow/lib/transpilers/esm/esmbuild-transpiler'\r\n});\r\n\r\nrequire('tsconfig-paths').register();\r\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
const hooks = require('require-extension-hooks');
|
|
7
|
-
const vue_sfc_1 = __importDefault(require("../vue-sfc"));
|
|
8
|
-
require('ts-node/esm').register({
|
|
9
|
-
transpileOnly: true,
|
|
10
|
-
transpiler: '@lynxwall/cucumber-tsflow/lib/transpilers/esm/esmbuild-transpiler'
|
|
11
|
-
});
|
|
12
|
-
require('tsconfig-paths').register();
|
|
13
|
-
// Register jsdom globally and set SVGElement on global
|
|
14
|
-
require('jsdom-global')();
|
|
15
|
-
global.SVGElement = global.window.SVGElement;
|
|
16
|
-
hooks('vue').push(function (params) {
|
|
17
|
-
try {
|
|
18
|
-
const transformer = new vue_sfc_1.default({
|
|
19
|
-
exclude: ['(?:^|/)node_modules/', '(?:^|/)cucumber-tsflow/lib/']
|
|
20
|
-
});
|
|
21
|
-
const transformResult = transformer.transformCode(params.content, params.filename);
|
|
22
|
-
return transformResult.code;
|
|
23
|
-
}
|
|
24
|
-
catch (err) {
|
|
25
|
-
console.log(err);
|
|
26
|
-
}
|
|
27
|
-
return params.content;
|
|
28
|
-
});
|
|
29
|
-
//# sourceMappingURL=esmvue.js.map
|