@cucumber/cucumber 10.5.1 → 10.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/convert_configuration.js +1 -0
- package/lib/api/convert_configuration.js.map +1 -1
- package/lib/api/load_support.js +9 -2
- package/lib/api/load_support.js.map +1 -1
- package/lib/api/run_cucumber.js +8 -5
- package/lib/api/run_cucumber.js.map +1 -1
- package/lib/api/runtime.d.ts +1 -4
- package/lib/api/runtime.js +1 -4
- package/lib/api/runtime.js.map +1 -1
- package/lib/api/support.d.ts +2 -1
- package/lib/api/support.js +7 -1
- package/lib/api/support.js.map +1 -1
- package/lib/api/types.d.ts +7 -3
- package/lib/api/types.js.map +1 -1
- package/lib/configuration/argv_parser.js +1 -0
- package/lib/configuration/argv_parser.js.map +1 -1
- package/lib/configuration/default_configuration.js +1 -0
- package/lib/configuration/default_configuration.js.map +1 -1
- package/lib/configuration/merge_configurations.js +1 -0
- package/lib/configuration/merge_configurations.js.map +1 -1
- package/lib/configuration/types.d.ts +5 -0
- package/lib/configuration/types.js.map +1 -1
- package/lib/configuration/validate_configuration.js +3 -0
- package/lib/configuration/validate_configuration.js.map +1 -1
- package/lib/paths/paths.js +1 -0
- package/lib/paths/paths.js.map +1 -1
- package/lib/runtime/parallel/command_types.d.ts +4 -5
- package/lib/runtime/parallel/command_types.js.map +1 -1
- package/lib/runtime/parallel/coordinator.d.ts +1 -7
- package/lib/runtime/parallel/coordinator.js +3 -36
- package/lib/runtime/parallel/coordinator.js.map +1 -1
- package/lib/runtime/parallel/worker.d.ts +1 -1
- package/lib/runtime/parallel/worker.js +12 -15
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/test_case_runner.d.ts +3 -1
- package/lib/runtime/test_case_runner.js +6 -1
- package/lib/runtime/test_case_runner.js.map +1 -1
- package/lib/support_code_library_builder/index.js +1 -0
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/types.d.ts +1 -0
- 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/package.json +1 -1
|
@@ -15,6 +15,7 @@ async function convertConfiguration(logger, flatConfiguration, env) {
|
|
|
15
15
|
requireModules: flatConfiguration.requireModule,
|
|
16
16
|
requirePaths: flatConfiguration.require,
|
|
17
17
|
importPaths: flatConfiguration.import,
|
|
18
|
+
loaders: flatConfiguration.loader,
|
|
18
19
|
},
|
|
19
20
|
runtime: {
|
|
20
21
|
dryRun: flatConfiguration.dryRun,
|
|
@@ -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;
|
|
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,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AAC,CAAC,CAAC,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 '../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 loaders: flatConfiguration.loader,\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/load_support.js
CHANGED
|
@@ -17,16 +17,23 @@ async function loadSupport(options, environment = {}) {
|
|
|
17
17
|
const mergedEnvironment = (0, environment_1.mergeEnvironment)(environment);
|
|
18
18
|
const { cwd, logger } = mergedEnvironment;
|
|
19
19
|
const newId = messages_1.IdGenerator.uuid();
|
|
20
|
+
const supportCoordinates = Object.assign({
|
|
21
|
+
requireModules: [],
|
|
22
|
+
requirePaths: [],
|
|
23
|
+
loaders: [],
|
|
24
|
+
importPaths: [],
|
|
25
|
+
}, options.support);
|
|
20
26
|
const pluginManager = await (0, plugins_1.initializeForLoadSupport)();
|
|
21
|
-
const resolvedPaths = await (0, paths_1.resolvePaths)(logger, cwd, options.sources,
|
|
27
|
+
const resolvedPaths = await (0, paths_1.resolvePaths)(logger, cwd, options.sources, supportCoordinates);
|
|
22
28
|
pluginManager.emit('paths:resolve', resolvedPaths);
|
|
23
29
|
const { requirePaths, importPaths } = resolvedPaths;
|
|
24
30
|
const supportCodeLibrary = await (0, support_1.getSupportCodeLibrary)({
|
|
25
31
|
logger,
|
|
26
32
|
cwd,
|
|
27
33
|
newId,
|
|
28
|
-
requireModules:
|
|
34
|
+
requireModules: supportCoordinates.requireModules,
|
|
29
35
|
requirePaths,
|
|
36
|
+
loaders: supportCoordinates.loaders,
|
|
30
37
|
importPaths,
|
|
31
38
|
});
|
|
32
39
|
await pluginManager.cleanup();
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,kBAAkB,GAAG,MAAM,CAAC,MAAM,CACtC;QACE,cAAc,EAAE,EAAE;QAClB,YAAY,EAAE,EAAE;QAChB,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,EAAE;KAChB,EACD,OAAO,CAAC,OAAO,CAChB,CAAA;IACD,MAAM,aAAa,GAAG,MAAM,IAAA,kCAAwB,GAAE,CAAA;IACtD,MAAM,aAAa,GAAG,MAAM,IAAA,oBAAY,EACtC,MAAM,EACN,GAAG,EACH,OAAO,CAAC,OAAO,EACf,kBAAkB,CACnB,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,MAAM;QACN,GAAG;QACH,KAAK;QACL,cAAc,EAAE,kBAAkB,CAAC,cAAc;QACjD,YAAY;QACZ,OAAO,EAAE,kBAAkB,CAAC,OAAO;QACnC,WAAW;KACZ,CAAC,CAAA;IACF,MAAM,aAAa,CAAC,OAAO,EAAE,CAAA;IAC7B,OAAO,kBAAkB,CAAA;AAC3B,CAAC;AApCD,kCAoCC","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 supportCoordinates = Object.assign(\n {\n requireModules: [],\n requirePaths: [],\n loaders: [],\n importPaths: [],\n },\n options.support\n )\n const pluginManager = await initializeForLoadSupport()\n const resolvedPaths = await resolvePaths(\n logger,\n cwd,\n options.sources,\n supportCoordinates\n )\n pluginManager.emit('paths:resolve', resolvedPaths)\n const { requirePaths, importPaths } = resolvedPaths\n const supportCodeLibrary = await getSupportCodeLibrary({\n logger,\n cwd,\n newId,\n requireModules: supportCoordinates.requireModules,\n requirePaths,\n loaders: supportCoordinates.loaders,\n importPaths,\n })\n await pluginManager.cleanup()\n return supportCodeLibrary\n}\n"]}
|
package/lib/api/run_cucumber.js
CHANGED
|
@@ -26,7 +26,12 @@ async function runCucumber(options, environment = {}, onMessage) {
|
|
|
26
26
|
const newId = messages_1.IdGenerator.uuid();
|
|
27
27
|
const supportCoordinates = 'originalCoordinates' in options.support
|
|
28
28
|
? options.support.originalCoordinates
|
|
29
|
-
:
|
|
29
|
+
: Object.assign({
|
|
30
|
+
requireModules: [],
|
|
31
|
+
requirePaths: [],
|
|
32
|
+
loaders: [],
|
|
33
|
+
importPaths: [],
|
|
34
|
+
}, options.support);
|
|
30
35
|
const pluginManager = await (0, plugins_1.initializeForRunCucumber)(logger, {
|
|
31
36
|
...options,
|
|
32
37
|
support: supportCoordinates,
|
|
@@ -41,8 +46,9 @@ async function runCucumber(options, environment = {}, onMessage) {
|
|
|
41
46
|
cwd,
|
|
42
47
|
newId,
|
|
43
48
|
requirePaths,
|
|
44
|
-
importPaths,
|
|
45
49
|
requireModules: supportCoordinates.requireModules,
|
|
50
|
+
importPaths,
|
|
51
|
+
loaders: supportCoordinates.loaders,
|
|
46
52
|
});
|
|
47
53
|
const eventBroadcaster = new node_events_1.EventEmitter();
|
|
48
54
|
if (onMessage) {
|
|
@@ -103,9 +109,6 @@ async function runCucumber(options, environment = {}, onMessage) {
|
|
|
103
109
|
pickleIds,
|
|
104
110
|
newId,
|
|
105
111
|
supportCodeLibrary,
|
|
106
|
-
requireModules: supportCoordinates.requireModules,
|
|
107
|
-
requirePaths,
|
|
108
|
-
importPaths,
|
|
109
112
|
options: options.runtime,
|
|
110
113
|
});
|
|
111
114
|
const success = await runtime.start();
|
|
@@ -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;AACzE,oCAAuC;AAGvC,uCAAuC;AACvC,6CAAmD;AACnD,uCAAiD;AACjD,+CAAgD;AAChD,uCAA+C;AAC/C,uCAAoD;AAEpD;;;;;;;GAOG;AACI,KAAK,UAAU,WAAW,CAC/B,OAAoB,EACpB,cAA+B,EAAE,EACjC,SAAuC;IAEvC,MAAM,iBAAiB,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IACvD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAA;IAE9D,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAEhC,MAAM,kBAAkB,GACtB,qBAAqB,IAAI,OAAO,CAAC,OAAO;QACtC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,mBAAmB;QACrC,CAAC,CAAC,OAAO,CAAC,OAAO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B,MAAM,aAAa,CAAC,OAAO,EAAE,CAAA;IAE7B,OAAO;QACL,OAAO,EAAE,OAAO,IAAI,CAAC,oBAAoB;QACzC,OAAO,EAAE,kBAAkB;KAC5B,CAAA;AACH,CAAC;AAzID,kCAyIC","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 : Object.assign(\n {\n requireModules: [],\n requirePaths: [],\n loaders: [],\n importPaths: [],\n },\n options.support\n )\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 logger,\n cwd,\n newId,\n requirePaths,\n requireModules: supportCoordinates.requireModules,\n importPaths,\n loaders: supportCoordinates.loaders,\n })\n\n const eventBroadcaster = new EventEmitter()\n if (onMessage) {\n eventBroadcaster.on('envelope', onMessage)\n }\n eventBroadcaster.on('envelope', (value) =>\n pluginManager.emit('message', value)\n )\n const eventDataCollector = new EventDataCollector(eventBroadcaster)\n\n let formatterStreamError = false\n const cleanupFormatters = await initializeFormatters({\n env,\n cwd,\n stdout,\n stderr,\n logger,\n onStreamError: () => (formatterStreamError = true),\n eventBroadcaster,\n eventDataCollector,\n configuration: options.formats,\n supportCodeLibrary,\n })\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 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
|
@@ -6,7 +6,7 @@ import { EventDataCollector } from '../formatter/helpers';
|
|
|
6
6
|
import { SupportCodeLibrary } from '../support_code_library_builder/types';
|
|
7
7
|
import { ILogger } from '../logger';
|
|
8
8
|
import { IRunOptionsRuntime } from './types';
|
|
9
|
-
export declare function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary,
|
|
9
|
+
export declare function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary, options: { parallel, ...options }, }: {
|
|
10
10
|
cwd: string;
|
|
11
11
|
logger: ILogger;
|
|
12
12
|
eventBroadcaster: EventEmitter;
|
|
@@ -14,8 +14,5 @@ export declare function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCo
|
|
|
14
14
|
newId: IdGenerator.NewId;
|
|
15
15
|
pickleIds: string[];
|
|
16
16
|
supportCodeLibrary: SupportCodeLibrary;
|
|
17
|
-
requireModules: string[];
|
|
18
|
-
requirePaths: string[];
|
|
19
|
-
importPaths: string[];
|
|
20
17
|
options: IRunOptionsRuntime;
|
|
21
18
|
}): IRuntime;
|
package/lib/api/runtime.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.makeRuntime = void 0;
|
|
7
7
|
const runtime_1 = __importDefault(require("../runtime"));
|
|
8
8
|
const coordinator_1 = __importDefault(require("../runtime/parallel/coordinator"));
|
|
9
|
-
function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary,
|
|
9
|
+
function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary, options: { parallel, ...options }, }) {
|
|
10
10
|
if (parallel > 0) {
|
|
11
11
|
return new coordinator_1.default({
|
|
12
12
|
cwd,
|
|
@@ -17,9 +17,6 @@ function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickle
|
|
|
17
17
|
options,
|
|
18
18
|
newId,
|
|
19
19
|
supportCodeLibrary,
|
|
20
|
-
requireModules,
|
|
21
|
-
requirePaths,
|
|
22
|
-
importPaths,
|
|
23
20
|
numberOfWorkers: parallel,
|
|
24
21
|
});
|
|
25
22
|
}
|
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,
|
|
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,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,GAUlC;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,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;AAxCD,kCAwCC","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 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 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 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,11 +1,12 @@
|
|
|
1
1
|
import { IdGenerator } from '@cucumber/messages';
|
|
2
2
|
import { SupportCodeLibrary } from '../support_code_library_builder/types';
|
|
3
3
|
import { ILogger } from '../logger';
|
|
4
|
-
export declare function getSupportCodeLibrary({ logger, cwd, newId, requireModules, requirePaths, importPaths, }: {
|
|
4
|
+
export declare function getSupportCodeLibrary({ logger, cwd, newId, requireModules, requirePaths, importPaths, loaders, }: {
|
|
5
5
|
logger: ILogger;
|
|
6
6
|
cwd: string;
|
|
7
7
|
newId: IdGenerator.NewId;
|
|
8
8
|
requireModules: string[];
|
|
9
9
|
requirePaths: string[];
|
|
10
10
|
importPaths: string[];
|
|
11
|
+
loaders: string[];
|
|
11
12
|
}): Promise<SupportCodeLibrary>;
|
package/lib/api/support.js
CHANGED
|
@@ -4,14 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getSupportCodeLibrary = void 0;
|
|
7
|
+
const node_module_1 = require("node:module");
|
|
7
8
|
const node_url_1 = require("node:url");
|
|
8
9
|
const support_code_library_builder_1 = __importDefault(require("../support_code_library_builder"));
|
|
9
10
|
const try_require_1 = __importDefault(require("../try_require"));
|
|
10
|
-
async function getSupportCodeLibrary({ logger, cwd, newId, requireModules, requirePaths, importPaths, }) {
|
|
11
|
+
async function getSupportCodeLibrary({ logger, cwd, newId, requireModules, requirePaths, importPaths, loaders, }) {
|
|
11
12
|
support_code_library_builder_1.default.reset(cwd, newId, {
|
|
12
13
|
requireModules,
|
|
13
14
|
requirePaths,
|
|
14
15
|
importPaths,
|
|
16
|
+
loaders,
|
|
15
17
|
});
|
|
16
18
|
requireModules.map((path) => {
|
|
17
19
|
logger.debug(`Attempting to require code from "${path}"`);
|
|
@@ -21,6 +23,10 @@ async function getSupportCodeLibrary({ logger, cwd, newId, requireModules, requi
|
|
|
21
23
|
logger.debug(`Attempting to require code from "${path}"`);
|
|
22
24
|
(0, try_require_1.default)(path);
|
|
23
25
|
});
|
|
26
|
+
for (const specifier of loaders) {
|
|
27
|
+
logger.debug(`Attempting to register loader "${specifier}"`);
|
|
28
|
+
(0, node_module_1.register)(specifier, (0, node_url_1.pathToFileURL)('./'));
|
|
29
|
+
}
|
|
24
30
|
for (const path of importPaths) {
|
|
25
31
|
logger.debug(`Attempting to import code from "${path}"`);
|
|
26
32
|
await import((0, node_url_1.pathToFileURL)(path).toString());
|
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;AAGhC,KAAK,UAAU,qBAAqB,CAAC,EAC1C,MAAM,EACN,GAAG,EACH,KAAK,EACL,cAAc,EACd,YAAY,EACZ,WAAW,
|
|
1
|
+
{"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/api/support.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAsC;AACtC,uCAAwC;AAGxC,mGAAuE;AACvE,iEAAuC;AAGhC,KAAK,UAAU,qBAAqB,CAAC,EAC1C,MAAM,EACN,GAAG,EACH,KAAK,EACL,cAAc,EACd,YAAY,EACZ,WAAW,EACX,OAAO,GASR;IACC,sCAAyB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE;QAC1C,cAAc;QACd,YAAY;QACZ,WAAW;QACX,OAAO;KACR,CAAC,CAAA;IAEF,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC1B,MAAM,CAAC,KAAK,CAAC,oCAAoC,IAAI,GAAG,CAAC,CAAA;QACzD,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;IACF,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,MAAM,CAAC,KAAK,CAAC,oCAAoC,IAAI,GAAG,CAAC,CAAA;QACzD,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;IAEF,KAAK,MAAM,SAAS,IAAI,OAAO,EAAE;QAC/B,MAAM,CAAC,KAAK,CAAC,kCAAkC,SAAS,GAAG,CAAC,CAAA;QAC5D,IAAA,sBAAQ,EAAC,SAAS,EAAE,IAAA,wBAAa,EAAC,IAAI,CAAC,CAAC,CAAA;KACzC;IAED,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE;QAC9B,MAAM,CAAC,KAAK,CAAC,mCAAmC,IAAI,GAAG,CAAC,CAAA;QACxD,MAAM,MAAM,CAAC,IAAA,wBAAa,EAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;KAC7C;IAED,OAAO,sCAAyB,CAAC,QAAQ,EAAE,CAAA;AAC7C,CAAC;AA5CD,sDA4CC","sourcesContent":["import { register } from 'node:module'\nimport { 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'\nimport { ILogger } from '../logger'\n\nexport async function getSupportCodeLibrary({\n logger,\n cwd,\n newId,\n requireModules,\n requirePaths,\n importPaths,\n loaders,\n}: {\n logger: ILogger\n cwd: string\n newId: IdGenerator.NewId\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\n loaders: string[]\n}): Promise<SupportCodeLibrary> {\n supportCodeLibraryBuilder.reset(cwd, newId, {\n requireModules,\n requirePaths,\n importPaths,\n loaders,\n })\n\n requireModules.map((path) => {\n logger.debug(`Attempting to require code from \"${path}\"`)\n tryRequire(path)\n })\n requirePaths.map((path) => {\n logger.debug(`Attempting to require code from \"${path}\"`)\n tryRequire(path)\n })\n\n for (const specifier of loaders) {\n logger.debug(`Attempting to register loader \"${specifier}\"`)\n register(specifier, pathToFileURL('./'))\n }\n\n for (const path of importPaths) {\n logger.debug(`Attempting to import code from \"${path}\"`)\n await import(pathToFileURL(path).toString())\n }\n\n return supportCodeLibraryBuilder.finalize()\n}\n"]}
|
package/lib/api/types.d.ts
CHANGED
|
@@ -144,6 +144,10 @@ export interface ISupportCodeCoordinates {
|
|
|
144
144
|
* Paths and/or glob expressions of user code to load, via `import()`
|
|
145
145
|
*/
|
|
146
146
|
importPaths: string[];
|
|
147
|
+
/**
|
|
148
|
+
* Specifiers of loaders to register, via `register()`
|
|
149
|
+
*/
|
|
150
|
+
loaders: string[];
|
|
147
151
|
}
|
|
148
152
|
/**
|
|
149
153
|
* Options for {@link loadSupport}
|
|
@@ -158,7 +162,7 @@ export interface ILoadSupportOptions {
|
|
|
158
162
|
* feature file locations.
|
|
159
163
|
*/
|
|
160
164
|
sources: ISourcesCoordinates;
|
|
161
|
-
support: ISupportCodeCoordinates
|
|
165
|
+
support: Partial<ISupportCodeCoordinates>;
|
|
162
166
|
}
|
|
163
167
|
/**
|
|
164
168
|
* Options relating to behaviour when actually running tests
|
|
@@ -237,7 +241,7 @@ export interface IRunOptionsFormats {
|
|
|
237
241
|
*/
|
|
238
242
|
export interface IRunConfiguration {
|
|
239
243
|
sources: ISourcesCoordinates;
|
|
240
|
-
support: ISupportCodeCoordinates
|
|
244
|
+
support: Partial<ISupportCodeCoordinates>;
|
|
241
245
|
runtime: IRunOptionsRuntime;
|
|
242
246
|
formats: IRunOptionsFormats;
|
|
243
247
|
}
|
|
@@ -265,7 +269,7 @@ export interface ISupportCodeLibrary {
|
|
|
265
269
|
* test runs happen within the same process. Note this is only useful in serial
|
|
266
270
|
* mode, as parallel workers will each load the support code themselves anyway.
|
|
267
271
|
*/
|
|
268
|
-
export type ISupportCodeCoordinatesOrLibrary = ISupportCodeCoordinates | ISupportCodeLibrary;
|
|
272
|
+
export type ISupportCodeCoordinatesOrLibrary = Partial<ISupportCodeCoordinates> | ISupportCodeLibrary;
|
|
269
273
|
/**
|
|
270
274
|
* Options for {@link runCucumber}
|
|
271
275
|
* @public
|
package/lib/api/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Writable } from 'node:stream'\nimport { JsonObject } from 'type-fest'\nimport { IPublishConfig } from '../publish'\nimport { IConfiguration } from '../configuration'\nimport { IPickleOrder } from '../filter'\n\n/**\n * Options for {@link loadConfiguration}\n * @public\n */\nexport interface ILoadConfigurationOptions {\n /**\n * Path to load configuration file from, or `false` to skip\n * @default `cucumber.(json|yaml|yml|js|cjs|mjs)`\n */\n file?: string | false\n /**\n * Zero or more profile names from which to source configuration in the file\n * @remarks\n * If omitted or empty, the `default` profile will be used.\n */\n profiles?: string[]\n /**\n * Ad-hoc configuration options to be merged over the top of whatever is\n * loaded from the configuration file/profiles\n * @example\n * \\{\n * failFast: true,\n * parallel: 2\n * \\}\n * @example [\"--fail-fast\", \"--parallel\", \"2\"]\n * @example \"--fail-fast --parallel 2\"\n * @remarks\n * This can also be provided as an array or single string of argv-style\n * arguments.\n */\n provided?: Partial<IConfiguration> | string[] | string\n}\n\n/**\n * Response from {@link loadConfiguration}\n * @public\n */\nexport interface IResolvedConfiguration {\n /**\n * The final flat configuration object resolved from the configuration\n * file/profiles plus any extra provided\n */\n useConfiguration: IConfiguration\n /**\n * The format that can be passed into {@link runCucumber}\n */\n runConfiguration: IRunConfiguration\n}\n\n/**\n * Options relating to sources (i.e. feature files) - where to load them from,\n * how to interpret, filter and order them\n * @public\n */\nexport interface ISourcesCoordinates {\n /**\n * Default Gherkin dialect\n * @remarks\n * Used if no dialect is specified in the feature file itself.\n */\n defaultDialect: string\n /**\n * Paths and/or glob expressions to feature files\n */\n paths: string[]\n /**\n * Regular expressions of which scenario names should match one of to be run\n */\n names: string[]\n /**\n * Tag expression to filter which scenarios should be run\n */\n tagExpression: string\n /**\n * Run in the order defined, or in a random order\n */\n order: IPickleOrder\n}\n\n/**\n * A pickle that has been successfully compiled from a source\n * @public\n */\nexport interface IPlannedPickle {\n /**\n * Name of the pickle (after parameter resolution)\n */\n name: string\n uri: string\n location: {\n line: number\n column?: number\n }\n}\n\n/**\n * An error encountered when parsing a source\n * @public\n */\nexport interface ISourcesError {\n uri: string\n location: {\n line: number\n column?: number\n }\n /**\n * Error message explaining what went wrong with the parse\n */\n message: string\n}\n\n/**\n * Response from {@link loadSources}\n * @public\n */\nexport interface ILoadSourcesResult {\n /**\n * Pickles that have been successfully compiled, in the order they would be\n * run in\n */\n plan: IPlannedPickle[]\n /**\n * Any errors encountered when parsing sources\n */\n errors: ISourcesError[]\n}\n\n/**\n * Options relating to user code (aka support code) - where to load it from and\n * how to preprocess it\n * @public\n */\nexport interface ISupportCodeCoordinates {\n /**\n * Names of transpilation modules to load, via `require()`\n */\n requireModules: string[]\n /**\n * Paths and/or glob expressions of user code to load, via `require()`\n */\n requirePaths: string[]\n /**\n * Paths and/or glob expressions of user code to load, via `import()`\n */\n importPaths: string[]\n}\n\n/**\n * Options for {@link loadSupport}\n * @public\n * @remarks\n * A subset of {@link IRunConfiguration}\n */\nexport interface ILoadSupportOptions {\n /**\n * @remarks\n * This is needed because the default support path locations are derived from\n * feature file locations.\n */\n sources: ISourcesCoordinates\n support: ISupportCodeCoordinates
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Writable } from 'node:stream'\nimport { JsonObject } from 'type-fest'\nimport { IPublishConfig } from '../publish'\nimport { IConfiguration } from '../configuration'\nimport { IPickleOrder } from '../filter'\n\n/**\n * Options for {@link loadConfiguration}\n * @public\n */\nexport interface ILoadConfigurationOptions {\n /**\n * Path to load configuration file from, or `false` to skip\n * @default `cucumber.(json|yaml|yml|js|cjs|mjs)`\n */\n file?: string | false\n /**\n * Zero or more profile names from which to source configuration in the file\n * @remarks\n * If omitted or empty, the `default` profile will be used.\n */\n profiles?: string[]\n /**\n * Ad-hoc configuration options to be merged over the top of whatever is\n * loaded from the configuration file/profiles\n * @example\n * \\{\n * failFast: true,\n * parallel: 2\n * \\}\n * @example [\"--fail-fast\", \"--parallel\", \"2\"]\n * @example \"--fail-fast --parallel 2\"\n * @remarks\n * This can also be provided as an array or single string of argv-style\n * arguments.\n */\n provided?: Partial<IConfiguration> | string[] | string\n}\n\n/**\n * Response from {@link loadConfiguration}\n * @public\n */\nexport interface IResolvedConfiguration {\n /**\n * The final flat configuration object resolved from the configuration\n * file/profiles plus any extra provided\n */\n useConfiguration: IConfiguration\n /**\n * The format that can be passed into {@link runCucumber}\n */\n runConfiguration: IRunConfiguration\n}\n\n/**\n * Options relating to sources (i.e. feature files) - where to load them from,\n * how to interpret, filter and order them\n * @public\n */\nexport interface ISourcesCoordinates {\n /**\n * Default Gherkin dialect\n * @remarks\n * Used if no dialect is specified in the feature file itself.\n */\n defaultDialect: string\n /**\n * Paths and/or glob expressions to feature files\n */\n paths: string[]\n /**\n * Regular expressions of which scenario names should match one of to be run\n */\n names: string[]\n /**\n * Tag expression to filter which scenarios should be run\n */\n tagExpression: string\n /**\n * Run in the order defined, or in a random order\n */\n order: IPickleOrder\n}\n\n/**\n * A pickle that has been successfully compiled from a source\n * @public\n */\nexport interface IPlannedPickle {\n /**\n * Name of the pickle (after parameter resolution)\n */\n name: string\n uri: string\n location: {\n line: number\n column?: number\n }\n}\n\n/**\n * An error encountered when parsing a source\n * @public\n */\nexport interface ISourcesError {\n uri: string\n location: {\n line: number\n column?: number\n }\n /**\n * Error message explaining what went wrong with the parse\n */\n message: string\n}\n\n/**\n * Response from {@link loadSources}\n * @public\n */\nexport interface ILoadSourcesResult {\n /**\n * Pickles that have been successfully compiled, in the order they would be\n * run in\n */\n plan: IPlannedPickle[]\n /**\n * Any errors encountered when parsing sources\n */\n errors: ISourcesError[]\n}\n\n/**\n * Options relating to user code (aka support code) - where to load it from and\n * how to preprocess it\n * @public\n */\nexport interface ISupportCodeCoordinates {\n /**\n * Names of transpilation modules to load, via `require()`\n */\n requireModules: string[]\n /**\n * Paths and/or glob expressions of user code to load, via `require()`\n */\n requirePaths: string[]\n /**\n * Paths and/or glob expressions of user code to load, via `import()`\n */\n importPaths: string[]\n /**\n * Specifiers of loaders to register, via `register()`\n */\n loaders: string[]\n}\n\n/**\n * Options for {@link loadSupport}\n * @public\n * @remarks\n * A subset of {@link IRunConfiguration}\n */\nexport interface ILoadSupportOptions {\n /**\n * @remarks\n * This is needed because the default support path locations are derived from\n * feature file locations.\n */\n sources: ISourcesCoordinates\n support: Partial<ISupportCodeCoordinates>\n}\n\n/**\n * Options relating to behaviour when actually running tests\n * @public\n */\nexport interface IRunOptionsRuntime {\n /**\n * Perform a dry run, where a test run is prepared but nothing is executed\n */\n dryRun: boolean\n /**\n * Stop running tests when a test fails\n */\n failFast: boolean\n /**\n * Filter out stack frames from Cucumber's code when formatting stack traces\n */\n filterStacktraces: boolean\n /**\n * Run tests in parallel with the given number of worker processes\n */\n parallel: number\n /**\n * Retry failing tests up to the given number of times\n */\n retry: number\n /**\n * Tag expression to filter which scenarios can be retried\n */\n retryTagFilter: string\n /**\n * Fail the test run if there are pending steps\n */\n strict: boolean\n /**\n * Parameters to be passed to the World\n * @remarks\n * The value must be a JSON-serializable object.\n */\n worldParameters: JsonObject\n}\n\n/**\n * Options relating to formatters - which ones to use, where to write their\n * output, how they should behave\n * @public\n */\nexport interface IRunOptionsFormats {\n /**\n * Name/path of the formatter to use for `stdout` output\n */\n stdout: string\n /**\n * Zero or more mappings of file output path (key) to name/path of the\n * formatter to use (value)\n * @example\n * \\{\n * \"./reports/cucumber.html\": \"html\",\n * \"./reports/custom.txt\": \"./custom-formatter.js\"\n * \\}\n */\n files: Record<string, string>\n /**\n * Options for report publication, or `false` to disable publication\n */\n publish: IPublishConfig | false\n /**\n * Options to be provided to formatters\n * @remarks\n * The value must be a JSON-serializable object.\n */\n options: JsonObject\n}\n\n/**\n * Structured configuration object suitable for passing to {@link runCucumber}\n * @public\n */\nexport interface IRunConfiguration {\n sources: ISourcesCoordinates\n support: Partial<ISupportCodeCoordinates>\n runtime: IRunOptionsRuntime\n formats: IRunOptionsFormats\n}\n\n/**\n * A collection of user-defined code and setup (\"support code\") that can be\n * used for a test run\n * @public\n * @remarks\n * This is mostly a marker interface. The actual instance is a complex object\n * that you shouldn't interact with directly, but some functions return and/or\n * accept it as a means of optimising a test workflow.\n */\nexport interface ISupportCodeLibrary {\n readonly originalCoordinates: ISupportCodeCoordinates\n}\n\n/**\n * Either an actual {@link ISupportCodeLibrary | support code library}, or the\n * {@link ISupportCodeCoordinates | coordinates} required to create and\n * populate one\n * @public\n * @remarks\n * This alias exists because {@link runCucumber} will accept an existing\n * support code library in its options and thus avoid trying to load it again,\n * improving performance and avoiding cache issues for use cases where multiple\n * test runs happen within the same process. Note this is only useful in serial\n * mode, as parallel workers will each load the support code themselves anyway.\n */\nexport type ISupportCodeCoordinatesOrLibrary =\n | Partial<ISupportCodeCoordinates>\n | ISupportCodeLibrary\n\n/**\n * Options for {@link runCucumber}\n * @public\n */\nexport interface IRunOptions {\n sources: ISourcesCoordinates\n support: ISupportCodeCoordinatesOrLibrary\n runtime: IRunOptionsRuntime\n formats: IRunOptionsFormats\n}\n\n/**\n * Contextual data about the project environment\n * @public\n */\nexport interface IRunEnvironment {\n /**\n * Working directory for the project\n * @default process.cwd()\n */\n cwd?: string\n /**\n * Writable stream where the test run's main formatter output is written\n * @default process.stdout\n */\n stdout?: Writable\n /**\n * Writable stream where the test run's warning/error output is written\n * @default process.stderr\n */\n stderr?: Writable\n /**\n * Environment variables\n * @default process.env\n */\n env?: NodeJS.ProcessEnv\n /**\n * Whether debug logging should be emitted to {@link IRunEnvironment.stderr}\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/debugging.md}\n */\n debug?: boolean\n}\n\n/**\n * Response from {@link runCucumber}\n * @public\n */\nexport interface IRunResult {\n /**\n * Whether the test run was overall successful\n * @remarks\n * The exact meaning can vary based on the `strict` configuration option.\n */\n success: boolean\n /**\n * The support code library that was used in the test run\n * @remarks\n * This can be reused in subsequent {@link runCucumber} calls,\n * see {@link ISupportCodeCoordinatesOrLibrary}\n */\n support: ISupportCodeLibrary\n}\n"]}
|
|
@@ -64,6 +64,7 @@ const ArgvParser = {
|
|
|
64
64
|
.option('--i18n-keywords <ISO 639-1>', 'list language keywords', ArgvParser.validateLanguage)
|
|
65
65
|
.option('--i18n-languages', 'list languages')
|
|
66
66
|
.option('-i, --import <GLOB|DIR|FILE>', 'import files before executing features (repeatable)', ArgvParser.collect)
|
|
67
|
+
.option('-l, --loader <NODE_MODULE>', 'module specifier(s) for loaders to be registered ahead of loading support code', ArgvParser.collect)
|
|
67
68
|
.option('--language <ISO 639-1>', 'provide the default language for feature files')
|
|
68
69
|
.option('--name <REGEXP>', 'only execute the scenarios with name matching the expression (repeatable)', ArgvParser.collect)
|
|
69
70
|
.option('--order <TYPE[:SEED]>', 'run scenarios in the specified order. Type should be `defined` or `random`')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"argv_parser.js","sourceRoot":"","sources":["../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O,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B,aAAa,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAA;SACnC;QAED,OAAO;YACL,OAAO,EAAE;gBACP,MAAM;gBACN,YAAY;gBACZ,aAAa;gBACb,OAAO;aACR;YACD,aAAa;SACd,CAAA;IACH,CAAC;CACF,CAAA;AAED,kBAAe,UAAU,CAAA","sourcesContent":["import { Command } from 'commander'\nimport merge from 'lodash.merge'\nimport { dialects } from '@cucumber/gherkin'\nimport Formatters from '../formatter/helpers/formatters'\nimport { version } from '../version'\nimport { IConfiguration } from './types'\n\nexport interface IParsedArgvOptions {\n config?: string\n i18nKeywords?: string\n i18nLanguages?: boolean\n profile: string[]\n}\n\nexport interface IParsedArgv {\n options: IParsedArgvOptions\n configuration: Partial<IConfiguration>\n}\n\ntype IRawArgvOptions = Partial<Omit<IConfiguration, 'paths'>> &\n IParsedArgvOptions\n\nconst ArgvParser = {\n collect<T>(val: T, memo: T[] = []): T[] {\n if (val) {\n return [...memo, val]\n }\n return undefined\n },\n\n mergeJson(option: string): (str: string, memo?: object) => object {\n return function (str: string, memo: object = {}) {\n let val: object\n try {\n val = JSON.parse(str)\n } catch (error) {\n const e: Error = error\n throw new Error(`${option} passed invalid JSON: ${e.message}: ${str}`)\n }\n if (typeof val !== 'object' || Array.isArray(val)) {\n throw new Error(`${option} must be passed JSON of an object: ${str}`)\n }\n return merge(memo, val)\n }\n },\n\n mergeTags(value: string, memo?: string): string {\n return memo ? `${memo} and (${value})` : `(${value})`\n },\n\n validateCountOption(value: string, optionName: string): number {\n const numericValue = parseInt(value)\n if (isNaN(numericValue) || numericValue < 0) {\n throw new Error(`${optionName} must be a non negative integer`)\n }\n return numericValue\n },\n\n validateLanguage(value: string): string {\n if (!Object.keys(dialects).includes(value)) {\n throw new Error(`Unsupported ISO 639-1: ${value}`)\n }\n return value\n },\n\n parse(argv: string[]): IParsedArgv {\n const program = new Command('cucumber-js')\n\n program\n .storeOptionsAsProperties(false)\n .usage('[options] [<GLOB|DIR|FILE[:LINE]>...]')\n .version(version, '-v, --version')\n .option('-b, --backtrace', 'show full backtrace for errors')\n .option('-c, --config <PATH>', 'specify configuration file')\n .option('-d, --dry-run', 'invoke formatters without executing steps')\n .option(\n '--exit, --force-exit',\n 'force shutdown of the event loop when the test run has finished: cucumber will call process.exit'\n )\n .option('--fail-fast', 'abort the run on first failure')\n .option(\n '-f, --format <TYPE[:PATH]>',\n 'specify the output format, optionally supply PATH to redirect formatter output (repeatable). Available formats:\\n' +\n Formatters.buildFormattersDocumentationString(),\n ArgvParser.collect\n )\n .option(\n '--format-options <JSON>',\n 'provide options for formatters (repeatable)',\n ArgvParser.mergeJson('--format-options')\n )\n .option(\n '--i18n-keywords <ISO 639-1>',\n 'list language keywords',\n ArgvParser.validateLanguage\n )\n .option('--i18n-languages', 'list languages')\n .option(\n '-i, --import <GLOB|DIR|FILE>',\n 'import files before executing features (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--language <ISO 639-1>',\n 'provide the default language for feature files'\n )\n .option(\n '--name <REGEXP>',\n 'only execute the scenarios with name matching the expression (repeatable)',\n ArgvParser.collect\n )\n\n .option(\n '--order <TYPE[:SEED]>',\n 'run scenarios in the specified order. Type should be `defined` or `random`'\n )\n .option(\n '-p, --profile <NAME>',\n 'specify the profile to use (repeatable)',\n ArgvParser.collect,\n []\n )\n .option(\n '--parallel <NUMBER_OF_WORKERS>',\n 'run in parallel with the given number of workers',\n (val) => ArgvParser.validateCountOption(val, '--parallel')\n )\n .option('--publish', 'Publish a report to https://reports.cucumber.io')\n .option(\n '--publish-quiet',\n \"Don't print information banner about publishing reports\"\n )\n .option(\n '-r, --require <GLOB|DIR|FILE>',\n 'require files before executing features (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--require-module <NODE_MODULE>',\n 'require node modules before requiring files (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--retry <NUMBER_OF_RETRIES>',\n 'specify the number of times to retry failing test cases (default: 0)',\n (val) => ArgvParser.validateCountOption(val, '--retry')\n )\n .option(\n '--retry-tag-filter <EXPRESSION>',\n `only retries the features or scenarios with tags matching the expression (repeatable).\n This option requires '--retry' to be specified.`,\n ArgvParser.mergeTags\n )\n .option('--strict', 'fail if there are pending steps')\n .option('--no-strict', 'succeed even if there are pending steps')\n .option(\n '-t, --tags <EXPRESSION>',\n 'only execute the features or scenarios with tags matching the expression (repeatable)',\n ArgvParser.mergeTags\n )\n .option(\n '--world-parameters <JSON>',\n 'provide parameters that will be passed to the world constructor (repeatable)',\n ArgvParser.mergeJson('--world-parameters')\n )\n\n program.addHelpText(\n 'afterAll',\n 'For more details please visit https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md'\n )\n\n program.parse(argv)\n const {\n config,\n i18nKeywords,\n i18nLanguages,\n profile,\n ...regularStuff\n }: IRawArgvOptions = program.opts()\n const configuration: Partial<IConfiguration> = regularStuff\n if (program.args.length > 0) {\n configuration.paths = program.args\n }\n\n return {\n options: {\n config,\n i18nKeywords,\n i18nLanguages,\n profile,\n },\n configuration,\n }\n },\n}\n\nexport default ArgvParser\n"]}
|
|
1
|
+
{"version":3,"file":"argv_parser.js","sourceRoot":"","sources":["../../src/configuration/argv_parser.ts"],"names":[],"mappings":";;;;;AAAA,yCAAmC;AACnC,gEAAgC;AAChC,+CAA4C;AAC5C,iFAAwD;AACxD,wCAAoC;AAkBpC,MAAM,UAAU,GAAG;IACjB,OAAO,CAAI,GAAM,EAAE,OAAY,EAAE;QAC/B,IAAI,GAAG,EAAE;YACP,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAA;SACtB;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,SAAS,CAAC,MAAc;QACtB,OAAO,UAAU,GAAW,EAAE,OAAe,EAAE;YAC7C,IAAI,GAAW,CAAA;YACf,IAAI;gBACF,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;aACtB;YAAC,OAAO,KAAK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AAO,CACnB;aACA,MAAM,CACL,gCAAgC,EAChC,0DAA0D,EAC1D,UAAU,CAAC,OAAO,CACnB;aACA,MAAM,CACL,6BAA6B,EAC7B,sEAAsE,EACtE,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,GAAG,EAAE,SAAS,CAAC,CACxD;aACA,MAAM,CACL,iCAAiC,EACjC;wDACgD,EAChD,UAAU,CAAC,SAAS,CACrB;aACA,MAAM,CAAC,UAAU,EAAE,iCAAiC,CAAC;aACrD,MAAM,CAAC,aAAa,EAAE,yCAAyC,CAAC;aAChE,MAAM,CACL,yBAAyB,EACzB,uFAAuF,EACvF,UAAU,CAAC,SAAS,CACrB;aACA,MAAM,CACL,2BAA2B,EAC3B,8EAA8E,EAC9E,UAAU,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAC3C,CAAA;QAEH,OAAO,CAAC,WAAW,CACjB,UAAU,EACV,6FAA6F,CAC9F,CAAA;QAED,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACnB,MAAM,EACJ,MAAM,EACN,YAAY,EACZ,aAAa,EACb,OAAO,EACP,GAAG,YAAY,EAChB,GAAoB,OAAO,CAAC,IAAI,EAAE,CAAA;QACnC,MAAM,aAAa,GAA4B,YAAY,CAAA;QAC3D,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B,aAAa,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAA;SACnC;QAED,OAAO;YACL,OAAO,EAAE;gBACP,MAAM;gBACN,YAAY;gBACZ,aAAa;gBACb,OAAO;aACR;YACD,aAAa;SACd,CAAA;IACH,CAAC;CACF,CAAA;AAED,kBAAe,UAAU,CAAA","sourcesContent":["import { Command } from 'commander'\nimport merge from 'lodash.merge'\nimport { dialects } from '@cucumber/gherkin'\nimport Formatters from '../formatter/helpers/formatters'\nimport { version } from '../version'\nimport { IConfiguration } from './types'\n\nexport interface IParsedArgvOptions {\n config?: string\n i18nKeywords?: string\n i18nLanguages?: boolean\n profile: string[]\n}\n\nexport interface IParsedArgv {\n options: IParsedArgvOptions\n configuration: Partial<IConfiguration>\n}\n\ntype IRawArgvOptions = Partial<Omit<IConfiguration, 'paths'>> &\n IParsedArgvOptions\n\nconst ArgvParser = {\n collect<T>(val: T, memo: T[] = []): T[] {\n if (val) {\n return [...memo, val]\n }\n return undefined\n },\n\n mergeJson(option: string): (str: string, memo?: object) => object {\n return function (str: string, memo: object = {}) {\n let val: object\n try {\n val = JSON.parse(str)\n } catch (error) {\n const e: Error = error\n throw new Error(`${option} passed invalid JSON: ${e.message}: ${str}`)\n }\n if (typeof val !== 'object' || Array.isArray(val)) {\n throw new Error(`${option} must be passed JSON of an object: ${str}`)\n }\n return merge(memo, val)\n }\n },\n\n mergeTags(value: string, memo?: string): string {\n return memo ? `${memo} and (${value})` : `(${value})`\n },\n\n validateCountOption(value: string, optionName: string): number {\n const numericValue = parseInt(value)\n if (isNaN(numericValue) || numericValue < 0) {\n throw new Error(`${optionName} must be a non negative integer`)\n }\n return numericValue\n },\n\n validateLanguage(value: string): string {\n if (!Object.keys(dialects).includes(value)) {\n throw new Error(`Unsupported ISO 639-1: ${value}`)\n }\n return value\n },\n\n parse(argv: string[]): IParsedArgv {\n const program = new Command('cucumber-js')\n\n program\n .storeOptionsAsProperties(false)\n .usage('[options] [<GLOB|DIR|FILE[:LINE]>...]')\n .version(version, '-v, --version')\n .option('-b, --backtrace', 'show full backtrace for errors')\n .option('-c, --config <PATH>', 'specify configuration file')\n .option('-d, --dry-run', 'invoke formatters without executing steps')\n .option(\n '--exit, --force-exit',\n 'force shutdown of the event loop when the test run has finished: cucumber will call process.exit'\n )\n .option('--fail-fast', 'abort the run on first failure')\n .option(\n '-f, --format <TYPE[:PATH]>',\n 'specify the output format, optionally supply PATH to redirect formatter output (repeatable). Available formats:\\n' +\n Formatters.buildFormattersDocumentationString(),\n ArgvParser.collect\n )\n .option(\n '--format-options <JSON>',\n 'provide options for formatters (repeatable)',\n ArgvParser.mergeJson('--format-options')\n )\n .option(\n '--i18n-keywords <ISO 639-1>',\n 'list language keywords',\n ArgvParser.validateLanguage\n )\n .option('--i18n-languages', 'list languages')\n .option(\n '-i, --import <GLOB|DIR|FILE>',\n 'import files before executing features (repeatable)',\n ArgvParser.collect\n )\n .option(\n '-l, --loader <NODE_MODULE>',\n 'module specifier(s) for loaders to be registered ahead of loading support code',\n ArgvParser.collect\n )\n .option(\n '--language <ISO 639-1>',\n 'provide the default language for feature files'\n )\n .option(\n '--name <REGEXP>',\n 'only execute the scenarios with name matching the expression (repeatable)',\n ArgvParser.collect\n )\n\n .option(\n '--order <TYPE[:SEED]>',\n 'run scenarios in the specified order. Type should be `defined` or `random`'\n )\n .option(\n '-p, --profile <NAME>',\n 'specify the profile to use (repeatable)',\n ArgvParser.collect,\n []\n )\n .option(\n '--parallel <NUMBER_OF_WORKERS>',\n 'run in parallel with the given number of workers',\n (val) => ArgvParser.validateCountOption(val, '--parallel')\n )\n .option('--publish', 'Publish a report to https://reports.cucumber.io')\n .option(\n '--publish-quiet',\n \"Don't print information banner about publishing reports\"\n )\n .option(\n '-r, --require <GLOB|DIR|FILE>',\n 'require files before executing features (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--require-module <NODE_MODULE>',\n 'require node modules before requiring files (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--retry <NUMBER_OF_RETRIES>',\n 'specify the number of times to retry failing test cases (default: 0)',\n (val) => ArgvParser.validateCountOption(val, '--retry')\n )\n .option(\n '--retry-tag-filter <EXPRESSION>',\n `only retries the features or scenarios with tags matching the expression (repeatable).\n This option requires '--retry' to be specified.`,\n ArgvParser.mergeTags\n )\n .option('--strict', 'fail if there are pending steps')\n .option('--no-strict', 'succeed even if there are pending steps')\n .option(\n '-t, --tags <EXPRESSION>',\n 'only execute the features or scenarios with tags matching the expression (repeatable)',\n ArgvParser.mergeTags\n )\n .option(\n '--world-parameters <JSON>',\n 'provide parameters that will be passed to the world constructor (repeatable)',\n ArgvParser.mergeJson('--world-parameters')\n )\n\n program.addHelpText(\n 'afterAll',\n 'For more details please visit https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md'\n )\n\n program.parse(argv)\n const {\n config,\n i18nKeywords,\n i18nLanguages,\n profile,\n ...regularStuff\n }: IRawArgvOptions = program.opts()\n const configuration: Partial<IConfiguration> = regularStuff\n if (program.args.length > 0) {\n configuration.paths = program.args\n }\n\n return {\n options: {\n config,\n i18nKeywords,\n i18nLanguages,\n profile,\n },\n configuration,\n }\n },\n}\n\nexport default ArgvParser\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default_configuration.js","sourceRoot":"","sources":["../../src/configuration/default_configuration.ts"],"names":[],"mappings":";;;AAEa,QAAA,qBAAqB,GAAmB;IACnD,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,EAAE;IACV,aAAa,EAAE,EAAE;IACjB,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,KAAK;IACd,YAAY,EAAE,KAAK;IACnB,OAAO,EAAE,EAAE;IACX,aAAa,EAAE,EAAE;IACjB,KAAK,EAAE,CAAC;IACR,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,EAAE;IACR,eAAe,EAAE,EAAE;CACpB,CAAA","sourcesContent":["import { IConfiguration } from './types'\n\nexport const DEFAULT_CONFIGURATION: IConfiguration = {\n backtrace: false,\n dryRun: false,\n forceExit: false,\n failFast: false,\n format: [],\n formatOptions: {},\n import: [],\n language: 'en',\n name: [],\n order: 'defined',\n paths: [],\n parallel: 0,\n publish: false,\n publishQuiet: false,\n require: [],\n requireModule: [],\n retry: 0,\n retryTagFilter: '',\n strict: true,\n tags: '',\n worldParameters: {},\n}\n"]}
|
|
1
|
+
{"version":3,"file":"default_configuration.js","sourceRoot":"","sources":["../../src/configuration/default_configuration.ts"],"names":[],"mappings":";;;AAEa,QAAA,qBAAqB,GAAmB;IACnD,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,EAAE;IACV,aAAa,EAAE,EAAE;IACjB,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,KAAK;IACd,YAAY,EAAE,KAAK;IACnB,OAAO,EAAE,EAAE;IACX,aAAa,EAAE,EAAE;IACjB,KAAK,EAAE,CAAC;IACR,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,EAAE;IACR,eAAe,EAAE,EAAE;CACpB,CAAA","sourcesContent":["import { IConfiguration } from './types'\n\nexport const DEFAULT_CONFIGURATION: IConfiguration = {\n backtrace: false,\n dryRun: false,\n forceExit: false,\n failFast: false,\n format: [],\n formatOptions: {},\n import: [],\n language: 'en',\n loader: [],\n name: [],\n order: 'defined',\n paths: [],\n parallel: 0,\n publish: false,\n publishQuiet: false,\n require: [],\n requireModule: [],\n retry: 0,\n retryTagFilter: '',\n strict: true,\n tags: '',\n worldParameters: {},\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge_configurations.js","sourceRoot":"","sources":["../../src/configuration/merge_configurations.ts"],"names":[],"mappings":";;;;;;AAAA,wEAAwC;AAGxC,MAAM,eAAe,GAAG;IACtB,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IACP,SAAS;IACT,eAAe;CAChB,CAAA;AACD,MA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_ARRAYS = [\n 'format',\n 'import',\n 'name',\n 'paths',\n 'require',\n 'requireModule',\n]\nconst TAG_EXPRESSIONS = ['tags', 'retryTagFilter']\n\nfunction mergeArrays(objValue: any[], srcValue: any[]) {\n if (objValue && srcValue) {\n return [].concat(objValue, srcValue)\n }\n return undefined\n}\n\nfunction mergeTagExpressions(objValue: string, srcValue: string) {\n if (objValue && srcValue) {\n return `${wrapTagExpression(objValue)} and ${wrapTagExpression(srcValue)}`\n }\n return undefined\n}\n\nfunction wrapTagExpression(raw: string) {\n if (raw.startsWith('(') && raw.endsWith(')')) {\n return raw\n }\n return `(${raw})`\n}\n\nfunction customizer(objValue: any, srcValue: any, key: string): any {\n if (ADDITIVE_ARRAYS.includes(key)) {\n return mergeArrays(objValue, srcValue)\n }\n if (TAG_EXPRESSIONS.includes(key)) {\n return mergeTagExpressions(objValue, srcValue)\n }\n return undefined\n}\n\nexport function mergeConfigurations<T = Partial<IConfiguration>>(\n source: T,\n ...configurations: Partial<IConfiguration>[]\n): T {\n return mergeWith({}, source, ...configurations, customizer)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"merge_configurations.js","sourceRoot":"","sources":["../../src/configuration/merge_configurations.ts"],"names":[],"mappings":";;;;;;AAAA,wEAAwC;AAGxC,MAAM,eAAe,GAAG;IACtB,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IACP,SAAS;IACT,eAAe;CAChB,CAAA;AACD,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;AAElD,SAAS,WAAW,CAAC,QAAe,EAAE,QAAe;IACnD,IAAI,QAAQ,IAAI,QAAQ,EAAE;QACxB,OAAO,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;KACrC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAS,mBAAmB,CAAC,QAAgB,EAAE,QAAgB;IAC7D,IAAI,QAAQ,IAAI,QAAQ,EAAE;QACxB,OAAO,GAAG,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAA;KAC3E;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAW;IACpC,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC5C,OAAO,GAAG,CAAA;KACX;IACD,OAAO,IAAI,GAAG,GAAG,CAAA;AACnB,CAAC;AAED,SAAS,UAAU,CAAC,QAAa,EAAE,QAAa,EAAE,GAAW;IAC3D,IAAI,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACjC,OAAO,WAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;KACvC;IACD,IAAI,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACjC,OAAO,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;KAC/C;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAgB,mBAAmB,CACjC,MAAS,EACT,GAAG,cAAyC;IAE5C,OAAO,IAAA,0BAAS,EAAC,EAAE,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,UAAU,CAAC,CAAA;AAC7D,CAAC;AALD,kDAKC","sourcesContent":["import mergeWith from 'lodash.mergewith'\nimport { IConfiguration } from './types'\n\nconst ADDITIVE_ARRAYS = [\n 'format',\n 'import',\n 'loader',\n 'name',\n 'paths',\n 'require',\n 'requireModule',\n]\nconst TAG_EXPRESSIONS = ['tags', 'retryTagFilter']\n\nfunction mergeArrays(objValue: any[], srcValue: any[]) {\n if (objValue && srcValue) {\n return [].concat(objValue, srcValue)\n }\n return undefined\n}\n\nfunction mergeTagExpressions(objValue: string, srcValue: string) {\n if (objValue && srcValue) {\n return `${wrapTagExpression(objValue)} and ${wrapTagExpression(srcValue)}`\n }\n return undefined\n}\n\nfunction wrapTagExpression(raw: string) {\n if (raw.startsWith('(') && raw.endsWith(')')) {\n return raw\n }\n return `(${raw})`\n}\n\nfunction customizer(objValue: any, srcValue: any, key: string): any {\n if (ADDITIVE_ARRAYS.includes(key)) {\n return mergeArrays(objValue, srcValue)\n }\n if (TAG_EXPRESSIONS.includes(key)) {\n return mergeTagExpressions(objValue, srcValue)\n }\n return undefined\n}\n\nexport function mergeConfigurations<T = Partial<IConfiguration>>(\n source: T,\n ...configurations: Partial<IConfiguration>[]\n): T {\n return mergeWith({}, source, ...configurations, customizer)\n}\n"]}
|
|
@@ -73,6 +73,11 @@ export interface IConfiguration {
|
|
|
73
73
|
* @default "en"
|
|
74
74
|
*/
|
|
75
75
|
language: string;
|
|
76
|
+
/**
|
|
77
|
+
* Module specifier(s) for loaders to be registered ahead of loading support code
|
|
78
|
+
* @default []
|
|
79
|
+
*/
|
|
80
|
+
loader: string[];
|
|
76
81
|
/**
|
|
77
82
|
* Regular expressions of which scenario names should match one of to be run
|
|
78
83
|
* @default []
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/configuration/types.ts"],"names":[],"mappings":"","sourcesContent":["import { JsonObject } from 'type-fest'\nimport { IPickleOrder } from '../filter'\n\n/**\n * User-defined configuration\n *\n * @public\n */\nexport interface IConfiguration {\n /**\n * Paths to where your feature files are\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-features}\n */\n paths: string[]\n /**\n * Show the full backtrace for errors\n * @default false\n */\n backtrace: boolean\n /**\n * Perform a dry run, where a test run is prepared but nothing is executed\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/dry_run.md}\n */\n dryRun: boolean\n /**\n * Explicitly call `process.exit()` after the test run\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md#exiting}\n * @remarks\n * This option is only used by the CLI.\n */\n forceExit: boolean\n /**\n * Stop running tests when a test fails\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/fail_fast.md}\n */\n failFast: boolean\n /**\n * Name/path and (optionally) output file path of each formatter to use\n *\n * @example\n * [\n * \"\\@cucumber/pretty-formatter\",\n * [\"html\", \"./reports/cucumber.html\"],\n * [\"./custom-formatter.js\", \"./reports/custom.txt\"]\n * ]\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md}\n * @remarks\n * Each item has one or two values. The first (required) identifies the\n * formatter to be used. The second (optional) specifies where the output\n * should be written.\n */\n format: Array<string | [string, string?]>\n /**\n * Options to be provided to formatters\n * @default \\{\\}\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md#options}\n * @remarks\n * The value must be a JSON-serializable object.\n */\n formatOptions: JsonObject\n /**\n * Paths to where your support code is\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code}\n */\n import: string[]\n /**\n * Default language for your feature files\n * @default \"en\"\n */\n language: string\n /**\n * Regular expressions of which scenario names should match one of to be run\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#names}\n */\n name: string[]\n /**\n * Run in the order defined, or in a random order\n * @default \"defined\"\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#order}\n */\n order: IPickleOrder\n /**\n * Run tests in parallel with the given number of worker processes\n * @default 0\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/parallel.md}\n */\n parallel: number\n /**\n * Publish a report of your test run to https://reports.cucumber.io/\n * @default false\n */\n publish: boolean\n /**\n * @deprecated no longer needed\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md}\n */\n publishQuiet: boolean\n /**\n * Paths to where your support code is, for CommonJS\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code}\n */\n require: string[]\n /**\n * Names of transpilation modules to load, via `require()`\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/transpiling.md}\n */\n requireModule: string[]\n /**\n * Retry failing tests up to the given number of times\n * @default 0\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/retry.md}\n */\n retry: number\n /**\n * Tag expression to filter which scenarios can be retried\n * @default \"\"\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/retry.md}\n */\n retryTagFilter: string\n /**\n * Fail the test run if there are pending steps\n * @default true\n */\n strict: boolean\n /**\n * Tag expression to filter which scenarios should be run\n * @default \"\"\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#tags}\n */\n tags: string\n /**\n * Parameters to be passed to your World\n * @default \\{\\}\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/world.md}\n * @remarks\n * The value must be a JSON-serializable object.\n */\n worldParameters: JsonObject\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/configuration/types.ts"],"names":[],"mappings":"","sourcesContent":["import { JsonObject } from 'type-fest'\nimport { IPickleOrder } from '../filter'\n\n/**\n * User-defined configuration\n *\n * @public\n */\nexport interface IConfiguration {\n /**\n * Paths to where your feature files are\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-features}\n */\n paths: string[]\n /**\n * Show the full backtrace for errors\n * @default false\n */\n backtrace: boolean\n /**\n * Perform a dry run, where a test run is prepared but nothing is executed\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/dry_run.md}\n */\n dryRun: boolean\n /**\n * Explicitly call `process.exit()` after the test run\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md#exiting}\n * @remarks\n * This option is only used by the CLI.\n */\n forceExit: boolean\n /**\n * Stop running tests when a test fails\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/fail_fast.md}\n */\n failFast: boolean\n /**\n * Name/path and (optionally) output file path of each formatter to use\n *\n * @example\n * [\n * \"\\@cucumber/pretty-formatter\",\n * [\"html\", \"./reports/cucumber.html\"],\n * [\"./custom-formatter.js\", \"./reports/custom.txt\"]\n * ]\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md}\n * @remarks\n * Each item has one or two values. The first (required) identifies the\n * formatter to be used. The second (optional) specifies where the output\n * should be written.\n */\n format: Array<string | [string, string?]>\n /**\n * Options to be provided to formatters\n * @default \\{\\}\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md#options}\n * @remarks\n * The value must be a JSON-serializable object.\n */\n formatOptions: JsonObject\n /**\n * Paths to where your support code is\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code}\n */\n import: string[]\n /**\n * Default language for your feature files\n * @default \"en\"\n */\n language: string\n /**\n * Module specifier(s) for loaders to be registered ahead of loading support code\n * @default []\n */\n loader: string[]\n /**\n * Regular expressions of which scenario names should match one of to be run\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#names}\n */\n name: string[]\n /**\n * Run in the order defined, or in a random order\n * @default \"defined\"\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#order}\n */\n order: IPickleOrder\n /**\n * Run tests in parallel with the given number of worker processes\n * @default 0\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/parallel.md}\n */\n parallel: number\n /**\n * Publish a report of your test run to https://reports.cucumber.io/\n * @default false\n */\n publish: boolean\n /**\n * @deprecated no longer needed\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md}\n */\n publishQuiet: boolean\n /**\n * Paths to where your support code is, for CommonJS\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code}\n */\n require: string[]\n /**\n * Names of transpilation modules to load, via `require()`\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/transpiling.md}\n */\n requireModule: string[]\n /**\n * Retry failing tests up to the given number of times\n * @default 0\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/retry.md}\n */\n retry: number\n /**\n * Tag expression to filter which scenarios can be retried\n * @default \"\"\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/retry.md}\n */\n retryTagFilter: string\n /**\n * Fail the test run if there are pending steps\n * @default true\n */\n strict: boolean\n /**\n * Tag expression to filter which scenarios should be run\n * @default \"\"\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#tags}\n */\n tags: string\n /**\n * Parameters to be passed to your World\n * @default \\{\\}\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/world.md}\n * @remarks\n * The value must be a JSON-serializable object.\n */\n worldParameters: JsonObject\n}\n"]}
|
|
@@ -8,6 +8,9 @@ function validateConfiguration(configuration, logger) {
|
|
|
8
8
|
if (configuration.requireModule.length && !configuration.require.length) {
|
|
9
9
|
logger.warn('Use of `require-module` option normally means you should specify your support code paths with `require`; see https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code');
|
|
10
10
|
}
|
|
11
|
+
if (configuration.loader.length && !configuration.import.length) {
|
|
12
|
+
logger.warn('Use of `loader` option normally means you should specify your support code paths with `import`; see https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code');
|
|
13
|
+
}
|
|
11
14
|
if (configuration.retryTagFilter && !configuration.retry) {
|
|
12
15
|
throw new Error('a positive `retry` count must be specified when setting `retryTagFilter`');
|
|
13
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate_configuration.js","sourceRoot":"","sources":["../../src/configuration/validate_configuration.ts"],"names":[],"mappings":";;;AAGA,SAAgB,qBAAqB,CACnC,aAA6B,EAC7B,MAAe;IAEf,IAAI,aAAa,CAAC,YAAY,EAAE;QAC9B,MAAM,CAAC,IAAI,CACT,kKAAkK,CACnK,CAAA;KACF;IACD,IAAI,aAAa,CAAC,aAAa,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE;QACvE,MAAM,CAAC,IAAI,CACT,wMAAwM,CACzM,CAAA;KACF;IACD,IAAI,aAAa,CAAC,cAAc,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE;QACxD,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAA;KACF;AACH,CAAC;
|
|
1
|
+
{"version":3,"file":"validate_configuration.js","sourceRoot":"","sources":["../../src/configuration/validate_configuration.ts"],"names":[],"mappings":";;;AAGA,SAAgB,qBAAqB,CACnC,aAA6B,EAC7B,MAAe;IAEf,IAAI,aAAa,CAAC,YAAY,EAAE;QAC9B,MAAM,CAAC,IAAI,CACT,kKAAkK,CACnK,CAAA;KACF;IACD,IAAI,aAAa,CAAC,aAAa,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE;QACvE,MAAM,CAAC,IAAI,CACT,wMAAwM,CACzM,CAAA;KACF;IACD,IAAI,aAAa,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE;QAC/D,MAAM,CAAC,IAAI,CACT,+LAA+L,CAChM,CAAA;KACF;IACD,IAAI,aAAa,CAAC,cAAc,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE;QACxD,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAA;KACF;AACH,CAAC;AAxBD,sDAwBC","sourcesContent":["import { ILogger } from '../logger'\nimport { IConfiguration } from './types'\n\nexport function validateConfiguration(\n configuration: IConfiguration,\n logger: ILogger\n): void {\n if (configuration.publishQuiet) {\n logger.warn(\n '`publishQuiet` option is no longer needed, you can remove it from your configuration; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'\n )\n }\n if (configuration.requireModule.length && !configuration.require.length) {\n logger.warn(\n 'Use of `require-module` option normally means you should specify your support code paths with `require`; see https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code'\n )\n }\n if (configuration.loader.length && !configuration.import.length) {\n logger.warn(\n 'Use of `loader` option normally means you should specify your support code paths with `import`; see https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code'\n )\n }\n if (configuration.retryTagFilter && !configuration.retry) {\n throw new Error(\n 'a positive `retry` count must be specified when setting `retryTagFilter`'\n )\n }\n}\n"]}
|
package/lib/paths/paths.js
CHANGED
|
@@ -11,6 +11,7 @@ async function resolvePaths(logger, cwd, sources, support = {
|
|
|
11
11
|
requireModules: [],
|
|
12
12
|
requirePaths: [],
|
|
13
13
|
importPaths: [],
|
|
14
|
+
loaders: [],
|
|
14
15
|
}) {
|
|
15
16
|
const unexpandedSourcePaths = await getUnexpandedSourcePaths(cwd, sources.paths);
|
|
16
17
|
const sourcePaths = await expandSourcePaths(cwd, unexpandedSourcePaths);
|
package/lib/paths/paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/paths/paths.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAC5B,+BAA2B;AAC3B,+CAAsB;AAKf,KAAK,UAAU,YAAY,CAChC,MAAe,EACf,GAAW,EACX,OAA2C,EAC3C,UAAmC;IACjC,cAAc,EAAE,EAAE;IAClB,YAAY,EAAE,EAAE;IAChB,WAAW,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/paths/paths.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAC5B,+BAA2B;AAC3B,+CAAsB;AAKf,KAAK,UAAU,YAAY,CAChC,MAAe,EACf,GAAW,EACX,OAA2C,EAC3C,UAAmC;IACjC,cAAc,EAAE,EAAE;IAClB,YAAY,EAAE,EAAE;IAChB,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,EAAE;CACZ;IAED,MAAM,qBAAqB,GAAG,MAAM,wBAAwB,CAC1D,GAAG,EACH,OAAO,CAAC,KAAK,CACd,CAAA;IACD,MAAM,WAAW,GAA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,CAAC,GAAG,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAA;QAC1E,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,WAAW,EAAE,CAAA;KACzC;IACD,MAAM,YAAY,GAChB,sBAAsB,CAAC,MAAM,GAAG,CAAC;QAC/B,CAAC,CAAC,MAAM,WAAW,CAAC,GAAG,EAAE,sBAAsB,EAAE,KAAK,CAAC;QACvD,CAAC,CAAC,EAAE,CAAA;IACR,MAAM,WAAW,GACf,qBAAqB,CAAC,MAAM,GAAG,CAAC;QAC9B,CAAC,CAAC,MAAM,WAAW,CAAC,GAAG,EAAE,qBAAqB,EAAE,gBAAgB,CAAC;QACjE,CAAC,CAAC,EAAE,CAAA;IACR,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAA;AACtC,CAAC","sourcesContent":["import path from 'node:path'\nimport { glob } from 'glob'\nimport fs from 'mz/fs'\nimport { ILogger } from '../logger'\nimport { ISourcesCoordinates, ISupportCodeCoordinates } from '../api'\nimport { IResolvedPaths } from './types'\n\nexport async function resolvePaths(\n logger: ILogger,\n cwd: string,\n sources: Pick<ISourcesCoordinates, 'paths'>,\n support: ISupportCodeCoordinates = {\n requireModules: [],\n requirePaths: [],\n importPaths: [],\n loaders: [],\n }\n): Promise<IResolvedPaths> {\n const unexpandedSourcePaths = await getUnexpandedSourcePaths(\n cwd,\n sources.paths\n )\n const sourcePaths: string[] = await expandSourcePaths(\n cwd,\n unexpandedSourcePaths\n )\n logger.debug('Found source files based on configuration:', sourcePaths)\n const { requirePaths, importPaths } = await deriveSupportPaths(\n cwd,\n sourcePaths,\n support.requirePaths,\n support.importPaths\n )\n logger.debug(\n 'Found support files to load via `require` based on configuration:',\n requirePaths\n )\n logger.debug(\n 'Found support files to load via `import` based on configuration:',\n importPaths\n )\n return {\n unexpandedSourcePaths: unexpandedSourcePaths,\n sourcePaths: sourcePaths,\n requirePaths,\n importPaths,\n }\n}\n\nasync function expandPaths(\n cwd: string,\n unexpandedPaths: string[],\n defaultExtension: string\n): Promise<string[]> {\n const expandedPaths = await Promise.all(\n unexpandedPaths.map(async (unexpandedPath) => {\n const matches = await glob(unexpandedPath, {\n absolute: true,\n windowsPathsNoEscape: true,\n cwd,\n })\n const expanded = await Promise.all(\n matches.map(async (match) => {\n if (path.extname(match) === '') {\n return glob(`${match}/**/*${defaultExtension}`, {\n windowsPathsNoEscape: true,\n })\n }\n return [match]\n })\n )\n return expanded.flat().sort()\n })\n )\n const normalized = expandedPaths.flat().map((x) => path.normalize(x))\n return [...new Set(normalized)]\n}\n\nasync function getUnexpandedSourcePaths(\n cwd: string,\n args: string[]\n): Promise<string[]> {\n if (args.length > 0) {\n const nestedFeaturePaths = await Promise.all(\n args.map(async (arg) => {\n const filename = path.basename(arg)\n if (filename[0] === '@') {\n const filePath = path.join(cwd, arg)\n const content = await fs.readFile(filePath, 'utf8')\n return content.split('\\n').map((x) => x.trim())\n }\n return [arg]\n })\n )\n const featurePaths = nestedFeaturePaths.flat()\n if (featurePaths.length > 0) {\n return featurePaths.filter((x) => x !== '')\n }\n }\n return ['features/**/*.{feature,feature.md}']\n}\n\nfunction getFeatureDirectoryPaths(\n cwd: string,\n featurePaths: string[]\n): string[] {\n const featureDirs = featurePaths.map((featurePath) => {\n let featureDir = path.dirname(featurePath)\n let childDir: string\n let parentDir = featureDir\n while (childDir !== parentDir) {\n childDir = parentDir\n parentDir = path.dirname(childDir)\n if (path.basename(parentDir) === 'features') {\n featureDir = parentDir\n break\n }\n }\n return path.relative(cwd, featureDir)\n })\n return [...new Set(featureDirs)]\n}\n\nasync function expandSourcePaths(\n cwd: string,\n featurePaths: string[]\n): Promise<string[]> {\n featurePaths = featurePaths.map((p) => p.replace(/(:\\d+)*$/g, '')) // Strip line numbers\n return await expandPaths(cwd, featurePaths, '.feature')\n}\n\nasync function deriveSupportPaths(\n cwd: string,\n featurePaths: string[],\n unexpandedRequirePaths: string[],\n unexpandedImportPaths: string[]\n): Promise<{\n requirePaths: string[]\n importPaths: string[]\n}> {\n if (\n unexpandedRequirePaths.length === 0 &&\n unexpandedImportPaths.length === 0\n ) {\n const defaultPaths = getFeatureDirectoryPaths(cwd, featurePaths)\n const importPaths = await expandPaths(cwd, defaultPaths, '.@(js|cjs|mjs)')\n return { requirePaths: [], importPaths }\n }\n const requirePaths =\n unexpandedRequirePaths.length > 0\n ? await expandPaths(cwd, unexpandedRequirePaths, '.js')\n : []\n const importPaths =\n unexpandedImportPaths.length > 0\n ? await expandPaths(cwd, unexpandedImportPaths, '.@(js|cjs|mjs)')\n : []\n return { requirePaths, importPaths }\n}\n"]}
|