@cucumber/cucumber 12.0.0 → 12.1.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/api/formatters.js +1 -1
- package/lib/api/formatters.js.map +1 -1
- package/lib/formatter/builtin/index.d.ts +1 -0
- package/lib/formatter/builtin/index.js +2 -0
- package/lib/formatter/builtin/index.js.map +1 -1
- package/lib/plugin/plugin_manager.d.ts +1 -1
- package/lib/plugin/plugin_manager.js +2 -1
- package/lib/plugin/plugin_manager.js.map +1 -1
- package/lib/plugin/types.d.ts +1 -0
- package/lib/plugin/types.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 +4 -3
package/lib/api/formatters.js
CHANGED
|
@@ -34,7 +34,7 @@ async function initializeFormatters({ env, cwd, stdout, logger, onStreamError, e
|
|
|
34
34
|
cleanupFns.push(async () => formatter.finished());
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
await pluginManager.initFormatter(implementation, configuration.options, stream.write.bind(stream), directory);
|
|
37
|
+
await pluginManager.initFormatter(implementation, configuration.options, stream, stream.write.bind(stream), directory);
|
|
38
38
|
if (stream !== stdout) {
|
|
39
39
|
cleanupFns.push((0, node_util_1.promisify)(stream.end.bind(stream)));
|
|
40
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/api/formatters.ts"],"names":[],"mappings":";;;;;AAaA,
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/api/formatters.ts"],"names":[],"mappings":";;;;;AAaA,oDAuFC;AAnGD,yCAAqC;AAKrC,mEAAmD;AAEnD,8DAAyD;AACzD,gFAA2E;AAIpE,KAAK,UAAU,oBAAoB,CAAC,EACzC,GAAG,EACH,GAAG,EACH,MAAM,EACN,MAAM,EACN,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,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A;YACD,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;gBACtB,UAAU,CAAC,IAAI,CAAC,IAAA,qBAAS,EAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;YAC1D,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC5E,KAAK,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QACtE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,IAAA,4BAAY,EAC9C,MAAM,EACN,aAAa,EACb,GAAG,EACH,MAAM,CACP,CAAA;QACD,MAAM,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,CAAA;IACjE,CAAC;IAED,OAAO,KAAK;QACV,MAAM,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;IAC/D,CAAC,CAAA;AACH,CAAC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { promisify } from 'node:util'\nimport { WriteStream as TtyWriteStream } from 'node:tty'\nimport { IFormatterStream } from '../formatter'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport FormatterBuilder from '../formatter/builder'\nimport { ILogger } from '../environment'\nimport { createStream } from '../formatter/create_stream'\nimport { resolveImplementation } from '../formatter/resolve_implementation'\nimport { PluginManager } from '../plugin'\nimport { IRunOptionsFormats } from './types'\n\nexport async function initializeFormatters({\n env,\n cwd,\n stdout,\n logger,\n onStreamError,\n eventBroadcaster,\n eventDataCollector,\n configuration,\n supportCodeLibrary,\n pluginManager,\n}: {\n env: NodeJS.ProcessEnv\n cwd: string\n stdout: IFormatterStream\n stderr: IFormatterStream\n logger: ILogger\n onStreamError: () => void\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n configuration: IRunOptionsFormats\n supportCodeLibrary: SupportCodeLibrary\n pluginManager: PluginManager\n}): Promise<() => Promise<void>> {\n const cleanupFns: Array<() => Promise<void>> = []\n\n async function initializeFormatter(\n stream: IFormatterStream,\n directory: string | undefined,\n target: string,\n specifier: string\n ): Promise<void> {\n if (specifier === 'progress-bar' && !(stream as TtyWriteStream).isTTY) {\n logger.warn(\n `Cannot use 'progress-bar' formatter for output to '${target}' as not a TTY. Switching to 'progress' formatter.`\n )\n specifier = 'progress'\n }\n const implementation = await resolveImplementation(specifier, cwd)\n if (typeof implementation === 'function') {\n const typeOptions = {\n env,\n cwd,\n eventBroadcaster,\n eventDataCollector,\n log: stream.write.bind(stream),\n parsedArgvOptions: configuration.options,\n stream,\n cleanup:\n stream === stdout\n ? async () => await Promise.resolve()\n : promisify<any>(stream.end.bind(stream)),\n supportCodeLibrary,\n }\n const formatter = await FormatterBuilder.build(\n implementation,\n typeOptions\n )\n cleanupFns.push(async () => formatter.finished())\n } else {\n await pluginManager.initFormatter(\n implementation,\n configuration.options,\n stream,\n stream.write.bind(stream),\n directory\n )\n if (stream !== stdout) {\n cleanupFns.push(promisify<any>(stream.end.bind(stream)))\n }\n }\n }\n\n await initializeFormatter(stdout, undefined, 'stdout', configuration.stdout)\n for (const [target, specifier] of Object.entries(configuration.files)) {\n const { stream, directory } = await createStream(\n target,\n onStreamError,\n cwd,\n logger\n )\n await initializeFormatter(stream, directory, target, specifier)\n }\n\n return async function () {\n await Promise.all(cleanupFns.map((cleanupFn) => cleanupFn()))\n }\n}\n"]}
|
|
@@ -18,6 +18,7 @@ const builtin = {
|
|
|
18
18
|
// new plugin-based formatters
|
|
19
19
|
html: html_1.default,
|
|
20
20
|
junit: '@cucumber/junit-xml-formatter',
|
|
21
|
+
pretty: '@cucumber/pretty-formatter',
|
|
21
22
|
message: message_1.default,
|
|
22
23
|
// legacy class-based formatters
|
|
23
24
|
json: json_formatter_1.default,
|
|
@@ -34,6 +35,7 @@ exports.documentation = {
|
|
|
34
35
|
// new plugin-based formatters
|
|
35
36
|
html: 'Outputs a HTML report',
|
|
36
37
|
junit: 'Produces a JUnit XML report',
|
|
38
|
+
pretty: 'Writes a rich report of the scenario and example execution as it happens',
|
|
37
39
|
message: 'Emits Cucumber messages in newline-delimited JSON',
|
|
38
40
|
// legacy class-based formatters
|
|
39
41
|
json: json_formatter_1.default.documentation,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/formatter/builtin/index.ts"],"names":[],"mappings":";;;;;;AACA,uEAA6C;AAC7C,+EAAqD;AACrD,uFAA4D;AAC5D,yEAA+C;AAC/C,+EAAqD;AACrD,6EAAmD;AACnD,yEAA+C;AAC/C,mFAAwD;AACxD,wDAAwC;AACxC,kDAAkC;AAElC,MAAM,OAAO,GAAG;IACd,8BAA8B;IAC9B,IAAI,EAAE,cAAa;IACnB,KAAK,EAAE,+BAA+B;IACtC,OAAO,EAAE,iBAAgB;IACzB,gCAAgC;IAChC,IAAI,EAAE,wBAAa;IACnB,QAAQ,EAAE,4BAAiB;IAC3B,cAAc,EAAE,gCAAoB;IACpC,KAAK,EAAE,yBAAc;IACrB,QAAQ,EAAE,4BAAiB;IAC3B,OAAO,EAAE,2BAAgB;IACzB,KAAK,EAAE,yBAAc;IACrB,YAAY,EAAE,8BAAkB;CACmC,CAAA;AAErE,kBAAe,OAA2D,CAAA;AAE7D,QAAA,aAAa,GAAG;IAC3B,8BAA8B;IAC9B,IAAI,EAAE,uBAAuB;IAC7B,KAAK,EAAE,6BAA6B;IACpC,OAAO,EAAE,mDAAmD;IAC5D,gCAAgC;IAChC,IAAI,EAAE,wBAAa,CAAC,aAAa;IACjC,QAAQ,EAAE,4BAAiB,CAAC,aAAa;IACzC,cAAc,EAAE,gCAAoB,CAAC,aAAa;IAClD,KAAK,EAAE,yBAAc,CAAC,aAAa;IACnC,QAAQ,EAAE,4BAAiB,CAAC,aAAa;IACzC,OAAO,EAAE,2BAAgB,CAAC,aAAa;IACvC,KAAK,EAAE,yBAAc,CAAC,aAAa;IACnC,YAAY,EAAE,8BAAkB,CAAC,aAAa;CACA,CAAA","sourcesContent":["import { FormatterImplementation } from '../index'\nimport JsonFormatter from '../json_formatter'\nimport ProgressFormatter from '../progress_formatter'\nimport ProgressBarFormatter from '../progress_bar_formatter'\nimport RerunFormatter from '../rerun_formatter'\nimport SnippetsFormatter from '../snippets_formatter'\nimport SummaryFormatter from '../summary_formatter'\nimport UsageFormatter from '../usage_formatter'\nimport UsageJsonFormatter from '../usage_json_formatter'\nimport messageFormatter from './message'\nimport htmlFormatter from './html'\n\nconst builtin = {\n // new plugin-based formatters\n html: htmlFormatter,\n junit: '@cucumber/junit-xml-formatter',\n message: messageFormatter,\n // legacy class-based formatters\n json: JsonFormatter,\n progress: ProgressFormatter,\n 'progress-bar': ProgressBarFormatter,\n rerun: RerunFormatter,\n snippets: SnippetsFormatter,\n summary: SummaryFormatter,\n usage: UsageFormatter,\n 'usage-json': UsageJsonFormatter,\n} as const satisfies Record<string, FormatterImplementation | string>\n\nexport default builtin as Record<string, FormatterImplementation | string>\n\nexport const documentation = {\n // new plugin-based formatters\n html: 'Outputs a HTML report',\n junit: 'Produces a JUnit XML report',\n message: 'Emits Cucumber messages in newline-delimited JSON',\n // legacy class-based formatters\n json: JsonFormatter.documentation,\n progress: ProgressFormatter.documentation,\n 'progress-bar': ProgressBarFormatter.documentation,\n rerun: RerunFormatter.documentation,\n snippets: SnippetsFormatter.documentation,\n summary: SummaryFormatter.documentation,\n usage: UsageFormatter.documentation,\n 'usage-json': UsageJsonFormatter.documentation,\n} satisfies Record<keyof typeof builtin, string>\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/formatter/builtin/index.ts"],"names":[],"mappings":";;;;;;AACA,uEAA6C;AAC7C,+EAAqD;AACrD,uFAA4D;AAC5D,yEAA+C;AAC/C,+EAAqD;AACrD,6EAAmD;AACnD,yEAA+C;AAC/C,mFAAwD;AACxD,wDAAwC;AACxC,kDAAkC;AAElC,MAAM,OAAO,GAAG;IACd,8BAA8B;IAC9B,IAAI,EAAE,cAAa;IACnB,KAAK,EAAE,+BAA+B;IACtC,MAAM,EAAE,4BAA4B;IACpC,OAAO,EAAE,iBAAgB;IACzB,gCAAgC;IAChC,IAAI,EAAE,wBAAa;IACnB,QAAQ,EAAE,4BAAiB;IAC3B,cAAc,EAAE,gCAAoB;IACpC,KAAK,EAAE,yBAAc;IACrB,QAAQ,EAAE,4BAAiB;IAC3B,OAAO,EAAE,2BAAgB;IACzB,KAAK,EAAE,yBAAc;IACrB,YAAY,EAAE,8BAAkB;CACmC,CAAA;AAErE,kBAAe,OAA2D,CAAA;AAE7D,QAAA,aAAa,GAAG;IAC3B,8BAA8B;IAC9B,IAAI,EAAE,uBAAuB;IAC7B,KAAK,EAAE,6BAA6B;IACpC,MAAM,EACJ,0EAA0E;IAC5E,OAAO,EAAE,mDAAmD;IAC5D,gCAAgC;IAChC,IAAI,EAAE,wBAAa,CAAC,aAAa;IACjC,QAAQ,EAAE,4BAAiB,CAAC,aAAa;IACzC,cAAc,EAAE,gCAAoB,CAAC,aAAa;IAClD,KAAK,EAAE,yBAAc,CAAC,aAAa;IACnC,QAAQ,EAAE,4BAAiB,CAAC,aAAa;IACzC,OAAO,EAAE,2BAAgB,CAAC,aAAa;IACvC,KAAK,EAAE,yBAAc,CAAC,aAAa;IACnC,YAAY,EAAE,8BAAkB,CAAC,aAAa;CACA,CAAA","sourcesContent":["import { FormatterImplementation } from '../index'\nimport JsonFormatter from '../json_formatter'\nimport ProgressFormatter from '../progress_formatter'\nimport ProgressBarFormatter from '../progress_bar_formatter'\nimport RerunFormatter from '../rerun_formatter'\nimport SnippetsFormatter from '../snippets_formatter'\nimport SummaryFormatter from '../summary_formatter'\nimport UsageFormatter from '../usage_formatter'\nimport UsageJsonFormatter from '../usage_json_formatter'\nimport messageFormatter from './message'\nimport htmlFormatter from './html'\n\nconst builtin = {\n // new plugin-based formatters\n html: htmlFormatter,\n junit: '@cucumber/junit-xml-formatter',\n pretty: '@cucumber/pretty-formatter',\n message: messageFormatter,\n // legacy class-based formatters\n json: JsonFormatter,\n progress: ProgressFormatter,\n 'progress-bar': ProgressBarFormatter,\n rerun: RerunFormatter,\n snippets: SnippetsFormatter,\n summary: SummaryFormatter,\n usage: UsageFormatter,\n 'usage-json': UsageJsonFormatter,\n} as const satisfies Record<string, FormatterImplementation | string>\n\nexport default builtin as Record<string, FormatterImplementation | string>\n\nexport const documentation = {\n // new plugin-based formatters\n html: 'Outputs a HTML report',\n junit: 'Produces a JUnit XML report',\n pretty:\n 'Writes a rich report of the scenario and example execution as it happens',\n message: 'Emits Cucumber messages in newline-delimited JSON',\n // legacy class-based formatters\n json: JsonFormatter.documentation,\n progress: ProgressFormatter.documentation,\n 'progress-bar': ProgressBarFormatter.documentation,\n rerun: RerunFormatter.documentation,\n snippets: SnippetsFormatter.documentation,\n summary: SummaryFormatter.documentation,\n usage: UsageFormatter.documentation,\n 'usage-json': UsageJsonFormatter.documentation,\n} satisfies Record<keyof typeof builtin, string>\n"]}
|
|
@@ -6,7 +6,7 @@ export declare class PluginManager {
|
|
|
6
6
|
private cleanupFns;
|
|
7
7
|
constructor(environment: UsableEnvironment);
|
|
8
8
|
private register;
|
|
9
|
-
initFormatter<OptionsType>(plugin: FormatterPlugin<OptionsType>, options: OptionsType, write: (buffer: string | Uint8Array) => void, directory?: string): Promise<void>;
|
|
9
|
+
initFormatter<OptionsType>(plugin: FormatterPlugin<OptionsType>, options: OptionsType, stream: NodeJS.WritableStream, write: (buffer: string | Uint8Array) => void, directory?: string): Promise<void>;
|
|
10
10
|
initCoordinator<OptionsType>(operation: Operation, plugin: InternalPlugin<OptionsType>, options: OptionsType): Promise<void>;
|
|
11
11
|
emit<K extends CoordinatorPluginEventKey>(event: K, value: CoordinatorPluginEventValues[K]): void;
|
|
12
12
|
transform<K extends CoordinatorPluginTransformEventKey>(event: K, value: CoordinatorPluginEventValues[K]): Promise<CoordinatorPluginEventValues[K]>;
|
|
@@ -16,13 +16,14 @@ class PluginManager {
|
|
|
16
16
|
async register(event, handler) {
|
|
17
17
|
this.handlers[event]?.push(handler);
|
|
18
18
|
}
|
|
19
|
-
async initFormatter(plugin, options, write, directory) {
|
|
19
|
+
async initFormatter(plugin, options, stream, write, directory) {
|
|
20
20
|
const cleanupFn = await plugin.formatter({
|
|
21
21
|
on: (key, handler) => this.register(key, handler),
|
|
22
22
|
options: plugin.optionsKey
|
|
23
23
|
? (options[plugin.optionsKey] ?? {})
|
|
24
24
|
: options,
|
|
25
25
|
logger: this.environment.logger,
|
|
26
|
+
stream,
|
|
26
27
|
write,
|
|
27
28
|
directory,
|
|
28
29
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin_manager.js","sourceRoot":"","sources":["../../src/plugin/plugin_manager.ts"],"names":[],"mappings":";;;AAgBA,MAAa,aAAa;IASK;IARrB,QAAQ,GAAoB;QAClC,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,EAAE;QACnB,gBAAgB,EAAE,EAAE;QACpB,eAAe,EAAE,EAAE;KACpB,CAAA;IACO,UAAU,GAAoB,EAAE,CAAA;IAExC,YAA6B,WAA8B;QAA9B,gBAAW,GAAX,WAAW,CAAmB;IAAG,CAAC;IAEvD,KAAK,CAAC,QAAQ,CACpB,KAAQ,EACR,OAAyC;QAEzC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IACrC,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,MAAoC,EACpC,OAAoB,EACpB,KAA4C,EAC5C,SAAkB;QAElB,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC;YACvC,EAAE,EAAE,CAAC,G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KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3C,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;YAC3C,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;gBACpC,WAAW,GAAG,QAAQ,CAAA;YACxB,CAAC;QACH,CAAC;QACD,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,OAAO;QACX,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACxC,MAAM,SAAS,EAAE,CAAA;QACnB,CAAC;IACH,CAAC;CACF;AAvFD,sCAuFC","sourcesContent":["import { UsableEnvironment } from '../environment'\nimport {\n CoordinatorPluginEventHandler,\n InternalPlugin,\n PluginCleanup,\n CoordinatorPluginEventValues,\n CoordinatorPluginEventKey,\n CoordinatorPluginTransformEventKey,\n Operation,\n FormatterPlugin,\n} from './types'\n\ntype HandlerRegistry = {\n [K in CoordinatorPluginEventKey]: Array<CoordinatorPluginEventHandler<K>>\n}\n\nexport class PluginManager {\n private handlers: HandlerRegistry = {\n message: [],\n 'paths:resolve': [],\n 'pickles:filter': [],\n 'pickles:order': [],\n }\n private cleanupFns: PluginCleanup[] = []\n\n constructor(private readonly environment: UsableEnvironment) {}\n\n private async register<K extends CoordinatorPluginEventKey>(\n event: K,\n handler: CoordinatorPluginEventHandler<K>\n ) {\n this.handlers[event]?.push(handler)\n }\n\n async initFormatter<OptionsType>(\n plugin: FormatterPlugin<OptionsType>,\n options: OptionsType,\n stream: NodeJS.WritableStream,\n write: (buffer: string | Uint8Array) => void,\n directory?: string\n ) {\n const cleanupFn = await plugin.formatter({\n on: (key, handler) => this.register(key, handler),\n options: plugin.optionsKey\n ? ((options as any)[plugin.optionsKey] ?? ({} as OptionsType))\n : options,\n logger: this.environment.logger,\n stream,\n write,\n directory,\n })\n if (typeof cleanupFn === 'function') {\n this.cleanupFns.push(cleanupFn)\n }\n }\n\n async initCoordinator<OptionsType>(\n operation: Operation,\n plugin: InternalPlugin<OptionsType>,\n options: OptionsType\n ) {\n const cleanupFn = await plugin.coordinator({\n operation,\n on: this.register.bind(this),\n options,\n logger: this.environment.logger,\n environment: {\n cwd: this.environment.cwd,\n stderr: this.environment.stderr,\n env: { ...this.environment.env },\n },\n })\n if (typeof cleanupFn === 'function') {\n this.cleanupFns.push(cleanupFn)\n }\n }\n\n emit<K extends CoordinatorPluginEventKey>(\n event: K,\n value: CoordinatorPluginEventValues[K]\n ): void {\n this.handlers[event].forEach((handler) => handler(value))\n }\n\n async transform<K extends CoordinatorPluginTransformEventKey>(\n event: K,\n value: CoordinatorPluginEventValues[K]\n ): Promise<CoordinatorPluginEventValues[K]> {\n let transformed = value\n for (const handler of this.handlers[event]) {\n const returned = await handler(transformed)\n if (typeof returned !== 'undefined') {\n transformed = returned\n }\n }\n return transformed\n }\n\n async cleanup(): Promise<void> {\n for (const cleanupFn of this.cleanupFns) {\n await cleanupFn()\n }\n }\n}\n"]}
|
package/lib/plugin/types.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ export interface FormatterPluginContext<OptionsType> {
|
|
|
41
41
|
on: (key: 'message', handler: (value: Envelope) => void) => void;
|
|
42
42
|
options: OptionsType;
|
|
43
43
|
logger: ILogger;
|
|
44
|
+
stream: NodeJS.WritableStream;
|
|
44
45
|
write: (buffer: string | Uint8Array) => void;
|
|
45
46
|
directory?: string;
|
|
46
47
|
}
|
package/lib/plugin/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/plugin/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Envelope } from '@cucumber/messages'\nimport { ArrayValues, Promisable } from 'type-fest'\nimport { IRunEnvironment } from '../environment'\nimport { ILogger } from '../environment'\nimport { IFilterablePickle } from '../filter'\nimport { IResolvedPaths } from '../paths'\nimport { coordinatorTransformKeys, coordinatorVoidKeys } from './events'\n\nexport type Operation = 'loadSources' | 'loadSupport' | 'runCucumber'\n\nexport type CoordinatorPluginEnvironment = Required<\n Pick<IRunEnvironment, 'cwd' | 'stderr' | 'env'>\n>\n\nexport type CoordinatorPluginVoidEventKey = ArrayValues<\n typeof coordinatorVoidKeys\n>\nexport type CoordinatorPluginTransformEventKey = ArrayValues<\n typeof coordinatorTransformKeys\n>\nexport type CoordinatorPluginEventKey =\n | CoordinatorPluginVoidEventKey\n | CoordinatorPluginTransformEventKey\n\nexport type CoordinatorPluginEventValues = {\n // void\n message: Readonly<Envelope>\n 'paths:resolve': Readonly<IResolvedPaths>\n // transform\n 'pickles:filter': Readonly<Array<IFilterablePickle>>\n 'pickles:order': Readonly<Array<IFilterablePickle>>\n}\n\nexport type CoordinatorPluginEventHandler<K extends CoordinatorPluginEventKey> =\n (\n value: CoordinatorPluginEventValues[K]\n ) => K extends CoordinatorPluginTransformEventKey\n ? Promisable<CoordinatorPluginEventValues[K]>\n : void\n\nexport interface CoordinatorPluginContext<OptionsType> {\n operation: Operation\n on: <EventKey extends CoordinatorPluginEventKey>(\n event: EventKey,\n handler: CoordinatorPluginEventHandler<EventKey>\n ) => void\n options: OptionsType\n logger: ILogger\n environment: CoordinatorPluginEnvironment\n}\n\nexport type CoordinatorPluginFunction<OptionsType> = (\n context: CoordinatorPluginContext<OptionsType>\n) => Promisable<PluginCleanup | void>\n\nexport type PluginCleanup = () => Promisable<void>\n\n/**\n * A plugin to implement Cucumber built-in functionality.\n *\n * Uses the same events and mechanisms as user-authored plugins, but is free to require configuration and context from\n * inside of Cucumber as its `options`, whereas user-authored plugins will be limited to `pluginOptions` from the\n * project configuration.\n */\nexport interface InternalPlugin<OptionsType = any> {\n type: 'plugin'\n coordinator: CoordinatorPluginFunction<OptionsType>\n}\n\nexport interface FormatterPluginContext<OptionsType> {\n on: (key: 'message', handler: (value: Envelope) => void) => void\n options: OptionsType\n logger: ILogger\n write: (buffer: string | Uint8Array) => void\n directory?: string\n}\n\nexport type FormatterPluginFunction<OptionsType> = (\n context: FormatterPluginContext<OptionsType>\n) => Promisable<PluginCleanup | void>\n\nexport interface FormatterPlugin<OptionsType = any> {\n type: 'formatter'\n formatter: FormatterPluginFunction<OptionsType>\n optionsKey?: string\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/plugin/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Envelope } from '@cucumber/messages'\nimport { ArrayValues, Promisable } from 'type-fest'\nimport { IRunEnvironment } from '../environment'\nimport { ILogger } from '../environment'\nimport { IFilterablePickle } from '../filter'\nimport { IResolvedPaths } from '../paths'\nimport { coordinatorTransformKeys, coordinatorVoidKeys } from './events'\n\nexport type Operation = 'loadSources' | 'loadSupport' | 'runCucumber'\n\nexport type CoordinatorPluginEnvironment = Required<\n Pick<IRunEnvironment, 'cwd' | 'stderr' | 'env'>\n>\n\nexport type CoordinatorPluginVoidEventKey = ArrayValues<\n typeof coordinatorVoidKeys\n>\nexport type CoordinatorPluginTransformEventKey = ArrayValues<\n typeof coordinatorTransformKeys\n>\nexport type CoordinatorPluginEventKey =\n | CoordinatorPluginVoidEventKey\n | CoordinatorPluginTransformEventKey\n\nexport type CoordinatorPluginEventValues = {\n // void\n message: Readonly<Envelope>\n 'paths:resolve': Readonly<IResolvedPaths>\n // transform\n 'pickles:filter': Readonly<Array<IFilterablePickle>>\n 'pickles:order': Readonly<Array<IFilterablePickle>>\n}\n\nexport type CoordinatorPluginEventHandler<K extends CoordinatorPluginEventKey> =\n (\n value: CoordinatorPluginEventValues[K]\n ) => K extends CoordinatorPluginTransformEventKey\n ? Promisable<CoordinatorPluginEventValues[K]>\n : void\n\nexport interface CoordinatorPluginContext<OptionsType> {\n operation: Operation\n on: <EventKey extends CoordinatorPluginEventKey>(\n event: EventKey,\n handler: CoordinatorPluginEventHandler<EventKey>\n ) => void\n options: OptionsType\n logger: ILogger\n environment: CoordinatorPluginEnvironment\n}\n\nexport type CoordinatorPluginFunction<OptionsType> = (\n context: CoordinatorPluginContext<OptionsType>\n) => Promisable<PluginCleanup | void>\n\nexport type PluginCleanup = () => Promisable<void>\n\n/**\n * A plugin to implement Cucumber built-in functionality.\n *\n * Uses the same events and mechanisms as user-authored plugins, but is free to require configuration and context from\n * inside of Cucumber as its `options`, whereas user-authored plugins will be limited to `pluginOptions` from the\n * project configuration.\n */\nexport interface InternalPlugin<OptionsType = any> {\n type: 'plugin'\n coordinator: CoordinatorPluginFunction<OptionsType>\n}\n\nexport interface FormatterPluginContext<OptionsType> {\n on: (key: 'message', handler: (value: Envelope) => void) => void\n options: OptionsType\n logger: ILogger\n stream: NodeJS.WritableStream\n write: (buffer: string | Uint8Array) => void\n directory?: string\n}\n\nexport type FormatterPluginFunction<OptionsType> = (\n context: FormatterPluginContext<OptionsType>\n) => Promisable<PluginCleanup | void>\n\nexport interface FormatterPlugin<OptionsType = any> {\n type: 'formatter'\n formatter: FormatterPluginFunction<OptionsType>\n optionsKey?: string\n}\n"]}
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "12.
|
|
1
|
+
export declare const version = "12.1.0";
|
package/lib/version.js
CHANGED
package/lib/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,QAAQ,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '12.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,QAAQ,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '12.1.0'\n"]}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"gherkin",
|
|
9
9
|
"tests"
|
|
10
10
|
],
|
|
11
|
-
"version": "12.
|
|
11
|
+
"version": "12.1.0",
|
|
12
12
|
"funding": "https://opencollective.com/cucumber",
|
|
13
13
|
"homepage": "https://github.com/cucumber/cucumber-js",
|
|
14
14
|
"author": "Julien Biezemans <jb@jbpros.com>",
|
|
@@ -218,7 +218,7 @@
|
|
|
218
218
|
"dependencies": {
|
|
219
219
|
"@cucumber/ci-environment": "10.0.1",
|
|
220
220
|
"@cucumber/cucumber-expressions": "18.0.1",
|
|
221
|
-
"@cucumber/gherkin": "32.
|
|
221
|
+
"@cucumber/gherkin": "32.2.0",
|
|
222
222
|
"@cucumber/gherkin-streams": "5.0.1",
|
|
223
223
|
"@cucumber/gherkin-utils": "9.2.0",
|
|
224
224
|
"@cucumber/html-formatter": "21.13.0",
|
|
@@ -258,6 +258,7 @@
|
|
|
258
258
|
},
|
|
259
259
|
"devDependencies": {
|
|
260
260
|
"@cucumber/compatibility-kit": "18.0.3",
|
|
261
|
+
"@cucumber/pretty-formatter": "^2.0.0",
|
|
261
262
|
"@cucumber/query": "13.5.0",
|
|
262
263
|
"@eslint/compat": "^1.3.0",
|
|
263
264
|
"@eslint/eslintrc": "^3.3.1",
|
|
@@ -294,7 +295,7 @@
|
|
|
294
295
|
"eslint": "^9.29.0",
|
|
295
296
|
"eslint-plugin-import": "^2.31.0",
|
|
296
297
|
"eslint-plugin-n": "^17.20.0",
|
|
297
|
-
"eslint-plugin-unicorn": "^
|
|
298
|
+
"eslint-plugin-unicorn": "^57.0.0",
|
|
298
299
|
"express": "^5.0.0",
|
|
299
300
|
"fs-extra": "10.1.0",
|
|
300
301
|
"genversion": "3.2.0",
|