@cucumber/cucumber 10.0.1 → 10.2.1
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/convert_configuration.js.map +1 -1
- package/lib/api/environment.d.ts +6 -1
- package/lib/api/environment.js +6 -1
- package/lib/api/environment.js.map +1 -1
- package/lib/api/formatters.d.ts +2 -2
- package/lib/api/formatters.js.map +1 -1
- package/lib/api/gherkin.d.ts +5 -13
- package/lib/api/gherkin.js +6 -26
- package/lib/api/gherkin.js.map +1 -1
- package/lib/api/index.d.ts +6 -2
- package/lib/api/index.js +4 -2
- package/lib/api/index.js.map +1 -1
- package/lib/api/load_configuration.d.ts +3 -3
- package/lib/api/load_configuration.js +7 -6
- package/lib/api/load_configuration.js.map +1 -1
- package/lib/api/load_sources.d.ts +4 -3
- package/lib/api/load_sources.js +20 -14
- package/lib/api/load_sources.js.map +1 -1
- package/lib/api/load_support.d.ts +4 -5
- package/lib/api/load_support.js +14 -9
- package/lib/api/load_support.js.map +1 -1
- package/lib/api/plugins.d.ts +4 -2
- package/lib/api/plugins.js +19 -8
- package/lib/api/plugins.js.map +1 -1
- package/lib/api/run_cucumber.d.ts +5 -5
- package/lib/api/run_cucumber.js +32 -28
- package/lib/api/run_cucumber.js.map +1 -1
- package/lib/api/runtime.d.ts +2 -2
- package/lib/api/runtime.js.map +1 -1
- package/lib/api/support.d.ts +2 -2
- package/lib/api/support.js.map +1 -1
- package/lib/api/types.d.ts +170 -26
- package/lib/api/types.js.map +1 -1
- package/lib/cli/helpers.d.ts +4 -4
- package/lib/cli/helpers.js.map +1 -1
- package/lib/cli/run.js +1 -2
- package/lib/cli/run.js.map +1 -1
- package/lib/configuration/check_schema.js +2 -2
- package/lib/configuration/check_schema.js.map +1 -1
- package/lib/configuration/types.d.ts +127 -10
- package/lib/configuration/types.js.map +1 -1
- package/lib/filter/filter_plugin.d.ts +3 -0
- package/lib/filter/filter_plugin.js +32 -0
- package/lib/filter/filter_plugin.js.map +1 -0
- package/lib/filter/index.d.ts +3 -0
- package/lib/filter/index.js +20 -0
- package/lib/filter/index.js.map +1 -0
- package/lib/filter/types.d.ts +14 -0
- package/lib/{models/pickle_order.js → filter/types.js} +1 -1
- package/lib/filter/types.js.map +1 -0
- package/lib/formatter/builder.d.ts +3 -3
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/helpers/issue_helpers.d.ts +2 -2
- package/lib/formatter/helpers/issue_helpers.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.d.ts +2 -2
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.d.ts +2 -2
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
- package/lib/formatter/index.d.ts +3 -7
- package/lib/formatter/index.js.map +1 -1
- package/lib/index.d.ts +15 -7
- package/lib/index.js +16 -7
- package/lib/index.js.map +1 -1
- package/lib/paths/index.d.ts +2 -0
- package/lib/paths/index.js +19 -0
- package/lib/paths/index.js.map +1 -0
- package/lib/paths/paths.d.ts +4 -0
- package/lib/{api → paths}/paths.js +8 -8
- package/lib/paths/paths.js.map +1 -0
- package/lib/paths/types.d.ts +6 -0
- package/lib/paths/types.js +3 -0
- package/lib/paths/types.js.map +1 -0
- package/lib/plugin/events.d.ts +2 -0
- package/lib/plugin/events.js +9 -0
- package/lib/plugin/events.js.map +1 -0
- package/lib/plugin/plugin_manager.d.ts +5 -6
- package/lib/plugin/plugin_manager.js +26 -16
- package/lib/plugin/plugin_manager.js.map +1 -1
- package/lib/plugin/types.d.ts +34 -10
- package/lib/plugin/types.js.map +1 -1
- package/lib/publish/index.d.ts +1 -0
- package/lib/publish/index.js +15 -0
- package/lib/publish/index.js.map +1 -1
- package/lib/publish/publish_plugin.d.ts +3 -2
- package/lib/publish/publish_plugin.js +27 -25
- package/lib/publish/publish_plugin.js.map +1 -1
- package/lib/publish/types.d.ts +14 -0
- package/lib/publish/types.js +3 -0
- package/lib/publish/types.js.map +1 -0
- package/lib/runtime/assemble_test_cases.d.ts +2 -2
- package/lib/runtime/assemble_test_cases.js.map +1 -1
- package/lib/runtime/index.d.ts +4 -3
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/index.js.map +1 -1
- package/lib/runtime/parallel/coordinator.d.ts +2 -2
- package/lib/runtime/parallel/coordinator.js.map +1 -1
- package/lib/runtime/parallel/run_worker.js +1 -2
- package/lib/runtime/parallel/run_worker.js.map +1 -1
- package/lib/runtime/parallel/worker.js +1 -1
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/run_test_run_hooks.d.ts +2 -1
- package/lib/runtime/run_test_run_hooks.js +3 -4
- package/lib/runtime/run_test_run_hooks.js.map +1 -1
- package/lib/runtime/test_case_runner.d.ts +4 -3
- package/lib/runtime/test_case_runner.js +1 -1
- package/lib/runtime/test_case_runner.js.map +1 -1
- package/lib/support_code_library_builder/index.d.ts +2 -2
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/types.d.ts +7 -3
- package/lib/support_code_library_builder/types.js.map +1 -1
- package/lib/try_require.js +1 -3
- package/lib/try_require.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/lib/wrapper.mjs +2 -1
- package/package.json +23 -19
- package/lib/api/paths.d.ts +0 -8
- package/lib/api/paths.js.map +0 -1
- package/lib/models/pickle_order.d.ts +0 -1
- package/lib/models/pickle_order.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert_configuration.js","sourceRoot":"","sources":["../../src/api/convert_configuration.ts"],"names":[],"mappings":";;;AAAA,oDAIyB;AAKlB,KAAK,UAAU,oBAAoB,CACxC,MAAe,EACf,iBAAiC,EACjC,GAAsB;IAEtB,OAAO;QACL,OAAO,EAAE;YACP,KAAK,EAAE,iBAAiB,CAAC,KAAK;YAC9B,cAAc,EAAE,iBAAiB,CAAC,QAAQ;YAC1C,KAA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,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;aAChC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE;YACjC,OAAO;gBACL,GAAG,MAAM;gBACT,CAAC,MAAM,CAAC,EAAE,IAAI;aACf,CAAA;QACH,CAAC,EAAE,EAAE,CAAC;QACR,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,EAAE,GAAG,CAAC;QAClD,OAAO,EAAE,iBAAiB,CAAC,aAAa;KACzC,CAAA;AACH,CAAC;AAED,SAAS,iBAAiB,CACxB,iBAAiC,EACjC,GAAsB;IAEtB,MAAM,OAAO,GAAG,YAAY,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAA;IACpD,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,KAAK,CAAA;KACb;IACD,OAAO;QACL,GAAG,EAAE,GAAG,CAAC,oBAAoB;QAC7B,KAAK,EAAE,GAAG,CAAC,sBAAsB;KAClC,CAAA;AACH,CAAC;AAED,SAAS,YAAY,CACnB,iBAAiC,EACjC,GAAsB;IAEtB,OAAO,CACL,iBAAiB,CAAC,OAAO;QACzB,IAAA,8BAAc,EAAC,GAAG,CAAC,wBAAwB,CAAC;QAC5C,GAAG,CAAC,sBAAsB,KAAK,SAAS,CACzC,CAAA;AACH,CAAC","sourcesContent":["import {\n IConfiguration,\n isTruthyString,\n splitFormatDescriptor,\n} from '../configuration'\nimport { IPublishConfig } from '../
|
|
1
|
+
{"version":3,"file":"convert_configuration.js","sourceRoot":"","sources":["../../src/api/convert_configuration.ts"],"names":[],"mappings":";;;AAAA,oDAIyB;AAKlB,KAAK,UAAU,oBAAoB,CACxC,MAAe,EACf,iBAAiC,EACjC,GAAsB;IAEtB,OAAO;QACL,OAAO,EAAE;YACP,KAAK,EAAE,iBAAiB,CAAC,KAAK;YAC9B,cAAc,EAAE,iBAAiB,CAAC,QAAQ;YAC1C,KAAK,EAAE,iBAAiB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AC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;aAChC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE;YACjC,OAAO;gBACL,GAAG,MAAM;gBACT,CAAC,MAAM,CAAC,EAAE,IAAI;aACf,CAAA;QACH,CAAC,EAAE,EAAE,CAAC;QACR,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,EAAE,GAAG,CAAC;QAClD,OAAO,EAAE,iBAAiB,CAAC,aAAa;KACzC,CAAA;AACH,CAAC;AAED,SAAS,iBAAiB,CACxB,iBAAiC,EACjC,GAAsB;IAEtB,MAAM,OAAO,GAAG,YAAY,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAA;IACpD,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,KAAK,CAAA;KACb;IACD,OAAO;QACL,GAAG,EAAE,GAAG,CAAC,oBAAoB;QAC7B,KAAK,EAAE,GAAG,CAAC,sBAAsB;KAClC,CAAA;AACH,CAAC;AAED,SAAS,YAAY,CACnB,iBAAiC,EACjC,GAAsB;IAEtB,OAAO,CACL,iBAAiB,CAAC,OAAO;QACzB,IAAA,8BAAc,EAAC,GAAG,CAAC,wBAAwB,CAAC;QAC5C,GAAG,CAAC,sBAAsB,KAAK,SAAS,CACzC,CAAA;AACH,CAAC","sourcesContent":["import {\n IConfiguration,\n isTruthyString,\n splitFormatDescriptor,\n} from '../configuration'\nimport { IPublishConfig } from '../publish'\nimport { ILogger } from '../logger'\nimport { IRunConfiguration } from './types'\n\nexport async function convertConfiguration(\n logger: ILogger,\n flatConfiguration: IConfiguration,\n env: NodeJS.ProcessEnv\n): Promise<IRunConfiguration> {\n return {\n sources: {\n paths: flatConfiguration.paths,\n defaultDialect: flatConfiguration.language,\n names: flatConfiguration.name,\n tagExpression: flatConfiguration.tags,\n order: flatConfiguration.order,\n },\n support: {\n requireModules: flatConfiguration.requireModule,\n requirePaths: flatConfiguration.require,\n importPaths: flatConfiguration.import,\n },\n runtime: {\n dryRun: flatConfiguration.dryRun,\n failFast: flatConfiguration.failFast,\n filterStacktraces: !flatConfiguration.backtrace,\n parallel: flatConfiguration.parallel,\n retry: flatConfiguration.retry,\n retryTagFilter: flatConfiguration.retryTagFilter,\n strict: flatConfiguration.strict,\n worldParameters: flatConfiguration.worldParameters,\n },\n formats: convertFormats(logger, flatConfiguration, env),\n }\n}\n\nfunction convertFormats(\n logger: ILogger,\n flatConfiguration: IConfiguration,\n env: NodeJS.ProcessEnv\n) {\n const splitFormats: string[][] = flatConfiguration.format.map((item) =>\n Array.isArray(item) ? item : splitFormatDescriptor(logger, item)\n )\n return {\n stdout:\n [...splitFormats].reverse().find(([, target]) => !target)?.[0] ??\n 'progress',\n files: splitFormats\n .filter(([, target]) => !!target)\n .reduce((mapped, [type, target]) => {\n return {\n ...mapped,\n [target]: type,\n }\n }, {}),\n publish: makePublishConfig(flatConfiguration, env),\n options: flatConfiguration.formatOptions,\n }\n}\n\nfunction makePublishConfig(\n flatConfiguration: IConfiguration,\n env: NodeJS.ProcessEnv\n): IPublishConfig | false {\n const enabled = isPublishing(flatConfiguration, env)\n if (!enabled) {\n return false\n }\n return {\n url: env.CUCUMBER_PUBLISH_URL,\n token: env.CUCUMBER_PUBLISH_TOKEN,\n }\n}\n\nfunction isPublishing(\n flatConfiguration: IConfiguration,\n env: NodeJS.ProcessEnv\n): boolean {\n return (\n flatConfiguration.publish ||\n isTruthyString(env.CUCUMBER_PUBLISH_ENABLED) ||\n env.CUCUMBER_PUBLISH_TOKEN !== undefined\n )\n}\n"]}
|
package/lib/api/environment.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
import { ILogger } from '../logger';
|
|
1
2
|
import { IRunEnvironment } from './types';
|
|
2
|
-
|
|
3
|
+
type EnvironmentWithLogger = Required<IRunEnvironment> & {
|
|
4
|
+
logger: ILogger;
|
|
5
|
+
};
|
|
6
|
+
export declare function mergeEnvironment(provided: IRunEnvironment): EnvironmentWithLogger;
|
|
7
|
+
export {};
|
package/lib/api/environment.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mergeEnvironment = void 0;
|
|
4
|
+
const console_logger_1 = require("./console_logger");
|
|
4
5
|
function mergeEnvironment(provided) {
|
|
5
|
-
|
|
6
|
+
const fullEnvironment = Object.assign({}, {
|
|
6
7
|
cwd: process.cwd(),
|
|
7
8
|
stdout: process.stdout,
|
|
8
9
|
stderr: process.stderr,
|
|
9
10
|
env: process.env,
|
|
10
11
|
debug: false,
|
|
11
12
|
}, provided);
|
|
13
|
+
return {
|
|
14
|
+
...fullEnvironment,
|
|
15
|
+
logger: new console_logger_1.ConsoleLogger(fullEnvironment.stderr, fullEnvironment.debug),
|
|
16
|
+
};
|
|
12
17
|
}
|
|
13
18
|
exports.mergeEnvironment = mergeEnvironment;
|
|
14
19
|
//# sourceMappingURL=environment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/api/environment.ts"],"names":[],"mappings":";;;AAEA,SAAgB,gBAAgB,CAC9B,QAAyB;IAEzB,
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/api/environment.ts"],"names":[],"mappings":";;;AAEA,qDAAgD;AAIhD,SAAgB,gBAAgB,CAC9B,QAAyB;IAEzB,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,OAAO;QACL,GAAG,eAAe;QAClB,MAAM,EAAE,IAAI,8BAAa,CAAC,eAAe,CAAC,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC;KACzE,CAAA;AACH,CAAC;AAlBD,4CAkBC","sourcesContent":["import { ILogger } from '../logger'\nimport { IRunEnvironment } from './types'\nimport { ConsoleLogger } from './console_logger'\n\ntype EnvironmentWithLogger = Required<IRunEnvironment> & { logger: ILogger }\n\nexport function mergeEnvironment(\n provided: IRunEnvironment\n): EnvironmentWithLogger {\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 return {\n ...fullEnvironment,\n logger: new ConsoleLogger(fullEnvironment.stderr, fullEnvironment.debug),\n }\n}\n"]}
|
package/lib/api/formatters.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { EventEmitter } from 'node:events';
|
|
4
4
|
import { IFormatterStream } from '../formatter';
|
|
5
5
|
import { EventDataCollector } from '../formatter/helpers';
|
|
6
|
-
import {
|
|
6
|
+
import { SupportCodeLibrary } from '../support_code_library_builder/types';
|
|
7
7
|
import { ILogger } from '../logger';
|
|
8
8
|
import { IRunOptionsFormats } from './types';
|
|
9
9
|
export declare function initializeFormatters({ env, cwd, stdout, logger, onStreamError, eventBroadcaster, eventDataCollector, configuration, supportCodeLibrary, }: {
|
|
@@ -16,5 +16,5 @@ export declare function initializeFormatters({ env, cwd, stdout, logger, onStrea
|
|
|
16
16
|
eventBroadcaster: EventEmitter;
|
|
17
17
|
eventDataCollector: EventDataCollector;
|
|
18
18
|
configuration: IRunOptionsFormats;
|
|
19
|
-
supportCodeLibrary:
|
|
19
|
+
supportCodeLibrary: SupportCodeLibrary;
|
|
20
20
|
}): Promise<() => Promise<void>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/api/formatters.ts"],"names":[],"mappings":";;;;;;AACA,yCAAqC;AAErC,0DAA4B;AAC5B,+CAAsB;AACtB,mCAA+B;AAI/B,mEA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AAE,CAAA;IAE1C,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE;QAC7D,cAAc,CAAC,IAAI,CACjB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,cAAc,GAAG,mBAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;YAEhD,IAAI;gBACF,MAAM,IAAA,eAAM,EAAC,mBAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAA;aAC3C;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAA;aACtE;YAED,MAAM,MAAM,GAAqB,YAAE,CAAC,iBAAiB,CAAC,IAAI,EAAE;gBAC1D,EAAE,EAAE,MAAM,YAAE,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,CAAC;aACvC,CAAC,CAAA;YACF,UAAU,CAAC,IAAI,CAAC,MAAM,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;QAClE,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,CACjB,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;IAEjC,OAAO,KAAK;QACV,MAAM,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;IACpE,CAAC,CAAA;AACH,CAAC;AAtFD,oDAsFC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { promisify } from 'node:util'\nimport { WriteStream as TtyWriteStream } from 'node:tty'\nimport path from 'node:path'\nimport fs from 'mz/fs'\nimport { mkdirp } from 'mkdirp'\nimport Formatter, { IFormatterStream } from '../formatter'\nimport { EventDataCollector } from '../formatter/helpers'\nimport {
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/api/formatters.ts"],"names":[],"mappings":";;;;;;AACA,yCAAqC;AAErC,0DAA4B;AAC5B,+CAAsB;AACtB,mCAA+B;AAI/B,mEAAmD;AAI5C,KAAK,UAAU,oBAAoB,CAAC,EACzC,GAAG,EACH,GAAG,EACH,MAAM,EACN,MAAM,EACN,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,kBAAkB,GAYnB;IACC,KAAK,UAAU,mBAAmB,CAChC,MAAwB,EACxB,MAAc,EACd,IAAY;QAEZ,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAY,EAAE,EAAE;YAClC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC3B,aAAa,EAAE,CAAA;QACjB,CAAC,CAAC,CAAA;QACF,MAAM,WAAW,GAAG;YAClB,GAAG;YACH,GAAG;YACH,gBAAgB;YAChB,kBAAkB;YAClB,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;YAC9B,iBAAiB,EAAE,aAAa,CAAC,OAAO;YACxC,MAAM;YACN,OAAO,EACL,MAAM,KAAK,MAAM;gBACf,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,MAAM,OAAO,CAAC,OAAO,EAAE;gBACrC,CAAC,CAAC,IAAA,qBAAS,EAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC7C,kBAAkB;SACnB,CAAA;QACD,IAAI,IAAI,KAAK,cAAc,IAAI,CAAE,MAAyB,CAAC,KAAK,EAAE;YAChE,MAAM,CAAC,IAAI,CACT,sDAAsD,MAAM,oDAAoD,CACjH,CAAA;YACD,IAAI,GAAG,UAAU,CAAA;SAClB;QACD,OAAO,MAAM,iBAAgB,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,CA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AAA;AACH,CAAC;AAtFD,oDAsFC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { promisify } from 'node:util'\nimport { WriteStream as TtyWriteStream } from 'node:tty'\nimport path from 'node:path'\nimport fs from 'mz/fs'\nimport { mkdirp } from 'mkdirp'\nimport Formatter, { IFormatterStream } from '../formatter'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport FormatterBuilder from '../formatter/builder'\nimport { ILogger } from '../logger'\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}: {\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}): Promise<() => Promise<void>> {\n async function initializeFormatter(\n stream: IFormatterStream,\n target: string,\n type: string\n ): Promise<Formatter> {\n stream.on('error', (error: Error) => {\n logger.error(error.message)\n onStreamError()\n })\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 if (type === '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 type = 'progress'\n }\n return await FormatterBuilder.build(type, typeOptions)\n }\n\n const formatters: Formatter[] = []\n\n formatters.push(\n await initializeFormatter(stdout, 'stdout', configuration.stdout)\n )\n\n const streamPromises: Promise<void>[] = []\n\n Object.entries(configuration.files).forEach(([target, type]) => {\n streamPromises.push(\n (async (target, type) => {\n const absoluteTarget = path.resolve(cwd, target)\n\n try {\n await mkdirp(path.dirname(absoluteTarget))\n } catch (error) {\n logger.warn('Failed to ensure directory for formatter target exists')\n }\n\n const stream: IFormatterStream = fs.createWriteStream(null, {\n fd: await fs.open(absoluteTarget, 'w'),\n })\n formatters.push(await initializeFormatter(stream, target, type))\n })(target, type)\n )\n })\n\n await Promise.all(streamPromises)\n\n return async function () {\n await Promise.all(formatters.map(async (f) => await f.finished()))\n }\n}\n"]}
|
package/lib/api/gherkin.d.ts
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
import { Envelope,
|
|
2
|
-
import {
|
|
1
|
+
import { Envelope, IdGenerator, ParseError } from '@cucumber/messages';
|
|
2
|
+
import { IFilterablePickle } from '../filter';
|
|
3
3
|
import { ISourcesCoordinates } from './types';
|
|
4
|
-
|
|
5
|
-
gherkinDocument: GherkinDocument;
|
|
6
|
-
location: Location;
|
|
7
|
-
pickle: Pickle;
|
|
8
|
-
}
|
|
9
|
-
export declare function getFilteredPicklesAndErrors({ newId, cwd, logger, unexpandedFeaturePaths, featurePaths, coordinates, onEnvelope, }: {
|
|
4
|
+
export declare function getPicklesAndErrors({ newId, cwd, sourcePaths, coordinates, onEnvelope, }: {
|
|
10
5
|
newId: IdGenerator.NewId;
|
|
11
6
|
cwd: string;
|
|
12
|
-
|
|
13
|
-
unexpandedFeaturePaths: string[];
|
|
14
|
-
featurePaths: string[];
|
|
7
|
+
sourcePaths: string[];
|
|
15
8
|
coordinates: ISourcesCoordinates;
|
|
16
9
|
onEnvelope?: (envelope: Envelope) => void;
|
|
17
10
|
}): Promise<{
|
|
18
|
-
|
|
11
|
+
filterablePickles: readonly IFilterablePickle[];
|
|
19
12
|
parseErrors: ParseError[];
|
|
20
13
|
}>;
|
|
21
|
-
export {};
|
package/lib/api/gherkin.js
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
3
|
+
exports.getPicklesAndErrors = void 0;
|
|
7
4
|
const gherkin_streams_1 = require("@cucumber/gherkin-streams");
|
|
8
5
|
const gherkin_utils_1 = require("@cucumber/gherkin-utils");
|
|
9
|
-
|
|
10
|
-
const helpers_1 = require("../cli/helpers");
|
|
11
|
-
async function getFilteredPicklesAndErrors({ newId, cwd, logger, unexpandedFeaturePaths, featurePaths, coordinates, onEnvelope, }) {
|
|
6
|
+
async function getPicklesAndErrors({ newId, cwd, sourcePaths, coordinates, onEnvelope, }) {
|
|
12
7
|
const gherkinQuery = new gherkin_utils_1.Query();
|
|
13
8
|
const parseErrors = [];
|
|
14
|
-
await gherkinFromPaths(
|
|
9
|
+
await gherkinFromPaths(sourcePaths, {
|
|
15
10
|
newId,
|
|
16
11
|
relativeTo: cwd,
|
|
17
12
|
defaultDialect: coordinates.defaultDialect,
|
|
@@ -22,21 +17,7 @@ async function getFilteredPicklesAndErrors({ newId, cwd, logger, unexpandedFeatu
|
|
|
22
17
|
}
|
|
23
18
|
onEnvelope?.(envelope);
|
|
24
19
|
});
|
|
25
|
-
const
|
|
26
|
-
cwd,
|
|
27
|
-
featurePaths: unexpandedFeaturePaths,
|
|
28
|
-
names: coordinates.names,
|
|
29
|
-
tagExpression: coordinates.tagExpression,
|
|
30
|
-
});
|
|
31
|
-
const filteredPickles = gherkinQuery
|
|
32
|
-
.getPickles()
|
|
33
|
-
.filter((pickle) => {
|
|
34
|
-
const gherkinDocument = gherkinQuery
|
|
35
|
-
.getGherkinDocuments()
|
|
36
|
-
.find((doc) => doc.uri === pickle.uri);
|
|
37
|
-
return pickleFilter.matches({ gherkinDocument, pickle });
|
|
38
|
-
})
|
|
39
|
-
.map((pickle) => {
|
|
20
|
+
const filterablePickles = gherkinQuery.getPickles().map((pickle) => {
|
|
40
21
|
const gherkinDocument = gherkinQuery
|
|
41
22
|
.getGherkinDocuments()
|
|
42
23
|
.find((doc) => doc.uri === pickle.uri);
|
|
@@ -47,13 +28,12 @@ async function getFilteredPicklesAndErrors({ newId, cwd, logger, unexpandedFeatu
|
|
|
47
28
|
pickle,
|
|
48
29
|
};
|
|
49
30
|
});
|
|
50
|
-
(0, helpers_1.orderPickles)(filteredPickles, coordinates.order, logger);
|
|
51
31
|
return {
|
|
52
|
-
|
|
32
|
+
filterablePickles,
|
|
53
33
|
parseErrors,
|
|
54
34
|
};
|
|
55
35
|
}
|
|
56
|
-
exports.
|
|
36
|
+
exports.getPicklesAndErrors = getPicklesAndErrors;
|
|
57
37
|
async function gherkinFromPaths(paths, options, onEnvelope) {
|
|
58
38
|
return new Promise((resolve, reject) => {
|
|
59
39
|
const gherkinMessageStream = gherkin_streams_1.GherkinStreams.fromPaths(paths, options);
|
package/lib/api/gherkin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gherkin.js","sourceRoot":"","sources":["../../src/api/gherkin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gherkin.js","sourceRoot":"","sources":["../../src/api/gherkin.ts"],"names":[],"mappings":";;;AAAA,+DAGkC;AAElC,2DAA+D;AAIxD,KAAK,UAAU,mBAAmB,CAAC,EACxC,KAAK,EACL,GAAG,EACH,WAAW,EACX,WAAW,EACX,UAAU,GAOX;IAIC,MAAM,YAAY,GAAG,IAAI,qBAAY,EAAE,CAAA;IACvC,MAAM,WAAW,GAAiB,EAAE,CAAA;IACpC,MAAM,gBAAgB,CACpB,WAAW,EACX;QACE,KAAK;QACL,UAAU,EAAE,GAAG;QACf,cAAc,EAAE,WAAW,CAAC,cAAc;KAC3C,EACD,CAAC,QAAQ,EAAE,EAAE;QACX,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QAC7B,IAAI,QAAQ,CAAC,UAAU,EAAE;YACvB,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;SACtC;QACD,UAAU,EAAE,CAAC,QAAQ,CAAC,CAAA;IACxB,CAAC,CACF,CAAA;IACD,MAAM,iBAAiB,GAAG,YAAY,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QACjE,MAAM,eAAe,GAAG,YAAY;aACjC,mBAAmB,EAAE;aACrB,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC,CAAA;QACxC,MAAM,QAAQ,GAAG,YAAY,CAAC,WAAW,CACvC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAChD,CAAA;QACD,OAAO;YACL,eAAe;YACf,QAAQ;YACR,MAAM;SACP,CAAA;IACH,CAAC,CAAC,CAAA;IACF,OAAO;QACL,iBAAiB;QACjB,WAAW;KACZ,CAAA;AACH,CAAC;AAlDD,kDAkDC;AAED,KAAK,UAAU,gBAAgB,CAC7B,KAAe,EACf,OAA8B,EAC9B,UAAwC;IAExC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,oBAAoB,GAAG,gCAAc,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACrE,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;QAC3C,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACvC,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAC1C,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {\n GherkinStreams,\n IGherkinStreamOptions,\n} from '@cucumber/gherkin-streams'\nimport { Envelope, IdGenerator, ParseError } from '@cucumber/messages'\nimport { Query as GherkinQuery } from '@cucumber/gherkin-utils'\nimport { IFilterablePickle } from '../filter'\nimport { ISourcesCoordinates } from './types'\n\nexport async function getPicklesAndErrors({\n newId,\n cwd,\n sourcePaths,\n coordinates,\n onEnvelope,\n}: {\n newId: IdGenerator.NewId\n cwd: string\n sourcePaths: string[]\n coordinates: ISourcesCoordinates\n onEnvelope?: (envelope: Envelope) => void\n}): Promise<{\n filterablePickles: readonly IFilterablePickle[]\n parseErrors: ParseError[]\n}> {\n const gherkinQuery = new GherkinQuery()\n const parseErrors: ParseError[] = []\n await gherkinFromPaths(\n sourcePaths,\n {\n newId,\n relativeTo: cwd,\n defaultDialect: coordinates.defaultDialect,\n },\n (envelope) => {\n gherkinQuery.update(envelope)\n if (envelope.parseError) {\n parseErrors.push(envelope.parseError)\n }\n onEnvelope?.(envelope)\n }\n )\n const filterablePickles = gherkinQuery.getPickles().map((pickle) => {\n const gherkinDocument = gherkinQuery\n .getGherkinDocuments()\n .find((doc) => doc.uri === pickle.uri)\n const location = gherkinQuery.getLocation(\n pickle.astNodeIds[pickle.astNodeIds.length - 1]\n )\n return {\n gherkinDocument,\n location,\n pickle,\n }\n })\n return {\n filterablePickles,\n parseErrors,\n }\n}\n\nasync function gherkinFromPaths(\n paths: string[],\n options: IGherkinStreamOptions,\n onEnvelope: (envelope: Envelope) => void\n): Promise<void> {\n return new Promise((resolve, reject) => {\n const gherkinMessageStream = GherkinStreams.fromPaths(paths, options)\n gherkinMessageStream.on('data', onEnvelope)\n gherkinMessageStream.on('end', resolve)\n gherkinMessageStream.on('error', reject)\n })\n}\n"]}
|
package/lib/api/index.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* JavaScript API for running and extending Cucumber
|
|
3
3
|
*
|
|
4
|
-
* @remarks These docs cover the API used for running Cucumber programmatically. The entry point is `@cucumber/cucumber/api`.
|
|
5
4
|
* @packageDocumentation
|
|
5
|
+
* @module api
|
|
6
|
+
* @remarks
|
|
7
|
+
* These docs cover the API used for running Cucumber programmatically. The entry point is `@cucumber/cucumber/api`.
|
|
6
8
|
*/
|
|
7
9
|
export { IConfiguration } from '../configuration';
|
|
10
|
+
export { IPickleOrder } from '../filter';
|
|
11
|
+
export { IPublishConfig } from '../publish';
|
|
8
12
|
export * from './load_configuration';
|
|
9
13
|
export * from './load_sources';
|
|
10
14
|
export * from './load_support';
|
package/lib/api/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* JavaScript API for running and extending Cucumber
|
|
4
4
|
*
|
|
5
|
-
* @remarks These docs cover the API used for running Cucumber programmatically. The entry point is `@cucumber/cucumber/api`.
|
|
6
5
|
* @packageDocumentation
|
|
6
|
+
* @module api
|
|
7
|
+
* @remarks
|
|
8
|
+
* These docs cover the API used for running Cucumber programmatically. The entry point is `@cucumber/cucumber/api`.
|
|
7
9
|
*/
|
|
8
10
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
11
|
if (k2 === undefined) k2 = k;
|
package/lib/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;AAKH,uDAAoC;AACpC,iDAA8B;AAC9B,iDAA8B;AAC9B,iDAA8B;AAC9B,0CAAuB","sourcesContent":["/**\n * JavaScript API for running and extending Cucumber\n *\n * @packageDocumentation\n * @module api\n * @remarks\n * These docs cover the API used for running Cucumber programmatically. The entry point is `@cucumber/cucumber/api`.\n */\n\nexport { IConfiguration } from '../configuration'\nexport { IPickleOrder } from '../filter'\nexport { IPublishConfig } from '../publish'\nexport * from './load_configuration'\nexport * from './load_sources'\nexport * from './load_support'\nexport * from './run_cucumber'\nexport * from './types'\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IRunEnvironment, IResolvedConfiguration, ILoadConfigurationOptions } from './types';
|
|
2
2
|
/**
|
|
3
|
-
* Load user-authored configuration to be used in a test run
|
|
3
|
+
* Load user-authored configuration to be used in a test run
|
|
4
4
|
*
|
|
5
5
|
* @public
|
|
6
|
-
* @param options - Coordinates required to find configuration
|
|
7
|
-
* @param environment - Project environment
|
|
6
|
+
* @param options - Coordinates required to find configuration
|
|
7
|
+
* @param environment - Project environment
|
|
8
8
|
*/
|
|
9
9
|
export declare function loadConfiguration(options?: ILoadConfigurationOptions, environment?: IRunEnvironment): Promise<IResolvedConfiguration>;
|
|
@@ -6,21 +6,22 @@ const configuration_1 = require("../configuration");
|
|
|
6
6
|
const validate_configuration_1 = require("../configuration/validate_configuration");
|
|
7
7
|
const convert_configuration_1 = require("./convert_configuration");
|
|
8
8
|
const environment_1 = require("./environment");
|
|
9
|
-
const console_logger_1 = require("./console_logger");
|
|
10
9
|
/**
|
|
11
|
-
* Load user-authored configuration to be used in a test run
|
|
10
|
+
* Load user-authored configuration to be used in a test run
|
|
12
11
|
*
|
|
13
12
|
* @public
|
|
14
|
-
* @param options - Coordinates required to find configuration
|
|
15
|
-
* @param environment - Project environment
|
|
13
|
+
* @param options - Coordinates required to find configuration
|
|
14
|
+
* @param environment - Project environment
|
|
16
15
|
*/
|
|
17
16
|
async function loadConfiguration(options = {}, environment = {}) {
|
|
18
|
-
const { cwd,
|
|
19
|
-
const logger = new console_logger_1.ConsoleLogger(stderr, debug);
|
|
17
|
+
const { cwd, env, logger } = (0, environment_1.mergeEnvironment)(environment);
|
|
20
18
|
const configFile = options.file ?? (0, locate_file_1.locateFile)(cwd);
|
|
21
19
|
if (configFile) {
|
|
22
20
|
logger.debug(`Configuration will be loaded from "${configFile}"`);
|
|
23
21
|
}
|
|
22
|
+
else if (configFile === false) {
|
|
23
|
+
logger.debug('Skipping configuration file resolution');
|
|
24
|
+
}
|
|
24
25
|
else {
|
|
25
26
|
logger.debug('No configuration file found');
|
|
26
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load_configuration.js","sourceRoot":"","sources":["../../src/api/load_configuration.ts"],"names":[],"mappings":";;;AAAA,8DAAyD;AACzD,oDAIyB;AACzB,oFAA+E;
|
|
1
|
+
{"version":3,"file":"load_configuration.js","sourceRoot":"","sources":["../../src/api/load_configuration.ts"],"names":[],"mappings":";;;AAAA,8DAAyD;AACzD,oDAIyB;AACzB,oFAA+E;AAC/E,mEAA8D;AAC9D,+CAAgD;AAOhD;;;;;;GAMG;AACI,KAAK,UAAU,iBAAiB,CACrC,UAAqC,EAAE,EACvC,cAA+B,EAAE;IAEjC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IAC1D,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,IAAI,IAAA,wBAAU,EAAC,GAAG,CAAC,CAAA;IAClD,IAAI,UAAU,EAAE;QACd,MAAM,CAAC,KAAK,CAAC,sCAAsC,UAAU,GAAG,CAAC,CAAA;KAClE;SAAM,IAAI,UAAU,KAAK,KAAK,EAAE;QAC/B,MAAM,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAA;KACvD;SAAM;QACL,MAAM,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAA;KAC5C;IACD,MAAM,oBAAoB,GAAG,UAAU;QACrC,CAAC,CAAC,MAAM,IAAA,wBAAQ,EAAC,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC;QAC3D,CAAC,CAAC,EAAE,CAAA;IACN,MAAM,QAAQ,GAAG,IAAA,mCAAmB,EAClC,qCAAqB,EACrB,oBAAoB,EACpB,OAAO,CAAC,QAAQ,CACjB,CAAA;IACD,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE,QAAQ,CAAC,CAAA;IACjD,IAAA,8CAAqB,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IACvC,MAAM,QAAQ,GAAG,MAAM,IAAA,4CAAoB,EAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAA;IAClE,OAAO;QACL,gBAAgB,EAAE,QAAQ;QAC1B,gBAAgB,EAAE,QAAQ;KAC3B,CAAA;AACH,CAAC;AA5BD,8CA4BC","sourcesContent":["import { locateFile } from '../configuration/locate_file'\nimport {\n DEFAULT_CONFIGURATION,\n fromFile,\n mergeConfigurations,\n} from '../configuration'\nimport { validateConfiguration } from '../configuration/validate_configuration'\nimport { convertConfiguration } from './convert_configuration'\nimport { mergeEnvironment } from './environment'\nimport {\n IRunEnvironment,\n IResolvedConfiguration,\n ILoadConfigurationOptions,\n} 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 } = mergeEnvironment(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 original = mergeConfigurations(\n DEFAULT_CONFIGURATION,\n profileConfiguration,\n options.provided\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"]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ILoadSourcesResult, IRunEnvironment, ISourcesCoordinates } from './types';
|
|
2
2
|
/**
|
|
3
|
-
* Load and parse features, produce a filtered and ordered test plan and/or
|
|
3
|
+
* Load and parse features, produce a filtered and ordered test plan and/or
|
|
4
|
+
* parse errors
|
|
4
5
|
*
|
|
5
6
|
* @public
|
|
6
|
-
* @param coordinates - Coordinates required to find features
|
|
7
|
-
* @param environment - Project environment
|
|
7
|
+
* @param coordinates - Coordinates required to find and process features
|
|
8
|
+
* @param environment - Project environment
|
|
8
9
|
*/
|
|
9
10
|
export declare function loadSources(coordinates: ISourcesCoordinates, environment?: IRunEnvironment): Promise<ILoadSourcesResult>;
|
package/lib/api/load_sources.js
CHANGED
|
@@ -2,37 +2,42 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadSources = void 0;
|
|
4
4
|
const messages_1 = require("@cucumber/messages");
|
|
5
|
-
const paths_1 = require("
|
|
5
|
+
const paths_1 = require("../paths");
|
|
6
6
|
const environment_1 = require("./environment");
|
|
7
7
|
const gherkin_1 = require("./gherkin");
|
|
8
|
-
const
|
|
8
|
+
const plugins_1 = require("./plugins");
|
|
9
9
|
/**
|
|
10
|
-
* Load and parse features, produce a filtered and ordered test plan and/or
|
|
10
|
+
* Load and parse features, produce a filtered and ordered test plan and/or
|
|
11
|
+
* parse errors
|
|
11
12
|
*
|
|
12
13
|
* @public
|
|
13
|
-
* @param coordinates - Coordinates required to find features
|
|
14
|
-
* @param environment - Project environment
|
|
14
|
+
* @param coordinates - Coordinates required to find and process features
|
|
15
|
+
* @param environment - Project environment
|
|
15
16
|
*/
|
|
16
17
|
async function loadSources(coordinates, environment = {}) {
|
|
17
|
-
const
|
|
18
|
-
const logger =
|
|
18
|
+
const mergedEnvironment = (0, environment_1.mergeEnvironment)(environment);
|
|
19
|
+
const { cwd, logger } = mergedEnvironment;
|
|
19
20
|
const newId = messages_1.IdGenerator.uuid();
|
|
20
|
-
const
|
|
21
|
-
|
|
21
|
+
const pluginManager = await (0, plugins_1.initializeForLoadSources)(logger, coordinates, mergedEnvironment);
|
|
22
|
+
const resolvedPaths = await (0, paths_1.resolvePaths)(logger, cwd, coordinates);
|
|
23
|
+
pluginManager.emit('paths:resolve', resolvedPaths);
|
|
24
|
+
const { sourcePaths } = resolvedPaths;
|
|
25
|
+
if (sourcePaths.length === 0) {
|
|
22
26
|
return {
|
|
23
27
|
plan: [],
|
|
24
28
|
errors: [],
|
|
25
29
|
};
|
|
26
30
|
}
|
|
27
|
-
const {
|
|
31
|
+
const { filterablePickles, parseErrors } = await (0, gherkin_1.getPicklesAndErrors)({
|
|
28
32
|
newId,
|
|
29
33
|
cwd,
|
|
30
|
-
|
|
31
|
-
unexpandedFeaturePaths,
|
|
32
|
-
featurePaths,
|
|
34
|
+
sourcePaths,
|
|
33
35
|
coordinates,
|
|
36
|
+
onEnvelope: (envelope) => pluginManager.emit('message', envelope),
|
|
34
37
|
});
|
|
35
|
-
const
|
|
38
|
+
const filteredPickles = await pluginManager.transform('pickles:filter', filterablePickles);
|
|
39
|
+
const orderedPickles = await pluginManager.transform('pickles:order', filteredPickles);
|
|
40
|
+
const plan = orderedPickles.map(({ location, pickle }) => ({
|
|
36
41
|
name: pickle.name,
|
|
37
42
|
uri: pickle.uri,
|
|
38
43
|
location,
|
|
@@ -44,6 +49,7 @@ async function loadSources(coordinates, environment = {}) {
|
|
|
44
49
|
message,
|
|
45
50
|
};
|
|
46
51
|
});
|
|
52
|
+
await pluginManager.cleanup();
|
|
47
53
|
return {
|
|
48
54
|
plan,
|
|
49
55
|
errors,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load_sources.js","sourceRoot":"","sources":["../../src/api/load_sources.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;
|
|
1
|
+
{"version":3,"file":"load_sources.js","sourceRoot":"","sources":["../../src/api/load_sources.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAChD,oCAAuC;AAQvC,+CAAgD;AAChD,uCAA+C;AAC/C,uCAAoD;AAEpD;;;;;;;GAOG;AACI,KAAK,UAAU,WAAW,CAC/B,WAAgC,EAChC,cAA+B,EAAE;IAEjC,MAAM,iBAAiB,GAAG,IAAA,8BAAgB,EAAC,WAAW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M,EAAE,OAAO,EAAE,EAAE,EAAE;QACtE,OAAO;YACL,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,OAAO;SACR,CAAA;IACH,CAAC,CAAC,CAAA;IACF,MAAM,aAAa,CAAC,OAAO,EAAE,CAAA;IAC7B,OAAO;QACL,IAAI;QACJ,MAAM;KACP,CAAA;AACH,CAAC;AArDD,kCAqDC","sourcesContent":["import { IdGenerator } from '@cucumber/messages'\nimport { resolvePaths } from '../paths'\nimport {\n ILoadSourcesResult,\n IPlannedPickle,\n IRunEnvironment,\n ISourcesCoordinates,\n ISourcesError,\n} from './types'\nimport { mergeEnvironment } from './environment'\nimport { getPicklesAndErrors } from './gherkin'\nimport { initializeForLoadSources } from './plugins'\n\n/**\n * Load and parse features, produce a filtered and ordered test plan and/or\n * parse errors\n *\n * @public\n * @param coordinates - Coordinates required to find and process features\n * @param environment - Project environment\n */\nexport async function loadSources(\n coordinates: ISourcesCoordinates,\n environment: IRunEnvironment = {}\n): Promise<ILoadSourcesResult> {\n const mergedEnvironment = mergeEnvironment(environment)\n const { cwd, logger } = mergedEnvironment\n const newId = IdGenerator.uuid()\n const pluginManager = await initializeForLoadSources(\n logger,\n coordinates,\n mergedEnvironment\n )\n const resolvedPaths = await resolvePaths(logger, cwd, coordinates)\n pluginManager.emit('paths:resolve', resolvedPaths)\n const { sourcePaths } = resolvedPaths\n if (sourcePaths.length === 0) {\n return {\n plan: [],\n errors: [],\n }\n }\n const { filterablePickles, parseErrors } = await getPicklesAndErrors({\n newId,\n cwd,\n sourcePaths,\n coordinates,\n onEnvelope: (envelope) => pluginManager.emit('message', envelope),\n })\n const filteredPickles = await pluginManager.transform(\n 'pickles:filter',\n filterablePickles\n )\n const orderedPickles = await pluginManager.transform(\n 'pickles:order',\n filteredPickles\n )\n const plan: IPlannedPickle[] = orderedPickles.map(({ location, pickle }) => ({\n name: pickle.name,\n uri: pickle.uri,\n location,\n }))\n const errors: ISourcesError[] = parseErrors.map(({ source, message }) => {\n return {\n uri: source.uri,\n location: source.location,\n message,\n }\n })\n await pluginManager.cleanup()\n return {\n plan,\n errors,\n }\n}\n"]}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { ISupportCodeLibrary } from '
|
|
2
|
-
import { ILoadSupportOptions, IRunEnvironment } from './types';
|
|
1
|
+
import { ILoadSupportOptions, IRunEnvironment, ISupportCodeLibrary } from './types';
|
|
3
2
|
/**
|
|
4
|
-
* Load support code for use in test runs
|
|
3
|
+
* Load support code for use in test runs
|
|
5
4
|
*
|
|
6
5
|
* @public
|
|
7
|
-
* @param options -
|
|
8
|
-
* @param environment - Project environment
|
|
6
|
+
* @param options - Options required to find the support code
|
|
7
|
+
* @param environment - Project environment
|
|
9
8
|
*/
|
|
10
9
|
export declare function loadSupport(options: ILoadSupportOptions, environment?: IRunEnvironment): Promise<ISupportCodeLibrary>;
|
package/lib/api/load_support.js
CHANGED
|
@@ -2,29 +2,34 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadSupport = void 0;
|
|
4
4
|
const messages_1 = require("@cucumber/messages");
|
|
5
|
-
const paths_1 = require("
|
|
5
|
+
const paths_1 = require("../paths");
|
|
6
6
|
const support_1 = require("./support");
|
|
7
7
|
const environment_1 = require("./environment");
|
|
8
|
-
const
|
|
8
|
+
const plugins_1 = require("./plugins");
|
|
9
9
|
/**
|
|
10
|
-
* Load support code for use in test runs
|
|
10
|
+
* Load support code for use in test runs
|
|
11
11
|
*
|
|
12
12
|
* @public
|
|
13
|
-
* @param options -
|
|
14
|
-
* @param environment - Project environment
|
|
13
|
+
* @param options - Options required to find the support code
|
|
14
|
+
* @param environment - Project environment
|
|
15
15
|
*/
|
|
16
16
|
async function loadSupport(options, environment = {}) {
|
|
17
|
-
const
|
|
18
|
-
const logger =
|
|
17
|
+
const mergedEnvironment = (0, environment_1.mergeEnvironment)(environment);
|
|
18
|
+
const { cwd, logger } = mergedEnvironment;
|
|
19
19
|
const newId = messages_1.IdGenerator.uuid();
|
|
20
|
-
const
|
|
21
|
-
|
|
20
|
+
const pluginManager = await (0, plugins_1.initializeForLoadSupport)();
|
|
21
|
+
const resolvedPaths = await (0, paths_1.resolvePaths)(logger, cwd, options.sources, options.support);
|
|
22
|
+
pluginManager.emit('paths:resolve', resolvedPaths);
|
|
23
|
+
const { requirePaths, importPaths } = resolvedPaths;
|
|
24
|
+
const supportCodeLibrary = await (0, support_1.getSupportCodeLibrary)({
|
|
22
25
|
cwd,
|
|
23
26
|
newId,
|
|
24
27
|
requireModules: options.support.requireModules,
|
|
25
28
|
requirePaths,
|
|
26
29
|
importPaths,
|
|
27
30
|
});
|
|
31
|
+
await pluginManager.cleanup();
|
|
32
|
+
return supportCodeLibrary;
|
|
28
33
|
}
|
|
29
34
|
exports.loadSupport = loadSupport;
|
|
30
35
|
//# sourceMappingURL=load_support.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load_support.js","sourceRoot":"","sources":["../../src/api/load_support.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;
|
|
1
|
+
{"version":3,"file":"load_support.js","sourceRoot":"","sources":["../../src/api/load_support.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAChD,oCAAuC;AAMvC,uCAAiD;AACjD,+CAAgD;AAChD,uCAAoD;AAEpD;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAC/B,OAA4B,EAC5B,cAA+B,EAAE;IAEjC,MAAM,iBAAiB,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IACvD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAA;IACzC,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAChC,MAAM,aAAa,GAAG,MAAM,IAAA,kCAAwB,GAAE,CAAA;IACtD,MAAM,aAAa,GAAG,MAAM,IAAA,oBAAY,EACtC,MAAM,EACN,GAAG,EACH,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,OAAO,CAChB,CAAA;IACD,aAAa,CAAC,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,CAAA;IAClD,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,aAAa,CAAA;IACnD,MAAM,kBAAkB,GAAG,MAAM,IAAA,+BAAqB,EAAC;QACrD,GAAG;QACH,KAAK;QACL,cAAc,EAAE,OAAO,CAAC,OAAO,CAAC,cAAc;QAC9C,YAAY;QACZ,WAAW;KACZ,CAAC,CAAA;IACF,MAAM,aAAa,CAAC,OAAO,EAAE,CAAA;IAC7B,OAAO,kBAAkB,CAAA;AAC3B,CAAC;AAzBD,kCAyBC","sourcesContent":["import { IdGenerator } from '@cucumber/messages'\nimport { resolvePaths } from '../paths'\nimport {\n ILoadSupportOptions,\n IRunEnvironment,\n ISupportCodeLibrary,\n} from './types'\nimport { getSupportCodeLibrary } from './support'\nimport { mergeEnvironment } from './environment'\nimport { initializeForLoadSupport } from './plugins'\n\n/**\n * Load support code for use in test runs\n *\n * @public\n * @param options - Options required to find the support code\n * @param environment - Project environment\n */\nexport async function loadSupport(\n options: ILoadSupportOptions,\n environment: IRunEnvironment = {}\n): Promise<ISupportCodeLibrary> {\n const mergedEnvironment = mergeEnvironment(environment)\n const { cwd, logger } = mergedEnvironment\n const newId = IdGenerator.uuid()\n const pluginManager = await initializeForLoadSupport()\n const resolvedPaths = await resolvePaths(\n logger,\n cwd,\n options.sources,\n options.support\n )\n pluginManager.emit('paths:resolve', resolvedPaths)\n const { requirePaths, importPaths } = resolvedPaths\n const supportCodeLibrary = await getSupportCodeLibrary({\n cwd,\n newId,\n requireModules: options.support.requireModules,\n requirePaths,\n importPaths,\n })\n await pluginManager.cleanup()\n return supportCodeLibrary\n}\n"]}
|
package/lib/api/plugins.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { PluginManager } from '../plugin';
|
|
2
2
|
import { ILogger } from '../logger';
|
|
3
|
-
import { IRunEnvironment,
|
|
4
|
-
export declare function
|
|
3
|
+
import { IRunConfiguration, IRunEnvironment, ISourcesCoordinates } from './types';
|
|
4
|
+
export declare function initializeForLoadSources(logger: ILogger, coordinates: ISourcesCoordinates, environment: Required<IRunEnvironment>): Promise<PluginManager>;
|
|
5
|
+
export declare function initializeForLoadSupport(): Promise<PluginManager>;
|
|
6
|
+
export declare function initializeForRunCucumber(logger: ILogger, configuration: IRunConfiguration, environment: Required<IRunEnvironment>): Promise<PluginManager>;
|
package/lib/api/plugins.js
CHANGED
|
@@ -3,17 +3,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.initializeForRunCucumber = exports.initializeForLoadSupport = exports.initializeForLoadSources = void 0;
|
|
7
7
|
const plugin_1 = require("../plugin");
|
|
8
8
|
const publish_1 = __importDefault(require("../publish"));
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const filter_1 = __importDefault(require("../filter"));
|
|
10
|
+
async function initializeForLoadSources(logger, coordinates, environment) {
|
|
11
|
+
// eventually we'll load plugin packages here
|
|
12
|
+
const pluginManager = new plugin_1.PluginManager();
|
|
13
|
+
await pluginManager.init('loadSources', filter_1.default, coordinates, logger, environment);
|
|
14
|
+
return pluginManager;
|
|
15
|
+
}
|
|
16
|
+
exports.initializeForLoadSources = initializeForLoadSources;
|
|
17
|
+
async function initializeForLoadSupport() {
|
|
18
|
+
// eventually we'll load plugin packages here
|
|
19
|
+
return new plugin_1.PluginManager();
|
|
20
|
+
}
|
|
21
|
+
exports.initializeForLoadSupport = initializeForLoadSupport;
|
|
22
|
+
async function initializeForRunCucumber(logger, configuration, environment) {
|
|
13
23
|
// eventually we'll load plugin packages here
|
|
14
|
-
const pluginManager = new plugin_1.PluginManager(
|
|
15
|
-
await pluginManager.init(
|
|
24
|
+
const pluginManager = new plugin_1.PluginManager();
|
|
25
|
+
await pluginManager.init('runCucumber', publish_1.default, configuration.formats.publish, logger, environment);
|
|
26
|
+
await pluginManager.init('runCucumber', filter_1.default, configuration.sources, logger, environment);
|
|
16
27
|
return pluginManager;
|
|
17
28
|
}
|
|
18
|
-
exports.
|
|
29
|
+
exports.initializeForRunCucumber = initializeForRunCucumber;
|
|
19
30
|
//# sourceMappingURL=plugins.js.map
|
package/lib/api/plugins.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/api/plugins.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/api/plugins.ts"],"names":[],"mappings":";;;;;;AAAA,sCAAyC;AACzC,yDAAsC;AAEtC,uDAAoC;AAO7B,KAAK,UAAU,wBAAwB,CAC5C,MAAe,EACf,WAAgC,EAChC,WAAsC;IAEtC,6CAA6C;IAC7C,MAAM,aAAa,GAAG,IAAI,sBAAa,EAAE,CAAA;IACzC,MAAM,aAAa,CAAC,IAAI,CACtB,aAAa,EACb,gBAAY,EACZ,WAAW,EACX,MAAM,EACN,WAAW,CACZ,CAAA;IACD,OAAO,aAAa,CAAA;AACtB,CAAC;AAfD,4DAeC;AAEM,KAAK,UAAU,wBAAwB;IAC5C,6CAA6C;IAC7C,OAAO,IAAI,sBAAa,EAAE,CAAA;AAC5B,CAAC;AAHD,4DAGC;AAEM,KAAK,UAAU,wBAAwB,CAC5C,MAAe,EACf,aAAgC,EAChC,WAAsC;IAEtC,6CAA6C;IAC7C,MAAM,aAAa,GAAG,IAAI,sBAAa,EAAE,CAAA;IACzC,MAAM,aAAa,CAAC,IAAI,CACtB,aAAa,EACb,iBAAa,EACb,aAAa,CAAC,OAAO,CAAC,OAAO,EAC7B,MAAM,EACN,WAAW,CACZ,CAAA;IACD,MAAM,aAAa,CAAC,IAAI,CACtB,aAAa,EACb,gBAAY,EACZ,aAAa,CAAC,OAAO,EACrB,MAAM,EACN,WAAW,CACZ,CAAA;IACD,OAAO,aAAa,CAAA;AACtB,CAAC;AAtBD,4DAsBC","sourcesContent":["import { PluginManager } from '../plugin'\nimport publishPlugin from '../publish'\nimport { ILogger } from '../logger'\nimport filterPlugin from '../filter'\nimport {\n IRunConfiguration,\n IRunEnvironment,\n ISourcesCoordinates,\n} from './types'\n\nexport async function initializeForLoadSources(\n logger: ILogger,\n coordinates: ISourcesCoordinates,\n environment: Required<IRunEnvironment>\n): Promise<PluginManager> {\n // eventually we'll load plugin packages here\n const pluginManager = new PluginManager()\n await pluginManager.init(\n 'loadSources',\n filterPlugin,\n coordinates,\n logger,\n environment\n )\n return pluginManager\n}\n\nexport async function initializeForLoadSupport(): Promise<PluginManager> {\n // eventually we'll load plugin packages here\n return new PluginManager()\n}\n\nexport async function initializeForRunCucumber(\n logger: ILogger,\n configuration: IRunConfiguration,\n environment: Required<IRunEnvironment>\n): Promise<PluginManager> {\n // eventually we'll load plugin packages here\n const pluginManager = new PluginManager()\n await pluginManager.init(\n 'runCucumber',\n publishPlugin,\n configuration.formats.publish,\n logger,\n environment\n )\n await pluginManager.init(\n 'runCucumber',\n filterPlugin,\n configuration.sources,\n logger,\n environment\n )\n return pluginManager\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Envelope } from '@cucumber/messages';
|
|
2
2
|
import { IRunOptions, IRunEnvironment, IRunResult } from './types';
|
|
3
3
|
/**
|
|
4
|
-
* Execute a Cucumber test run
|
|
4
|
+
* Execute a Cucumber test run and return the overall result
|
|
5
5
|
*
|
|
6
6
|
* @public
|
|
7
|
-
* @param
|
|
8
|
-
* @param environment - Project environment
|
|
9
|
-
* @param onMessage - Callback fired each time Cucumber emits a message
|
|
7
|
+
* @param options - Options for the run, obtainable via {@link loadConfiguration}
|
|
8
|
+
* @param environment - Project environment
|
|
9
|
+
* @param onMessage - Callback fired each time Cucumber emits a message
|
|
10
10
|
*/
|
|
11
|
-
export declare function runCucumber(
|
|
11
|
+
export declare function runCucumber(options: IRunOptions, environment?: IRunEnvironment, onMessage?: (message: Envelope) => void): Promise<IRunResult>;
|