@cucumber/cucumber 10.1.0 → 10.3.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 +2 -2
- 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/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 +9 -9
- package/lib/api/load_configuration.js.map +1 -1
- package/lib/api/load_sources.d.ts +4 -3
- package/lib/api/load_sources.js +5 -6
- package/lib/api/load_sources.js.map +1 -1
- package/lib/api/load_support.d.ts +4 -5
- package/lib/api/load_support.js +4 -6
- package/lib/api/load_support.js.map +1 -1
- package/lib/api/run_cucumber.d.ts +5 -5
- package/lib/api/run_cucumber.js +16 -18
- 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 +179 -27
- 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/configuration/check_schema.js +2 -2
- package/lib/configuration/check_schema.js.map +1 -1
- package/lib/configuration/from_file.js +2 -21
- package/lib/configuration/from_file.js.map +1 -1
- package/lib/configuration/index.d.ts +2 -0
- package/lib/configuration/index.js +2 -0
- package/lib/configuration/index.js.map +1 -1
- package/lib/configuration/parse_configuration.d.ts +3 -0
- package/lib/configuration/parse_configuration.js +31 -0
- package/lib/configuration/parse_configuration.js.map +1 -0
- package/lib/configuration/types.d.ts +125 -9
- package/lib/configuration/types.js.map +1 -1
- package/lib/filter/types.d.ts +8 -0
- package/lib/filter/types.js.map +1 -1
- 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 +13 -5
- package/lib/index.js +16 -7
- package/lib/index.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 +1 -1
- package/lib/publish/publish_plugin.js.map +1 -1
- package/lib/publish/types.d.ts +14 -0
- package/lib/{models/pickle_order.js → publish/types.js} +1 -1
- 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/format_error.js +14 -11
- package/lib/runtime/format_error.js.map +1 -1
- package/lib/runtime/index.d.ts +2 -2
- 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/worker.js.map +1 -1
- package/lib/runtime/test_case_runner.d.ts +2 -2
- 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 +1 -1
- package/lib/support_code_library_builder/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/lib/wrapper.mjs +2 -1
- package/package.json +13 -8
- package/lib/models/pickle_order.d.ts +0 -1
- package/lib/models/pickle_order.js.map +0 -1
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ Looking to contribute? Read our [code of conduct](https://github.com/cucumber/.g
|
|
|
28
28
|
Cucumber is [available on npm](https://www.npmjs.com/package/@cucumber/cucumber):
|
|
29
29
|
|
|
30
30
|
```shell
|
|
31
|
-
|
|
31
|
+
npm install @cucumber/cucumber
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
## Get Started
|
|
@@ -79,7 +79,7 @@ Then('I should have heard {string}', function (expectedResponse) {
|
|
|
79
79
|
Finally, run Cucumber:
|
|
80
80
|
|
|
81
81
|
```shell
|
|
82
|
-
|
|
82
|
+
npx cucumber-js
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
And see the output:
|
|
@@ -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,KAAK,EAAE,iBAAiB,CAAC,IAAI;YAC7B,aAAa,EAAE,iBAAiB,CAAC,IAAI;YACrC,KAAK,EAAE,iBAAiB,CAAC,KAAK;SAC/B;QACD,OAAO,EAAE;YACP,cAAc,EAAE,iBAAiB,CAAC,aAAa;YAC/C,YAAY,EAAE,iBAAiB,CAAC,OAAO;YACvC,WAAW,EAAE,iBAAiB,CAAC,MAAM;SACtC;QACD,OAAO,EAAE;YACP,MAAM,EAAE,iBAAiB,CAAC,MAAM;YAChC,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;YACpC,iBAAiB,EAAE,CAAC,iBAAiB,CAAC,SAAS;YAC/C,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;YACpC,KAAK,EAAE,iBAAi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E,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,CAAC,IAAI;YAC7B,aAAa,EAAE,iBAAiB,CAAC,IAAI;YACrC,KAAK,EAAE,iBAAiB,CAAC,KAAK;SAC/B;QACD,OAAO,EAAE;YACP,cAAc,EAAE,iBAAiB,CAAC,aAAa;YAC/C,YAAY,EAAE,iBAAiB,CAAC,OAAO;YACvC,WAAW,EAAE,iBAAiB,CAAC,MAAM;SACtC;QACD,OAAO,EAAE;YACP,MAAM,EAAE,iBAAiB,CAAC,MAAM;YAChC,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;YACpC,iBAAiB,EAAE,CAAC,iBAAiB,CAAC,SAAS;YAC/C,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;YACpC,KAAK,EAAE,iBAAiB,CAAC,KAAK;Y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AAA;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,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,kBA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AAA;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,KA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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 { 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/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>;
|
|
@@ -3,33 +3,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.loadConfiguration = void 0;
|
|
4
4
|
const locate_file_1 = require("../configuration/locate_file");
|
|
5
5
|
const configuration_1 = require("../configuration");
|
|
6
|
-
const validate_configuration_1 = require("../configuration/validate_configuration");
|
|
7
6
|
const convert_configuration_1 = require("./convert_configuration");
|
|
8
7
|
const environment_1 = require("./environment");
|
|
9
|
-
const console_logger_1 = require("./console_logger");
|
|
10
8
|
/**
|
|
11
|
-
* Load user-authored configuration to be used in a test run
|
|
9
|
+
* Load user-authored configuration to be used in a test run
|
|
12
10
|
*
|
|
13
11
|
* @public
|
|
14
|
-
* @param options - Coordinates required to find configuration
|
|
15
|
-
* @param environment - Project environment
|
|
12
|
+
* @param options - Coordinates required to find configuration
|
|
13
|
+
* @param environment - Project environment
|
|
16
14
|
*/
|
|
17
15
|
async function loadConfiguration(options = {}, environment = {}) {
|
|
18
|
-
const { cwd,
|
|
19
|
-
const logger = new console_logger_1.ConsoleLogger(stderr, debug);
|
|
16
|
+
const { cwd, env, logger } = (0, environment_1.mergeEnvironment)(environment);
|
|
20
17
|
const configFile = options.file ?? (0, locate_file_1.locateFile)(cwd);
|
|
21
18
|
if (configFile) {
|
|
22
19
|
logger.debug(`Configuration will be loaded from "${configFile}"`);
|
|
23
20
|
}
|
|
21
|
+
else if (configFile === false) {
|
|
22
|
+
logger.debug('Skipping configuration file resolution');
|
|
23
|
+
}
|
|
24
24
|
else {
|
|
25
25
|
logger.debug('No configuration file found');
|
|
26
26
|
}
|
|
27
27
|
const profileConfiguration = configFile
|
|
28
28
|
? await (0, configuration_1.fromFile)(logger, cwd, configFile, options.profiles)
|
|
29
29
|
: {};
|
|
30
|
-
const original = (0, configuration_1.mergeConfigurations)(configuration_1.DEFAULT_CONFIGURATION, profileConfiguration, options.provided);
|
|
30
|
+
const original = (0, configuration_1.mergeConfigurations)(configuration_1.DEFAULT_CONFIGURATION, profileConfiguration, (0, configuration_1.parseConfiguration)(logger, 'Provided', options.provided));
|
|
31
31
|
logger.debug('Resolved configuration:', original);
|
|
32
|
-
(0,
|
|
32
|
+
(0, configuration_1.validateConfiguration)(original, logger);
|
|
33
33
|
const runnable = await (0, convert_configuration_1.convertConfiguration)(logger, original, env);
|
|
34
34
|
return {
|
|
35
35
|
useConfiguration: original,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load_configuration.js","sourceRoot":"","sources":["../../src/api/load_configuration.ts"],"names":[],"mappings":";;;AAAA,8DAAyD;AACzD,
|
|
1
|
+
{"version":3,"file":"load_configuration.js","sourceRoot":"","sources":["../../src/api/load_configuration.ts"],"names":[],"mappings":";;;AAAA,8DAAyD;AACzD,oDAMyB;AACzB,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,IAAA,kCAAkB,EAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC,CACzD,CAAA;IACD,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE,QAAQ,CAAC,CAAA;IACjD,IAAA,qCAAqB,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 parseConfiguration,\n validateConfiguration,\n} from '../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 parseConfiguration(logger, 'Provided', 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
|
@@ -5,19 +5,18 @@ const messages_1 = require("@cucumber/messages");
|
|
|
5
5
|
const paths_1 = require("../paths");
|
|
6
6
|
const environment_1 = require("./environment");
|
|
7
7
|
const gherkin_1 = require("./gherkin");
|
|
8
|
-
const console_logger_1 = require("./console_logger");
|
|
9
8
|
const plugins_1 = require("./plugins");
|
|
10
9
|
/**
|
|
11
|
-
* 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
|
|
12
12
|
*
|
|
13
13
|
* @public
|
|
14
|
-
* @param coordinates - Coordinates required to find features
|
|
15
|
-
* @param environment - Project environment
|
|
14
|
+
* @param coordinates - Coordinates required to find and process features
|
|
15
|
+
* @param environment - Project environment
|
|
16
16
|
*/
|
|
17
17
|
async function loadSources(coordinates, environment = {}) {
|
|
18
18
|
const mergedEnvironment = (0, environment_1.mergeEnvironment)(environment);
|
|
19
|
-
const { cwd,
|
|
20
|
-
const logger = new console_logger_1.ConsoleLogger(stderr, debug);
|
|
19
|
+
const { cwd, logger } = mergedEnvironment;
|
|
21
20
|
const newId = messages_1.IdGenerator.uuid();
|
|
22
21
|
const pluginManager = await (0, plugins_1.initializeForLoadSources)(logger, coordinates, mergedEnvironment);
|
|
23
22
|
const resolvedPaths = await (0, paths_1.resolvePaths)(logger, cwd, coordinates);
|
|
@@ -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,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,EAClD,MAA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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
|
@@ -5,19 +5,17 @@ const messages_1 = require("@cucumber/messages");
|
|
|
5
5
|
const paths_1 = require("../paths");
|
|
6
6
|
const support_1 = require("./support");
|
|
7
7
|
const environment_1 = require("./environment");
|
|
8
|
-
const console_logger_1 = require("./console_logger");
|
|
9
8
|
const plugins_1 = require("./plugins");
|
|
10
9
|
/**
|
|
11
|
-
* Load support code for use in test runs
|
|
10
|
+
* Load support code for use in test runs
|
|
12
11
|
*
|
|
13
12
|
* @public
|
|
14
|
-
* @param options -
|
|
15
|
-
* @param environment - Project environment
|
|
13
|
+
* @param options - Options required to find the support code
|
|
14
|
+
* @param environment - Project environment
|
|
16
15
|
*/
|
|
17
16
|
async function loadSupport(options, environment = {}) {
|
|
18
17
|
const mergedEnvironment = (0, environment_1.mergeEnvironment)(environment);
|
|
19
|
-
const { cwd,
|
|
20
|
-
const logger = new console_logger_1.ConsoleLogger(stderr, debug);
|
|
18
|
+
const { cwd, logger } = mergedEnvironment;
|
|
21
19
|
const newId = messages_1.IdGenerator.uuid();
|
|
22
20
|
const pluginManager = await (0, plugins_1.initializeForLoadSupport)();
|
|
23
21
|
const resolvedPaths = await (0, paths_1.resolvePaths)(logger, cwd, options.sources, options.support);
|
|
@@ -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"]}
|
|
@@ -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>;
|
package/lib/api/run_cucumber.js
CHANGED
|
@@ -12,32 +12,30 @@ const support_1 = require("./support");
|
|
|
12
12
|
const environment_1 = require("./environment");
|
|
13
13
|
const gherkin_1 = require("./gherkin");
|
|
14
14
|
const plugins_1 = require("./plugins");
|
|
15
|
-
const console_logger_1 = require("./console_logger");
|
|
16
15
|
/**
|
|
17
|
-
* Execute a Cucumber test run
|
|
16
|
+
* Execute a Cucumber test run and return the overall result
|
|
18
17
|
*
|
|
19
18
|
* @public
|
|
20
|
-
* @param
|
|
21
|
-
* @param environment - Project environment
|
|
22
|
-
* @param onMessage - Callback fired each time Cucumber emits a message
|
|
19
|
+
* @param options - Options for the run, obtainable via {@link loadConfiguration}
|
|
20
|
+
* @param environment - Project environment
|
|
21
|
+
* @param onMessage - Callback fired each time Cucumber emits a message
|
|
23
22
|
*/
|
|
24
|
-
async function runCucumber(
|
|
23
|
+
async function runCucumber(options, environment = {}, onMessage) {
|
|
25
24
|
const mergedEnvironment = (0, environment_1.mergeEnvironment)(environment);
|
|
26
|
-
const { cwd, stdout, stderr, env,
|
|
27
|
-
const logger = new console_logger_1.ConsoleLogger(stderr, debug);
|
|
25
|
+
const { cwd, stdout, stderr, env, logger } = mergedEnvironment;
|
|
28
26
|
const newId = messages_1.IdGenerator.uuid();
|
|
29
|
-
const supportCoordinates = '
|
|
30
|
-
?
|
|
31
|
-
:
|
|
27
|
+
const supportCoordinates = 'originalCoordinates' in options.support
|
|
28
|
+
? options.support.originalCoordinates
|
|
29
|
+
: options.support;
|
|
32
30
|
const pluginManager = await (0, plugins_1.initializeForRunCucumber)(logger, {
|
|
33
|
-
...
|
|
31
|
+
...options,
|
|
34
32
|
support: supportCoordinates,
|
|
35
33
|
}, mergedEnvironment);
|
|
36
|
-
const resolvedPaths = await (0, paths_1.resolvePaths)(logger, cwd,
|
|
34
|
+
const resolvedPaths = await (0, paths_1.resolvePaths)(logger, cwd, options.sources, supportCoordinates);
|
|
37
35
|
pluginManager.emit('paths:resolve', resolvedPaths);
|
|
38
36
|
const { sourcePaths, requirePaths, importPaths } = resolvedPaths;
|
|
39
|
-
const supportCodeLibrary = '
|
|
40
|
-
?
|
|
37
|
+
const supportCodeLibrary = 'originalCoordinates' in options.support
|
|
38
|
+
? options.support
|
|
41
39
|
: await (0, support_1.getSupportCodeLibrary)({
|
|
42
40
|
cwd,
|
|
43
41
|
newId,
|
|
@@ -61,7 +59,7 @@ async function runCucumber(configuration, environment = {}, onMessage) {
|
|
|
61
59
|
onStreamError: () => (formatterStreamError = true),
|
|
62
60
|
eventBroadcaster,
|
|
63
61
|
eventDataCollector,
|
|
64
|
-
configuration:
|
|
62
|
+
configuration: options.formats,
|
|
65
63
|
supportCodeLibrary,
|
|
66
64
|
});
|
|
67
65
|
await (0, helpers_2.emitMetaMessage)(eventBroadcaster, env);
|
|
@@ -72,7 +70,7 @@ async function runCucumber(configuration, environment = {}, onMessage) {
|
|
|
72
70
|
newId,
|
|
73
71
|
cwd,
|
|
74
72
|
sourcePaths,
|
|
75
|
-
coordinates:
|
|
73
|
+
coordinates: options.sources,
|
|
76
74
|
onEnvelope: (envelope) => eventBroadcaster.emit('envelope', envelope),
|
|
77
75
|
});
|
|
78
76
|
const filteredPickles = await pluginManager.transform('pickles:filter', gherkinResult.filterablePickles);
|
|
@@ -107,7 +105,7 @@ async function runCucumber(configuration, environment = {}, onMessage) {
|
|
|
107
105
|
requireModules: supportCoordinates.requireModules,
|
|
108
106
|
requirePaths,
|
|
109
107
|
importPaths,
|
|
110
|
-
options:
|
|
108
|
+
options: options.runtime,
|
|
111
109
|
});
|
|
112
110
|
const success = await runtime.start();
|
|
113
111
|
await cleanupFormatters();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run_cucumber.js","sourceRoot":"","sources":["../../src/api/run_cucumber.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,iDAAsE;AACtE,kDAAyD;AACzD,4CAAyE;
|
|
1
|
+
{"version":3,"file":"run_cucumber.js","sourceRoot":"","sources":["../../src/api/run_cucumber.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,iDAAsE;AACtE,kDAAyD;AACzD,4CAAyE;AACzE,oCAAuC;AAGvC,uCAAuC;AACvC,6CAAmD;AACnD,uCAAiD;AACjD,+CAAgD;AAChD,uCAA+C;AAC/C,uCAAoD;AAEpD;;;;;;;GAOG;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AG,aAAa,CAAC,WAAW,CAAA;KACxC;IACD,IAAI,WAAW,CAAC,MAAM,EAAE;QACtB,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YACjC,MAAM,CAAC,KAAK,CACV,mBAAmB,UAAU,CAAC,MAAM,CAAC,GAAG,KAAK,UAAU,CAAC,OAAO,EAAE,CAClE,CAAA;QACH,CAAC,CAAC,CAAA;QACF,MAAM,iBAAiB,EAAE,CAAA;QACzB,MAAM,aAAa,CAAC,OAAO,EAAE,CAAA;QAC7B,OAAO;YACL,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,kBAAkB;SAC5B,CAAA;KACF;IAED,IAAA,iCAAuB,EAAC;QACtB,gBAAgB;QAChB,kBAAkB;QAClB,KAAK;KACN,CAAC,CAAA;IAEF,MAAM,OAAO,GAAG,IAAA,qBAAW,EAAC;QAC1B,GAAG;QACH,MAAM;QACN,gBAAgB;QAChB,kBAAkB;QAClB,SAAS;QACT,KAAK;QACL,kBAAkB;QAClB,cAAc,EAAE,kBAAkB,CAAC,cAAc;QACjD,YAAY;QACZ,WAAW;QACX,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC,CAAA;IACF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,KAAK,EAAE,CAAA;IACrC,MAAM,iBAAiB,EAAE,CAAA;IACzB,MAAM,aAAa,CAAC,OAAO,EAAE,CAAA;IAE7B,OAAO;QACL,OAAO,EAAE,OAAO,IAAI,CAAC,oBAAoB;QACzC,OAAO,EAAE,kBAAkB;KAC5B,CAAA;AACH,CAAC;AAlID,kCAkIC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { Envelope, IdGenerator, ParseError } from '@cucumber/messages'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { emitMetaMessage, emitSupportCodeMessages } from '../cli/helpers'\nimport { resolvePaths } from '../paths'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport { IRunOptions, IRunEnvironment, IRunResult } from './types'\nimport { makeRuntime } from './runtime'\nimport { initializeFormatters } from './formatters'\nimport { getSupportCodeLibrary } from './support'\nimport { mergeEnvironment } from './environment'\nimport { getPicklesAndErrors } from './gherkin'\nimport { initializeForRunCucumber } from './plugins'\n\n/**\n * Execute a Cucumber test run and return the overall result\n *\n * @public\n * @param options - Options for the run, obtainable via {@link loadConfiguration}\n * @param environment - Project environment\n * @param onMessage - Callback fired each time Cucumber emits a message\n */\nexport async function runCucumber(\n options: IRunOptions,\n environment: IRunEnvironment = {},\n onMessage?: (message: Envelope) => void\n): Promise<IRunResult> {\n const mergedEnvironment = mergeEnvironment(environment)\n const { cwd, stdout, stderr, env, logger } = mergedEnvironment\n\n const newId = IdGenerator.uuid()\n\n const supportCoordinates =\n 'originalCoordinates' in options.support\n ? options.support.originalCoordinates\n : options.support\n\n const pluginManager = await initializeForRunCucumber(\n logger,\n {\n ...options,\n support: supportCoordinates,\n },\n mergedEnvironment\n )\n\n const resolvedPaths = await resolvePaths(\n logger,\n cwd,\n options.sources,\n supportCoordinates\n )\n pluginManager.emit('paths:resolve', resolvedPaths)\n const { sourcePaths, requirePaths, importPaths } = resolvedPaths\n\n const supportCodeLibrary =\n 'originalCoordinates' in options.support\n ? (options.support as SupportCodeLibrary)\n : await getSupportCodeLibrary({\n cwd,\n newId,\n requirePaths,\n importPaths,\n requireModules: supportCoordinates.requireModules,\n })\n\n const eventBroadcaster = new EventEmitter()\n if (onMessage) {\n eventBroadcaster.on('envelope', onMessage)\n }\n eventBroadcaster.on('envelope', (value) =>\n pluginManager.emit('message', value)\n )\n const eventDataCollector = new EventDataCollector(eventBroadcaster)\n\n let formatterStreamError = false\n const cleanupFormatters = await initializeFormatters({\n env,\n cwd,\n stdout,\n stderr,\n logger,\n onStreamError: () => (formatterStreamError = true),\n eventBroadcaster,\n eventDataCollector,\n configuration: options.formats,\n supportCodeLibrary,\n })\n await emitMetaMessage(eventBroadcaster, env)\n\n let pickleIds: string[] = []\n let parseErrors: ParseError[] = []\n if (sourcePaths.length > 0) {\n const gherkinResult = await getPicklesAndErrors({\n newId,\n cwd,\n sourcePaths,\n coordinates: options.sources,\n onEnvelope: (envelope) => eventBroadcaster.emit('envelope', envelope),\n })\n const filteredPickles = await pluginManager.transform(\n 'pickles:filter',\n gherkinResult.filterablePickles\n )\n const orderedPickles = await pluginManager.transform(\n 'pickles:order',\n filteredPickles\n )\n pickleIds = orderedPickles.map(({ pickle }) => pickle.id)\n parseErrors = gherkinResult.parseErrors\n }\n if (parseErrors.length) {\n parseErrors.forEach((parseError) => {\n logger.error(\n `Parse error in \"${parseError.source.uri}\" ${parseError.message}`\n )\n })\n await cleanupFormatters()\n await pluginManager.cleanup()\n return {\n success: false,\n support: supportCodeLibrary,\n }\n }\n\n emitSupportCodeMessages({\n eventBroadcaster,\n supportCodeLibrary,\n newId,\n })\n\n const runtime = makeRuntime({\n cwd,\n logger,\n eventBroadcaster,\n eventDataCollector,\n pickleIds,\n newId,\n supportCodeLibrary,\n requireModules: supportCoordinates.requireModules,\n requirePaths,\n importPaths,\n options: options.runtime,\n })\n const success = await runtime.start()\n await cleanupFormatters()\n await pluginManager.cleanup()\n\n return {\n success: success && !formatterStreamError,\n support: supportCodeLibrary,\n }\n}\n"]}
|
package/lib/api/runtime.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { EventEmitter } from 'node:events';
|
|
|
3
3
|
import { IdGenerator } from '@cucumber/messages';
|
|
4
4
|
import { IRuntime } from '../runtime';
|
|
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 { IRunOptionsRuntime } from './types';
|
|
9
9
|
export declare function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary, requireModules, requirePaths, importPaths, options: { parallel, ...options }, }: {
|
|
@@ -13,7 +13,7 @@ export declare function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCo
|
|
|
13
13
|
eventDataCollector: EventDataCollector;
|
|
14
14
|
newId: IdGenerator.NewId;
|
|
15
15
|
pickleIds: string[];
|
|
16
|
-
supportCodeLibrary:
|
|
16
|
+
supportCodeLibrary: SupportCodeLibrary;
|
|
17
17
|
requireModules: string[];
|
|
18
18
|
requirePaths: string[];
|
|
19
19
|
importPaths: string[];
|
package/lib/api/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/api/runtime.ts"],"names":[],"mappings":";;;;;;AAEA,yDAA8C;AAG9C,kFAAyD;AAIzD,SAAgB,WAAW,CAAC,EAC1B,GAAG,EACH,MAAM,EACN,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,KAAK,EACL,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,WAAW,EACX,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,GAalC;IACC,IAAI,QAAQ,GAAG,CAAC,EAAE;QAChB,OAAO,IAAI,qBAAW,CAAC;YACrB,GAAG;YACH,MAAM;YACN,gBAAgB;YAChB,kBAAkB;YAClB,SAAS;YACT,OAAO;YACP,KAAK;YACL,kBAAkB;YAClB,cAAc;YACd,YAAY;YACZ,WAAW;YACX,eAAe,EAAE,QAAQ;SAC1B,CAAC,CAAA;KACH;IACD,OAAO,IAAI,iBAAO,CAAC;QACjB,gBAAgB;QAChB,kBAAkB;QAClB,KAAK;QACL,SAAS;QACT,kBAAkB;QAClB,OAAO;KACR,CAAC,CAAA;AACJ,CAAC;AAjDD,kCAiDC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { IdGenerator } from '@cucumber/messages'\nimport Runtime, { IRuntime } from '../runtime'\nimport { EventDataCollector } from '../formatter/helpers'\nimport {
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/api/runtime.ts"],"names":[],"mappings":";;;;;;AAEA,yDAA8C;AAG9C,kFAAyD;AAIzD,SAAgB,WAAW,CAAC,EAC1B,GAAG,EACH,MAAM,EACN,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,KAAK,EACL,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,WAAW,EACX,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,GAalC;IACC,IAAI,QAAQ,GAAG,CAAC,EAAE;QAChB,OAAO,IAAI,qBAAW,CAAC;YACrB,GAAG;YACH,MAAM;YACN,gBAAgB;YAChB,kBAAkB;YAClB,SAAS;YACT,OAAO;YACP,KAAK;YACL,kBAAkB;YAClB,cAAc;YACd,YAAY;YACZ,WAAW;YACX,eAAe,EAAE,QAAQ;SAC1B,CAAC,CAAA;KACH;IACD,OAAO,IAAI,iBAAO,CAAC;QACjB,gBAAgB;QAChB,kBAAkB;QAClB,KAAK;QACL,SAAS;QACT,kBAAkB;QAClB,OAAO;KACR,CAAC,CAAA;AACJ,CAAC;AAjDD,kCAiDC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { IdGenerator } from '@cucumber/messages'\nimport Runtime, { IRuntime } from '../runtime'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport Coordinator from '../runtime/parallel/coordinator'\nimport { ILogger } from '../logger'\nimport { IRunOptionsRuntime } from './types'\n\nexport function makeRuntime({\n cwd,\n logger,\n eventBroadcaster,\n eventDataCollector,\n pickleIds,\n newId,\n supportCodeLibrary,\n requireModules,\n requirePaths,\n importPaths,\n options: { parallel, ...options },\n}: {\n cwd: string\n logger: ILogger\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n newId: IdGenerator.NewId\n pickleIds: string[]\n supportCodeLibrary: SupportCodeLibrary\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\n options: IRunOptionsRuntime\n}): IRuntime {\n if (parallel > 0) {\n return new Coordinator({\n cwd,\n logger,\n eventBroadcaster,\n eventDataCollector,\n pickleIds,\n options,\n newId,\n supportCodeLibrary,\n requireModules,\n requirePaths,\n importPaths,\n numberOfWorkers: parallel,\n })\n }\n return new Runtime({\n eventBroadcaster,\n eventDataCollector,\n newId,\n pickleIds,\n supportCodeLibrary,\n options,\n })\n}\n"]}
|
package/lib/api/support.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IdGenerator } from '@cucumber/messages';
|
|
2
|
-
import {
|
|
2
|
+
import { SupportCodeLibrary } from '../support_code_library_builder/types';
|
|
3
3
|
export declare function getSupportCodeLibrary({ cwd, newId, requireModules, requirePaths, importPaths, }: {
|
|
4
4
|
cwd: string;
|
|
5
5
|
newId: IdGenerator.NewId;
|
|
6
6
|
requireModules: string[];
|
|
7
7
|
requirePaths: string[];
|
|
8
8
|
importPaths: string[];
|
|
9
|
-
}): Promise<
|
|
9
|
+
}): Promise<SupportCodeLibrary>;
|
package/lib/api/support.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/api/support.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAwC;AAGxC,mGAAuE;AACvE,iEAAuC;AAEhC,KAAK,UAAU,qBAAqB,CAAC,EAC1C,GAAG,EACH,KAAK,EACL,cAAc,EACd,YAAY,EACZ,WAAW,GAOZ;IACC,sCAAyB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE;QAC1C,cAAc;QACd,YAAY;QACZ,WAAW;KACZ,CAAC,CAAA;IAEF,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAA,qBAAU,EAAC,MAAM,CAAC,CAAC,CAAA;IAClD,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAC,CAAA;IAE5C,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE;QAC9B,MAAM,MAAM,CAAC,IAAA,wBAAa,EAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;KAC7C;IAED,OAAO,sCAAyB,CAAC,QAAQ,EAAE,CAAA;AAC7C,CAAC;AA3BD,sDA2BC","sourcesContent":["import { pathToFileURL } from 'node:url'\nimport { IdGenerator } from '@cucumber/messages'\nimport {
|
|
1
|
+
{"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/api/support.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAwC;AAGxC,mGAAuE;AACvE,iEAAuC;AAEhC,KAAK,UAAU,qBAAqB,CAAC,EAC1C,GAAG,EACH,KAAK,EACL,cAAc,EACd,YAAY,EACZ,WAAW,GAOZ;IACC,sCAAyB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE;QAC1C,cAAc;QACd,YAAY;QACZ,WAAW;KACZ,CAAC,CAAA;IAEF,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAA,qBAAU,EAAC,MAAM,CAAC,CAAC,CAAA;IAClD,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAC,CAAA;IAE5C,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE;QAC9B,MAAM,MAAM,CAAC,IAAA,wBAAa,EAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;KAC7C;IAED,OAAO,sCAAyB,CAAC,QAAQ,EAAE,CAAA;AAC7C,CAAC;AA3BD,sDA2BC","sourcesContent":["import { pathToFileURL } from 'node:url'\nimport { IdGenerator } from '@cucumber/messages'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport supportCodeLibraryBuilder from '../support_code_library_builder'\nimport tryRequire from '../try_require'\n\nexport async function getSupportCodeLibrary({\n cwd,\n newId,\n requireModules,\n requirePaths,\n importPaths,\n}: {\n cwd: string\n newId: IdGenerator.NewId\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\n}): Promise<SupportCodeLibrary> {\n supportCodeLibraryBuilder.reset(cwd, newId, {\n requireModules,\n requirePaths,\n importPaths,\n })\n\n requireModules.map((module) => tryRequire(module))\n requirePaths.map((path) => tryRequire(path))\n\n for (const path of importPaths) {\n await import(pathToFileURL(path).toString())\n }\n\n return supportCodeLibraryBuilder.finalize()\n}\n"]}
|