@cucumber/cucumber 12.5.0 → 12.7.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/{cli/helpers.d.ts → api/emit_support_code_messages.d.ts} +0 -3
- package/lib/{cli/helpers.js → api/emit_support_code_messages.js} +67 -101
- package/lib/api/emit_support_code_messages.js.map +1 -0
- package/lib/api/load_configuration.d.ts +1 -1
- package/lib/api/load_configuration.js +13 -1
- package/lib/api/load_configuration.js.map +1 -1
- package/lib/api/run_cucumber.js +7 -7
- package/lib/api/run_cucumber.js.map +1 -1
- package/lib/configuration/validate_configuration.js +5 -0
- package/lib/configuration/validate_configuration.js.map +1 -1
- package/lib/filter/filter_plugin.js +2 -2
- package/lib/filter/filter_plugin.js.map +1 -1
- package/lib/filter/index.d.ts +1 -0
- package/lib/filter/index.js +3 -0
- package/lib/filter/index.js.map +1 -1
- package/lib/filter/order_pickles.d.ts +3 -0
- package/lib/filter/order_pickles.js +37 -0
- package/lib/filter/order_pickles.js.map +1 -0
- package/lib/formatter/index.d.ts +3 -0
- package/lib/formatter/index.js.map +1 -1
- package/lib/models/definition.d.ts +4 -1
- package/lib/models/definition.js +3 -1
- package/lib/models/definition.js.map +1 -1
- package/lib/pickle_filter.js +3 -3
- package/lib/pickle_filter.js.map +1 -1
- package/lib/runtime/format_error.js +1 -1
- package/lib/runtime/format_error.js.map +1 -1
- package/lib/support_code_library_builder/get_definition_line_and_uri.js +4 -0
- package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +1 -1
- package/lib/support_code_library_builder/index.d.ts +5 -0
- package/lib/support_code_library_builder/index.js +15 -5
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/sourced_parameter_type_registry.d.ts +4 -2
- package/lib/support_code_library_builder/sourced_parameter_type_registry.js +2 -2
- package/lib/support_code_library_builder/sourced_parameter_type_registry.js.map +1 -1
- package/lib/tsconfig.node.tsbuildinfo +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +18 -16
- package/lib/cli/helpers.js.map +0 -1
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
2
|
import { IdGenerator } from '@cucumber/messages';
|
|
3
3
|
import { SupportCodeLibrary } from '../support_code_library_builder/types';
|
|
4
|
-
import { ILogger } from '../environment';
|
|
5
|
-
import { IPickleOrder } from '../filter';
|
|
6
|
-
export declare function orderPickles<T = string>(pickleIds: T[], order: IPickleOrder, logger: ILogger): void;
|
|
7
4
|
export declare function emitMetaMessage(eventBroadcaster: EventEmitter, env: NodeJS.ProcessEnv): Promise<void>;
|
|
8
5
|
export declare function emitSupportCodeMessages({ eventBroadcaster, supportCodeLibrary, newId, }: {
|
|
9
6
|
eventBroadcaster: EventEmitter;
|
|
@@ -36,44 +36,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.orderPickles = orderPickles;
|
|
40
39
|
exports.emitMetaMessage = emitMetaMessage;
|
|
41
40
|
exports.emitSupportCodeMessages = emitSupportCodeMessages;
|
|
42
41
|
const node_os_1 = __importDefault(require("node:os"));
|
|
43
|
-
const knuth_shuffle_seeded_1 = __importDefault(require("knuth-shuffle-seeded"));
|
|
44
42
|
const messages = __importStar(require("@cucumber/messages"));
|
|
45
43
|
const messages_1 = require("@cucumber/messages");
|
|
46
44
|
const ci_environment_1 = __importDefault(require("@cucumber/ci-environment"));
|
|
47
45
|
const version_1 = require("../version");
|
|
48
|
-
// Orders the pickleIds in place - morphs input
|
|
49
|
-
function orderPickles(pickleIds, order, logger) {
|
|
50
|
-
const [type, seed] = splitOrder(order);
|
|
51
|
-
switch (type) {
|
|
52
|
-
case 'defined':
|
|
53
|
-
break;
|
|
54
|
-
case 'reverse':
|
|
55
|
-
pickleIds.reverse();
|
|
56
|
-
break;
|
|
57
|
-
case 'random':
|
|
58
|
-
if (seed === '') {
|
|
59
|
-
const newSeed = Math.floor(Math.random() * 1000 * 1000).toString();
|
|
60
|
-
logger.warn(`Random order using seed: ${newSeed}`);
|
|
61
|
-
(0, knuth_shuffle_seeded_1.default)(pickleIds, newSeed);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
(0, knuth_shuffle_seeded_1.default)(pickleIds, seed);
|
|
65
|
-
}
|
|
66
|
-
break;
|
|
67
|
-
default:
|
|
68
|
-
throw new Error('Unrecognized order type. Should be `defined` or `random`');
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function splitOrder(order) {
|
|
72
|
-
if (!order.includes(':')) {
|
|
73
|
-
return [order, ''];
|
|
74
|
-
}
|
|
75
|
-
return order.split(':');
|
|
76
|
-
}
|
|
77
46
|
async function emitMetaMessage(eventBroadcaster, env) {
|
|
78
47
|
const meta = {
|
|
79
48
|
protocolVersion: messages.version,
|
|
@@ -98,43 +67,48 @@ async function emitMetaMessage(eventBroadcaster, env) {
|
|
|
98
67
|
meta,
|
|
99
68
|
});
|
|
100
69
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
70
|
+
function makeSourceReference(source) {
|
|
71
|
+
return {
|
|
72
|
+
uri: source.uri,
|
|
73
|
+
location: {
|
|
74
|
+
line: source.line,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function extractPatternSource(pattern) {
|
|
79
|
+
if (pattern instanceof RegExp) {
|
|
80
|
+
return pattern.flags ? pattern.toString() : pattern.source;
|
|
81
|
+
}
|
|
82
|
+
return pattern;
|
|
83
|
+
}
|
|
84
|
+
function collectParameterTypeEnvelopes(supportCodeLibrary, newId) {
|
|
85
|
+
const ordered = [];
|
|
108
86
|
for (const parameterType of supportCodeLibrary.parameterTypeRegistry
|
|
109
87
|
.parameterTypes) {
|
|
110
88
|
if (parameterType.builtin) {
|
|
111
89
|
continue;
|
|
112
90
|
}
|
|
113
91
|
const source = supportCodeLibrary.parameterTypeRegistry.lookupSource(parameterType);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
92
|
+
ordered.push({
|
|
93
|
+
order: source.order,
|
|
94
|
+
envelope: {
|
|
95
|
+
parameterType: {
|
|
96
|
+
id: newId(),
|
|
97
|
+
name: parameterType.name,
|
|
98
|
+
preferForRegularExpressionMatch: parameterType.preferForRegexpMatch,
|
|
99
|
+
regularExpressions: parameterType.regexpStrings,
|
|
100
|
+
useForSnippets: parameterType.useForSnippets,
|
|
101
|
+
sourceReference: makeSourceReference(source),
|
|
102
|
+
},
|
|
122
103
|
},
|
|
123
|
-
};
|
|
124
|
-
eventBroadcaster.emit('envelope', envelope);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
function emitUndefinedParameterTypes(supportCodeLibrary, eventBroadcaster) {
|
|
128
|
-
for (const undefinedParameterType of supportCodeLibrary.undefinedParameterTypes) {
|
|
129
|
-
const envelope = {
|
|
130
|
-
undefinedParameterType,
|
|
131
|
-
};
|
|
132
|
-
eventBroadcaster.emit('envelope', envelope);
|
|
104
|
+
});
|
|
133
105
|
}
|
|
106
|
+
return ordered;
|
|
134
107
|
}
|
|
135
|
-
function
|
|
136
|
-
supportCodeLibrary.stepDefinitions.
|
|
137
|
-
|
|
108
|
+
function collectStepDefinitionEnvelopes(supportCodeLibrary) {
|
|
109
|
+
return supportCodeLibrary.stepDefinitions.map((stepDefinition) => ({
|
|
110
|
+
order: stepDefinition.order,
|
|
111
|
+
envelope: {
|
|
138
112
|
stepDefinition: {
|
|
139
113
|
id: stepDefinition.id,
|
|
140
114
|
pattern: {
|
|
@@ -145,19 +119,11 @@ function emitStepDefinitions(supportCodeLibrary, eventBroadcaster) {
|
|
|
145
119
|
},
|
|
146
120
|
sourceReference: makeSourceReference(stepDefinition),
|
|
147
121
|
},
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
function extractPatternSource(pattern) {
|
|
153
|
-
if (pattern instanceof RegExp) {
|
|
154
|
-
return pattern.flags ? pattern.toString() : pattern.source;
|
|
155
|
-
}
|
|
156
|
-
return pattern;
|
|
122
|
+
},
|
|
123
|
+
}));
|
|
157
124
|
}
|
|
158
|
-
function
|
|
159
|
-
|
|
160
|
-
[
|
|
125
|
+
function collectHookEnvelopes(supportCodeLibrary) {
|
|
126
|
+
const allHooks = [
|
|
161
127
|
[
|
|
162
128
|
supportCodeLibrary.beforeTestCaseHookDefinitions,
|
|
163
129
|
messages_1.HookType.BEFORE_TEST_CASE,
|
|
@@ -166,23 +132,6 @@ function emitTestCaseHooks(supportCodeLibrary, eventBroadcaster) {
|
|
|
166
132
|
supportCodeLibrary.afterTestCaseHookDefinitions,
|
|
167
133
|
messages_1.HookType.AFTER_TEST_CASE,
|
|
168
134
|
],
|
|
169
|
-
].forEach(([hooks, type]) => {
|
|
170
|
-
hooks.forEach((hook) => {
|
|
171
|
-
eventBroadcaster.emit('envelope', {
|
|
172
|
-
hook: {
|
|
173
|
-
id: hook.id,
|
|
174
|
-
type,
|
|
175
|
-
name: hook.name,
|
|
176
|
-
tagExpression: hook.tagExpression,
|
|
177
|
-
sourceReference: makeSourceReference(hook),
|
|
178
|
-
},
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
function emitTestRunHooks(supportCodeLibrary, eventBroadcaster) {
|
|
184
|
-
;
|
|
185
|
-
[
|
|
186
135
|
[
|
|
187
136
|
supportCodeLibrary.beforeTestRunHookDefinitions,
|
|
188
137
|
messages_1.HookType.BEFORE_TEST_RUN,
|
|
@@ -191,24 +140,41 @@ function emitTestRunHooks(supportCodeLibrary, eventBroadcaster) {
|
|
|
191
140
|
supportCodeLibrary.afterTestRunHookDefinitions,
|
|
192
141
|
messages_1.HookType.AFTER_TEST_RUN,
|
|
193
142
|
],
|
|
194
|
-
]
|
|
143
|
+
];
|
|
144
|
+
const ordered = [];
|
|
145
|
+
allHooks.forEach(([hooks, type]) => {
|
|
195
146
|
hooks.forEach((hook) => {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
147
|
+
ordered.push({
|
|
148
|
+
order: hook.order,
|
|
149
|
+
envelope: {
|
|
150
|
+
hook: {
|
|
151
|
+
id: hook.id,
|
|
152
|
+
type,
|
|
153
|
+
name: hook.name,
|
|
154
|
+
...('tagExpression' in hook && {
|
|
155
|
+
tagExpression: hook.tagExpression,
|
|
156
|
+
}),
|
|
157
|
+
sourceReference: makeSourceReference(hook),
|
|
158
|
+
},
|
|
202
159
|
},
|
|
203
160
|
});
|
|
204
161
|
});
|
|
205
162
|
});
|
|
163
|
+
return ordered;
|
|
206
164
|
}
|
|
207
165
|
function emitSupportCodeMessages({ eventBroadcaster, supportCodeLibrary, newId, }) {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
166
|
+
const orderedEnvelopes = [
|
|
167
|
+
...collectParameterTypeEnvelopes(supportCodeLibrary, newId),
|
|
168
|
+
...collectStepDefinitionEnvelopes(supportCodeLibrary),
|
|
169
|
+
...collectHookEnvelopes(supportCodeLibrary),
|
|
170
|
+
];
|
|
171
|
+
orderedEnvelopes
|
|
172
|
+
.sort((a, b) => a.order - b.order)
|
|
173
|
+
.forEach(({ envelope }) => eventBroadcaster.emit('envelope', envelope));
|
|
174
|
+
supportCodeLibrary.undefinedParameterTypes
|
|
175
|
+
.map((undefinedParameterType) => ({
|
|
176
|
+
undefinedParameterType,
|
|
177
|
+
}))
|
|
178
|
+
.forEach((envelope) => eventBroadcaster.emit('envelope', envelope));
|
|
213
179
|
}
|
|
214
|
-
//# sourceMappingURL=
|
|
180
|
+
//# sourceMappingURL=emit_support_code_messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit_support_code_messages.js","sourceRoot":"","sources":["../../src/api/emit_support_code_messages.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,0CA0BC;AA+GD,0DAuBC;AA7KD,sDAAwB;AACxB,6DAA8C;AAC9C,iDAAoE;AACpE,8EAA0D;AAE1D,wCAAoC;AAQ7B,KAAK,UAAU,eAAe,CACnC,gBAA8B,EAC9B,GAAsB;IAEtB,MAAM,IAAI,GAAkB;QAC1B,eAAe,EAAE,QAAQ,CAAC,OAAO;QACjC,cAAc,EAAE;YACd,OAAO,EAAP,iBAAO;YACP,IAAI,EAAE,aAAa;SACpB;QACD,GAAG,EAAE;YACH,IAAI,EAAE,iBAAE,CAAC,IAAI,EAAE;SAChB;QACD,EAAE,EAAE;YACF,IAAI,EAAE,iBAAE,CAAC,QAAQ,EAAE;YACnB,OAAO,EAAE,iBAAE,CAAC,OAAO,EAAE;SACtB;QACD,OAAO,EAAE;YACP,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI;SAC/B;QACD,EAAE,EAAE,IAAA,wBAAmB,EAAC,GAAG,CAAC;KAC7B,CAAA;IACD,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE;QAChC,IAAI;KACL,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,mBAAmB,CAAC,MAAmB;IAC9C,OAAO;QACL,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,QAAQ,EAAE;YACR,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB;KACF,CAAA;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,OAAwB;IACpD,IAAI,OAAO,YAAY,MAAM,EAAE,CAAC;QAC9B,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CA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AkB,EAAE,KAAK,CAAC;QAC3D,GAAG,8BAA8B,CAAC,kBAAkB,CAAC;QACrD,GAAG,oBAAoB,CAAC,kBAAkB,CAAC;KAC5C,CAAA;IACD,gBAAgB;SACb,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;SACjC,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAA;IAEzE,kBAAkB,CAAC,uBAAuB;SACvC,GAAG,CAAC,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;QAChC,sBAAsB;KACvB,CAAC,CAAC;SACF,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAA;AACvE,CAAC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport os from 'node:os'\nimport * as messages from '@cucumber/messages'\nimport { Envelope, HookType, IdGenerator } from '@cucumber/messages'\nimport detectCiEnvironment from '@cucumber/ci-environment'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport { version } from '../version'\nimport { ILineAndUri } from '../types'\n\ninterface OrderedEnvelope {\n order: number\n envelope: messages.Envelope\n}\n\nexport async function emitMetaMessage(\n eventBroadcaster: EventEmitter,\n env: NodeJS.ProcessEnv\n): Promise<void> {\n const meta: messages.Meta = {\n protocolVersion: messages.version,\n implementation: {\n version,\n name: 'cucumber-js',\n },\n cpu: {\n name: os.arch(),\n },\n os: {\n name: os.platform(),\n version: os.release(),\n },\n runtime: {\n name: 'node.js',\n version: process.versions.node,\n },\n ci: detectCiEnvironment(env),\n }\n eventBroadcaster.emit('envelope', {\n meta,\n })\n}\n\nfunction makeSourceReference(source: ILineAndUri) {\n return {\n uri: source.uri,\n location: {\n line: source.line,\n },\n }\n}\n\nfunction extractPatternSource(pattern: string | RegExp) {\n if (pattern instanceof RegExp) {\n return pattern.flags ? pattern.toString() : pattern.source\n }\n return pattern\n}\n\nfunction collectParameterTypeEnvelopes(\n supportCodeLibrary: SupportCodeLibrary,\n newId: IdGenerator.NewId\n): ReadonlyArray<OrderedEnvelope> {\n const ordered: Array<OrderedEnvelope> = []\n for (const parameterType of supportCodeLibrary.parameterTypeRegistry\n .parameterTypes) {\n if (parameterType.builtin) {\n continue\n }\n const source =\n supportCodeLibrary.parameterTypeRegistry.lookupSource(parameterType)\n ordered.push({\n order: source.order,\n envelope: {\n parameterType: {\n id: newId(),\n name: parameterType.name,\n preferForRegularExpressionMatch: parameterType.preferForRegexpMatch,\n regularExpressions: parameterType.regexpStrings,\n useForSnippets: parameterType.useForSnippets,\n sourceReference: makeSourceReference(source),\n },\n },\n })\n }\n return ordered\n}\n\nfunction collectStepDefinitionEnvelopes(\n supportCodeLibrary: SupportCodeLibrary\n): ReadonlyArray<OrderedEnvelope> {\n return supportCodeLibrary.stepDefinitions.map((stepDefinition) => ({\n order: stepDefinition.order,\n envelope: {\n stepDefinition: {\n id: stepDefinition.id,\n pattern: {\n source: extractPatternSource(stepDefinition.pattern),\n type:\n typeof stepDefinition.pattern === 'string'\n ? messages.StepDefinitionPatternType.CUCUMBER_EXPRESSION\n : messages.StepDefinitionPatternType.REGULAR_EXPRESSION,\n },\n sourceReference: makeSourceReference(stepDefinition),\n },\n },\n }))\n}\n\nfunction collectHookEnvelopes(\n supportCodeLibrary: SupportCodeLibrary\n): ReadonlyArray<OrderedEnvelope> {\n const allHooks = [\n [\n supportCodeLibrary.beforeTestCaseHookDefinitions,\n HookType.BEFORE_TEST_CASE,\n ] as const,\n [\n supportCodeLibrary.afterTestCaseHookDefinitions,\n HookType.AFTER_TEST_CASE,\n ] as const,\n [\n supportCodeLibrary.beforeTestRunHookDefinitions,\n HookType.BEFORE_TEST_RUN,\n ] as const,\n [\n supportCodeLibrary.afterTestRunHookDefinitions,\n HookType.AFTER_TEST_RUN,\n ] as const,\n ]\n const ordered: Array<OrderedEnvelope> = []\n allHooks.forEach(([hooks, type]) => {\n hooks.forEach((hook) => {\n ordered.push({\n order: hook.order,\n envelope: {\n hook: {\n id: hook.id,\n type,\n name: hook.name,\n ...('tagExpression' in hook && {\n tagExpression: hook.tagExpression,\n }),\n sourceReference: makeSourceReference(hook),\n },\n } satisfies Envelope,\n })\n })\n })\n return ordered\n}\n\nexport function emitSupportCodeMessages({\n eventBroadcaster,\n supportCodeLibrary,\n newId,\n}: {\n eventBroadcaster: EventEmitter\n supportCodeLibrary: SupportCodeLibrary\n newId: IdGenerator.NewId\n}): void {\n const orderedEnvelopes = [\n ...collectParameterTypeEnvelopes(supportCodeLibrary, newId),\n ...collectStepDefinitionEnvelopes(supportCodeLibrary),\n ...collectHookEnvelopes(supportCodeLibrary),\n ]\n orderedEnvelopes\n .sort((a, b) => a.order - b.order)\n .forEach(({ envelope }) => eventBroadcaster.emit('envelope', envelope))\n\n supportCodeLibrary.undefinedParameterTypes\n .map((undefinedParameterType) => ({\n undefinedParameterType,\n }))\n .forEach((envelope) => eventBroadcaster.emit('envelope', envelope))\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IRunEnvironment } from '../environment';
|
|
2
|
-
import {
|
|
2
|
+
import { ILoadConfigurationOptions, IResolvedConfiguration } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Load user-authored configuration to be used in a test run
|
|
5
5
|
*
|
|
@@ -27,7 +27,19 @@ async function loadConfiguration(options = {}, environment = {}) {
|
|
|
27
27
|
const profileConfiguration = configFile
|
|
28
28
|
? await (0, configuration_1.fromFile)(logger, cwd, configFile, options.profiles)
|
|
29
29
|
: {};
|
|
30
|
-
const
|
|
30
|
+
const providedConfiguration = (0, configuration_1.parseConfiguration)(logger, 'Provided', options.provided);
|
|
31
|
+
if (profileConfiguration.paths?.length > 0 &&
|
|
32
|
+
providedConfiguration.paths?.length > 0) {
|
|
33
|
+
const configPaths = profileConfiguration.paths;
|
|
34
|
+
const cliPaths = providedConfiguration.paths;
|
|
35
|
+
const mergedPaths = [...configPaths, ...cliPaths];
|
|
36
|
+
logger.warn(`You have specified paths in both your configuration file and as CLI arguments.\n` +
|
|
37
|
+
`In a future major version, the CLI argument will override the configuration file instead of being merged.\n` +
|
|
38
|
+
`To prepare for this change, see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md\n` +
|
|
39
|
+
` Current result: ${mergedPaths.join(', ')}\n` +
|
|
40
|
+
` Future result: ${cliPaths.join(', ')}`);
|
|
41
|
+
}
|
|
42
|
+
const original = (0, configuration_1.mergeConfigurations)(configuration_1.DEFAULT_CONFIGURATION, profileConfiguration, providedConfiguration);
|
|
31
43
|
logger.debug('Resolved configuration:', original);
|
|
32
44
|
(0, configuration_1.validateConfiguration)(original, logger);
|
|
33
45
|
const runnable = await (0, convert_configuration_1.convertConfiguration)(logger, original, env);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load_configuration.js","sourceRoot":"","sources":["../../src/api/load_configuration.ts"],"names":[],"mappings":";;AAmBA,
|
|
1
|
+
{"version":3,"file":"load_configuration.js","sourceRoot":"","sources":["../../src/api/load_configuration.ts"],"names":[],"mappings":";;AAmBA,8CAgDC;AAnED,8DAAyD;AACzD,oDAMyB;AACzB,gDAAiE;AACjE,mEAA8D;AAG9D;;;;;;GAMG;AACI,KAAK,UAAU,iBAAiB,CACrC,UAAqC,EAAE,EACvC,cAA+B,EAAE;IAEjC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAA,6BAAe,EAAC,WAAW,CAAC,CAAA;IACzD,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,IAAI,IAAA,wBAAU,EAAC,GAAG,CAAC,CAAA;IAClD,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,sCAAsC,UAAU,GAAG,CAAC,CAAA;IACnE,CAAC;SAAM,IAA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G,CAAC,CAAA;IAClE,OAAO;QACL,gBAAgB,EAAE,QAAQ;QAC1B,gBAAgB,EAAE,QAAQ;KAC3B,CAAA;AACH,CAAC","sourcesContent":["import { locateFile } from '../configuration/locate_file'\nimport {\n DEFAULT_CONFIGURATION,\n fromFile,\n mergeConfigurations,\n parseConfiguration,\n validateConfiguration,\n} from '../configuration'\nimport { IRunEnvironment, makeEnvironment } from '../environment'\nimport { convertConfiguration } from './convert_configuration'\nimport { ILoadConfigurationOptions, IResolvedConfiguration } from './types'\n\n/**\n * Load user-authored configuration to be used in a test run\n *\n * @public\n * @param options - Coordinates required to find configuration\n * @param environment - Project environment\n */\nexport async function loadConfiguration(\n options: ILoadConfigurationOptions = {},\n environment: IRunEnvironment = {}\n): Promise<IResolvedConfiguration> {\n const { cwd, env, logger } = makeEnvironment(environment)\n const configFile = options.file ?? locateFile(cwd)\n if (configFile) {\n logger.debug(`Configuration will be loaded from \"${configFile}\"`)\n } else if (configFile === false) {\n logger.debug('Skipping configuration file resolution')\n } else {\n logger.debug('No configuration file found')\n }\n const profileConfiguration = configFile\n ? await fromFile(logger, cwd, configFile, options.profiles)\n : {}\n const providedConfiguration = parseConfiguration(\n logger,\n 'Provided',\n options.provided\n )\n if (\n profileConfiguration.paths?.length > 0 &&\n providedConfiguration.paths?.length > 0\n ) {\n const configPaths = profileConfiguration.paths\n const cliPaths = providedConfiguration.paths\n const mergedPaths = [...configPaths, ...cliPaths]\n logger.warn(\n `You have specified paths in both your configuration file and as CLI arguments.\\n` +\n `In a future major version, the CLI argument will override the configuration file instead of being merged.\\n` +\n `To prepare for this change, see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md\\n` +\n ` Current result: ${mergedPaths.join(', ')}\\n` +\n ` Future result: ${cliPaths.join(', ')}`\n )\n }\n const original = mergeConfigurations(\n DEFAULT_CONFIGURATION,\n profileConfiguration,\n providedConfiguration\n )\n logger.debug('Resolved configuration:', original)\n validateConfiguration(original, logger)\n const runnable = await convertConfiguration(logger, original, env)\n return {\n useConfiguration: original,\n runConfiguration: runnable,\n }\n}\n"]}
|
package/lib/api/run_cucumber.js
CHANGED
|
@@ -3,16 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.runCucumber = runCucumber;
|
|
4
4
|
const node_events_1 = require("node:events");
|
|
5
5
|
const messages_1 = require("@cucumber/messages");
|
|
6
|
+
const environment_1 = require("../environment");
|
|
6
7
|
const helpers_1 = require("../formatter/helpers");
|
|
7
|
-
const helpers_2 = require("../cli/helpers");
|
|
8
8
|
const paths_1 = require("../paths");
|
|
9
|
-
const version_1 = require("../version");
|
|
10
9
|
const runtime_1 = require("../runtime");
|
|
11
|
-
const
|
|
10
|
+
const version_1 = require("../version");
|
|
11
|
+
const emit_support_code_messages_1 = require("./emit_support_code_messages");
|
|
12
12
|
const formatters_1 = require("./formatters");
|
|
13
|
-
const support_1 = require("./support");
|
|
14
13
|
const gherkin_1 = require("./gherkin");
|
|
15
14
|
const plugins_1 = require("./plugins");
|
|
15
|
+
const support_1 = require("./support");
|
|
16
16
|
/**
|
|
17
17
|
* Execute a Cucumber test run and return the overall result
|
|
18
18
|
*
|
|
@@ -75,7 +75,7 @@ Running from: ${__dirname}
|
|
|
75
75
|
supportCodeLibrary,
|
|
76
76
|
pluginManager,
|
|
77
77
|
});
|
|
78
|
-
await (0,
|
|
78
|
+
await (0, emit_support_code_messages_1.emitMetaMessage)(eventBroadcaster, env);
|
|
79
79
|
let filteredPickles = [];
|
|
80
80
|
let parseErrors = [];
|
|
81
81
|
if (sourcePaths.length > 0) {
|
|
@@ -101,13 +101,13 @@ Running from: ${__dirname}
|
|
|
101
101
|
support: supportCodeLibrary,
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
|
-
(0,
|
|
104
|
+
(0, emit_support_code_messages_1.emitSupportCodeMessages)({
|
|
105
105
|
eventBroadcaster,
|
|
106
106
|
supportCodeLibrary,
|
|
107
107
|
newId,
|
|
108
108
|
});
|
|
109
109
|
const runtime = await (0, runtime_1.makeRuntime)({
|
|
110
|
-
environment,
|
|
110
|
+
environment: mergedEnvironment,
|
|
111
111
|
logger,
|
|
112
112
|
eventBroadcaster,
|
|
113
113
|
sourcedPickles: filteredPickles,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run_cucumber.js","sourceRoot":"","sources":["../../src/api/run_cucumber.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"run_cucumber.js","sourceRoot":"","sources":["../../src/api/run_cucumber.ts"],"names":[],"mappings":";;AA2BA,kCA6IC;AAxKD,6CAA0C;AAC1C,iDAAsE;AACtE,gDAAiE;AAEjE,kDAAyD;AACzD,oCAAuC;AACvC,wCAAwC;AAExC,wCAAoC;AACpC,6EAGqC;AACrC,6CAAmD;AACnD,uCAA+C;AAC/C,uCAAoD;AACpD,uCAAiD;AAGjD;;;;;;;GAOG;AACI,KAAK,UAAU,WAAW,CAC/B,OAAoB,EACpB,cAA+B,EAAE,EACjC,SAAuC;IAEvC,MAAM,iBAAiB,GAAG,IAAA,6BAAe,EAAC,WAAW,CAAC,CAAA;IACtD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAA;IAE9D,MAAM,CAAC,KAAK,CAAC,uBAAuB,iBAAO;qBACxB,GAAG;gBACR,SAAS;CACxB,CAAC,CAAA;IAEA,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAEhC,MAAM,kBAAkB,GACtB,qBAAqB,IAAI,OAAO,CAAC,OAAO;QACtC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,mBAAmB;QACrC,CAAC,CAAC,MAAM,CAAC,MAAM,CACX;YACE,cAAc,EAAE,EAAE;YAClB,YAAY,EAAE,EAAE;YAChB,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,EAAE;SAChB,EACD,OAAO,CAAC,OAAO,CAChB,CAAA;IAEP,MAAM,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EF,MAAM,OAAO,GAAG,MAAM,IAAA,qBAAW,EAAC;QAChC,WAAW,EAAE,iBAAiB;QAC9B,MAAM;QACN,gBAAgB;QAChB,cAAc,EAAE,eAAe;QAC/B,KAAK;QACL,kBAAkB;QAClB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,cAAc,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO;KACxC,CAAC,CAAA;IACF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,CAAA;IACnC,MAAM,aAAa,CAAC,OAAO,EAAE,CAAA;IAC7B,MAAM,iBAAiB,EAAE,CAAA;IAEzB,OAAO;QACL,OAAO,EAAE,OAAO,IAAI,CAAC,oBAAoB;QACzC,OAAO,EAAE,kBAAkB;KAC5B,CAAA;AACH,CAAC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { Envelope, IdGenerator, ParseError } from '@cucumber/messages'\nimport { IRunEnvironment, makeEnvironment } from '../environment'\nimport { IFilterablePickle } from '../filter'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { resolvePaths } from '../paths'\nimport { makeRuntime } from '../runtime'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport { version } from '../version'\nimport {\n emitMetaMessage,\n emitSupportCodeMessages,\n} from './emit_support_code_messages'\nimport { initializeFormatters } from './formatters'\nimport { getPicklesAndErrors } from './gherkin'\nimport { initializeForRunCucumber } from './plugins'\nimport { getSupportCodeLibrary } from './support'\nimport { IRunOptions, IRunResult } from './types'\n\n/**\n * Execute a Cucumber test run and return the overall result\n *\n * @public\n * @param options - Options for the run, obtainable via {@link loadConfiguration}\n * @param environment - Project environment\n * @param onMessage - Callback fired each time Cucumber emits a message\n */\nexport async function runCucumber(\n options: IRunOptions,\n environment: IRunEnvironment = {},\n onMessage?: (message: Envelope) => void\n): Promise<IRunResult> {\n const mergedEnvironment = makeEnvironment(environment)\n const { cwd, stdout, stderr, env, logger } = mergedEnvironment\n\n logger.debug(`Running cucumber-js ${version} \nWorking directory: ${cwd}\nRunning from: ${__dirname} \n`)\n\n const newId = IdGenerator.uuid()\n\n const supportCoordinates =\n 'originalCoordinates' in options.support\n ? options.support.originalCoordinates\n : Object.assign(\n {\n requireModules: [],\n requirePaths: [],\n loaders: [],\n importPaths: [],\n },\n options.support\n )\n\n const pluginManager = await initializeForRunCucumber(\n {\n ...options,\n support: supportCoordinates,\n },\n mergedEnvironment\n )\n\n const resolvedPaths = await resolvePaths(\n logger,\n cwd,\n options.sources,\n supportCoordinates\n )\n pluginManager.emit('paths:resolve', resolvedPaths)\n const { sourcePaths, requirePaths, importPaths } = resolvedPaths\n\n const supportCodeLibrary =\n 'originalCoordinates' in options.support\n ? (options.support as SupportCodeLibrary)\n : await getSupportCodeLibrary({\n logger,\n cwd,\n newId,\n requirePaths,\n requireModules: supportCoordinates.requireModules,\n importPaths,\n loaders: supportCoordinates.loaders,\n })\n\n const eventBroadcaster = new EventEmitter()\n if (onMessage) {\n eventBroadcaster.on('envelope', onMessage)\n }\n eventBroadcaster.on('envelope', (value) =>\n pluginManager.emit('message', value)\n )\n const eventDataCollector = new EventDataCollector(eventBroadcaster)\n\n let formatterStreamError = false\n const cleanupFormatters = await initializeFormatters({\n env,\n cwd,\n stdout,\n stderr,\n logger,\n onStreamError: () => (formatterStreamError = true),\n eventBroadcaster,\n eventDataCollector,\n configuration: options.formats,\n supportCodeLibrary,\n pluginManager,\n })\n await emitMetaMessage(eventBroadcaster, env)\n\n let filteredPickles: ReadonlyArray<IFilterablePickle> = []\n let parseErrors: ParseError[] = []\n if (sourcePaths.length > 0) {\n const gherkinResult = await getPicklesAndErrors({\n newId,\n cwd,\n sourcePaths,\n coordinates: options.sources,\n onEnvelope: (envelope) => eventBroadcaster.emit('envelope', envelope),\n })\n filteredPickles = await pluginManager.transform(\n 'pickles:filter',\n gherkinResult.filterablePickles\n )\n filteredPickles = await pluginManager.transform(\n 'pickles:order',\n filteredPickles\n )\n parseErrors = gherkinResult.parseErrors\n }\n if (parseErrors.length) {\n parseErrors.forEach((parseError) => {\n logger.error(\n `Parse error in \"${parseError.source.uri}\" ${parseError.message}`\n )\n })\n await cleanupFormatters()\n await pluginManager.cleanup()\n return {\n success: false,\n support: supportCodeLibrary,\n }\n }\n\n emitSupportCodeMessages({\n eventBroadcaster,\n supportCodeLibrary,\n newId,\n })\n\n const runtime = await makeRuntime({\n environment: mergedEnvironment,\n logger,\n eventBroadcaster,\n sourcedPickles: filteredPickles,\n newId,\n supportCodeLibrary,\n options: options.runtime,\n snippetOptions: options.formats.options,\n })\n const success = await runtime.run()\n await pluginManager.cleanup()\n await cleanupFormatters()\n\n return {\n success: success && !formatterStreamError,\n support: supportCodeLibrary,\n }\n}\n"]}
|
|
@@ -8,6 +8,11 @@ function validateConfiguration(configuration, logger) {
|
|
|
8
8
|
if (configuration.loader.length && !configuration.import.length) {
|
|
9
9
|
logger.warn('Use of `loader` option normally means you should specify your support code paths with `import`; see https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code');
|
|
10
10
|
}
|
|
11
|
+
if (configuration.formatOptions.colorsEnabled !== undefined) {
|
|
12
|
+
logger.warn(`The 'colorsEnabled' format option is deprecated and will be removed in a future major version. ` +
|
|
13
|
+
`Use the FORCE_COLOR environment variable instead (FORCE_COLOR=1 to enable, FORCE_COLOR=0 to disable); ` +
|
|
14
|
+
`see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md`);
|
|
15
|
+
}
|
|
11
16
|
if (configuration.retryTagFilter && !configuration.retry) {
|
|
12
17
|
throw new Error('a positive `retry` count must be specified when setting `retryTagFilter`');
|
|
13
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate_configuration.js","sourceRoot":"","sources":["../../src/configuration/validate_configuration.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"validate_configuration.js","sourceRoot":"","sources":["../../src/configuration/validate_configuration.ts"],"names":[],"mappings":";;AAGA,sDA+BC;AA/BD,SAAgB,qBAAqB,CACnC,aAA6B,EAC7B,MAAe;IAEf,IAAI,aAAa,CAAC,aAAa,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACxE,MAAM,CAAC,IAAI,CACT,wMAAwM,CACzM,CAAA;IACH,CAAC;IACD,IAAI,aAAa,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAChE,MAAM,CAAC,IAAI,CACT,+LAA+L,CAChM,CAAA;IACH,CAAC;IACD,IAAI,aAAa,CAAC,aAAa,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;QAC5D,MAAM,CAAC,IAAI,CACT,iGAAiG;YAC/F,wGAAwG;YACxG,4EAA4E,CAC/E,CAAA;IACH,CAAC;IACD,IAAI,aAAa,CAAC,cAAc,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAA;IACH,CAAC;IACD,IAAI,aAAa,CAAC,KAAK,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QACnE,MAAM,IAAI,KAAK,CACb,mEAAmE,CACpE,CAAA;IACH,CAAC;AACH,CAAC","sourcesContent":["import { ILogger } from '../environment'\nimport { IConfiguration } from './types'\n\nexport function validateConfiguration(\n configuration: IConfiguration,\n logger: ILogger\n): void {\n if (configuration.requireModule.length && !configuration.require.length) {\n logger.warn(\n 'Use of `require-module` option normally means you should specify your support code paths with `require`; see https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code'\n )\n }\n if (configuration.loader.length && !configuration.import.length) {\n logger.warn(\n 'Use of `loader` option normally means you should specify your support code paths with `import`; see https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code'\n )\n }\n if (configuration.formatOptions.colorsEnabled !== undefined) {\n logger.warn(\n `The 'colorsEnabled' format option is deprecated and will be removed in a future major version. ` +\n `Use the FORCE_COLOR environment variable instead (FORCE_COLOR=1 to enable, FORCE_COLOR=0 to disable); ` +\n `see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md`\n )\n }\n if (configuration.retryTagFilter && !configuration.retry) {\n throw new Error(\n 'a positive `retry` count must be specified when setting `retryTagFilter`'\n )\n }\n if (configuration.shard && !/^\\d+\\/\\d+$/.test(configuration.shard)) {\n throw new Error(\n 'the shard option must be in the format <index>/<total> (e.g. 1/3)'\n )\n }\n}\n"]}
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.filterPlugin = void 0;
|
|
7
7
|
const pickle_filter_1 = __importDefault(require("../pickle_filter"));
|
|
8
|
-
const
|
|
8
|
+
const order_pickles_1 = require("./order_pickles");
|
|
9
9
|
exports.filterPlugin = {
|
|
10
10
|
type: 'plugin',
|
|
11
11
|
coordinator: async ({ on, transform, options, logger, environment }) => {
|
|
@@ -24,7 +24,7 @@ exports.filterPlugin = {
|
|
|
24
24
|
});
|
|
25
25
|
transform('pickles:order', async (unorderedPickles) => {
|
|
26
26
|
const orderedPickles = [...unorderedPickles];
|
|
27
|
-
(0,
|
|
27
|
+
(0, order_pickles_1.orderPickles)(orderedPickles, options.order, logger);
|
|
28
28
|
return orderedPickles;
|
|
29
29
|
});
|
|
30
30
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter_plugin.js","sourceRoot":"","sources":["../../src/filter/filter_plugin.ts"],"names":[],"mappings":";;;;;;AACA,qEAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"filter_plugin.js","sourceRoot":"","sources":["../../src/filter/filter_plugin.ts"],"names":[],"mappings":";;;;;;AACA,qEAA2C;AAC3C,mDAA8C;AAEjC,QAAA,YAAY,GAAW;IAClC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE;QACrE,IAAI,qBAAqB,GAAa,EAAE,CAAA;QACxC,EAAE,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE;YAC5B,qBAAqB,GAAG,KAAK,CAAC,qBAAqB,CAAA;QACrD,CAAC,CAAC,CAAA;QAEF,SAAS,CAAC,gBAAgB,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE;YAC/C,MAAM,YAAY,GAAG,IAAI,uBAAY,CAAC;gBACpC,GAAG,EAAE,WAAW,CAAC,GAAG;gBACpB,YAAY,EAAE,qBAAqB;gBACnC,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,aAAa,EAAE,OAAO,CAAC,aAAa;aACrC,CAAC,CAAA;YAEF,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;QACpE,CAAC,CAAC,CAAA;QAEF,SAAS,CAAC,eAAe,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE;YACpD,MAAM,cAAc,GAAG,CAAC,GAAG,gBAAgB,CAAC,CAAA;YAC5C,IAAA,4BAAY,EAAC,cAAc,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;YACnD,OAAO,cAAc,CAAA;QACvB,CAAC,CAAC,CAAA;IACJ,CAAC;CACF,CAAA","sourcesContent":["import { Plugin } from '../plugin'\nimport PickleFilter from '../pickle_filter'\nimport { orderPickles } from './order_pickles'\n\nexport const filterPlugin: Plugin = {\n type: 'plugin',\n coordinator: async ({ on, transform, options, logger, environment }) => {\n let unexpandedSourcePaths: string[] = []\n on('paths:resolve', (paths) => {\n unexpandedSourcePaths = paths.unexpandedSourcePaths\n })\n\n transform('pickles:filter', async (allPickles) => {\n const pickleFilter = new PickleFilter({\n cwd: environment.cwd,\n featurePaths: unexpandedSourcePaths,\n names: options.names,\n tagExpression: options.tagExpression,\n })\n\n return allPickles.filter((pickle) => pickleFilter.matches(pickle))\n })\n\n transform('pickles:order', async (unorderedPickles) => {\n const orderedPickles = [...unorderedPickles]\n orderPickles(orderedPickles, options.order, logger)\n return orderedPickles\n })\n },\n}\n"]}
|
package/lib/filter/index.d.ts
CHANGED
package/lib/filter/index.js
CHANGED
|
@@ -14,7 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.orderPickles = void 0;
|
|
17
18
|
const filter_plugin_1 = require("./filter_plugin");
|
|
18
19
|
__exportStar(require("./types"), exports);
|
|
20
|
+
var order_pickles_1 = require("./order_pickles");
|
|
21
|
+
Object.defineProperty(exports, "orderPickles", { enumerable: true, get: function () { return order_pickles_1.orderPickles; } });
|
|
19
22
|
exports.default = filter_plugin_1.filterPlugin;
|
|
20
23
|
//# sourceMappingURL=index.js.map
|
package/lib/filter/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/filter/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/filter/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mDAA8C;AAC9C,0CAAuB;AACvB,iDAA8C;AAArC,6GAAA,YAAY,OAAA;AAErB,kBAAe,4BAAY,CAAA","sourcesContent":["import { filterPlugin } from './filter_plugin'\nexport * from './types'\nexport { orderPickles } from './order_pickles'\n\nexport default filterPlugin\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
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.orderPickles = orderPickles;
|
|
7
|
+
const knuth_shuffle_seeded_1 = __importDefault(require("knuth-shuffle-seeded"));
|
|
8
|
+
// Orders the pickleIds in place - morphs input
|
|
9
|
+
function orderPickles(pickleIds, order, logger) {
|
|
10
|
+
const [type, seed] = splitOrder(order);
|
|
11
|
+
switch (type) {
|
|
12
|
+
case 'defined':
|
|
13
|
+
break;
|
|
14
|
+
case 'reverse':
|
|
15
|
+
pickleIds.reverse();
|
|
16
|
+
break;
|
|
17
|
+
case 'random':
|
|
18
|
+
if (seed === '') {
|
|
19
|
+
const newSeed = Math.floor(Math.random() * 1000 * 1000).toString();
|
|
20
|
+
logger.warn(`Random order using seed: ${newSeed}`);
|
|
21
|
+
(0, knuth_shuffle_seeded_1.default)(pickleIds, newSeed);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
(0, knuth_shuffle_seeded_1.default)(pickleIds, seed);
|
|
25
|
+
}
|
|
26
|
+
break;
|
|
27
|
+
default:
|
|
28
|
+
throw new Error('Unrecognized order type. Should be `defined` or `random`');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function splitOrder(order) {
|
|
32
|
+
if (!order.includes(':')) {
|
|
33
|
+
return [order, ''];
|
|
34
|
+
}
|
|
35
|
+
return order.split(':');
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=order_pickles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order_pickles.js","sourceRoot":"","sources":["../../src/filter/order_pickles.ts"],"names":[],"mappings":";;;;;AAKA,oCA0BC;AA/BD,gFAA0C;AAI1C,+CAA+C;AAC/C,SAAgB,YAAY,CAC1B,SAAc,EACd,KAAmB,EACnB,MAAe;IAEf,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;IACtC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,SAAS;YACZ,MAAK;QACP,KAAK,SAAS;YACZ,SAAS,CAAC,OAAO,EAAE,CAAA;YACnB,MAAK;QACP,KAAK,QAAQ;YACX,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;gBAChB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAA;gBAClE,MAAM,CAAC,IAAI,CAAC,4BAA4B,OAAO,EAAE,CAAC,CAAA;gBAClD,IAAA,8BAAO,EAAC,SAAS,EAAE,OAAO,CAAC,CAAA;YAC7B,CAAC;iBAAM,CAAC;gBACN,IAAA,8BAAO,EAAC,SAAS,EAAE,IAAI,CAAC,CAAA;YAC1B,CAAC;YACD,MAAK;QACP;YACE,MAAM,IAAI,KAAK,CACb,0DAA0D,CAC3D,CAAA;IACL,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IACpB,CAAC;IACD,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;AACzB,CAAC","sourcesContent":["import shuffle from 'knuth-shuffle-seeded'\nimport { ILogger } from '../environment'\nimport { IPickleOrder } from './types'\n\n// Orders the pickleIds in place - morphs input\nexport function orderPickles<T = string>(\n pickleIds: T[],\n order: IPickleOrder,\n logger: ILogger\n): void {\n const [type, seed] = splitOrder(order)\n switch (type) {\n case 'defined':\n break\n case 'reverse':\n pickleIds.reverse()\n break\n case 'random':\n if (seed === '') {\n const newSeed = Math.floor(Math.random() * 1000 * 1000).toString()\n logger.warn(`Random order using seed: ${newSeed}`)\n shuffle(pickleIds, newSeed)\n } else {\n shuffle(pickleIds, seed)\n }\n break\n default:\n throw new Error(\n 'Unrecognized order type. Should be `defined` or `random`'\n )\n }\n}\n\nfunction splitOrder(order: string) {\n if (!order.includes(':')) {\n return [order, '']\n }\n return order.split(':')\n}\n"]}
|
package/lib/formatter/index.d.ts
CHANGED
|
@@ -10,6 +10,9 @@ export interface FormatRerunOptions {
|
|
|
10
10
|
separator?: string;
|
|
11
11
|
}
|
|
12
12
|
export interface FormatOptions {
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated use `FORCE_COLOR` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md
|
|
15
|
+
*/
|
|
13
16
|
colorsEnabled?: boolean;
|
|
14
17
|
html?: {
|
|
15
18
|
externalAttachments?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/formatter/index.ts"],"names":[],"mappings":";;AAGA,oDAAiD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/formatter/index.ts"],"names":[],"mappings":";;AAGA,oDAAiD;AA4CjD,MAAqB,SAAS;IAClB,QAAQ,CAAW;IACnB,GAAG,CAAQ;IACX,kBAAkB,CAAoB;IACtC,GAAG,CAAiB;IACpB,cAAc,CAA8B;IAC5C,MAAM,CAAU;IAChB,kBAAkB,CAAoB;IACtC,gBAAgB,CAAS;IAClB,OAAO,CAAqB;IAC7C,MAAM,CAAU,aAAa,CAAQ;IAErC,YAAY,OAA0B;QACpC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;QAChC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;QACtB,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAA;QACpD,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;QACtB,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAA;QAC5C,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAC5B,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAA;QACpD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;QAC9B,IAAI,CAAC,gBAAgB,GAAG,IAAA,8BAAc,EACpC,OAAO,CAAC,iBAAiB,CAAC,gBAAgB,EAC1C,IAAI,CACL,CAAA;IACH,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,OAAO,EAAE,CAAA;IACtB,CAAC;CACF;AA9BD,4BA8BC","sourcesContent":["import { Writable } from 'node:stream'\nimport { EventEmitter } from 'node:events'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport { valueOrDefault } from '../value_checker'\nimport { FormatterPlugin } from '../plugin'\nimport { IColorFns } from './get_color_fns'\nimport { EventDataCollector } from './helpers'\nimport StepDefinitionSnippetBuilder from './step_definition_snippet_builder'\nimport { SnippetInterface } from './step_definition_snippet_builder/snippet_syntax'\n\nexport interface FormatRerunOptions {\n separator?: string\n}\n\nexport interface FormatOptions {\n /**\n * @deprecated use `FORCE_COLOR` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md\n */\n colorsEnabled?: boolean\n html?: {\n externalAttachments?: boolean\n }\n rerun?: FormatRerunOptions\n snippetInterface?: SnippetInterface\n snippetSyntax?: string\n printAttachments?: boolean\n [customKey: string]: any\n}\n\nexport type FormatterImplementation = typeof Formatter | FormatterPlugin\nexport type IFormatterStream = Writable\nexport type IFormatterLogFn = (buffer: string | Uint8Array) => void\nexport type IFormatterCleanupFn = () => Promise<any>\n\nexport interface IFormatterOptions {\n colorFns: IColorFns\n cwd: string\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n log: IFormatterLogFn\n parsedArgvOptions: FormatOptions\n snippetBuilder: StepDefinitionSnippetBuilder\n stream: Writable\n cleanup: IFormatterCleanupFn\n supportCodeLibrary: SupportCodeLibrary\n}\n\nexport default class Formatter {\n protected colorFns: IColorFns\n protected cwd: string\n protected eventDataCollector: EventDataCollector\n protected log: IFormatterLogFn\n protected snippetBuilder: StepDefinitionSnippetBuilder\n protected stream: Writable\n protected supportCodeLibrary: SupportCodeLibrary\n protected printAttachments: boolean\n private readonly cleanup: IFormatterCleanupFn\n static readonly documentation: string\n\n constructor(options: IFormatterOptions) {\n this.colorFns = options.colorFns\n this.cwd = options.cwd\n this.eventDataCollector = options.eventDataCollector\n this.log = options.log\n this.snippetBuilder = options.snippetBuilder\n this.stream = options.stream\n this.supportCodeLibrary = options.supportCodeLibrary\n this.cleanup = options.cleanup\n this.printAttachments = valueOrDefault(\n options.parsedArgvOptions.printAttachments,\n true\n )\n }\n\n async finished(): Promise<void> {\n await this.cleanup()\n }\n}\n"]}
|
|
@@ -25,6 +25,7 @@ export interface IDefinitionParameters<T extends IDefinitionOptions> {
|
|
|
25
25
|
id: string;
|
|
26
26
|
line: number;
|
|
27
27
|
options: T;
|
|
28
|
+
order: number;
|
|
28
29
|
unwrappedCode?: Function;
|
|
29
30
|
uri: string;
|
|
30
31
|
}
|
|
@@ -38,6 +39,7 @@ export interface IDefinition {
|
|
|
38
39
|
readonly id: string;
|
|
39
40
|
readonly line: number;
|
|
40
41
|
readonly options: IDefinitionOptions;
|
|
42
|
+
readonly order: number;
|
|
41
43
|
readonly unwrappedCode: Function;
|
|
42
44
|
readonly uri: string;
|
|
43
45
|
getInvocationParameters: (options: IGetInvocationDataRequest) => Promise<IGetInvocationDataResponse>;
|
|
@@ -47,9 +49,10 @@ export default abstract class Definition {
|
|
|
47
49
|
readonly id: string;
|
|
48
50
|
readonly line: number;
|
|
49
51
|
readonly options: IDefinitionOptions;
|
|
52
|
+
readonly order: number;
|
|
50
53
|
readonly unwrappedCode: Function;
|
|
51
54
|
readonly uri: string;
|
|
52
|
-
constructor({ code, id, line, options, unwrappedCode, uri, }: IDefinitionParameters<IDefinitionOptions>);
|
|
55
|
+
constructor({ code, id, line, options, order, unwrappedCode, uri, }: IDefinitionParameters<IDefinitionOptions>);
|
|
53
56
|
buildInvalidCodeLengthMessage(syncOrPromiseLength: number | string, callbackLength: number | string): string;
|
|
54
57
|
baseGetInvalidCodeLengthMessage(parameters: any[]): string;
|
|
55
58
|
}
|
package/lib/models/definition.js
CHANGED
|
@@ -5,13 +5,15 @@ class Definition {
|
|
|
5
5
|
id;
|
|
6
6
|
line;
|
|
7
7
|
options;
|
|
8
|
+
order;
|
|
8
9
|
unwrappedCode;
|
|
9
10
|
uri;
|
|
10
|
-
constructor({ code, id, line, options, unwrappedCode, uri, }) {
|
|
11
|
+
constructor({ code, id, line, options, order, unwrappedCode, uri, }) {
|
|
11
12
|
this.code = code;
|
|
12
13
|
this.id = id;
|
|
13
14
|
this.line = line;
|
|
14
15
|
this.options = options;
|
|
16
|
+
this.order = order;
|
|
15
17
|
this.unwrappedCode = unwrappedCode;
|
|
16
18
|
this.uri = uri;
|
|
17
19
|
}
|