@cucumber/cucumber 11.1.1 → 11.2.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/README.md +9 -7
- package/lib/api/convert_configuration.d.ts +1 -1
- package/lib/api/convert_configuration.js.map +1 -1
- package/lib/api/formatters.d.ts +1 -1
- package/lib/api/formatters.js +1 -1
- package/lib/api/formatters.js.map +1 -1
- package/lib/api/index.d.ts +1 -0
- package/lib/api/index.js.map +1 -1
- package/lib/api/load_configuration.d.ts +2 -1
- package/lib/api/load_configuration.js +2 -2
- package/lib/api/load_configuration.js.map +1 -1
- package/lib/api/load_sources.d.ts +2 -1
- package/lib/api/load_sources.js +3 -3
- package/lib/api/load_sources.js.map +1 -1
- package/lib/api/load_support.d.ts +2 -1
- package/lib/api/load_support.js +3 -3
- package/lib/api/load_support.js.map +1 -1
- package/lib/api/plugins.d.ts +5 -5
- package/lib/api/plugins.js +9 -9
- package/lib/api/plugins.js.map +1 -1
- package/lib/api/run_cucumber.d.ts +2 -1
- package/lib/api/run_cucumber.js +3 -3
- package/lib/api/run_cucumber.js.map +1 -1
- package/lib/api/support.d.ts +1 -1
- package/lib/api/support.js.map +1 -1
- package/lib/api/test_helpers.d.ts +1 -1
- package/lib/api/test_helpers.js.map +1 -1
- package/lib/api/types.d.ts +0 -35
- package/lib/api/types.js.map +1 -1
- package/lib/assemble/assemble_test_cases.d.ts +1 -6
- package/lib/assemble/assemble_test_cases.js +2 -1
- package/lib/assemble/assemble_test_cases.js.map +1 -1
- package/lib/cli/helpers.d.ts +1 -1
- package/lib/cli/helpers.js +41 -22
- package/lib/cli/helpers.js.map +1 -1
- package/lib/configuration/from_file.d.ts +1 -1
- package/lib/configuration/from_file.js +2 -2
- package/lib/configuration/from_file.js.map +1 -1
- package/lib/configuration/parse_configuration.d.ts +1 -1
- package/lib/configuration/parse_configuration.js.map +1 -1
- package/lib/configuration/split_format_descriptor.d.ts +1 -1
- package/lib/configuration/split_format_descriptor.js.map +1 -1
- package/lib/configuration/validate_configuration.d.ts +1 -1
- package/lib/configuration/validate_configuration.js.map +1 -1
- package/lib/environment/console_logger.d.ts +12 -0
- package/lib/{api → environment}/console_logger.js +6 -6
- package/lib/environment/console_logger.js.map +1 -0
- package/lib/environment/index.d.ts +2 -0
- package/lib/environment/index.js +19 -0
- package/lib/environment/index.js.map +1 -0
- package/lib/environment/make_environment.d.ts +2 -0
- package/lib/{api/environment.js → environment/make_environment.js} +4 -4
- package/lib/environment/make_environment.js.map +1 -0
- package/lib/environment/types.d.ts +42 -0
- package/lib/{logger.js → environment/types.js} +1 -1
- package/lib/environment/types.js.map +1 -0
- package/lib/formatter/create_stream.d.ts +1 -1
- package/lib/formatter/create_stream.js.map +1 -1
- package/lib/paths/paths.d.ts +1 -1
- package/lib/paths/paths.js.map +1 -1
- package/lib/plugin/plugin_manager.d.ts +5 -4
- package/lib/plugin/plugin_manager.js +13 -5
- package/lib/plugin/plugin_manager.js.map +1 -1
- package/lib/plugin/types.d.ts +4 -3
- package/lib/plugin/types.js.map +1 -1
- package/lib/runtime/coordinator.js +4 -6
- package/lib/runtime/coordinator.js.map +1 -1
- package/lib/runtime/make_runtime.d.ts +3 -2
- package/lib/runtime/make_runtime.js.map +1 -1
- package/lib/runtime/parallel/adapter.d.ts +2 -2
- package/lib/runtime/parallel/adapter.js.map +1 -1
- package/lib/runtime/step_runner.js +6 -4
- package/lib/runtime/step_runner.js.map +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 +9 -9
- package/lib/api/console_logger.d.ts +0 -12
- package/lib/api/console_logger.js.map +0 -1
- package/lib/api/environment.d.ts +0 -7
- package/lib/api/environment.js.map +0 -1
- package/lib/logger.d.ts +0 -5
- package/lib/logger.js.map +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.assembleTestCases = void 0;
|
|
4
4
|
const value_checker_1 = require("../value_checker");
|
|
5
|
-
async function assembleTestCases(
|
|
5
|
+
async function assembleTestCases(testRunStartedId, eventBroadcaster, newId, sourcedPickles, supportCodeLibrary) {
|
|
6
6
|
return sourcedPickles.map(({ gherkinDocument, pickle }) => {
|
|
7
7
|
const testCaseId = newId();
|
|
8
8
|
const fromBeforeHooks = makeBeforeHookSteps({
|
|
@@ -21,6 +21,7 @@ async function assembleTestCases({ eventBroadcaster, newId, sourcedPickles, supp
|
|
|
21
21
|
newId,
|
|
22
22
|
});
|
|
23
23
|
const testCase = {
|
|
24
|
+
testRunStartedId,
|
|
24
25
|
pickleId: pickle.id,
|
|
25
26
|
id: testCaseId,
|
|
26
27
|
testSteps: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assemble_test_cases.js","sourceRoot":"","sources":["../../src/assemble/assemble_test_cases.ts"],"names":[],"mappings":";;;AAWA,oDAAgD;AAGzC,KAAK,UAAU,iBAAiB,
|
|
1
|
+
{"version":3,"file":"assemble_test_cases.js","sourceRoot":"","sources":["../../src/assemble/assemble_test_cases.ts"],"names":[],"mappings":";;;AAWA,oDAAgD;AAGzC,KAAK,UAAU,iBAAiB,CACrC,gBAAwB,EACxB,gBAA8B,EAC9B,KAAwB,EACxB,cAA4C,EAC5C,kBAAsC;IAEtC,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,EAAE;QACxD,MAAM,UAAU,GAAG,KAAK,EAAE,CAAA;QAC1B,MAAM,eAAe,GAAe,mBAAmB,CAAC;YACtD,kBAAkB;YAClB,MAAM;YACN,KAAK;SACN,CAAC,CAAA;QACF,MAAM,mBAAmB,GAAe,SAAS,CAAC;YAChD,MAAM;YACN,kBAAkB;YAClB,KAAK;SACN,CAAC,CAAA;QACF,MAAM,cAAc,GAAe,kBAAkB,CAAC;YACpD,kBAAkB;YAClB,MAAM;YACN,KAAK;SACN,CAAC,CAAA;QACF,MAAM,QAAQ,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\n Group as MessagesGroup,\n} from '@cucumber/messages'\nimport { Group } from '@cucumber/cucumber-expressions'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport { doesHaveValue } from '../value_checker'\nimport { AssembledTestCase, SourcedPickle } from './types'\n\nexport async function assembleTestCases(\n testRunStartedId: string,\n eventBroadcaster: EventEmitter,\n newId: IdGenerator.NewId,\n sourcedPickles: ReadonlyArray<SourcedPickle>,\n supportCodeLibrary: SupportCodeLibrary\n): Promise<ReadonlyArray<AssembledTestCase>> {\n return sourcedPickles.map(({ gherkinDocument, pickle }) => {\n const testCaseId = newId()\n const fromBeforeHooks: TestStep[] = makeBeforeHookSteps({\n supportCodeLibrary,\n pickle,\n newId,\n })\n const fromStepDefinitions: TestStep[] = makeSteps({\n pickle,\n supportCodeLibrary,\n newId,\n })\n const fromAfterHooks: TestStep[] = makeAfterHookSteps({\n supportCodeLibrary,\n pickle,\n newId,\n })\n const testCase: TestCase = {\n testRunStartedId,\n pickleId: pickle.id,\n id: testCaseId,\n testSteps: [\n ...fromBeforeHooks,\n ...fromStepDefinitions,\n ...fromAfterHooks,\n ],\n }\n eventBroadcaster.emit('envelope', { testCase } satisfies Envelope)\n return {\n gherkinDocument,\n pickle,\n testCase,\n }\n })\n}\n\nfunction makeAfterHookSteps({\n supportCodeLibrary,\n pickle,\n newId,\n}: {\n supportCodeLibrary: SupportCodeLibrary\n pickle: Pickle\n newId: IdGenerator.NewId\n}): TestStep[] {\n return supportCodeLibrary.afterTestCaseHookDefinitions\n .slice(0)\n .reverse()\n .filter((hookDefinition) => hookDefinition.appliesToTestCase(pickle))\n .map((hookDefinition) => ({\n id: newId(),\n hookId: hookDefinition.id,\n }))\n}\n\nfunction makeBeforeHookSteps({\n supportCodeLibrary,\n pickle,\n newId,\n}: {\n supportCodeLibrary: SupportCodeLibrary\n pickle: Pickle\n newId: IdGenerator.NewId\n}): TestStep[] {\n return supportCodeLibrary.beforeTestCaseHookDefinitions\n .filter((hookDefinition) => hookDefinition.appliesToTestCase(pickle))\n .map((hookDefinition) => ({\n id: newId(),\n hookId: hookDefinition.id,\n }))\n}\n\nfunction makeSteps({\n pickle,\n supportCodeLibrary,\n newId,\n}: {\n pickle: Pickle\n supportCodeLibrary: SupportCodeLibrary\n newId: () => string\n}): TestStep[] {\n return pickle.steps.map((pickleStep) => {\n const stepDefinitions = supportCodeLibrary.stepDefinitions.filter(\n (stepDefinition) => stepDefinition.matchesStepName(pickleStep.text)\n )\n return {\n id: newId(),\n pickleStepId: pickleStep.id,\n stepDefinitionIds: stepDefinitions.map(\n (stepDefinition) => stepDefinition.id\n ),\n stepMatchArgumentsLists: stepDefinitions.map((stepDefinition) => {\n const result = stepDefinition.expression.match(pickleStep.text)\n return {\n stepMatchArguments: result.map((arg) => {\n return {\n group: mapArgumentGroup(arg.group),\n parameterTypeName: arg.parameterType.name,\n }\n }),\n }\n }),\n }\n })\n}\n\nfunction mapArgumentGroup(group: Group): MessagesGroup {\n return {\n start: group.start,\n value: group.value,\n children: doesHaveValue(group.children)\n ? group.children.map((child) => mapArgumentGroup(child))\n : undefined,\n }\n}\n"]}
|
package/lib/cli/helpers.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { EventEmitter } from 'node:events';
|
|
4
4
|
import { IdGenerator } from '@cucumber/messages';
|
|
5
5
|
import { SupportCodeLibrary } from '../support_code_library_builder/types';
|
|
6
|
-
import { ILogger } from '../
|
|
6
|
+
import { ILogger } from '../environment';
|
|
7
7
|
import { IPickleOrder } from '../filter';
|
|
8
8
|
export declare function orderPickles<T = string>(pickleIds: T[], order: IPickleOrder, logger: ILogger): void;
|
|
9
9
|
export declare function emitMetaMessage(eventBroadcaster: EventEmitter, env: NodeJS.ProcessEnv): Promise<void>;
|
package/lib/cli/helpers.js
CHANGED
|
@@ -30,6 +30,7 @@ exports.emitSupportCodeMessages = exports.emitMetaMessage = exports.orderPickles
|
|
|
30
30
|
const node_os_1 = __importDefault(require("node:os"));
|
|
31
31
|
const knuth_shuffle_seeded_1 = __importDefault(require("knuth-shuffle-seeded"));
|
|
32
32
|
const messages = __importStar(require("@cucumber/messages"));
|
|
33
|
+
const messages_1 = require("@cucumber/messages");
|
|
33
34
|
const ci_environment_1 = __importDefault(require("@cucumber/ci-environment"));
|
|
34
35
|
const version_1 = require("../version");
|
|
35
36
|
// Orders the pickleIds in place - morphs input
|
|
@@ -137,32 +138,50 @@ function emitStepDefinitions(supportCodeLibrary, eventBroadcaster) {
|
|
|
137
138
|
}
|
|
138
139
|
function emitTestCaseHooks(supportCodeLibrary, eventBroadcaster) {
|
|
139
140
|
;
|
|
140
|
-
[
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
141
|
+
[
|
|
142
|
+
[
|
|
143
|
+
supportCodeLibrary.beforeTestCaseHookDefinitions,
|
|
144
|
+
messages_1.HookType.BEFORE_TEST_CASE,
|
|
145
|
+
],
|
|
146
|
+
[
|
|
147
|
+
supportCodeLibrary.afterTestCaseHookDefinitions,
|
|
148
|
+
messages_1.HookType.AFTER_TEST_CASE,
|
|
149
|
+
],
|
|
150
|
+
].forEach(([hooks, type]) => {
|
|
151
|
+
hooks.forEach((hook) => {
|
|
152
|
+
eventBroadcaster.emit('envelope', {
|
|
153
|
+
hook: {
|
|
154
|
+
id: hook.id,
|
|
155
|
+
type,
|
|
156
|
+
name: hook.name,
|
|
157
|
+
tagExpression: hook.tagExpression,
|
|
158
|
+
sourceReference: makeSourceReference(hook),
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
});
|
|
152
162
|
});
|
|
153
163
|
}
|
|
154
164
|
function emitTestRunHooks(supportCodeLibrary, eventBroadcaster) {
|
|
155
165
|
;
|
|
156
|
-
[
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
+
[
|
|
167
|
+
[
|
|
168
|
+
supportCodeLibrary.beforeTestRunHookDefinitions,
|
|
169
|
+
messages_1.HookType.BEFORE_TEST_RUN,
|
|
170
|
+
],
|
|
171
|
+
[
|
|
172
|
+
supportCodeLibrary.afterTestRunHookDefinitions,
|
|
173
|
+
messages_1.HookType.AFTER_TEST_RUN,
|
|
174
|
+
],
|
|
175
|
+
].forEach(([hooks, type]) => {
|
|
176
|
+
hooks.forEach((hook) => {
|
|
177
|
+
eventBroadcaster.emit('envelope', {
|
|
178
|
+
hook: {
|
|
179
|
+
id: hook.id,
|
|
180
|
+
type,
|
|
181
|
+
sourceReference: makeSourceReference(hook),
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
});
|
|
166
185
|
});
|
|
167
186
|
}
|
|
168
187
|
function emitSupportCodeMessages({ eventBroadcaster, supportCodeLibrary, newId, }) {
|
package/lib/cli/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sDAAwB;AACxB,gFAA0C;AAC1C,6DAA8C;AAE9C,8EAA0D;AAI1D,wCAAoC;AAKpC,+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;QACZ,KAAK,SAAS;YACZ,MAAK;QACP,KAAK,QAAQ;YACX,IAAI,IAAI,KAAK,EAAE,EAAE;gBACf,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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AA;IAC7C,CAAC,CAAC,CAAA;AACN,CAAC;AAED,SAAgB,uBAAuB,CAAC,EACtC,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,GAKN;IACC,kBAAkB,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAA;IAC/D,2BAA2B,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACjE,mBAAmB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACzD,iBAAiB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACvD,gBAAgB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;AACxD,CAAC;AAdD,0DAcC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport os from 'node:os'\nimport shuffle from 'knuth-shuffle-seeded'\nimport * as messages from '@cucumber/messages'\nimport { IdGenerator } from '@cucumber/messages'\nimport detectCiEnvironment from '@cucumber/ci-environment'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport TestCaseHookDefinition from '../models/test_case_hook_definition'\nimport TestRunHookDefinition from '../models/test_run_hook_definition'\nimport { version } from '../version'\nimport { ILogger } from '../logger'\nimport { ILineAndUri } from '../types'\nimport { IPickleOrder } from '../filter'\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 '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\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\nconst makeSourceReference = (source: ILineAndUri) => ({\n uri: source.uri,\n location: {\n line: source.line,\n },\n})\n\nfunction emitParameterTypes(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter,\n newId: IdGenerator.NewId\n): void {\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 const envelope: messages.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 eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitUndefinedParameterTypes(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n for (const undefinedParameterType of supportCodeLibrary.undefinedParameterTypes) {\n const envelope: messages.Envelope = {\n undefinedParameterType,\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitStepDefinitions(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n supportCodeLibrary.stepDefinitions.forEach((stepDefinition) => {\n const envelope: messages.Envelope = {\n stepDefinition: {\n id: stepDefinition.id,\n pattern: {\n source: stepDefinition.pattern.toString(),\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 eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestCaseHooks(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestCaseHookDefinitions,\n supportCodeLibrary.afterTestCaseHookDefinitions\n )\n .forEach((testCaseHookDefinition: TestCaseHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testCaseHookDefinition.id,\n name: testCaseHookDefinition.name,\n tagExpression: testCaseHookDefinition.tagExpression,\n sourceReference: makeSourceReference(testCaseHookDefinition),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestRunHooks(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestRunHookDefinitions,\n supportCodeLibrary.afterTestRunHookDefinitions\n )\n .forEach((testRunHookDefinition: TestRunHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testRunHookDefinition.id,\n sourceReference: makeSourceReference(testRunHookDefinition),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\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 emitParameterTypes(supportCodeLibrary, eventBroadcaster, newId)\n emitUndefinedParameterTypes(supportCodeLibrary, eventBroadcaster)\n emitStepDefinitions(supportCodeLibrary, eventBroadcaster)\n emitTestCaseHooks(supportCodeLibrary, eventBroadcaster)\n emitTestRunHooks(supportCodeLibrary, eventBroadcaster)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sDAAwB;AACxB,gFAA0C;AAC1C,6DAA8C;AAC9C,iDA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IAAI;oBACf,aAAa,EAAE,IAAI,CAAC,aAAa;oBACjC,eAAe,EAAE,mBAAmB,CAAC,IAAI,CAAC;iBAC3C;aACiB,CAAC,CAAA;QACvB,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,gBAAgB,CACvB,kBAAsC,EACtC,gBAA8B;IAE9B,CAAC;IAAA;QACC;YACE,kBAAkB,CAAC,4BAA4B;YAC/C,mBAAQ,CAAC,eAAe;SAChB;QACV;YACE,kBAAkB,CAAC,2BAA2B;YAC9C,mBAAQ,CAAC,cAAc;SACf;KACX,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACrB,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE;gBAChC,IAAI,EAAE;oBACJ,EAAE,EAAE,IAAI,CAAC,EAAE;oBACX,IAAI;oBACJ,eAAe,EAAE,mBAAmB,CAAC,IAAI,CAAC;iBAC3C;aACiB,CAAC,CAAA;QACvB,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,SAAgB,uBAAuB,CAAC,EACtC,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,GAKN;IACC,kBAAkB,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAA;IAC/D,2BAA2B,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACjE,mBAAmB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACzD,iBAAiB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACvD,gBAAgB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;AACxD,CAAC;AAdD,0DAcC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport os from 'node:os'\nimport shuffle from 'knuth-shuffle-seeded'\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 { ILogger } from '../environment'\nimport { ILineAndUri } from '../types'\nimport { IPickleOrder } from '../filter'\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 '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\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\nconst makeSourceReference = (source: ILineAndUri) => ({\n uri: source.uri,\n location: {\n line: source.line,\n },\n})\n\nfunction emitParameterTypes(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter,\n newId: IdGenerator.NewId\n): void {\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 const envelope: messages.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 eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitUndefinedParameterTypes(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n for (const undefinedParameterType of supportCodeLibrary.undefinedParameterTypes) {\n const envelope: messages.Envelope = {\n undefinedParameterType,\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitStepDefinitions(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n supportCodeLibrary.stepDefinitions.forEach((stepDefinition) => {\n const envelope: messages.Envelope = {\n stepDefinition: {\n id: stepDefinition.id,\n pattern: {\n source: stepDefinition.pattern.toString(),\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 eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestCaseHooks(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[\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 ].forEach(([hooks, type]) => {\n hooks.forEach((hook) => {\n eventBroadcaster.emit('envelope', {\n hook: {\n id: hook.id,\n type,\n name: hook.name,\n tagExpression: hook.tagExpression,\n sourceReference: makeSourceReference(hook),\n },\n } satisfies Envelope)\n })\n })\n}\n\nfunction emitTestRunHooks(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[\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 ].forEach(([hooks, type]) => {\n hooks.forEach((hook) => {\n eventBroadcaster.emit('envelope', {\n hook: {\n id: hook.id,\n type,\n sourceReference: makeSourceReference(hook),\n },\n } satisfies Envelope)\n })\n })\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 emitParameterTypes(supportCodeLibrary, eventBroadcaster, newId)\n emitUndefinedParameterTypes(supportCodeLibrary, eventBroadcaster)\n emitStepDefinitions(supportCodeLibrary, eventBroadcaster)\n emitTestCaseHooks(supportCodeLibrary, eventBroadcaster)\n emitTestRunHooks(supportCodeLibrary, eventBroadcaster)\n}\n"]}
|
|
@@ -9,7 +9,6 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
9
9
|
const node_util_1 = require("node:util");
|
|
10
10
|
const node_url_1 = require("node:url");
|
|
11
11
|
const yaml_1 = __importDefault(require("yaml"));
|
|
12
|
-
const read_pkg_up_1 = __importDefault(require("read-pkg-up"));
|
|
13
12
|
const merge_configurations_1 = require("./merge_configurations");
|
|
14
13
|
const parse_configuration_1 = require("./parse_configuration");
|
|
15
14
|
async function fromFile(logger, cwd, file, profiles = []) {
|
|
@@ -97,7 +96,8 @@ async function loadFile(logger, cwd, file) {
|
|
|
97
96
|
return definitions;
|
|
98
97
|
}
|
|
99
98
|
async function readPackageJson(filePath) {
|
|
100
|
-
const
|
|
99
|
+
const { readPackageUp } = await import('read-package-up');
|
|
100
|
+
const parentPackage = await readPackageUp({ cwd: node_path_1.default.dirname(filePath) });
|
|
101
101
|
return parentPackage?.packageJson;
|
|
102
102
|
}
|
|
103
103
|
//# sourceMappingURL=from_file.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"from_file.js","sourceRoot":"","sources":["../../src/configuration/from_file.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAwB;AACxB,0DAA4B;AAC5B,yCAAqC;AACrC,uCAAwC;AACxC,gDAAuB;
|
|
1
|
+
{"version":3,"file":"from_file.js","sourceRoot":"","sources":["../../src/configuration/from_file.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAwB;AACxB,0DAA4B;AAC5B,yCAAqC;AACrC,uCAAwC;AACxC,gDAAuB;AAGvB,iEAA4D;AAC5D,+DAA0D;AAEnD,KAAK,UAAU,QAAQ,CAC5B,MAAe,EACf,GAAW,EACX,IAAY,EACZ,WAAqB,EAAE;IAEvB,IAAI,WAAW,GAAG,MAAM,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;IAEnD,MAAM,iBAAiB,GAAY,WAAW,CAAC,OAAO,CAAA;IAEtD,IAAI,iBAAiB,EAAE;QACrB,IAAI,OAAO,iBAAiB,KAAK,UAAU,EAAE;YAC3C,MAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAA;YACxD,WAAW,GAAG,MAAM,+BAA+B,CACjD,WAAW,EACX,iBAAiB,CAClB,CAAA;SACF;KACF;SAAM;QACL,MAAM,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAA;QAChE,WAAW,CAAC,OAAO,GAAG,EAAE,CAAA;KACzB;IAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;QACvB,MAAM,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAA;QAC5D,QAAQ,GAAG,CAAC,SAAS,CAAC,CAAA;KACvB;IAED,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;IAC5C,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;QAC9B,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;YACrC,MAAM,IAAI,KAAK,CAAC,sBAAsB,UAAU,iBAAiB,CAAC,CAAA;SACnE;IACH,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AAO,WAAW,CAAA;AACpB,CAAC;AAED,KAAK,UAAU,eAAe,CAAC,QAAgB;IAC7C,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAA;IACzD,MAAM,aAAa,GAAG,MAAM,aAAa,CAAC,EAAE,GAAG,EAAE,mBAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IAC1E,OAAO,aAAa,EAAE,WAAW,CAAA;AACnC,CAAC","sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\nimport { promisify } from 'node:util'\nimport { pathToFileURL } from 'node:url'\nimport YAML from 'yaml'\nimport { ILogger } from '../environment'\nimport { IConfiguration } from './types'\nimport { mergeConfigurations } from './merge_configurations'\nimport { parseConfiguration } from './parse_configuration'\n\nexport async function fromFile(\n logger: ILogger,\n cwd: string,\n file: string,\n profiles: string[] = []\n): Promise<Partial<IConfiguration>> {\n let definitions = await loadFile(logger, cwd, file)\n\n const defaultDefinition: unknown = definitions.default\n\n if (defaultDefinition) {\n if (typeof defaultDefinition === 'function') {\n logger.debug('Default function found; loading profiles')\n definitions = await handleDefaultFunctionDefinition(\n definitions,\n defaultDefinition\n )\n }\n } else {\n logger.debug('No default profile defined in configuration file')\n definitions.default = {}\n }\n\n if (profiles.length < 1) {\n logger.debug('No profiles specified; using default profile')\n profiles = ['default']\n }\n\n const definedKeys = Object.keys(definitions)\n profiles.forEach((profileKey) => {\n if (!definedKeys.includes(profileKey)) {\n throw new Error(`Requested profile \"${profileKey}\" doesn't exist`)\n }\n })\n return mergeConfigurations(\n {},\n ...profiles.map((profileKey) =>\n parseConfiguration(\n logger,\n `Profile \"${profileKey}\"`,\n definitions[profileKey]\n )\n )\n )\n}\n\nasync function handleDefaultFunctionDefinition(\n definitions: Record<string, any>,\n defaultDefinition: Function\n): Promise<Record<string, any>> {\n if (Object.keys(definitions).length > 1) {\n throw new Error(\n 'Invalid profiles specified: if a default function definition is provided, no other static profiles should be specified'\n )\n }\n\n const definitionsFromDefault = await defaultDefinition()\n\n return {\n default: {},\n ...definitionsFromDefault,\n }\n}\n\nasync function loadFile(\n logger: ILogger,\n cwd: string,\n file: string\n): Promise<Record<string, any>> {\n const filePath: string = path.join(cwd, file)\n const extension = path.extname(filePath)\n let definitions\n switch (extension) {\n case '.json':\n definitions = JSON.parse(\n await promisify(fs.readFile)(filePath, { encoding: 'utf-8' })\n )\n break\n case '.yaml':\n case '.yml':\n definitions = YAML.parse(\n await promisify(fs.readFile)(filePath, { encoding: 'utf-8' })\n )\n break\n case '.cjs':\n logger.debug(\n `Loading configuration file \"${file}\" as CommonJS based on extension`\n )\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n definitions = require(filePath)\n break\n case '.mjs':\n logger.debug(\n `Loading configuration file \"${file}\" as ESM based on extension`\n )\n definitions = await import(pathToFileURL(filePath).toString())\n break\n case '.js':\n {\n const parentPackage = await readPackageJson(filePath)\n if (!parentPackage) {\n logger.debug(\n `Loading configuration file \"${file}\" as CommonJS based on absence of a parent package`\n )\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n definitions = require(filePath)\n } else if (parentPackage.type === 'module') {\n logger.debug(\n `Loading configuration file \"${file}\" as ESM based on \"${parentPackage.name}\" package type`\n )\n definitions = await import(pathToFileURL(filePath).toString())\n } else {\n logger.debug(\n `Loading configuration file \"${file}\" as CommonJS based on \"${parentPackage.name}\" package type`\n )\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n definitions = require(filePath)\n }\n }\n break\n default:\n throw new Error(`Unsupported configuration file extension \"${extension}\"`)\n }\n if (typeof definitions !== 'object') {\n throw new Error(`Configuration file ${filePath} does not export an object`)\n }\n return definitions\n}\n\nasync function readPackageJson(filePath: string) {\n const { readPackageUp } = await import('read-package-up')\n const parentPackage = await readPackageUp({ cwd: path.dirname(filePath) })\n return parentPackage?.packageJson\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ILogger } from '../
|
|
1
|
+
import { ILogger } from '../environment';
|
|
2
2
|
import { IConfiguration } from './types';
|
|
3
3
|
export declare function parseConfiguration(logger: ILogger, source: string, definition: Partial<IConfiguration> | string[] | string | undefined): Partial<IConfiguration>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse_configuration.js","sourceRoot":"","sources":["../../src/configuration/parse_configuration.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAoC;AAGpC,gEAAsC;AACtC,iDAA4C;AAE5C,SAAgB,kBAAkB,CAChC,MAAe,EACf,MAAc,EACd,UAAmE;IAEnE,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,EAAE,CAAA;KACV;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QAC7B,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,mDAAmD,CAAC,CAAA;QAC1E,MAAM,EAAE,aAAa,EAAE,GAAG,qBAAU,CAAC,KAAK,CAAC;YACzC,MAAM;YACN,aAAa;YACb,GAAG,UAAU;SACd,CAAC,CAAA;QACF,OAAO,aAAa,CAAA;KACrB;IACD,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QAClC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,mDAAmD,CAAC,CAAA;QAC1E,MAAM,EAAE,aAAa,EAAE,GAAG,qBAAU,CAAC,KAAK,CAAC;YACzC,MAAM;YACN,aAAa;YACb,GAAG,IAAA,qBAAU,EAAC,UAAU,CAAC;SAC1B,CAAC,CAAA;QACF,OAAO,aAAa,CAAA;KACrB;IACD,IAAI;QACF,OAAO,IAAA,0BAAW,EAAC,UAAU,CAAC,CAAA;KAC/B;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CACb,GAAG,MAAM,kDAAkD,KAAK,CAAC,MAAM,CAAC,IAAI,CAC1E,GAAG,CACJ,EAAE,CACJ,CAAA;KACF;AACH,CAAC;AAnCD,gDAmCC","sourcesContent":["import stringArgv from 'string-argv'\nimport { ILogger } from '../
|
|
1
|
+
{"version":3,"file":"parse_configuration.js","sourceRoot":"","sources":["../../src/configuration/parse_configuration.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAoC;AAGpC,gEAAsC;AACtC,iDAA4C;AAE5C,SAAgB,kBAAkB,CAChC,MAAe,EACf,MAAc,EACd,UAAmE;IAEnE,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,EAAE,CAAA;KACV;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QAC7B,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,mDAAmD,CAAC,CAAA;QAC1E,MAAM,EAAE,aAAa,EAAE,GAAG,qBAAU,CAAC,KAAK,CAAC;YACzC,MAAM;YACN,aAAa;YACb,GAAG,UAAU;SACd,CAAC,CAAA;QACF,OAAO,aAAa,CAAA;KACrB;IACD,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QAClC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,mDAAmD,CAAC,CAAA;QAC1E,MAAM,EAAE,aAAa,EAAE,GAAG,qBAAU,CAAC,KAAK,CAAC;YACzC,MAAM;YACN,aAAa;YACb,GAAG,IAAA,qBAAU,EAAC,UAAU,CAAC;SAC1B,CAAC,CAAA;QACF,OAAO,aAAa,CAAA;KACrB;IACD,IAAI;QACF,OAAO,IAAA,0BAAW,EAAC,UAAU,CAAC,CAAA;KAC/B;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CACb,GAAG,MAAM,kDAAkD,KAAK,CAAC,MAAM,CAAC,IAAI,CAC1E,GAAG,CACJ,EAAE,CACJ,CAAA;KACF;AACH,CAAC;AAnCD,gDAmCC","sourcesContent":["import stringArgv from 'string-argv'\nimport { ILogger } from '../environment'\nimport { IConfiguration } from './types'\nimport ArgvParser from './argv_parser'\nimport { checkSchema } from './check_schema'\n\nexport function parseConfiguration(\n logger: ILogger,\n source: string,\n definition: Partial<IConfiguration> | string[] | string | undefined\n): Partial<IConfiguration> {\n if (!definition) {\n return {}\n }\n if (Array.isArray(definition)) {\n logger.debug(`${source} configuration value is an array; parsing as argv`)\n const { configuration } = ArgvParser.parse([\n 'node',\n 'cucumber-js',\n ...definition,\n ])\n return configuration\n }\n if (typeof definition === 'string') {\n logger.debug(`${source} configuration value is a string; parsing as argv`)\n const { configuration } = ArgvParser.parse([\n 'node',\n 'cucumber-js',\n ...stringArgv(definition),\n ])\n return configuration\n }\n try {\n return checkSchema(definition)\n } catch (error) {\n throw new Error(\n `${source} configuration value failed schema validation: ${error.errors.join(\n ' '\n )}`\n )\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ILogger } from '../
|
|
1
|
+
import { ILogger } from '../environment';
|
|
2
2
|
export declare function splitFormatDescriptor(logger: ILogger, option: string): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split_format_descriptor.js","sourceRoot":"","sources":["../../src/configuration/split_format_descriptor.ts"],"names":[],"mappings":";;;AAEA,SAAgB,qBAAqB,CACnC,MAAe,EACf,MAAc;IAEd,MAAM,SAAS,GAAG,CAAC,MAAgB,EAAE,EAAE;QACrC,IAAI,QAAQ,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAA;QAC/B,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE;YACb,QAAQ,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAA;SAC9B;QACD,MAAM,CAAC,IAAI,CACT;YACM,QAAQ,EAAE,CACjB,CAAA;IACH,CAAC,CAAA;IACD,IAAI,MAAgB,CAAA;IACpB,IAAI,MAAM,EAAE,MAAM,CAAA;IAElB,2BAA2B;IAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,KAAK,IAAI,EAAE;QACxD,cAAc;QACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,KAAK,I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AE,EAAE,CAAC,CAAA;SACtB;QACD,SAAS,CAAC,MAAM,CAAC,CAAA;KAClB;IACD,mBAAmB;SACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,KAAK,IAAI,EAAE;QACnE,2BAA2B;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,KAAK,IAAI,EAAE;YACzD,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;SAC5C;aAAM;YACL,MAAM,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;SACtB;QACD,SAAS,CAAC,MAAM,CAAC,CAAA;KAClB;IACD,UAAU;SACL,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,KAAK,IAAI,EAAE;QAC3D,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;QAC/B,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAChC,SAAS,CAAC,MAAM,CAAC,CAAA;SAClB;KACF;IACD,MAAM;SACD;QACH,MAAM,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;KACtB;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AA7ED,sDA6EC","sourcesContent":["import { ILogger } from '../
|
|
1
|
+
{"version":3,"file":"split_format_descriptor.js","sourceRoot":"","sources":["../../src/configuration/split_format_descriptor.ts"],"names":[],"mappings":";;;AAEA,SAAgB,qBAAqB,CACnC,MAAe,EACf,MAAc;IAEd,MAAM,SAAS,GAAG,CAAC,MAAgB,EAAE,EAAE;QACrC,IAAI,QAAQ,GAAG,IAAI,MAAM,CAAC,C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AAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAChC,SAAS,CAAC,MAAM,CAAC,CAAA;SAClB;KACF;IACD,MAAM;SACD;QACH,MAAM,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;KACtB;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AA7ED,sDA6EC","sourcesContent":["import { ILogger } from '../environment'\n\nexport function splitFormatDescriptor(\n logger: ILogger,\n option: string\n): string[] {\n const doWarning = (result: string[]) => {\n let expected = `\"${result[0]}\"`\n if (result[1]) {\n expected += `:\"${result[1]}\"`\n }\n logger.warn(\n `Each part of a user-specified format should be quoted; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md#ambiguous-colons-in-formats\nChange to ${expected}`\n )\n }\n let result: string[]\n let match1, match2\n\n // \"foo\":\"bar\" or \"foo\":bar\n if ((match1 = option.match(/^\"([^\"]*)\":(.*)$/)) !== null) {\n // \"foo\":\"bar\"\n if ((match2 = match1[2].match(/^\"([^\"]*)\"$/)) !== null) {\n result = [match1[1], match2[1]]\n }\n // \"foo\":bar\n else {\n result = [match1[1], match1[2]]\n if (result[1].includes(':')) {\n doWarning(result)\n }\n }\n }\n // foo:\"bar\"\n else if ((match1 = option.match(/^(.*):\"([^\"]*)\"$/)) !== null) {\n result = [match1[1], match1[2]]\n if (result[0].includes(':')) {\n doWarning(result)\n }\n }\n // \"foo\"\n else if ((match1 = option.match(/^\"([^\"]*)\"$/)) !== null) {\n result = [match1[1], '']\n }\n // file://foo or file:///foo or file://C:/foo or file://C:\\foo or file:///C:/foo or file:///C:\\foo\n else if (\n (match1 = option.match(/^(file:\\/{2,3}(?:[a-zA-Z]:[/\\\\])?)(.*)$/)) !== null\n ) {\n // file://foo:bar\n if ((match2 = match1[2].match(/^([^:]*):(.*)$/)) !== null) {\n result = [match1[1] + match2[1], match2[2]]\n } else {\n result = [option, '']\n }\n doWarning(result)\n }\n // C:\\foo or C:/foo\n else if ((match1 = option.match(/^([a-zA-Z]:[/\\\\])(.*)$/)) !== null) {\n // C:\\foo:bar or C:/foo:bar\n if ((match2 = match1[2].match(/^([^:]*):(.*)$/)) !== null) {\n result = [match1[1] + match2[1], match2[2]]\n } else {\n result = [option, '']\n }\n doWarning(result)\n }\n // foo:bar\n else if ((match1 = option.match(/^([^:]*):(.*)$/)) !== null) {\n result = [match1[1], match1[2]]\n if (option.split(':').length > 2) {\n doWarning(result)\n }\n }\n // foo\n else {\n result = [option, '']\n }\n\n return result\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate_configuration.js","sourceRoot":"","sources":["../../src/configuration/validate_configuration.ts"],"names":[],"mappings":";;;AAGA,SAAgB,qBAAqB,CACnC,aAA6B,EAC7B,MAAe;IAEf,IAAI,aAAa,CAAC,YAAY,EAAE;QAC9B,MAAM,CAAC,IAAI,CACT,kKAAkK,CACnK,CAAA;KACF;IACD,IAAI,aAAa,CAAC,aAAa,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE;QACvE,MAAM,CAAC,IAAI,CACT,wMAAwM,CACzM,CAAA;KACF;IACD,IAAI,aAAa,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE;QAC/D,MAAM,CAAC,IAAI,CACT,+LAA+L,CAChM,CAAA;KACF;IACD,IAAI,aAAa,CAAC,cAAc,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE;QACxD,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAA;KACF;AACH,CAAC;AAxBD,sDAwBC","sourcesContent":["import { ILogger } from '../
|
|
1
|
+
{"version":3,"file":"validate_configuration.js","sourceRoot":"","sources":["../../src/configuration/validate_configuration.ts"],"names":[],"mappings":";;;AAGA,SAAgB,qBAAqB,CACnC,aAA6B,EAC7B,MAAe;IAEf,IAAI,aAAa,CAAC,YAAY,EAAE;QAC9B,MAAM,CAAC,IAAI,CACT,kKAAkK,CACnK,CAAA;KACF;IACD,IAAI,aAAa,CAAC,aAAa,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE;QACvE,MAAM,CAAC,IAAI,CACT,wMAAwM,CACzM,CAAA;KACF;IACD,IAAI,aAAa,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE;QAC/D,MAAM,CAAC,IAAI,CACT,+LAA+L,CAChM,CAAA;KACF;IACD,IAAI,aAAa,CAAC,cAAc,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE;QACxD,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAA;KACF;AACH,CAAC;AAxBD,sDAwBC","sourcesContent":["import { ILogger } from '../environment'\nimport { IConfiguration } from './types'\n\nexport function validateConfiguration(\n configuration: IConfiguration,\n logger: ILogger\n): void {\n if (configuration.publishQuiet) {\n logger.warn(\n '`publishQuiet` option is no longer needed, you can remove it from your configuration; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'\n )\n }\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.retryTagFilter && !configuration.retry) {\n throw new Error(\n 'a positive `retry` count must be specified when setting `retryTagFilter`'\n )\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Writable } from 'node:stream';
|
|
3
|
+
import { ILogger } from './types';
|
|
4
|
+
export declare class ConsoleLogger implements ILogger {
|
|
5
|
+
private stream;
|
|
6
|
+
private debugEnabled;
|
|
7
|
+
private readonly console;
|
|
8
|
+
constructor(stream: Writable, debugEnabled: boolean);
|
|
9
|
+
debug(message?: any, ...optionalParams: any[]): void;
|
|
10
|
+
error(message?: any, ...optionalParams: any[]): void;
|
|
11
|
+
warn(message?: any, ...optionalParams: any[]): void;
|
|
12
|
+
}
|
|
@@ -11,16 +11,16 @@ class ConsoleLogger {
|
|
|
11
11
|
this.debugEnabled = debugEnabled;
|
|
12
12
|
this.console = new node_console_1.Console(this.stream);
|
|
13
13
|
}
|
|
14
|
-
debug(...
|
|
14
|
+
debug(message, ...optionalParams) {
|
|
15
15
|
if (this.debugEnabled) {
|
|
16
|
-
this.console.debug(...
|
|
16
|
+
this.console.debug(message, ...optionalParams);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
error(...
|
|
20
|
-
this.console.error(...
|
|
19
|
+
error(message, ...optionalParams) {
|
|
20
|
+
this.console.error(message, ...optionalParams);
|
|
21
21
|
}
|
|
22
|
-
warn(...
|
|
23
|
-
this.console.warn(...
|
|
22
|
+
warn(message, ...optionalParams) {
|
|
23
|
+
this.console.warn(message, ...optionalParams);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
exports.ConsoleLogger = ConsoleLogger;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console_logger.js","sourceRoot":"","sources":["../../src/environment/console_logger.ts"],"names":[],"mappings":";;;AAAA,+CAAsC;AAItC,MAAa,aAAa;IAId;IACA;IAJO,OAAO,CAAS;IAEjC,YACU,MAAgB,EAChB,YAAqB;QADrB,WAAM,GAAN,MAAM,CAAU;QAChB,iBAAY,GAAZ,YAAY,CAAS;QAE7B,IAAI,CAAC,OAAO,GAAG,IAAI,sBAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACzC,CAAC;IAED,KAAK,CAAC,OAAa,EAAE,GAAG,cAAqB;QAC3C,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,CAAA;SAC/C;IACH,CAAC;IAED,KAAK,CAAC,OAAa,EAAE,GAAG,cAAqB;QAC3C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,CAAA;IAChD,CAAC;IAED,IAAI,CAAC,OAAa,EAAE,GAAG,cAAqB;QAC1C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,CAAA;IAC/C,CAAC;CACF;AAvBD,sCAuBC","sourcesContent":["import { Console } from 'node:console'\nimport { Writable } from 'node:stream'\nimport { ILogger } from './types'\n\nexport class ConsoleLogger implements ILogger {\n private readonly console: Console\n\n constructor(\n private stream: Writable,\n private debugEnabled: boolean\n ) {\n this.console = new Console(this.stream)\n }\n\n debug(message?: any, ...optionalParams: any[]): void {\n if (this.debugEnabled) {\n this.console.debug(message, ...optionalParams)\n }\n }\n\n error(message?: any, ...optionalParams: any[]): void {\n this.console.error(message, ...optionalParams)\n }\n\n warn(message?: any, ...optionalParams: any[]): void {\n this.console.warn(message, ...optionalParams)\n }\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./make_environment"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/environment/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAkC;AAClC,0CAAuB","sourcesContent":["export * from './make_environment'\nexport * from './types'\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.makeEnvironment = void 0;
|
|
4
4
|
const console_logger_1 = require("./console_logger");
|
|
5
|
-
function
|
|
5
|
+
function makeEnvironment(provided) {
|
|
6
6
|
const fullEnvironment = Object.assign({}, {
|
|
7
7
|
cwd: process.cwd(),
|
|
8
8
|
stdout: process.stdout,
|
|
@@ -17,5 +17,5 @@ function mergeEnvironment(provided) {
|
|
|
17
17
|
logger: logger,
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
exports.
|
|
21
|
-
//# sourceMappingURL=
|
|
20
|
+
exports.makeEnvironment = makeEnvironment;
|
|
21
|
+
//# sourceMappingURL=make_environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"make_environment.js","sourceRoot":"","sources":["../../src/environment/make_environment.ts"],"names":[],"mappings":";;;AAAA,qDAAgD;AAGhD,SAAgB,eAAe,CAAC,QAAyB;IACvD,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CACnC,EAAE,EACF;QACE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,KAAK,EAAE,KAAK;KACb,EACD,QAAQ,CACT,CAAA;IACD,MAAM,MAAM,GAAG,IAAI,8BAAa,CAC9B,eAAe,CAAC,MAAM,EACtB,eAAe,CAAC,KAAK,CACtB,CAAA;IACD,MAAM,CAAC,KAAK,CAAC,uBAAuB,EAAE,eAAe,CAAC,CAAA;IACtD,OAAO;QACL,GAAG,eAAe;QAClB,MAAM,EAAE,MAAM;KACf,CAAA;AACH,CAAC;AArBD,0CAqBC","sourcesContent":["import { ConsoleLogger } from './console_logger'\nimport { UsableEnvironment, IRunEnvironment } from './types'\n\nexport function makeEnvironment(provided: IRunEnvironment): UsableEnvironment {\n const fullEnvironment = Object.assign(\n {},\n {\n cwd: process.cwd(),\n stdout: process.stdout,\n stderr: process.stderr,\n env: process.env,\n debug: false,\n },\n provided\n )\n const logger = new ConsoleLogger(\n fullEnvironment.stderr,\n fullEnvironment.debug\n )\n logger.debug('Resolved environment:', fullEnvironment)\n return {\n ...fullEnvironment,\n logger: logger,\n }\n}\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Writable } from 'node:stream';
|
|
3
|
+
export interface ILogger {
|
|
4
|
+
debug: (message?: any, ...optionalParams: any[]) => void;
|
|
5
|
+
error: (message?: any, ...optionalParams: any[]) => void;
|
|
6
|
+
warn: (message?: any, ...optionalParams: any[]) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Contextual data about the project environment
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export interface IRunEnvironment {
|
|
13
|
+
/**
|
|
14
|
+
* Working directory for the project
|
|
15
|
+
* @default process.cwd()
|
|
16
|
+
*/
|
|
17
|
+
cwd?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Writable stream where the test run's main formatter output is written
|
|
20
|
+
* @default process.stdout
|
|
21
|
+
*/
|
|
22
|
+
stdout?: Writable;
|
|
23
|
+
/**
|
|
24
|
+
* Writable stream where the test run's warning/error output is written
|
|
25
|
+
* @default process.stderr
|
|
26
|
+
*/
|
|
27
|
+
stderr?: Writable;
|
|
28
|
+
/**
|
|
29
|
+
* Environment variables
|
|
30
|
+
* @default process.env
|
|
31
|
+
*/
|
|
32
|
+
env?: Record<string, string | undefined>;
|
|
33
|
+
/**
|
|
34
|
+
* Whether debug logging should be emitted to {@link IRunEnvironment.stderr}
|
|
35
|
+
* @default false
|
|
36
|
+
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/debugging.md}
|
|
37
|
+
*/
|
|
38
|
+
debug?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export type UsableEnvironment = Required<IRunEnvironment> & {
|
|
41
|
+
logger: ILogger;
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/environment/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Writable } from 'node:stream'\n\nexport interface ILogger {\n debug: (message?: any, ...optionalParams: any[]) => void\n error: (message?: any, ...optionalParams: any[]) => void\n warn: (message?: any, ...optionalParams: any[]) => void\n}\n\n/**\n * Contextual data about the project environment\n * @public\n */\nexport interface IRunEnvironment {\n /**\n * Working directory for the project\n * @default process.cwd()\n */\n cwd?: string\n /**\n * Writable stream where the test run's main formatter output is written\n * @default process.stdout\n */\n stdout?: Writable\n /**\n * Writable stream where the test run's warning/error output is written\n * @default process.stderr\n */\n stderr?: Writable\n /**\n * Environment variables\n * @default process.env\n */\n env?: Record<string, string | undefined>\n /**\n * Whether debug logging should be emitted to {@link IRunEnvironment.stderr}\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/debugging.md}\n */\n debug?: boolean\n}\n\nexport type UsableEnvironment = Required<IRunEnvironment> & {\n logger: ILogger\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Writable } from 'node:stream';
|
|
3
|
-
import { ILogger } from '../
|
|
3
|
+
import { ILogger } from '../environment';
|
|
4
4
|
export declare function createStream(target: string, onStreamError: () => void, cwd: string, logger: ILogger): Promise<{
|
|
5
5
|
directory: string;
|
|
6
6
|
stream: Writable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_stream.js","sourceRoot":"","sources":["../../src/formatter/create_stream.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAE5B,mCAA+B;AAC/B,+CAAsB;AAGf,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,aAAyB,EACzB,GAAW,EACX,MAAe;IAEf,MAAM,cAAc,GAAG,mBAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IAChD,MAAM,SAAS,GAAG,mBAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;IAE9C,IAAI;QACF,MAAM,IAAA,eAAM,EAAC,SAAS,CAAC,CAAA;KACxB;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAA;KACtE;IAED,MAAM,MAAM,GAAa,YAAE,CAAC,iBAAiB,CAAC,IAAI,EAAE;QAClD,EAAE,EAAE,MAAM,YAAE,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,CAAC;KACvC,CAAC,CAAA;IAEF,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAY,EAAE,EAAE;QAClC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC3B,aAAa,EAAE,CAAA;IACjB,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,SAAS;QACT,MAAM;KACP,CAAA;AACH,CAAC;AA5BD,oCA4BC","sourcesContent":["import path from 'node:path'\nimport { Writable } from 'node:stream'\nimport { mkdirp } from 'mkdirp'\nimport fs from 'mz/fs'\nimport { ILogger } from '../
|
|
1
|
+
{"version":3,"file":"create_stream.js","sourceRoot":"","sources":["../../src/formatter/create_stream.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAE5B,mCAA+B;AAC/B,+CAAsB;AAGf,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,aAAyB,EACzB,GAAW,EACX,MAAe;IAEf,MAAM,cAAc,GAAG,mBAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IAChD,MAAM,SAAS,GAAG,mBAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;IAE9C,IAAI;QACF,MAAM,IAAA,eAAM,EAAC,SAAS,CAAC,CAAA;KACxB;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAA;KACtE;IAED,MAAM,MAAM,GAAa,YAAE,CAAC,iBAAiB,CAAC,IAAI,EAAE;QAClD,EAAE,EAAE,MAAM,YAAE,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,CAAC;KACvC,CAAC,CAAA;IAEF,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAY,EAAE,EAAE;QAClC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC3B,aAAa,EAAE,CAAA;IACjB,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,SAAS;QACT,MAAM;KACP,CAAA;AACH,CAAC;AA5BD,oCA4BC","sourcesContent":["import path from 'node:path'\nimport { Writable } from 'node:stream'\nimport { mkdirp } from 'mkdirp'\nimport fs from 'mz/fs'\nimport { ILogger } from '../environment'\n\nexport async function createStream(\n target: string,\n onStreamError: () => void,\n cwd: string,\n logger: ILogger\n) {\n const absoluteTarget = path.resolve(cwd, target)\n const directory = path.dirname(absoluteTarget)\n\n try {\n await mkdirp(directory)\n } catch (error) {\n logger.warn('Failed to ensure directory for formatter target exists')\n }\n\n const stream: Writable = fs.createWriteStream(null, {\n fd: await fs.open(absoluteTarget, 'w'),\n })\n\n stream.on('error', (error: Error) => {\n logger.error(error.message)\n onStreamError()\n })\n\n return {\n directory,\n stream,\n }\n}\n"]}
|
package/lib/paths/paths.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILogger } from '../
|
|
1
|
+
import { ILogger } from '../environment';
|
|
2
2
|
import { ISourcesCoordinates, ISupportCodeCoordinates } from '../api';
|
|
3
3
|
import { IResolvedPaths } from './types';
|
|
4
4
|
export declare function resolvePaths(logger: ILogger, cwd: string, sources: Pick<ISourcesCoordinates, 'paths'>, support?: ISupportCodeCoordinates): Promise<IResolvedPaths>;
|
package/lib/paths/paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/paths/paths.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAC5B,+BAA2B;AAC3B,+CAAsB;AAKf,KAAK,UAAU,YAAY,CAChC,MAAe,EACf,GAAW,EACX,OAA2C,EAC3C,UAAmC;IACjC,cAAc,EAAE,EAAE;IAClB,YAAY,EAAE,EAAE;IAChB,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,EAAE;CACZ;IAED,MAAM,qBAAqB,GAAG,MAAM,wBAAwB,CAC1D,GAAG,EACH,OAAO,CAAC,KAAK,CACd,CAAA;IACD,MAAM,WAAW,GAAa,MAAM,iBAAiB,CACnD,GAAG,EACH,qBAAqB,CACtB,CAAA;IACD,MAAM,CAAC,KAAK,CAAC,4CAA4C,EAAE,WAAW,CAAC,CAAA;IACvE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,MAAM,kBAAkB,CAC5D,GAAG,EACH,WAAW,EACX,OAAO,CAAC,YAAY,EACpB,OAAO,CAAC,WAAW,CACpB,CAAA;IACD,MAAM,CAAC,KAAK,CACV,mEAAmE,EACnE,YAAY,CACb,CAAA;IACD,MAAM,CAAC,KAAK,CACV,kEAAkE,EAClE,WAAW,CACZ,CAAA;IACD,OAAO;QACL,qBAAqB,EAAE,qBAAqB;QAC5C,WAAW,EAAE,WAAW;QACxB,YAAY;QACZ,WAAW;KACZ,CAAA;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AE,CAAA;AACtC,CAAC","sourcesContent":["import path from 'node:path'\nimport { glob } from 'glob'\nimport fs from 'mz/fs'\nimport { ILogger } from '../
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/paths/paths.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAC5B,+BAA2B;AAC3B,+CAAsB;AAKf,KAAK,UAAU,YAAY,CAChC,MAAe,EACf,GAAW,EACX,OAA2C,EAC3C,UAAmC;IACjC,cAAc,EAAE,EAAE;IAClB,YAAY,EAAE,EAAE;IAChB,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,EAAE;CACZ;IAED,MAAM,qBAAqB,GAAG,MAAM,wBAAwB,CAC1D,GAAG,EACH,OAAO,CAAC,KAAK,CACd,CAAA;IACD,MAAM,WAAW,GAAa,MAAM,iBAAiB,CACnD,GAAG,EACH,qBAAqB,CACtB,CAAA;IACD,MAAM,CAAC,KAAK,CAAC,4CAA4C,EAAE,WAAW,CAAC,CAAA;IACvE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,MAAM,kBAAkB,CAC5D,GAAG,EACH,WAAW,EACX,OAAO,CAAC,YAAY,EACpB,OAAO,CAAC,WAAW,CACpB,CAAA;IACD,MAAM,CAAC,KAAK,CACV,mEAAmE,EACnE,YAAY,CACb,CAAA;IACD,MAAM,CAAC,KAAK,CACV,kEAAkE,EAClE,WAAW,CACZ,CAAA;IACD,OAAO;QACL,qBAAqB,EAAE,qBAAqB;QAC5C,WAAW,EAAE,WAAW;QACxB,YAAY;QACZ,WAAW;KACZ,CAAA;AACH,CAAC;AAxCD,oCAwCC;AAED,KAAK,UAAU,WAAW,CACxB,GAAW,EACX,eAAyB,EACzB,gBAAwB;IAExB,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,GAAG,CACrC,eAAe,CAAC,GAAG,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE;QAC3C,MAAM,OAAO,GAAG,MAAM,IAAA,WAAI,EAAC,cAA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IAEtB,YAAY,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAA,CAAC,qBAAqB;IACxF,OAAO,MAAM,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,UAAU,CAAC,CAAA;AACzD,CAAC;AAED,KAAK,UAAU,kBAAkB,CAC/B,GAAW,EACX,YAAsB,EACtB,sBAAgC,EAChC,qBAA+B;IAK/B,IACE,sBAAsB,CAAC,MAAM,KAAK,CAAC;QACnC,qBAAqB,CAAC,MAAM,KAAK,CAAC,EAClC;QACA,MAAM,YAAY,GAAG,wBAAwB,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;QAChE,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAA;QAC1E,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,WAAW,EAAE,CAAA;KACzC;IACD,MAAM,YAAY,GAChB,sBAAsB,CAAC,MAAM,GAAG,CAAC;QAC/B,CAAC,CAAC,MAAM,WAAW,CAAC,GAAG,EAAE,sBAAsB,EAAE,KAAK,CAAC;QACvD,CAAC,CAAC,EAAE,CAAA;IACR,MAAM,WAAW,GACf,qBAAqB,CAAC,MAAM,GAAG,CAAC;QAC9B,CAAC,CAAC,MAAM,WAAW,CAAC,GAAG,EAAE,qBAAqB,EAAE,gBAAgB,CAAC;QACjE,CAAC,CAAC,EAAE,CAAA;IACR,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAA;AACtC,CAAC","sourcesContent":["import path from 'node:path'\nimport { glob } from 'glob'\nimport fs from 'mz/fs'\nimport { ILogger } from '../environment'\nimport { ISourcesCoordinates, ISupportCodeCoordinates } from '../api'\nimport { IResolvedPaths } from './types'\n\nexport async function resolvePaths(\n logger: ILogger,\n cwd: string,\n sources: Pick<ISourcesCoordinates, 'paths'>,\n support: ISupportCodeCoordinates = {\n requireModules: [],\n requirePaths: [],\n importPaths: [],\n loaders: [],\n }\n): Promise<IResolvedPaths> {\n const unexpandedSourcePaths = await getUnexpandedSourcePaths(\n cwd,\n sources.paths\n )\n const sourcePaths: string[] = await expandSourcePaths(\n cwd,\n unexpandedSourcePaths\n )\n logger.debug('Found source files based on configuration:', sourcePaths)\n const { requirePaths, importPaths } = await deriveSupportPaths(\n cwd,\n sourcePaths,\n support.requirePaths,\n support.importPaths\n )\n logger.debug(\n 'Found support files to load via `require` based on configuration:',\n requirePaths\n )\n logger.debug(\n 'Found support files to load via `import` based on configuration:',\n importPaths\n )\n return {\n unexpandedSourcePaths: unexpandedSourcePaths,\n sourcePaths: sourcePaths,\n requirePaths,\n importPaths,\n }\n}\n\nasync function expandPaths(\n cwd: string,\n unexpandedPaths: string[],\n defaultExtension: string\n): Promise<string[]> {\n const expandedPaths = await Promise.all(\n unexpandedPaths.map(async (unexpandedPath) => {\n const matches = await glob(unexpandedPath, {\n absolute: true,\n windowsPathsNoEscape: true,\n cwd,\n })\n const expanded = await Promise.all(\n matches.map(async (match) => {\n if (path.extname(match) === '') {\n return glob(`${match}/**/*${defaultExtension}`, {\n windowsPathsNoEscape: true,\n })\n }\n return [match]\n })\n )\n return expanded.flat().sort()\n })\n )\n const normalized = expandedPaths.flat().map((x) => path.normalize(x))\n return [...new Set(normalized)]\n}\n\nasync function getUnexpandedSourcePaths(\n cwd: string,\n args: string[]\n): Promise<string[]> {\n if (args.length > 0) {\n const nestedFeaturePaths = await Promise.all(\n args.map(async (arg) => {\n const filename = path.basename(arg)\n if (filename[0] === '@') {\n const filePath = path.join(cwd, arg)\n const content = await fs.readFile(filePath, 'utf8')\n return content.split('\\n').map((x) => x.trim())\n }\n return [arg]\n })\n )\n const featurePaths = nestedFeaturePaths.flat()\n if (featurePaths.length > 0) {\n return featurePaths.filter((x) => x !== '')\n }\n }\n return ['features/**/*.{feature,feature.md}']\n}\n\nfunction getFeatureDirectoryPaths(\n cwd: string,\n featurePaths: string[]\n): string[] {\n const featureDirs = featurePaths.map((featurePath) => {\n let featureDir = path.dirname(featurePath)\n let childDir: string\n let parentDir = featureDir\n while (childDir !== parentDir) {\n childDir = parentDir\n parentDir = path.dirname(childDir)\n if (path.basename(parentDir) === 'features') {\n featureDir = parentDir\n break\n }\n }\n return path.relative(cwd, featureDir)\n })\n return [...new Set(featureDirs)]\n}\n\nasync function expandSourcePaths(\n cwd: string,\n featurePaths: string[]\n): Promise<string[]> {\n featurePaths = featurePaths.map((p) => p.replace(/(:\\d+)*$/g, '')) // Strip line numbers\n return await expandPaths(cwd, featurePaths, '.feature')\n}\n\nasync function deriveSupportPaths(\n cwd: string,\n featurePaths: string[],\n unexpandedRequirePaths: string[],\n unexpandedImportPaths: string[]\n): Promise<{\n requirePaths: string[]\n importPaths: string[]\n}> {\n if (\n unexpandedRequirePaths.length === 0 &&\n unexpandedImportPaths.length === 0\n ) {\n const defaultPaths = getFeatureDirectoryPaths(cwd, featurePaths)\n const importPaths = await expandPaths(cwd, defaultPaths, '.@(js|cjs|mjs)')\n return { requirePaths: [], importPaths }\n }\n const requirePaths =\n unexpandedRequirePaths.length > 0\n ? await expandPaths(cwd, unexpandedRequirePaths, '.js')\n : []\n const importPaths =\n unexpandedImportPaths.length > 0\n ? await expandPaths(cwd, unexpandedImportPaths, '.@(js|cjs|mjs)')\n : []\n return { requirePaths, importPaths }\n}\n"]}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ILogger } from '../logger';
|
|
1
|
+
import { UsableEnvironment } from '../environment';
|
|
3
2
|
import { InternalPlugin, CoordinatorPluginEventValues, CoordinatorPluginEventKey, CoordinatorPluginTransformEventKey, Operation, FormatterPlugin } from './types';
|
|
4
3
|
export declare class PluginManager {
|
|
4
|
+
private readonly environment;
|
|
5
5
|
private handlers;
|
|
6
6
|
private cleanupFns;
|
|
7
|
+
constructor(environment: UsableEnvironment);
|
|
7
8
|
private register;
|
|
8
|
-
initFormatter<OptionsType>(plugin: FormatterPlugin<OptionsType>, options: OptionsType,
|
|
9
|
-
initCoordinator<OptionsType>(operation: Operation, plugin: InternalPlugin<OptionsType>, options: OptionsType
|
|
9
|
+
initFormatter<OptionsType>(plugin: FormatterPlugin<OptionsType>, options: OptionsType, write: (buffer: string | Uint8Array) => void, directory?: string): Promise<void>;
|
|
10
|
+
initCoordinator<OptionsType>(operation: Operation, plugin: InternalPlugin<OptionsType>, options: OptionsType): Promise<void>;
|
|
10
11
|
emit<K extends CoordinatorPluginEventKey>(event: K, value: CoordinatorPluginEventValues[K]): void;
|
|
11
12
|
transform<K extends CoordinatorPluginTransformEventKey>(event: K, value: CoordinatorPluginEventValues[K]): Promise<CoordinatorPluginEventValues[K]>;
|
|
12
13
|
cleanup(): Promise<void>;
|