@lynxwall/cucumber-tsflow 7.7.0 → 7.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,14 @@
1
+ /**
2
+ * loader-worker.ts
3
+ *
4
+ * Runs inside a worker_threads Worker. Receives support-code file paths and
5
+ * transpiler configuration, loads the files (warming the transpiler cache),
6
+ * extracts serializable binding descriptors from the BindingRegistry, and
7
+ * posts them back to the main thread.
8
+ *
9
+ * The __LOADER_WORKER global flag causes the binding decorator to skip
10
+ * Cucumber step/hook registration — only BindingRegistry population occurs.
11
+ */
1
12
  import 'polyfill-symbol-metadata';
2
13
  /** Message types sent from main thread to worker */
3
14
  export interface LoaderWorkerRequest {
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
2
  /**
4
3
  * loader-worker.ts
5
4
  *
@@ -11,6 +10,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
11
10
  * The __LOADER_WORKER global flag causes the binding decorator to skip
12
11
  * Cucumber step/hook registration — only BindingRegistry population occurs.
13
12
  */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ // Shim 'window' for libraries that expect a browser environment in worker threads
15
+ if (typeof globalThis.window === 'undefined') {
16
+ globalThis.window = globalThis;
17
+ }
14
18
  const node_worker_threads_1 = require("node:worker_threads");
15
19
  const node_module_1 = require("node:module");
16
20
  const node_url_1 = require("node:url");
@@ -1 +1 @@
1
- {"version":3,"file":"loader-worker.js","sourceRoot":"","sources":["../../src/api/loader-worker.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;GAUG;AACH,6DAA6D;AAC7D,6CAAuC;AACvC,uCAAyC;AACzC,oCAAkC;AAElC,gFAAgF;AAC/E,MAAc,CAAC,eAAe,GAAG,IAAI,CAAC;AA4BvC,KAAK,UAAU,cAAc,CAAC,OAA4B;IACzD,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC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GAAQ,EAAE,CAAC;QACnB,MAAM,QAAQ,GAAyB;YACtC,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,GAAG,CAAC,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC;SACjC,CAAC;QACF,gCAAW,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;AACF,CAAC;AAED,uEAAuE;AACvE,IAAI,gCAAU,IAAI,gCAAU,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC9C,cAAc,CAAC,gCAAiC,CAAC,CAAC;AACnD,CAAC;AAED,4CAA4C;AAC5C,gCAAU,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,GAAwB,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC","sourcesContent":["/**\r\n * loader-worker.ts\r\n *\r\n * Runs inside a worker_threads Worker. Receives support-code file paths and\r\n * transpiler configuration, loads the files (warming the transpiler cache),\r\n * extracts serializable binding descriptors from the BindingRegistry, and\r\n * posts them back to the main thread.\r\n *\r\n * The __LOADER_WORKER global flag causes the binding decorator to skip\r\n * Cucumber step/hook registration — only BindingRegistry population occurs.\r\n */\r\nimport { parentPort, workerData } from 'node:worker_threads';\r\nimport { register } from 'node:module';\r\nimport { pathToFileURL } from 'node:url';\r\nimport 'polyfill-symbol-metadata';\r\n\r\n// Signal that we're in a loader-worker context so decorators skip Cucumber APIs\r\n(global as any).__LOADER_WORKER = true;\r\n\r\n/** Message types sent from main thread to worker */\r\nexport interface LoaderWorkerRequest {\r\n\ttype: 'LOAD';\r\n\t/** Absolute paths to load via require() */\r\n\trequirePaths: string[];\r\n\t/** Absolute paths to load via import() */\r\n\timportPaths: string[];\r\n\t/** Modules to require before support code (transpiler setup etc.) */\r\n\trequireModules: string[];\r\n\t/** ESM loaders to register before importing */\r\n\tloaders: string[];\r\n\t/** Whether to use experimental decorators */\r\n\texperimentalDecorators: boolean;\r\n}\r\n\r\n/** Message types sent from worker back to main thread */\r\nexport interface LoaderWorkerResponse {\r\n\ttype: 'LOADED' | 'ERROR';\r\n\t/** Serializable binding descriptors extracted from the registry */\r\n\tdescriptors?: import('../bindings/step-binding').SerializableBindingDescriptor[];\r\n\t/** Source files that were successfully loaded */\r\n\tloadedFiles?: string[];\r\n\t/** Error message if something went wrong */\r\n\terror?: string;\r\n}\r\n\r\nasync function processMessage(message: LoaderWorkerRequest): Promise<void> {\r\n\tif (message.type !== 'LOAD') {\r\n\t\treturn;\r\n\t}\r\n\r\n\ttry {\r\n\t\t// Set the experimental decorators flag before loading support code\r\n\t\tglobal.experimentalDecorators = message.experimentalDecorators;\r\n\t\tprocess.env.CUCUMBER_EXPERIMENTAL_DECORATORS = String(message.experimentalDecorators);\r\n\r\n\t\t// Load require modules (transpiler setup)\r\n\t\tfor (const modulePath of message.requireModules) {\r\n\t\t\trequire(modulePath);\r\n\t\t}\r\n\r\n\t\t// Load support files via require (CJS)\r\n\t\tfor (const filePath of message.requirePaths) {\r\n\t\t\trequire(filePath);\r\n\t\t}\r\n\r\n\t\t// Register ESM loaders\r\n\t\tfor (const specifier of message.loaders) {\r\n\t\t\tregister(specifier, pathToFileURL('./'));\r\n\t\t}\r\n\r\n\t\t// Load support files via import (ESM)\r\n\t\tfor (const filePath of message.importPaths) {\r\n\t\t\tawait import(pathToFileURL(filePath).toString());\r\n\t\t}\r\n\r\n\t\t// Extract descriptors from the binding registry\r\n\t\tconst { BindingRegistry } = require('../bindings/binding-registry');\r\n\t\tconst registry = BindingRegistry.instance;\r\n\t\tconst descriptors = registry.toDescriptors();\r\n\t\tconst loadedFiles: string[] = Array.from(registry.getDescriptorSourceFiles());\r\n\r\n\t\tconst response: LoaderWorkerResponse = {\r\n\t\t\ttype: 'LOADED',\r\n\t\t\tdescriptors,\r\n\t\t\tloadedFiles\r\n\t\t};\r\n\t\tparentPort!.postMessage(response);\r\n\t} catch (err: any) {\r\n\t\tconst response: LoaderWorkerResponse = {\r\n\t\t\ttype: 'ERROR',\r\n\t\t\terror: err.message || String(err)\r\n\t\t};\r\n\t\tparentPort!.postMessage(response);\r\n\t}\r\n}\r\n\r\n// Handle initial workerData (if files are passed at construction time)\r\nif (workerData && workerData.type === 'LOAD') {\r\n\tprocessMessage(workerData as LoaderWorkerRequest);\r\n}\r\n\r\n// Handle messages posted after construction\r\nparentPort?.on('message', (msg: LoaderWorkerRequest) => processMessage(msg));\r\n"]}
1
+ {"version":3,"file":"loader-worker.js","sourceRoot":"","sources":["../../src/api/loader-worker.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAEH,kFAAkF;AAClF,IAAI,OAAO,UAAU,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;IAC7C,UAAsC,CAAC,MAAM,GAAG,UAAU,CAAC;AAC7D,CAAC;AAED,6DAA6D;AAC7D,6CAAuC;AACvC,uCAAyC;AACzC,oCAAkC;AAElC,gFAAgF;AAC/E,MAAc,CAAC,eAAe,GAAG,IAAI,CAAC;AA4BvC,KAAK,UAAU,cAAc,CAAC,OAA4B;IACzD,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC7B,OAAO;IACR,CAAC;IAED,IAAI,CAAC;QACJ,mEAAmE;QACnE,MAAM,CAAC,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC;QAC/D,OAAO,CAAC,GAAG,CAAC,gCAAgC,GAAG,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;QAEtF,0CAA0C;QAC1C,KAAK,MAAM,UAAU,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;YACjD,OAAO,CAAC,UAAU,CAAC,CAAC;QACrB,CAAC;QAED,uCAAuC;QACvC,KAAK,MAAM,QAAQ,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;YAC7C,OAAO,CAAC,QAAQ,CAAC,CAAC;QACnB,CAAC;QAED,uBAAuB;QACvB,KAAK,MAAM,SAAS,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACzC,IAAA,sBAAQ,EAAC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\n * transpiler configuration, loads the files (warming the transpiler cache),\r\n * extracts serializable binding descriptors from the BindingRegistry, and\r\n * posts them back to the main thread.\r\n *\r\n * The __LOADER_WORKER global flag causes the binding decorator to skip\r\n * Cucumber step/hook registration — only BindingRegistry population occurs.\r\n */\r\n\r\n// Shim 'window' for libraries that expect a browser environment in worker threads\r\nif (typeof globalThis.window === 'undefined') {\r\n\t(globalThis as Record<string, unknown>).window = globalThis;\r\n}\r\n\r\nimport { parentPort, workerData } from 'node:worker_threads';\r\nimport { register } from 'node:module';\r\nimport { pathToFileURL } from 'node:url';\r\nimport 'polyfill-symbol-metadata';\r\n\r\n// Signal that we're in a loader-worker context so decorators skip Cucumber APIs\r\n(global as any).__LOADER_WORKER = true;\r\n\r\n/** Message types sent from main thread to worker */\r\nexport interface LoaderWorkerRequest {\r\n\ttype: 'LOAD';\r\n\t/** Absolute paths to load via require() */\r\n\trequirePaths: string[];\r\n\t/** Absolute paths to load via import() */\r\n\timportPaths: string[];\r\n\t/** Modules to require before support code (transpiler setup etc.) */\r\n\trequireModules: string[];\r\n\t/** ESM loaders to register before importing */\r\n\tloaders: string[];\r\n\t/** Whether to use experimental decorators */\r\n\texperimentalDecorators: boolean;\r\n}\r\n\r\n/** Message types sent from worker back to main thread */\r\nexport interface LoaderWorkerResponse {\r\n\ttype: 'LOADED' | 'ERROR';\r\n\t/** Serializable binding descriptors extracted from the registry */\r\n\tdescriptors?: import('../bindings/step-binding').SerializableBindingDescriptor[];\r\n\t/** Source files that were successfully loaded */\r\n\tloadedFiles?: string[];\r\n\t/** Error message if something went wrong */\r\n\terror?: string;\r\n}\r\n\r\nasync function processMessage(message: LoaderWorkerRequest): Promise<void> {\r\n\tif (message.type !== 'LOAD') {\r\n\t\treturn;\r\n\t}\r\n\r\n\ttry {\r\n\t\t// Set the experimental decorators flag before loading support code\r\n\t\tglobal.experimentalDecorators = message.experimentalDecorators;\r\n\t\tprocess.env.CUCUMBER_EXPERIMENTAL_DECORATORS = String(message.experimentalDecorators);\r\n\r\n\t\t// Load require modules (transpiler setup)\r\n\t\tfor (const modulePath of message.requireModules) {\r\n\t\t\trequire(modulePath);\r\n\t\t}\r\n\r\n\t\t// Load support files via require (CJS)\r\n\t\tfor (const filePath of message.requirePaths) {\r\n\t\t\trequire(filePath);\r\n\t\t}\r\n\r\n\t\t// Register ESM loaders\r\n\t\tfor (const specifier of message.loaders) {\r\n\t\t\tregister(specifier, pathToFileURL('./'));\r\n\t\t}\r\n\r\n\t\t// Load support files via import (ESM)\r\n\t\tfor (const filePath of message.importPaths) {\r\n\t\t\tawait import(pathToFileURL(filePath).toString());\r\n\t\t}\r\n\r\n\t\t// Extract descriptors from the binding registry\r\n\t\tconst { BindingRegistry } = require('../bindings/binding-registry');\r\n\t\tconst registry = BindingRegistry.instance;\r\n\t\tconst descriptors = registry.toDescriptors();\r\n\t\tconst loadedFiles: string[] = Array.from(registry.getDescriptorSourceFiles());\r\n\r\n\t\tconst response: LoaderWorkerResponse = {\r\n\t\t\ttype: 'LOADED',\r\n\t\t\tdescriptors,\r\n\t\t\tloadedFiles\r\n\t\t};\r\n\t\tparentPort!.postMessage(response);\r\n\t} catch (err: any) {\r\n\t\tconst response: LoaderWorkerResponse = {\r\n\t\t\ttype: 'ERROR',\r\n\t\t\terror: err.message || String(err)\r\n\t\t};\r\n\t\tparentPort!.postMessage(response);\r\n\t}\r\n}\r\n\r\n// Handle initial workerData (if files are passed at construction time)\r\nif (workerData && workerData.type === 'LOAD') {\r\n\tprocessMessage(workerData as LoaderWorkerRequest);\r\n}\r\n\r\n// Handle messages posted after construction\r\nparentPort?.on('message', (msg: LoaderWorkerRequest) => processMessage(msg));\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"run-cucumber.js","sourceRoot":"","sources":["../../src/api/run-cucumber.ts"],"names":[],"mappings":";;;;;AA0CA,kCA2LC;AArOD,iDAAuE;AACvE,mCAAsC;AAEtC,sGAAiH;AAEjH,8DAAkE;AAElE,0DAAsD;AACtD,sEAA6E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e,CAAC,CAAC;QAClF,WAAW,GAAG,aAAa,CAAC,WAAW,CAAC;IACzC,CAAC;IACD,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;QACxB,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;YAChC,MAAM,CAAC,KAAK,CAAC,mBAAmB,UAAU,CAAC,MAAM,CAAC,GAAG,KAAK,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;QACjF,CAAC,CAAC,CAAC;QACH,MAAM,iBAAiB,EAAE,CAAC;QAC1B,MAAM,aAAa,CAAC,OAAO,EAAE,CAAC;QAC9B,OAAO;YACN,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,kBAAkB;SAC3B,CAAC;IACH,CAAC;IAED,IAAA,oDAAuB,EAAC;QACvB,gBAAgB;QAChB,kBAAkB;QAClB,KAAK;KACL,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,IAAA,0BAAW,EAAC;QACjC,WAAW;QACX,MAAM;QACN,gBAAgB;QAChB,cAAc,EAAE,eAAe;QAC/B,KAAK;QACL,kBAAkB;QAClB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,WAAW,EAAE,OAAO,CAAC,OAAO;KAC5B,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,CAAC;IACpC,MAAM,aAAa,CAAC,OAAO,EAAE,CAAC;IAC9B,MAAM,iBAAiB,EAAE,CAAC;IAE1B,OAAO;QACN,OAAO,EAAE,OAAO,IAAI,CAAC,oBAAoB;QACzC,OAAO,EAAE,kBAAkB;KAC3B,CAAC;AACH,CAAC","sourcesContent":["import { Envelope, IdGenerator, ParseError } from '@cucumber/messages';\r\nimport { EventEmitter } from 'events';\r\nimport { EventDataCollector } from '@cucumber/cucumber/lib/formatter/helpers/index';\r\nimport { emitMetaMessage, emitSupportCodeMessages } from '@cucumber/cucumber/lib/api/emit_support_code_messages';\r\nimport { IRunOptions, IRunResult } from '@cucumber/cucumber/lib/api/types';\r\nimport { resolvePaths } from '@cucumber/cucumber/lib/paths/index';\r\nimport { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';\r\nimport { makeRuntime } from '../runtime/make-runtime';\r\nimport { initializeFormatters } from '@cucumber/cucumber/lib/api/formatters';\r\nimport { getSupportCodeLibrary } from './support';\r\nimport { IRunEnvironment, makeEnvironment } from '@cucumber/cucumber/lib/environment/index';\r\nimport { getPicklesAndErrors } from '@cucumber/cucumber/lib/api/gherkin';\r\nimport MessageCollector from '../runtime/message-collector';\r\nimport { version } from '../version';\r\nimport { initializeForRunCucumber } from '@cucumber/cucumber/lib/api/plugins';\r\nimport { IFilterablePickle } from '@cucumber/cucumber/lib/filter/index';\r\nimport 'polyfill-symbol-metadata';\r\nimport { BindingRegistry } from '../bindings/binding-registry';\r\nimport { ITsFlowRunOptionsRuntime } from '../runtime/types';\r\nimport { Console } from 'console';\r\nimport ansis from 'ansis';\r\nimport { supportCodeLibraryBuilder } from '@cucumber/cucumber';\r\nimport { parallelPreload } from './parallel-loader';\r\nimport { createLogger } from '../utils/tsflow-logger';\r\n\r\nconst runLogger = createLogger('run-cucumber');\r\n\r\nexport interface ITsFlowRunOptions extends IRunOptions {\r\n\truntime: ITsFlowRunOptionsRuntime;\r\n}\r\n\r\n/**\r\n * Execute a Cucumber test run.\r\n *\r\n * Extended from cucumber.js so that we can use our own implementation\r\n * of makeRuntime\r\n *\r\n * @public\r\n * @param options - Configuration loaded from `loadConfiguration`.\r\n * @param environment - Project environment.\r\n * @param onMessage - Callback fired each time Cucumber emits a message.\r\n */\r\nexport async function runCucumber(\r\n\toptions: ITsFlowRunOptions,\r\n\tenvironment: IRunEnvironment = {},\r\n\tonMessage?: (message: Envelope) => void\r\n): Promise<IRunResult> {\r\n\tconst mergedEnvironment = makeEnvironment(environment);\r\n\tconst { cwd, stdout, stderr, env, logger } = mergedEnvironment;\r\n\r\n\tlogger.debug(`Running cucumber-tsflow ${version}\r\nWorking directory: ${cwd}\r\nRunning from: ${__dirname}\r\n`);\r\n\tconst consoleLogger = new Console(environment.stdout as any, environment.stderr);\r\n\tif (options.runtime.experimentalDecorators) {\r\n\t\tconsoleLogger.info(ansis.yellowBright('Using Experimental Decorators.'));\r\n\t}\r\n\tif (options.runtime.parallel > 0) {\r\n\t\tconsoleLogger.info(\r\n\t\t\tansis.cyanBright(`Running Cucumber-TsFlow in Parallel with ${options.runtime.parallel} worker(s).\\n`)\r\n\t\t);\r\n\t} else {\r\n\t\tconsoleLogger.info(ansis.cyanBright('Running Cucumber-TsFlow in Serial mode.\\n'));\r\n\t}\r\n\r\n\tconst newId = IdGenerator.uuid();\r\n\r\n\tconst supportCoordinates =\r\n\t\t'originalCoordinates' in options.support\r\n\t\t\t? options.support.originalCoordinates\r\n\t\t\t: Object.assign(\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\trequireModules: [],\r\n\t\t\t\t\t\trequirePaths: [],\r\n\t\t\t\t\t\tloaders: [],\r\n\t\t\t\t\t\timportPaths: []\r\n\t\t\t\t\t},\r\n\t\t\t\t\toptions.support\r\n\t\t\t\t);\r\n\r\n\tconst pluginManager = await initializeForRunCucumber(\r\n\t\t{\r\n\t\t\t...options,\r\n\t\t\tsupport: supportCoordinates\r\n\t\t},\r\n\t\tmergedEnvironment\r\n\t);\r\n\r\n\tconst resolvedPaths = await resolvePaths(logger, cwd, options.sources, supportCoordinates);\r\n\tpluginManager.emit('paths:resolve', resolvedPaths);\r\n\tconst { sourcePaths, requirePaths, importPaths } = resolvedPaths;\r\n\r\n\t/**\r\n\t * The support code library contains all of the hook and step definitions.\r\n\t * These are loaded into the library when calling getSupportCodeLibrary,\r\n\t * which loads all of the step definitions using require or import.\r\n\t */\r\n\tlet supportCodeLibrary =\r\n\t\t'originalCoordinates' in options.support\r\n\t\t\t? (options.support as SupportCodeLibrary)\r\n\t\t\t: await (async () => {\r\n\t\t\t\t\t// Parallel preload phase: warm transpiler caches in worker threads\r\n\t\t\t\t\tif (options.runtime.parallelLoad) {\r\n\t\t\t\t\t\trunLogger.checkpoint('Running parallel preload phase');\r\n\t\t\t\t\t\tconsoleLogger.info(ansis.cyanBright('Pre-warming transpiler caches in parallel...\\n'));\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\tconst result = await parallelPreload({\r\n\t\t\t\t\t\t\t\trequirePaths,\r\n\t\t\t\t\t\t\t\timportPaths,\r\n\t\t\t\t\t\t\t\trequireModules: supportCoordinates.requireModules,\r\n\t\t\t\t\t\t\t\tloaders: supportCoordinates.loaders,\r\n\t\t\t\t\t\t\t\texperimentalDecorators: options.runtime.experimentalDecorators,\r\n\t\t\t\t\t\t\t\tthreadCount: options.runtime.parallelLoad\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\trunLogger.checkpoint('Parallel preload completed', {\r\n\t\t\t\t\t\t\t\tdescriptors: result.descriptors.length,\r\n\t\t\t\t\t\t\t\tfiles: result.loadedFiles.length,\r\n\t\t\t\t\t\t\t\tdurationMs: result.durationMs\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\tconsoleLogger.info(\r\n\t\t\t\t\t\t\t\tansis.cyanBright(\r\n\t\t\t\t\t\t\t\t\t`Parallel preload completed in ${result.durationMs}ms ` +\r\n\t\t\t\t\t\t\t\t\t\t`(${result.loadedFiles.length} files, ${result.descriptors.length} bindings)\\n`\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t} catch (err: any) {\r\n\t\t\t\t\t\t\trunLogger.error('Parallel preload failed, falling back to serial load', err);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn getSupportCodeLibrary({\r\n\t\t\t\t\t\tlogger,\r\n\t\t\t\t\t\tcwd,\r\n\t\t\t\t\t\tnewId,\r\n\t\t\t\t\t\trequirePaths,\r\n\t\t\t\t\t\trequireModules: supportCoordinates.requireModules,\r\n\t\t\t\t\t\timportPaths,\r\n\t\t\t\t\t\tloaders: supportCoordinates.loaders\r\n\t\t\t\t\t});\r\n\t\t\t\t})();\r\n\r\n\t// Set support to the updated step and hook definitions\r\n\t// in the supportCodeLibrary. We also need to initialize originalCoordinates\r\n\t// to support parallel execution.\r\n\tsupportCodeLibrary = BindingRegistry.instance.updateSupportCodeLibrary(supportCodeLibrary);\r\n\tsupportCodeLibrary = { ...supportCodeLibrary, ...{ originalCoordinates: supportCoordinates } };\r\n\toptions.support = supportCodeLibrary;\r\n\r\n\tconst eventBroadcaster = new EventEmitter();\r\n\tif (onMessage) {\r\n\t\teventBroadcaster.on('envelope', onMessage);\r\n\t}\r\n\teventBroadcaster.on('envelope', value => pluginManager.emit('message', value));\r\n\r\n\t// create a global instance of the message collector and bind it\r\n\t// to the event broadcaster. This is used by cucumber and for tests\r\n\t// that are not running in parallel.\r\n\tglobal.messageCollector = new MessageCollector(eventBroadcaster);\r\n\r\n\t// cast the MessageCollector to an EventDataCollector\r\n\tconst eventDataCollector = global.messageCollector as unknown as EventDataCollector;\r\n\r\n\tlet formatterStreamError = false;\r\n\tconst cleanupFormatters = await initializeFormatters({\r\n\t\tenv,\r\n\t\tcwd,\r\n\t\tstdout,\r\n\t\tstderr,\r\n\t\tlogger,\r\n\t\tonStreamError: () => (formatterStreamError = true),\r\n\t\teventBroadcaster,\r\n\t\teventDataCollector: eventDataCollector,\r\n\t\tconfiguration: options.formats,\r\n\t\tsupportCodeLibrary,\r\n\t\tpluginManager\r\n\t});\r\n\tawait emitMetaMessage(eventBroadcaster, env);\r\n\r\n\tlet filteredPickles: ReadonlyArray<IFilterablePickle> = [];\r\n\tlet parseErrors: ParseError[] = [];\r\n\tif (sourcePaths.length > 0) {\r\n\t\tconst gherkinResult = await getPicklesAndErrors({\r\n\t\t\tnewId,\r\n\t\t\tcwd,\r\n\t\t\tsourcePaths,\r\n\t\t\tcoordinates: options.sources,\r\n\t\t\tonEnvelope: envelope => eventBroadcaster.emit('envelope', envelope)\r\n\t\t});\r\n\t\tfilteredPickles = await pluginManager.transform('pickles:filter', gherkinResult.filterablePickles);\r\n\t\tfilteredPickles = await pluginManager.transform('pickles:order', filteredPickles);\r\n\t\tparseErrors = gherkinResult.parseErrors;\r\n\t}\r\n\tif (parseErrors.length) {\r\n\t\tparseErrors.forEach(parseError => {\r\n\t\t\tlogger.error(`Parse error in \"${parseError.source.uri}\" ${parseError.message}`);\r\n\t\t});\r\n\t\tawait cleanupFormatters();\r\n\t\tawait pluginManager.cleanup();\r\n\t\treturn {\r\n\t\t\tsuccess: false,\r\n\t\t\tsupport: supportCodeLibrary\r\n\t\t};\r\n\t}\r\n\r\n\temitSupportCodeMessages({\r\n\t\teventBroadcaster,\r\n\t\tsupportCodeLibrary,\r\n\t\tnewId\r\n\t});\r\n\r\n\tconst runtime = await makeRuntime({\r\n\t\tenvironment,\r\n\t\tlogger,\r\n\t\teventBroadcaster,\r\n\t\tsourcedPickles: filteredPickles,\r\n\t\tnewId,\r\n\t\tsupportCodeLibrary,\r\n\t\toptions: options.runtime,\r\n\t\tcoordinates: options.sources\r\n\t});\r\n\tconst success = await runtime.run();\r\n\tawait pluginManager.cleanup();\r\n\tawait cleanupFormatters();\r\n\r\n\treturn {\r\n\t\tsuccess: success && !formatterStreamError,\r\n\t\tsupport: supportCodeLibrary\r\n\t};\r\n}\r\n"]}
1
+ {"version":3,"file":"run-cucumber.js","sourceRoot":"","sources":["../../src/api/run-cucumber.ts"],"names":[],"mappings":";;;;;AAyCA,kCA2LC;AApOD,iDAAuE;AACvE,mCAAsC;AAEtC,sGAAiH;AAEjH,8DAAkE;AAElE,0DAAsD;AACtD,sEAA6E;AAC7E,uCAAkD;AAClD,oEAA4F;AAC5F,gEAAyE;AACzE,qFAA4D;AAC5D,wCAAqC;AACrC,gEAA8E;AAE9E,oCAAkC;AAClC,mEAA+D;AAE/D,qCAAkC;AAClC,kDAA0B;AAC1B,uDAAoD;AACpD,0DAAsD;AAEtD,MAAM,SAAS,GAAG,IAAA,4BAAY,EAAC,cAAc,CAAC,C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AAC,OAAO,EAAE,CAAC,CAAC;QACjF,CAAC,CAAC,CAAC;QACH,MAAM,iBAAiB,EAAE,CAAC;QAC1B,MAAM,aAAa,CAAC,OAAO,EAAE,CAAC;QAC9B,OAAO;YACN,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,kBAAkB;SAC3B,CAAC;IACH,CAAC;IAED,IAAA,oDAAuB,EAAC;QACvB,gBAAgB;QAChB,kBAAkB;QAClB,KAAK;KACL,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,IAAA,0BAAW,EAAC;QACjC,WAAW;QACX,MAAM;QACN,gBAAgB;QAChB,cAAc,EAAE,eAAe;QAC/B,KAAK;QACL,kBAAkB;QAClB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,WAAW,EAAE,OAAO,CAAC,OAAO;KAC5B,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,CAAC;IACpC,MAAM,aAAa,CAAC,OAAO,EAAE,CAAC;IAC9B,MAAM,iBAAiB,EAAE,CAAC;IAE1B,OAAO;QACN,OAAO,EAAE,OAAO,IAAI,CAAC,oBAAoB;QACzC,OAAO,EAAE,kBAAkB;KAC3B,CAAC;AACH,CAAC","sourcesContent":["import { Envelope, IdGenerator, ParseError } from '@cucumber/messages';\r\nimport { EventEmitter } from 'events';\r\nimport { EventDataCollector } from '@cucumber/cucumber/lib/formatter/helpers/index';\r\nimport { emitMetaMessage, emitSupportCodeMessages } from '@cucumber/cucumber/lib/api/emit_support_code_messages';\r\nimport { IRunOptions, IRunResult } from '@cucumber/cucumber/lib/api/types';\r\nimport { resolvePaths } from '@cucumber/cucumber/lib/paths/index';\r\nimport { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';\r\nimport { makeRuntime } from '../runtime/make-runtime';\r\nimport { initializeFormatters } from '@cucumber/cucumber/lib/api/formatters';\r\nimport { getSupportCodeLibrary } from './support';\r\nimport { IRunEnvironment, makeEnvironment } from '@cucumber/cucumber/lib/environment/index';\r\nimport { getPicklesAndErrors } from '@cucumber/cucumber/lib/api/gherkin';\r\nimport MessageCollector from '../runtime/message-collector';\r\nimport { version } from '../version';\r\nimport { initializeForRunCucumber } from '@cucumber/cucumber/lib/api/plugins';\r\nimport { IFilterablePickle } from '@cucumber/cucumber/lib/filter/index';\r\nimport 'polyfill-symbol-metadata';\r\nimport { BindingRegistry } from '../bindings/binding-registry';\r\nimport { ITsFlowRunOptionsRuntime } from '../runtime/types';\r\nimport { Console } from 'console';\r\nimport ansis from 'ansis';\r\nimport { parallelPreload } from './parallel-loader';\r\nimport { createLogger } from '../utils/tsflow-logger';\r\n\r\nconst runLogger = createLogger('run-cucumber');\r\n\r\nexport interface ITsFlowRunOptions extends IRunOptions {\r\n\truntime: ITsFlowRunOptionsRuntime;\r\n}\r\n\r\n/**\r\n * Execute a Cucumber test run.\r\n *\r\n * Extended from cucumber.js so that we can use our own implementation\r\n * of makeRuntime\r\n *\r\n * @public\r\n * @param options - Configuration loaded from `loadConfiguration`.\r\n * @param environment - Project environment.\r\n * @param onMessage - Callback fired each time Cucumber emits a message.\r\n */\r\nexport async function runCucumber(\r\n\toptions: ITsFlowRunOptions,\r\n\tenvironment: IRunEnvironment = {},\r\n\tonMessage?: (message: Envelope) => void\r\n): Promise<IRunResult> {\r\n\tconst mergedEnvironment = makeEnvironment(environment);\r\n\tconst { cwd, stdout, stderr, env, logger } = mergedEnvironment;\r\n\r\n\tlogger.debug(`Running cucumber-tsflow ${version}\r\nWorking directory: ${cwd}\r\nRunning from: ${__dirname}\r\n`);\r\n\tconst consoleLogger = new Console(environment.stdout as any, environment.stderr);\r\n\tif (options.runtime.experimentalDecorators) {\r\n\t\tconsoleLogger.info(ansis.yellowBright('Using Experimental Decorators.'));\r\n\t}\r\n\tif (options.runtime.parallel > 0) {\r\n\t\tconsoleLogger.info(\r\n\t\t\tansis.cyanBright(`Running Cucumber-TsFlow in Parallel with ${options.runtime.parallel} worker(s).\\n`)\r\n\t\t);\r\n\t} else {\r\n\t\tconsoleLogger.info(ansis.cyanBright('Running Cucumber-TsFlow in Serial mode.\\n'));\r\n\t}\r\n\r\n\tconst newId = IdGenerator.uuid();\r\n\r\n\tconst supportCoordinates =\r\n\t\t'originalCoordinates' in options.support\r\n\t\t\t? options.support.originalCoordinates\r\n\t\t\t: Object.assign(\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\trequireModules: [],\r\n\t\t\t\t\t\trequirePaths: [],\r\n\t\t\t\t\t\tloaders: [],\r\n\t\t\t\t\t\timportPaths: []\r\n\t\t\t\t\t},\r\n\t\t\t\t\toptions.support\r\n\t\t\t\t);\r\n\r\n\tconst pluginManager = await initializeForRunCucumber(\r\n\t\t{\r\n\t\t\t...options,\r\n\t\t\tsupport: supportCoordinates\r\n\t\t},\r\n\t\tmergedEnvironment\r\n\t);\r\n\r\n\tconst resolvedPaths = await resolvePaths(logger, cwd, options.sources, supportCoordinates);\r\n\tpluginManager.emit('paths:resolve', resolvedPaths);\r\n\tconst { sourcePaths, requirePaths, importPaths } = resolvedPaths;\r\n\r\n\t/**\r\n\t * The support code library contains all of the hook and step definitions.\r\n\t * These are loaded into the library when calling getSupportCodeLibrary,\r\n\t * which loads all of the step definitions using require or import.\r\n\t */\r\n\tlet supportCodeLibrary =\r\n\t\t'originalCoordinates' in options.support\r\n\t\t\t? (options.support as SupportCodeLibrary)\r\n\t\t\t: await (async () => {\r\n\t\t\t\t\t// Parallel preload phase: warm transpiler caches in worker threads\r\n\t\t\t\t\tif (options.runtime.parallelLoad) {\r\n\t\t\t\t\t\trunLogger.checkpoint('Running parallel preload phase');\r\n\t\t\t\t\t\tconsoleLogger.info(ansis.cyanBright('Pre-warming transpiler caches in parallel...\\n'));\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\tconst result = await parallelPreload({\r\n\t\t\t\t\t\t\t\trequirePaths,\r\n\t\t\t\t\t\t\t\timportPaths,\r\n\t\t\t\t\t\t\t\trequireModules: supportCoordinates.requireModules,\r\n\t\t\t\t\t\t\t\tloaders: supportCoordinates.loaders,\r\n\t\t\t\t\t\t\t\texperimentalDecorators: options.runtime.experimentalDecorators,\r\n\t\t\t\t\t\t\t\tthreadCount: options.runtime.parallelLoad\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\trunLogger.checkpoint('Parallel preload completed', {\r\n\t\t\t\t\t\t\t\tdescriptors: result.descriptors.length,\r\n\t\t\t\t\t\t\t\tfiles: result.loadedFiles.length,\r\n\t\t\t\t\t\t\t\tdurationMs: result.durationMs\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\tconsoleLogger.info(\r\n\t\t\t\t\t\t\t\tansis.cyanBright(\r\n\t\t\t\t\t\t\t\t\t`Parallel preload completed in ${result.durationMs}ms ` +\r\n\t\t\t\t\t\t\t\t\t\t`(${result.loadedFiles.length} files, ${result.descriptors.length} bindings)\\n`\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t} catch (err: any) {\r\n\t\t\t\t\t\t\trunLogger.error('Parallel preload failed, falling back to serial load', err);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn getSupportCodeLibrary({\r\n\t\t\t\t\t\tlogger,\r\n\t\t\t\t\t\tcwd,\r\n\t\t\t\t\t\tnewId,\r\n\t\t\t\t\t\trequirePaths,\r\n\t\t\t\t\t\trequireModules: supportCoordinates.requireModules,\r\n\t\t\t\t\t\timportPaths,\r\n\t\t\t\t\t\tloaders: supportCoordinates.loaders\r\n\t\t\t\t\t});\r\n\t\t\t\t})();\r\n\r\n\t// Set support to the updated step and hook definitions\r\n\t// in the supportCodeLibrary. We also need to initialize originalCoordinates\r\n\t// to support parallel execution.\r\n\tsupportCodeLibrary = BindingRegistry.instance.updateSupportCodeLibrary(supportCodeLibrary);\r\n\tsupportCodeLibrary = { ...supportCodeLibrary, ...{ originalCoordinates: supportCoordinates } };\r\n\toptions.support = supportCodeLibrary;\r\n\r\n\tconst eventBroadcaster = new EventEmitter();\r\n\tif (onMessage) {\r\n\t\teventBroadcaster.on('envelope', onMessage);\r\n\t}\r\n\teventBroadcaster.on('envelope', value => pluginManager.emit('message', value));\r\n\r\n\t// create a global instance of the message collector and bind it\r\n\t// to the event broadcaster. This is used by cucumber and for tests\r\n\t// that are not running in parallel.\r\n\tglobal.messageCollector = new MessageCollector(eventBroadcaster);\r\n\r\n\t// cast the MessageCollector to an EventDataCollector\r\n\tconst eventDataCollector = global.messageCollector as unknown as EventDataCollector;\r\n\r\n\tlet formatterStreamError = false;\r\n\tconst cleanupFormatters = await initializeFormatters({\r\n\t\tenv,\r\n\t\tcwd,\r\n\t\tstdout,\r\n\t\tstderr,\r\n\t\tlogger,\r\n\t\tonStreamError: () => (formatterStreamError = true),\r\n\t\teventBroadcaster,\r\n\t\teventDataCollector: eventDataCollector,\r\n\t\tconfiguration: options.formats,\r\n\t\tsupportCodeLibrary,\r\n\t\tpluginManager\r\n\t});\r\n\tawait emitMetaMessage(eventBroadcaster, env);\r\n\r\n\tlet filteredPickles: ReadonlyArray<IFilterablePickle> = [];\r\n\tlet parseErrors: ParseError[] = [];\r\n\tif (sourcePaths.length > 0) {\r\n\t\tconst gherkinResult = await getPicklesAndErrors({\r\n\t\t\tnewId,\r\n\t\t\tcwd,\r\n\t\t\tsourcePaths,\r\n\t\t\tcoordinates: options.sources,\r\n\t\t\tonEnvelope: envelope => eventBroadcaster.emit('envelope', envelope)\r\n\t\t});\r\n\t\tfilteredPickles = await pluginManager.transform('pickles:filter', gherkinResult.filterablePickles);\r\n\t\tfilteredPickles = await pluginManager.transform('pickles:order', filteredPickles);\r\n\t\tparseErrors = gherkinResult.parseErrors;\r\n\t}\r\n\tif (parseErrors.length) {\r\n\t\tparseErrors.forEach(parseError => {\r\n\t\t\tlogger.error(`Parse error in \"${parseError.source.uri}\" ${parseError.message}`);\r\n\t\t});\r\n\t\tawait cleanupFormatters();\r\n\t\tawait pluginManager.cleanup();\r\n\t\treturn {\r\n\t\t\tsuccess: false,\r\n\t\t\tsupport: supportCodeLibrary\r\n\t\t};\r\n\t}\r\n\r\n\temitSupportCodeMessages({\r\n\t\teventBroadcaster,\r\n\t\tsupportCodeLibrary,\r\n\t\tnewId\r\n\t});\r\n\r\n\tconst runtime = await makeRuntime({\r\n\t\tenvironment,\r\n\t\tlogger,\r\n\t\teventBroadcaster,\r\n\t\tsourcedPickles: filteredPickles,\r\n\t\tnewId,\r\n\t\tsupportCodeLibrary,\r\n\t\toptions: options.runtime,\r\n\t\tcoordinates: options.sources\r\n\t});\r\n\tconst success = await runtime.run();\r\n\tawait pluginManager.cleanup();\r\n\tawait cleanupFormatters();\r\n\r\n\treturn {\r\n\t\tsuccess: success && !formatterStreamError,\r\n\t\tsupport: supportCodeLibrary\r\n\t};\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"binding-decorator.js","sourceRoot":"","sources":["../../src/bindings/binding-decorator.ts"],"names":[],"mappings":";;AAqCA,sEAEC;AAUD,0BA4DC;AA7GD,iDAW4B;AAC5B,uDAA8F;AAC9F,yDAAkE;AAClE,iDAA+D;AAQ/D;;;;;;;GAOG;AACH,MAAM,wBAAwB,GAAG,IAAI,GAAG,EAAiC,CAAC;AAE1E;;;;GAIG;AACH,SAAgB,6BAA6B;IAC5C,wBAAwB,CAAC,KAAK,EAAE,CAAC;AAClC,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,OAAO,CAAC,oBAAoC;IAC3D,IAAI,MAAM,CAAC,sBAAsB,EAAE,CAAC;QACnC,OAAO,CAAI,MAAmC,EAAE,EAAE;YACjD,MAAM,eAAe,GAAG,kCAAe,CAAC,QAAQ,CAAC;YACjD,eAAe,CAAC,4BAA4B,CAAC,MAAM,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YAErF,qGAAqG;YACrG,gEAAgE;YAChE,4FAA4F;YAC5F,MAAM,WAAW,GAAkB,IAAA,oCAAkB,GAAE,CAAC;YAC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AAC,CAAC,CAAC;YAC7B,MAAM,OAAO,GAAG,EAAE,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC;YACnG,IAAA,gBAAK,EAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YAC7B,MAAM;QACP,CAAC;QACD,KAAK,+BAAgB,CAAC,SAAS,CAAC,CAAC,CAAC;YACjC,MAAM,OAAO,GAAG,EAAE,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC;YACnG,IAAA,oBAAS,EAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YACjC,MAAM;QACP,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["import {\r\n\tAfter,\r\n\tAfterStep,\r\n\tAfterAll,\r\n\tBefore,\r\n\tBeforeStep,\r\n\tBeforeAll,\r\n\tGiven,\r\n\tThen,\r\n\tWhen,\r\n\tWorld\r\n} from '@cucumber/cucumber';\r\nimport { getStepBindings, getStepBindingsExp, getCollectedBindings } from './binding-context';\r\nimport { BindingRegistry, DEFAULT_TAG } from './binding-registry';\r\nimport { StepBinding, StepBindingFlags } from './step-binding';\r\nimport { ContextType, StepPattern } from './types';\r\nimport { defineParameterType } from '../index';\r\n\r\ninterface WritableWorld extends World {\r\n\t[key: string]: any;\r\n}\r\n\r\n/**\r\n * A set of step patterns that have been registered with Cucumber.\r\n *\r\n * In order to support scoped (or tagged) step definitions, we must ensure that any step binding is\r\n * only registered with Cucumber once. The binding function for that step pattern then becomes\r\n * responsible for looking up and execuing the step binding based on the context that is in scope at\r\n * the point of invocation.\r\n */\r\nconst stepPatternRegistrations = new Map<StepPattern, StepBindingFlags>();\r\n\r\n/**\r\n * Clear the step pattern registration cache. Must be called whenever\r\n * `supportCodeLibraryBuilder.reset()` is used so that decorators\r\n * re-register definitions with the fresh builder instance.\r\n */\r\nexport function resetStepPatternRegistrations(): void {\r\n\tstepPatternRegistrations.clear();\r\n}\r\n\r\n/**\r\n * A class decorator that marks the associated class as a CucumberJS binding.\r\n *\r\n * @param requiredContextTypes An optional array of Types that will be created and passed into the created\r\n * object for each scenario.\r\n *\r\n * An instance of the decorated class will be created for each scenario.\r\n */\r\nexport function binding(requiredContextTypes?: ContextType[]): any {\r\n\tif (global.experimentalDecorators) {\r\n\t\treturn <T>(target: { new (...args: any[]): T }) => {\r\n\t\t\tconst bindingRegistry = BindingRegistry.instance;\r\n\t\t\tbindingRegistry.registerContextTypesForClass(target.prototype, requiredContextTypes);\r\n\r\n\t\t\t// the class decorator is called last when decorators on a type are initialized. All other decorators\r\n\t\t\t// are added to DecoratorContext.metadata before this is called.\r\n\t\t\t// This will get all those bindings and then clear metadata for the next type that's loaded.\r\n\t\t\tconst allBindings: StepBinding[] = getStepBindingsExp();\r\n\t\t\tallBindings.forEach(stepBinding => {\r\n\t\t\t\t// For static methods, we need to set the classPrototype to the class itself, not the prototype\r\n\t\t\t\tif (stepBinding.stepIsStatic) {\r\n\t\t\t\t\tstepBinding.classPrototype = target;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tstepBinding.classPrototype = target.prototype;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbindingRegistry.registerStepBinding(stepBinding);\r\n\r\n\t\t\t\t// Register with cucumber\r\n\t\t\t\taddStepBinding(stepBinding);\r\n\t\t\t});\r\n\t\t};\r\n\t} else {\r\n\t\treturn function classDecorator(target: Function, context: ClassDecoratorContext) {\r\n\t\t\tconst bindingRegistry = BindingRegistry.instance;\r\n\t\t\tbindingRegistry.registerContextTypesForClass(target.prototype, requiredContextTypes);\r\n\r\n\t\t\t// the class decorator is called last when decorators on a type are initialized. All other decorators\r\n\t\t\t// are added to DecoratorContext.metadata before this is called.\r\n\t\t\t// This will get all those bindings and then clear metadata for the next type that's loaded.\r\n\t\t\tconst allBindings: StepBinding[] = getStepBindings(context);\r\n\t\t\tallBindings.forEach(stepBinding => {\r\n\t\t\t\t// Set the class prototype and then register the binding with the prototype\r\n\t\t\t\tstepBinding.classPrototype = target.prototype;\r\n\t\t\t\tbindingRegistry.registerStepBinding(stepBinding);\r\n\r\n\t\t\t\t// add the step binding to the binding registry\r\n\t\t\t\taddStepBinding(stepBinding);\r\n\t\t\t});\r\n\r\n\t\t\t// Process pending step bindings after class is decorated\r\n\t\t\tcontext.addInitializer(function () {\r\n\t\t\t\t// Get all the collected bindings\r\n\t\t\t\tconst allBindings = getCollectedBindings();\r\n\r\n\t\t\t\tallBindings.forEach(stepBinding => {\r\n\t\t\t\t\t// Set the class prototype and register\r\n\t\t\t\t\tstepBinding.classPrototype = target.prototype;\r\n\t\t\t\t\tbindingRegistry.registerStepBinding(stepBinding);\r\n\r\n\t\t\t\t\t// Register with cucumber - call the local addStepBinding function\r\n\t\t\t\t\taddStepBinding(stepBinding);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\r\n\t\t\treturn target;\r\n\t\t};\r\n\t}\r\n}\r\n\r\n/**\r\n * Common helper used to add StepBindings to the binding registry\r\n * @param stepBinding\r\n * @returns\r\n */\r\nfunction addStepBinding(stepBinding: StepBinding): void {\r\n\t// In loader-worker threads, skip Cucumber registration — we only need\r\n\t// the BindingRegistry populated for descriptor extraction.\r\n\tif (global.__LOADER_WORKER) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (stepBinding.bindingType & StepBindingFlags.StepDefinitions) {\r\n\t\tlet stepBindingFlags = stepPatternRegistrations.get(stepBinding.stepPattern.toString());\r\n\t\tif (stepBindingFlags === undefined) {\r\n\t\t\tstepBindingFlags = StepBindingFlags.none;\r\n\t\t}\r\n\t\tif (stepBindingFlags & stepBinding.bindingType) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tbindStepDefinition(stepBinding);\r\n\t\tstepPatternRegistrations.set(stepBinding.stepPattern.toString(), stepBindingFlags | stepBinding.bindingType);\r\n\t} else if (stepBinding.bindingType & StepBindingFlags.Hooks) {\r\n\t\tbindHook(stepBinding);\r\n\t}\r\n}\r\n\r\n/**\r\n * Binds a step definition to Cucumber.\r\n *\r\n * @param stepBinding The [[StepBinding]] that represents a 'given', 'when', or 'then' step definition.\r\n */\r\nfunction bindStepDefinition(stepBinding: StepBinding): void {\r\n\tconst stepFunction = function (this: WritableWorld): any {\r\n\t\tconst bindingRegistry = BindingRegistry.instance;\r\n\r\n\t\tconst scenarioContext = global.messageCollector.getStepScenarioContext(stepBinding);\r\n\r\n\t\tif (scenarioContext) {\r\n\t\t\tconst matchingStepBindings = bindingRegistry.getStepBindings(\r\n\t\t\t\tstepBinding.stepPattern.toString(),\r\n\t\t\t\tscenarioContext.scenarioInfo.tags\r\n\t\t\t);\r\n\r\n\t\t\tif (matchingStepBindings.length > 1) {\r\n\t\t\t\tlet message = `Ambiguous step definitions for '${matchingStepBindings[0].stepPattern}':\\n`;\r\n\r\n\t\t\t\tmatchingStepBindings.forEach(matchingStepBinding => {\r\n\t\t\t\t\tmessage =\r\n\t\t\t\t\t\tmessage +\r\n\t\t\t\t\t\t`\\t\\t${String(matchingStepBinding.classPropertyKey)} (${matchingStepBinding.callsite.toString()})\\n`;\r\n\t\t\t\t});\r\n\r\n\t\t\t\tthrow new Error(message);\r\n\t\t\t} else if (matchingStepBindings.length === 0) {\r\n\t\t\t\tthrow new Error(\r\n\t\t\t\t\t`Cannot find matched step definition for ${stepBinding.stepPattern.toString()} with tag ${\r\n\t\t\t\t\t\tscenarioContext.scenarioInfo.tags\r\n\t\t\t\t\t} in binding registry`\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\tconst contextTypes = bindingRegistry.getContextTypesForClass(matchingStepBindings[0].classPrototype);\r\n\t\t\tconst bindingObject = scenarioContext.getOrActivateBindingClass(\r\n\t\t\t\tmatchingStepBindings[0].classPrototype,\r\n\t\t\t\tcontextTypes,\r\n\t\t\t\tthis\r\n\t\t\t);\r\n\t\t\tbindingObject._worldObj = this;\r\n\r\n\t\t\treturn (bindingObject[matchingStepBindings[0].classPropertyKey] as Function).apply(\r\n\t\t\t\tbindingObject,\r\n\t\t\t\targuments as any\r\n\t\t\t);\r\n\t\t} else {\r\n\t\t\tthrow new Error('Unable to find the Scenario Context for a Step!');\r\n\t\t}\r\n\t};\r\n\r\n\tObject.defineProperty(stepFunction, 'length', {\r\n\t\tvalue: stepBinding.stepArgsLength\r\n\t});\r\n\r\n\t// initialize options used on all step bindings\r\n\tconst options = {\r\n\t\tcucumberKey: stepBinding.cucumberKey,\r\n\t\ttimeout: stepBinding.timeout,\r\n\t\twrapperOptions: stepBinding.wrapperOption\r\n\t};\r\n\t// call appropriate step\r\n\tif (stepBinding.bindingType & StepBindingFlags.given) {\r\n\t\tGiven(stepBinding.stepPattern, options, stepFunction);\r\n\t} else if (stepBinding.bindingType & StepBindingFlags.when) {\r\n\t\tWhen(stepBinding.stepPattern, options, stepFunction);\r\n\t} else if (stepBinding.bindingType & StepBindingFlags.then) {\r\n\t\tThen(stepBinding.stepPattern, options, stepFunction);\r\n\t}\r\n}\r\n\r\n/**\r\n * Binds a hook to Cucumber.\r\n *\r\n * @param stepBinding The [[StepBinding]] that represents a 'before', or 'after', step definition.\r\n */\r\nfunction bindHook(stepBinding: StepBinding): void {\r\n\tconst globalHookFunction = function (this: any): any {\r\n\t\t// Check if it's a static method\r\n\t\tif (stepBinding.stepIsStatic || !stepBinding.classPrototype[stepBinding.classPropertyKey]) {\r\n\t\t\tconst constructor = stepBinding.classPrototype.constructor;\r\n\r\n\t\t\tif (constructor && constructor[stepBinding.classPropertyKey]) {\r\n\t\t\t\treturn constructor[stepBinding.classPropertyKey].apply(constructor);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// For non-static methods\r\n\t\tif (stepBinding.classPrototype[stepBinding.classPropertyKey]) {\r\n\t\t\treturn stepBinding.classPrototype[stepBinding.classPropertyKey].apply(stepBinding.classPrototype);\r\n\t\t}\r\n\r\n\t\tthrow new Error(\r\n\t\t\t`Method ${String(stepBinding.classPropertyKey)} not found on class ${stepBinding.classPrototype?.constructor?.name}`\r\n\t\t);\r\n\t};\r\n\t// Main binding for all other hooks (before, after, beforeStep, afterStep)\r\n\tconst hookFunction = function (this: any, arg: any): any {\r\n\t\tconst scenarioContext = global.messageCollector.getHookScenarioContext(arg);\r\n\t\tif (scenarioContext) {\r\n\t\t\tconst contextTypes = BindingRegistry.instance.getContextTypesForClass(stepBinding.classPrototype);\r\n\t\t\tconst bindingObject = scenarioContext.getOrActivateBindingClass(stepBinding.classPrototype, contextTypes, this);\r\n\t\t\tbindingObject._worldObj = this;\r\n\t\t\treturn (bindingObject[stepBinding.classPropertyKey] as Function).apply(bindingObject, arguments as any);\r\n\t\t} else {\r\n\t\t\tthrow new Error('Unable to find the Scenario Context for Hook!');\r\n\t\t}\r\n\t};\r\n\t// length values need to be added to our binding functions.\r\n\t// These are used in cucumber to determine if the function is\r\n\t// a callback or promise.\r\n\tObject.defineProperty(globalHookFunction, 'length', {\r\n\t\tvalue: stepBinding.stepArgsLength\r\n\t});\r\n\tObject.defineProperty(hookFunction, 'length', {\r\n\t\tvalue: stepBinding.stepArgsLength\r\n\t});\r\n\r\n\tconst tags = stepBinding.tags === DEFAULT_TAG ? undefined : stepBinding.tags;\r\n\r\n\t// This binds the appropriate function above to the associated\r\n\t// cucumber step functions.\r\n\tswitch (stepBinding.bindingType) {\r\n\t\tcase StepBindingFlags.beforeAll: {\r\n\t\t\tconst options = { cucumberKey: stepBinding.cucumberKey, timeout: stepBinding.timeout };\r\n\t\t\tBeforeAll(options, globalHookFunction);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase StepBindingFlags.before: {\r\n\t\t\tconst options = { cucumberKey: stepBinding.cucumberKey, tags: tags, timeout: stepBinding.timeout };\r\n\t\t\tBefore(options, hookFunction);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase StepBindingFlags.beforeStep: {\r\n\t\t\tconst options = { cucumberKey: stepBinding.cucumberKey, tags: tags, timeout: stepBinding.timeout };\r\n\t\t\tBeforeStep(options, hookFunction);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase StepBindingFlags.afterAll: {\r\n\t\t\tconst options = { cucumberKey: stepBinding.cucumberKey, timeout: stepBinding.timeout };\r\n\t\t\tAfterAll(options, globalHookFunction);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase StepBindingFlags.after: {\r\n\t\t\tconst options = { cucumberKey: stepBinding.cucumberKey, tags: tags, timeout: stepBinding.timeout };\r\n\t\t\tAfter(options, hookFunction);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase StepBindingFlags.afterStep: {\r\n\t\t\tconst options = { cucumberKey: stepBinding.cucumberKey, tags: tags, timeout: stepBinding.timeout };\r\n\t\t\tAfterStep(options, hookFunction);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n"]}
1
+ {"version":3,"file":"binding-decorator.js","sourceRoot":"","sources":["../../src/bindings/binding-decorator.ts"],"names":[],"mappings":";;AAoCA,sEAEC;AAUD,0BA4DC;AA5GD,iDAW4B;AAC5B,uDAA8F;AAC9F,yDAAkE;AAClE,iDAA+D;AAO/D;;;;;;;GAOG;AACH,MAAM,wBAAwB,GAAG,IAAI,GAAG,EAAiC,CAAC;AAE1E;;;;GAIG;AACH,SAAgB,6BAA6B;IAC5C,wBAAwB,CAAC,KAAK,EAAE,CAAC;AAClC,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,OAAO,CAAC,oBAAoC;IAC3D,IAAI,MAAM,CAAC,sBAAsB,EAAE,CAAC;QACnC,OAAO,CAAI,MAAmC,EAAE,EAAE;YACjD,MAAM,eAAe,GAAG,kCAAe,CAAC,QAAQ,CAAC;YACjD,eAAe,CAAC,4BAA4B,CAAC,MAAM,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YAErF,qGAAqG;YACrG,gEAAgE;YAChE,4FAA4F;YAC5F,MAAM,WAAW,GAAkB,IAAA,oCAAkB,GAAE,CAAC;YACxD,WAA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AC,CAAC;YAC7B,MAAM,OAAO,GAAG,EAAE,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC;YACnG,IAAA,gBAAK,EAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YAC7B,MAAM;QACP,CAAC;QACD,KAAK,+BAAgB,CAAC,SAAS,CAAC,CAAC,CAAC;YACjC,MAAM,OAAO,GAAG,EAAE,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC;YACnG,IAAA,oBAAS,EAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YACjC,MAAM;QACP,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["import {\r\n\tAfter,\r\n\tAfterStep,\r\n\tAfterAll,\r\n\tBefore,\r\n\tBeforeStep,\r\n\tBeforeAll,\r\n\tGiven,\r\n\tThen,\r\n\tWhen,\r\n\tWorld\r\n} from '@cucumber/cucumber';\r\nimport { getStepBindings, getStepBindingsExp, getCollectedBindings } from './binding-context';\r\nimport { BindingRegistry, DEFAULT_TAG } from './binding-registry';\r\nimport { StepBinding, StepBindingFlags } from './step-binding';\r\nimport { ContextType, StepPattern } from './types';\r\n\r\ninterface WritableWorld extends World {\r\n\t[key: string]: any;\r\n}\r\n\r\n/**\r\n * A set of step patterns that have been registered with Cucumber.\r\n *\r\n * In order to support scoped (or tagged) step definitions, we must ensure that any step binding is\r\n * only registered with Cucumber once. The binding function for that step pattern then becomes\r\n * responsible for looking up and execuing the step binding based on the context that is in scope at\r\n * the point of invocation.\r\n */\r\nconst stepPatternRegistrations = new Map<StepPattern, StepBindingFlags>();\r\n\r\n/**\r\n * Clear the step pattern registration cache. Must be called whenever\r\n * `supportCodeLibraryBuilder.reset()` is used so that decorators\r\n * re-register definitions with the fresh builder instance.\r\n */\r\nexport function resetStepPatternRegistrations(): void {\r\n\tstepPatternRegistrations.clear();\r\n}\r\n\r\n/**\r\n * A class decorator that marks the associated class as a CucumberJS binding.\r\n *\r\n * @param requiredContextTypes An optional array of Types that will be created and passed into the created\r\n * object for each scenario.\r\n *\r\n * An instance of the decorated class will be created for each scenario.\r\n */\r\nexport function binding(requiredContextTypes?: ContextType[]): any {\r\n\tif (global.experimentalDecorators) {\r\n\t\treturn <T>(target: { new (...args: any[]): T }) => {\r\n\t\t\tconst bindingRegistry = BindingRegistry.instance;\r\n\t\t\tbindingRegistry.registerContextTypesForClass(target.prototype, requiredContextTypes);\r\n\r\n\t\t\t// the class decorator is called last when decorators on a type are initialized. All other decorators\r\n\t\t\t// are added to DecoratorContext.metadata before this is called.\r\n\t\t\t// This will get all those bindings and then clear metadata for the next type that's loaded.\r\n\t\t\tconst allBindings: StepBinding[] = getStepBindingsExp();\r\n\t\t\tallBindings.forEach(stepBinding => {\r\n\t\t\t\t// For static methods, we need to set the classPrototype to the class itself, not the prototype\r\n\t\t\t\tif (stepBinding.stepIsStatic) {\r\n\t\t\t\t\tstepBinding.classPrototype = target;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tstepBinding.classPrototype = target.prototype;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbindingRegistry.registerStepBinding(stepBinding);\r\n\r\n\t\t\t\t// Register with cucumber\r\n\t\t\t\taddStepBinding(stepBinding);\r\n\t\t\t});\r\n\t\t};\r\n\t} else {\r\n\t\treturn function classDecorator(target: Function, context: ClassDecoratorContext) {\r\n\t\t\tconst bindingRegistry = BindingRegistry.instance;\r\n\t\t\tbindingRegistry.registerContextTypesForClass(target.prototype, requiredContextTypes);\r\n\r\n\t\t\t// the class decorator is called last when decorators on a type are initialized. All other decorators\r\n\t\t\t// are added to DecoratorContext.metadata before this is called.\r\n\t\t\t// This will get all those bindings and then clear metadata for the next type that's loaded.\r\n\t\t\tconst allBindings: StepBinding[] = getStepBindings(context);\r\n\t\t\tallBindings.forEach(stepBinding => {\r\n\t\t\t\t// Set the class prototype and then register the binding with the prototype\r\n\t\t\t\tstepBinding.classPrototype = target.prototype;\r\n\t\t\t\tbindingRegistry.registerStepBinding(stepBinding);\r\n\r\n\t\t\t\t// add the step binding to the binding registry\r\n\t\t\t\taddStepBinding(stepBinding);\r\n\t\t\t});\r\n\r\n\t\t\t// Process pending step bindings after class is decorated\r\n\t\t\tcontext.addInitializer(function () {\r\n\t\t\t\t// Get all the collected bindings\r\n\t\t\t\tconst allBindings = getCollectedBindings();\r\n\r\n\t\t\t\tallBindings.forEach(stepBinding => {\r\n\t\t\t\t\t// Set the class prototype and register\r\n\t\t\t\t\tstepBinding.classPrototype = target.prototype;\r\n\t\t\t\t\tbindingRegistry.registerStepBinding(stepBinding);\r\n\r\n\t\t\t\t\t// Register with cucumber - call the local addStepBinding function\r\n\t\t\t\t\taddStepBinding(stepBinding);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\r\n\t\t\treturn target;\r\n\t\t};\r\n\t}\r\n}\r\n\r\n/**\r\n * Common helper used to add StepBindings to the binding registry\r\n * @param stepBinding\r\n * @returns\r\n */\r\nfunction addStepBinding(stepBinding: StepBinding): void {\r\n\t// In loader-worker threads, skip Cucumber registration — we only need\r\n\t// the BindingRegistry populated for descriptor extraction.\r\n\tif (global.__LOADER_WORKER) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (stepBinding.bindingType & StepBindingFlags.StepDefinitions) {\r\n\t\tlet stepBindingFlags = stepPatternRegistrations.get(stepBinding.stepPattern.toString());\r\n\t\tif (stepBindingFlags === undefined) {\r\n\t\t\tstepBindingFlags = StepBindingFlags.none;\r\n\t\t}\r\n\t\tif (stepBindingFlags & stepBinding.bindingType) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tbindStepDefinition(stepBinding);\r\n\t\tstepPatternRegistrations.set(stepBinding.stepPattern.toString(), stepBindingFlags | stepBinding.bindingType);\r\n\t} else if (stepBinding.bindingType & StepBindingFlags.Hooks) {\r\n\t\tbindHook(stepBinding);\r\n\t}\r\n}\r\n\r\n/**\r\n * Binds a step definition to Cucumber.\r\n *\r\n * @param stepBinding The [[StepBinding]] that represents a 'given', 'when', or 'then' step definition.\r\n */\r\nfunction bindStepDefinition(stepBinding: StepBinding): void {\r\n\tconst stepFunction = function (this: WritableWorld): any {\r\n\t\tconst bindingRegistry = BindingRegistry.instance;\r\n\r\n\t\tconst scenarioContext = global.messageCollector.getStepScenarioContext(stepBinding);\r\n\r\n\t\tif (scenarioContext) {\r\n\t\t\tconst matchingStepBindings = bindingRegistry.getStepBindings(\r\n\t\t\t\tstepBinding.stepPattern.toString(),\r\n\t\t\t\tscenarioContext.scenarioInfo.tags\r\n\t\t\t);\r\n\r\n\t\t\tif (matchingStepBindings.length > 1) {\r\n\t\t\t\tlet message = `Ambiguous step definitions for '${matchingStepBindings[0].stepPattern}':\\n`;\r\n\r\n\t\t\t\tmatchingStepBindings.forEach(matchingStepBinding => {\r\n\t\t\t\t\tmessage =\r\n\t\t\t\t\t\tmessage +\r\n\t\t\t\t\t\t`\\t\\t${String(matchingStepBinding.classPropertyKey)} (${matchingStepBinding.callsite.toString()})\\n`;\r\n\t\t\t\t});\r\n\r\n\t\t\t\tthrow new Error(message);\r\n\t\t\t} else if (matchingStepBindings.length === 0) {\r\n\t\t\t\tthrow new Error(\r\n\t\t\t\t\t`Cannot find matched step definition for ${stepBinding.stepPattern.toString()} with tag ${\r\n\t\t\t\t\t\tscenarioContext.scenarioInfo.tags\r\n\t\t\t\t\t} in binding registry`\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\tconst contextTypes = bindingRegistry.getContextTypesForClass(matchingStepBindings[0].classPrototype);\r\n\t\t\tconst bindingObject = scenarioContext.getOrActivateBindingClass(\r\n\t\t\t\tmatchingStepBindings[0].classPrototype,\r\n\t\t\t\tcontextTypes,\r\n\t\t\t\tthis\r\n\t\t\t);\r\n\t\t\tbindingObject._worldObj = this;\r\n\r\n\t\t\treturn (bindingObject[matchingStepBindings[0].classPropertyKey] as Function).apply(\r\n\t\t\t\tbindingObject,\r\n\t\t\t\targuments as any\r\n\t\t\t);\r\n\t\t} else {\r\n\t\t\tthrow new Error('Unable to find the Scenario Context for a Step!');\r\n\t\t}\r\n\t};\r\n\r\n\tObject.defineProperty(stepFunction, 'length', {\r\n\t\tvalue: stepBinding.stepArgsLength\r\n\t});\r\n\r\n\t// initialize options used on all step bindings\r\n\tconst options = {\r\n\t\tcucumberKey: stepBinding.cucumberKey,\r\n\t\ttimeout: stepBinding.timeout,\r\n\t\twrapperOptions: stepBinding.wrapperOption\r\n\t};\r\n\t// call appropriate step\r\n\tif (stepBinding.bindingType & StepBindingFlags.given) {\r\n\t\tGiven(stepBinding.stepPattern, options, stepFunction);\r\n\t} else if (stepBinding.bindingType & StepBindingFlags.when) {\r\n\t\tWhen(stepBinding.stepPattern, options, stepFunction);\r\n\t} else if (stepBinding.bindingType & StepBindingFlags.then) {\r\n\t\tThen(stepBinding.stepPattern, options, stepFunction);\r\n\t}\r\n}\r\n\r\n/**\r\n * Binds a hook to Cucumber.\r\n *\r\n * @param stepBinding The [[StepBinding]] that represents a 'before', or 'after', step definition.\r\n */\r\nfunction bindHook(stepBinding: StepBinding): void {\r\n\tconst globalHookFunction = function (this: any): any {\r\n\t\t// Check if it's a static method\r\n\t\tif (stepBinding.stepIsStatic || !stepBinding.classPrototype[stepBinding.classPropertyKey]) {\r\n\t\t\tconst constructor = stepBinding.classPrototype.constructor;\r\n\r\n\t\t\tif (constructor && constructor[stepBinding.classPropertyKey]) {\r\n\t\t\t\treturn constructor[stepBinding.classPropertyKey].apply(constructor);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// For non-static methods\r\n\t\tif (stepBinding.classPrototype[stepBinding.classPropertyKey]) {\r\n\t\t\treturn stepBinding.classPrototype[stepBinding.classPropertyKey].apply(stepBinding.classPrototype);\r\n\t\t}\r\n\r\n\t\tthrow new Error(\r\n\t\t\t`Method ${String(stepBinding.classPropertyKey)} not found on class ${stepBinding.classPrototype?.constructor?.name}`\r\n\t\t);\r\n\t};\r\n\t// Main binding for all other hooks (before, after, beforeStep, afterStep)\r\n\tconst hookFunction = function (this: any, arg: any): any {\r\n\t\tconst scenarioContext = global.messageCollector.getHookScenarioContext(arg);\r\n\t\tif (scenarioContext) {\r\n\t\t\tconst contextTypes = BindingRegistry.instance.getContextTypesForClass(stepBinding.classPrototype);\r\n\t\t\tconst bindingObject = scenarioContext.getOrActivateBindingClass(stepBinding.classPrototype, contextTypes, this);\r\n\t\t\tbindingObject._worldObj = this;\r\n\t\t\treturn (bindingObject[stepBinding.classPropertyKey] as Function).apply(bindingObject, arguments as any);\r\n\t\t} else {\r\n\t\t\tthrow new Error('Unable to find the Scenario Context for Hook!');\r\n\t\t}\r\n\t};\r\n\t// length values need to be added to our binding functions.\r\n\t// These are used in cucumber to determine if the function is\r\n\t// a callback or promise.\r\n\tObject.defineProperty(globalHookFunction, 'length', {\r\n\t\tvalue: stepBinding.stepArgsLength\r\n\t});\r\n\tObject.defineProperty(hookFunction, 'length', {\r\n\t\tvalue: stepBinding.stepArgsLength\r\n\t});\r\n\r\n\tconst tags = stepBinding.tags === DEFAULT_TAG ? undefined : stepBinding.tags;\r\n\r\n\t// This binds the appropriate function above to the associated\r\n\t// cucumber step functions.\r\n\tswitch (stepBinding.bindingType) {\r\n\t\tcase StepBindingFlags.beforeAll: {\r\n\t\t\tconst options = { cucumberKey: stepBinding.cucumberKey, timeout: stepBinding.timeout };\r\n\t\t\tBeforeAll(options, globalHookFunction);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase StepBindingFlags.before: {\r\n\t\t\tconst options = { cucumberKey: stepBinding.cucumberKey, tags: tags, timeout: stepBinding.timeout };\r\n\t\t\tBefore(options, hookFunction);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase StepBindingFlags.beforeStep: {\r\n\t\t\tconst options = { cucumberKey: stepBinding.cucumberKey, tags: tags, timeout: stepBinding.timeout };\r\n\t\t\tBeforeStep(options, hookFunction);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase StepBindingFlags.afterAll: {\r\n\t\t\tconst options = { cucumberKey: stepBinding.cucumberKey, timeout: stepBinding.timeout };\r\n\t\t\tAfterAll(options, globalHookFunction);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase StepBindingFlags.after: {\r\n\t\t\tconst options = { cucumberKey: stepBinding.cucumberKey, tags: tags, timeout: stepBinding.timeout };\r\n\t\t\tAfter(options, hookFunction);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase StepBindingFlags.afterStep: {\r\n\t\t\tconst options = { cucumberKey: stepBinding.cucumberKey, tags: tags, timeout: stepBinding.timeout };\r\n\t\t\tAfterStep(options, hookFunction);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"step-decorators.js","sourceRoot":"","sources":["../../src/bindings/step-decorators.ts"],"names":[],"mappings":";;;;;AAYA,sBA8CC;AASD,oBA+CC;AASD,oBA+CC;AA1KD,wDAAiD;AACjD,iDAA+D;AAC/D,4DAAmC;AACnC,uDAA0F;AAE1F;;;;;;GAMG;AACH,SAAgB,KAAK,CAAC,WAA4B,EAAE,GAAY,EAAE,OAAgB,EAAE,aAAmB;IACtG,MAAM,QAAQ,GAAG,uBAAQ,CAAC,OAAO,EAAE,CAAC;IACpC,IAAI,MAAM,CAAC,sBAAsB,EAAE,CAAC;QACnC,OAAO,CAAI,MAAW,EAAE,WAA4B,EAAE,UAAsC,EAAE,EAAE;YAC/F,MAAM,YAAY,GAAG,UAAU,EAAE,KAAK,IAAI,MAAM,CAAC,WAAW,CAAC,CAAC;YAE9D,MAAM,WAAW,GAAgB;gBAChC,WAAW,EAAE,WAAW;gBACxB,WAAW,EAAE,+BAAgB,CAAC,KAAK;gBACnC,cAAc,EAAE,MAAM;gBACtB,gBAAgB,EAAE,WAAW;gBAC7B,YAAY;gBACZ,YAAY,EAAE,KAAK;gBACnB,cAAc,E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gBAC5B,QAAQ,EAAE,QAAQ;gBAClB,WAAW,EAAE,IAAA,oBAAS,GAAE,CAAC,GAAG,EAAE;aAC9B,CAAC;YAEF,IAAA,oCAAkB,EAAC,WAAW,CAAC,CAAC;YAEhC,OAAO;QACR,CAAC,CAAC;IACH,CAAC;AACF,CAAC","sourcesContent":["import { Callsite } from '../utils/our-callsite';\r\nimport { StepBinding, StepBindingFlags } from './step-binding';\r\nimport shortUuid from 'short-uuid';\r\nimport { addStepBinding, addStepBindingExp, collectStepBinding } from './binding-context';\r\n\r\n/**\r\n * A method decorator that marks the associated function as a 'Given' step.\r\n *\r\n * @param stepPattern The regular expression that will be used to match steps.\r\n * @param tag An optional tag.\r\n * @param timeout An optional timeout.\r\n */\r\nexport function given(stepPattern: RegExp | string, tag?: string, timeout?: number, wrapperOption?: any): any {\r\n\tconst callsite = Callsite.capture();\r\n\tif (global.experimentalDecorators) {\r\n\t\treturn <T>(target: any, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => {\r\n\t\t\tconst stepFunction = descriptor?.value || target[propertyKey];\r\n\r\n\t\t\tconst stepBinding: StepBinding = {\r\n\t\t\t\tstepPattern: stepPattern,\r\n\t\t\t\tbindingType: StepBindingFlags.given,\r\n\t\t\t\tclassPrototype: target,\r\n\t\t\t\tclassPropertyKey: propertyKey,\r\n\t\t\t\tstepFunction,\r\n\t\t\t\tstepIsStatic: false,\r\n\t\t\t\tstepArgsLength: stepFunction ? stepFunction.length : 0, // Safe access\r\n\t\t\t\ttags: tag,\r\n\t\t\t\ttimeout: timeout,\r\n\t\t\t\twrapperOption: wrapperOption,\r\n\t\t\t\tcallsite: callsite,\r\n\t\t\t\tcucumberKey: shortUuid().new()\r\n\t\t\t};\r\n\t\t\taddStepBindingExp(stepBinding);\r\n\r\n\t\t\treturn descriptor;\r\n\t\t};\r\n\t} else {\r\n\t\treturn function givenDecorator(target: Function, context: ClassMethodDecoratorContext) {\r\n\t\t\tconst stepBinding: StepBinding = {\r\n\t\t\t\tstepPattern: stepPattern,\r\n\t\t\t\tbindingType: StepBindingFlags.given,\r\n\t\t\t\tclassPrototype: undefined,\r\n\t\t\t\tclassPropertyKey: context.name,\r\n\t\t\t\tstepFunction: target,\r\n\t\t\t\tstepIsStatic: context.static,\r\n\t\t\t\tstepArgsLength: target.length,\r\n\t\t\t\ttags: tag,\r\n\t\t\t\ttimeout: timeout,\r\n\t\t\t\twrapperOption: wrapperOption,\r\n\t\t\t\tcallsite: callsite,\r\n\t\t\t\tcucumberKey: shortUuid().new()\r\n\t\t\t};\r\n\r\n\t\t\tcollectStepBinding(stepBinding);\r\n\r\n\t\t\treturn;\r\n\t\t};\r\n\t}\r\n}\r\n\r\n/**\r\n * A method decorator that marks the associated function as a 'When' step.\r\n *\r\n * @param stepPattern The regular expression that will be used to match steps.\r\n * @param tag An optional tag.\r\n * @param timeout An optional timeout.\r\n */\r\nexport function when(stepPattern: RegExp | string, tag?: string, timeout?: number, wrapperOption?: any): any {\r\n\tconst callsite = Callsite.capture();\r\n\r\n\tif (global.experimentalDecorators) {\r\n\t\treturn <T>(target: any, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => {\r\n\t\t\tconst stepFunction = descriptor?.value || target[propertyKey];\r\n\r\n\t\t\tconst stepBinding: StepBinding = {\r\n\t\t\t\tstepPattern: stepPattern,\r\n\t\t\t\tbindingType: StepBindingFlags.when,\r\n\t\t\t\tclassPrototype: target,\r\n\t\t\t\tclassPropertyKey: propertyKey,\r\n\t\t\t\tstepFunction,\r\n\t\t\t\tstepIsStatic: false,\r\n\t\t\t\tstepArgsLength: stepFunction ? stepFunction.length : 0, // Safe access\r\n\t\t\t\ttags: tag,\r\n\t\t\t\ttimeout: timeout,\r\n\t\t\t\twrapperOption: wrapperOption,\r\n\t\t\t\tcallsite: callsite,\r\n\t\t\t\tcucumberKey: shortUuid().new()\r\n\t\t\t};\r\n\t\t\taddStepBindingExp(stepBinding);\r\n\r\n\t\t\treturn descriptor;\r\n\t\t};\r\n\t} else {\r\n\t\treturn function whenDecorator(target: Function, context: ClassMethodDecoratorContext) {\r\n\t\t\tconst stepBinding: StepBinding = {\r\n\t\t\t\tstepPattern: stepPattern,\r\n\t\t\t\tbindingType: StepBindingFlags.when,\r\n\t\t\t\tclassPrototype: undefined,\r\n\t\t\t\tclassPropertyKey: context.name,\r\n\t\t\t\tstepFunction: target,\r\n\t\t\t\tstepIsStatic: context.static,\r\n\t\t\t\tstepArgsLength: target.length,\r\n\t\t\t\ttags: tag,\r\n\t\t\t\ttimeout: timeout,\r\n\t\t\t\twrapperOption: wrapperOption,\r\n\t\t\t\tcallsite: callsite,\r\n\t\t\t\tcucumberKey: shortUuid().new()\r\n\t\t\t};\r\n\r\n\t\t\tcollectStepBinding(stepBinding);\r\n\r\n\t\t\treturn;\r\n\t\t};\r\n\t}\r\n}\r\n\r\n/**\r\n * A method decorator that marks the associated function as a 'Then' step.\r\n *\r\n * @param stepPattern The regular expression that will be used to match steps.\r\n * @param tag An optional tag.\r\n * @param timeout An optional timeout.\r\n */\r\nexport function then(stepPattern: RegExp | string, tag?: string, timeout?: number, wrapperOption?: any): any {\r\n\tconst callsite = Callsite.capture();\r\n\r\n\tif (global.experimentalDecorators) {\r\n\t\treturn <T>(target: any, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => {\r\n\t\t\tconst stepFunction = descriptor?.value || target[propertyKey];\r\n\r\n\t\t\tconst stepBinding: StepBinding = {\r\n\t\t\t\tstepPattern: stepPattern,\r\n\t\t\t\tbindingType: StepBindingFlags.then,\r\n\t\t\t\tclassPrototype: target,\r\n\t\t\t\tclassPropertyKey: propertyKey,\r\n\t\t\t\tstepFunction,\r\n\t\t\t\tstepIsStatic: false,\r\n\t\t\t\tstepArgsLength: stepFunction ? stepFunction.length : 0, // Safe access\r\n\t\t\t\ttags: tag,\r\n\t\t\t\ttimeout: timeout,\r\n\t\t\t\twrapperOption: wrapperOption,\r\n\t\t\t\tcallsite: callsite,\r\n\t\t\t\tcucumberKey: shortUuid().new()\r\n\t\t\t};\r\n\t\t\taddStepBindingExp(stepBinding);\r\n\r\n\t\t\treturn descriptor;\r\n\t\t};\r\n\t} else {\r\n\t\treturn function thenDecorator(target: Function, context: ClassMethodDecoratorContext) {\r\n\t\t\tconst stepBinding: StepBinding = {\r\n\t\t\t\tstepPattern: stepPattern,\r\n\t\t\t\tbindingType: StepBindingFlags.then,\r\n\t\t\t\tclassPrototype: undefined,\r\n\t\t\t\tclassPropertyKey: context.name,\r\n\t\t\t\tstepFunction: target,\r\n\t\t\t\tstepIsStatic: context.static,\r\n\t\t\t\tstepArgsLength: target.length,\r\n\t\t\t\ttags: tag,\r\n\t\t\t\ttimeout: timeout,\r\n\t\t\t\twrapperOption: wrapperOption,\r\n\t\t\t\tcallsite: callsite,\r\n\t\t\t\tcucumberKey: shortUuid().new()\r\n\t\t\t};\r\n\r\n\t\t\tcollectStepBinding(stepBinding);\r\n\r\n\t\t\treturn;\r\n\t\t};\r\n\t}\r\n}\r\n"]}
1
+ {"version":3,"file":"step-decorators.js","sourceRoot":"","sources":["../../src/bindings/step-decorators.ts"],"names":[],"mappings":";;;;;AAYA,sBA8CC;AASD,oBA+CC;AASD,oBA+CC;AA1KD,wDAAiD;AACjD,iDAA+D;AAC/D,4DAAmC;AACnC,uDAA0E;AAE1E;;;;;;GAMG;AACH,SAAgB,KAAK,CAAC,WAA4B,EAAE,GAAY,EAAE,OAAgB,EAAE,aAAmB;IACtG,MAAM,QAAQ,GAAG,uBAAQ,CAAC,OAAO,EAAE,CAAC;IACpC,IAAI,MAAM,CAAC,sBAAsB,EAAE,CAAC;QACnC,OAAO,CAAI,MAAW,EAAE,WAA4B,EAAE,UAAsC,EAAE,EAAE;YAC/F,MAAM,YAAY,GAAG,UAAU,EAAE,KAAK,IAAI,MAAM,CAAC,WAAW,CAAC,CAAC;YAE9D,MAAM,WAAW,GAAgB;gBAChC,WAAW,EAAE,WAAW;gBACxB,WAAW,EAAE,+BAAgB,CAAC,KAAK;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,cAAc,EAAE,MAAM,CAAC,MAAM;gBAC7B,IAAI,EAAE,GAAG;gBACT,OAAO,EAAE,OAAO;gBAChB,aAAa,EAAE,aAAa;gBAC5B,QAAQ,EAAE,QAAQ;gBAClB,WAAW,EAAE,IAAA,oBAAS,GAAE,CAAC,GAAG,EAAE;aAC9B,CAAC;YAEF,IAAA,oCAAkB,EAAC,WAAW,CAAC,CAAC;YAEhC,OAAO;QACR,CAAC,CAAC;IACH,CAAC;AACF,CAAC","sourcesContent":["import { Callsite } from '../utils/our-callsite';\r\nimport { StepBinding, StepBindingFlags } from './step-binding';\r\nimport shortUuid from 'short-uuid';\r\nimport { addStepBindingExp, collectStepBinding } from './binding-context';\r\n\r\n/**\r\n * A method decorator that marks the associated function as a 'Given' step.\r\n *\r\n * @param stepPattern The regular expression that will be used to match steps.\r\n * @param tag An optional tag.\r\n * @param timeout An optional timeout.\r\n */\r\nexport function given(stepPattern: RegExp | string, tag?: string, timeout?: number, wrapperOption?: any): any {\r\n\tconst callsite = Callsite.capture();\r\n\tif (global.experimentalDecorators) {\r\n\t\treturn <T>(target: any, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => {\r\n\t\t\tconst stepFunction = descriptor?.value || target[propertyKey];\r\n\r\n\t\t\tconst stepBinding: StepBinding = {\r\n\t\t\t\tstepPattern: stepPattern,\r\n\t\t\t\tbindingType: StepBindingFlags.given,\r\n\t\t\t\tclassPrototype: target,\r\n\t\t\t\tclassPropertyKey: propertyKey,\r\n\t\t\t\tstepFunction,\r\n\t\t\t\tstepIsStatic: false,\r\n\t\t\t\tstepArgsLength: stepFunction ? stepFunction.length : 0, // Safe access\r\n\t\t\t\ttags: tag,\r\n\t\t\t\ttimeout: timeout,\r\n\t\t\t\twrapperOption: wrapperOption,\r\n\t\t\t\tcallsite: callsite,\r\n\t\t\t\tcucumberKey: shortUuid().new()\r\n\t\t\t};\r\n\t\t\taddStepBindingExp(stepBinding);\r\n\r\n\t\t\treturn descriptor;\r\n\t\t};\r\n\t} else {\r\n\t\treturn function givenDecorator(target: Function, context: ClassMethodDecoratorContext) {\r\n\t\t\tconst stepBinding: StepBinding = {\r\n\t\t\t\tstepPattern: stepPattern,\r\n\t\t\t\tbindingType: StepBindingFlags.given,\r\n\t\t\t\tclassPrototype: undefined,\r\n\t\t\t\tclassPropertyKey: context.name,\r\n\t\t\t\tstepFunction: target,\r\n\t\t\t\tstepIsStatic: context.static,\r\n\t\t\t\tstepArgsLength: target.length,\r\n\t\t\t\ttags: tag,\r\n\t\t\t\ttimeout: timeout,\r\n\t\t\t\twrapperOption: wrapperOption,\r\n\t\t\t\tcallsite: callsite,\r\n\t\t\t\tcucumberKey: shortUuid().new()\r\n\t\t\t};\r\n\r\n\t\t\tcollectStepBinding(stepBinding);\r\n\r\n\t\t\treturn;\r\n\t\t};\r\n\t}\r\n}\r\n\r\n/**\r\n * A method decorator that marks the associated function as a 'When' step.\r\n *\r\n * @param stepPattern The regular expression that will be used to match steps.\r\n * @param tag An optional tag.\r\n * @param timeout An optional timeout.\r\n */\r\nexport function when(stepPattern: RegExp | string, tag?: string, timeout?: number, wrapperOption?: any): any {\r\n\tconst callsite = Callsite.capture();\r\n\r\n\tif (global.experimentalDecorators) {\r\n\t\treturn <T>(target: any, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => {\r\n\t\t\tconst stepFunction = descriptor?.value || target[propertyKey];\r\n\r\n\t\t\tconst stepBinding: StepBinding = {\r\n\t\t\t\tstepPattern: stepPattern,\r\n\t\t\t\tbindingType: StepBindingFlags.when,\r\n\t\t\t\tclassPrototype: target,\r\n\t\t\t\tclassPropertyKey: propertyKey,\r\n\t\t\t\tstepFunction,\r\n\t\t\t\tstepIsStatic: false,\r\n\t\t\t\tstepArgsLength: stepFunction ? stepFunction.length : 0, // Safe access\r\n\t\t\t\ttags: tag,\r\n\t\t\t\ttimeout: timeout,\r\n\t\t\t\twrapperOption: wrapperOption,\r\n\t\t\t\tcallsite: callsite,\r\n\t\t\t\tcucumberKey: shortUuid().new()\r\n\t\t\t};\r\n\t\t\taddStepBindingExp(stepBinding);\r\n\r\n\t\t\treturn descriptor;\r\n\t\t};\r\n\t} else {\r\n\t\treturn function whenDecorator(target: Function, context: ClassMethodDecoratorContext) {\r\n\t\t\tconst stepBinding: StepBinding = {\r\n\t\t\t\tstepPattern: stepPattern,\r\n\t\t\t\tbindingType: StepBindingFlags.when,\r\n\t\t\t\tclassPrototype: undefined,\r\n\t\t\t\tclassPropertyKey: context.name,\r\n\t\t\t\tstepFunction: target,\r\n\t\t\t\tstepIsStatic: context.static,\r\n\t\t\t\tstepArgsLength: target.length,\r\n\t\t\t\ttags: tag,\r\n\t\t\t\ttimeout: timeout,\r\n\t\t\t\twrapperOption: wrapperOption,\r\n\t\t\t\tcallsite: callsite,\r\n\t\t\t\tcucumberKey: shortUuid().new()\r\n\t\t\t};\r\n\r\n\t\t\tcollectStepBinding(stepBinding);\r\n\r\n\t\t\treturn;\r\n\t\t};\r\n\t}\r\n}\r\n\r\n/**\r\n * A method decorator that marks the associated function as a 'Then' step.\r\n *\r\n * @param stepPattern The regular expression that will be used to match steps.\r\n * @param tag An optional tag.\r\n * @param timeout An optional timeout.\r\n */\r\nexport function then(stepPattern: RegExp | string, tag?: string, timeout?: number, wrapperOption?: any): any {\r\n\tconst callsite = Callsite.capture();\r\n\r\n\tif (global.experimentalDecorators) {\r\n\t\treturn <T>(target: any, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => {\r\n\t\t\tconst stepFunction = descriptor?.value || target[propertyKey];\r\n\r\n\t\t\tconst stepBinding: StepBinding = {\r\n\t\t\t\tstepPattern: stepPattern,\r\n\t\t\t\tbindingType: StepBindingFlags.then,\r\n\t\t\t\tclassPrototype: target,\r\n\t\t\t\tclassPropertyKey: propertyKey,\r\n\t\t\t\tstepFunction,\r\n\t\t\t\tstepIsStatic: false,\r\n\t\t\t\tstepArgsLength: stepFunction ? stepFunction.length : 0, // Safe access\r\n\t\t\t\ttags: tag,\r\n\t\t\t\ttimeout: timeout,\r\n\t\t\t\twrapperOption: wrapperOption,\r\n\t\t\t\tcallsite: callsite,\r\n\t\t\t\tcucumberKey: shortUuid().new()\r\n\t\t\t};\r\n\t\t\taddStepBindingExp(stepBinding);\r\n\r\n\t\t\treturn descriptor;\r\n\t\t};\r\n\t} else {\r\n\t\treturn function thenDecorator(target: Function, context: ClassMethodDecoratorContext) {\r\n\t\t\tconst stepBinding: StepBinding = {\r\n\t\t\t\tstepPattern: stepPattern,\r\n\t\t\t\tbindingType: StepBindingFlags.then,\r\n\t\t\t\tclassPrototype: undefined,\r\n\t\t\t\tclassPropertyKey: context.name,\r\n\t\t\t\tstepFunction: target,\r\n\t\t\t\tstepIsStatic: context.static,\r\n\t\t\t\tstepArgsLength: target.length,\r\n\t\t\t\ttags: tag,\r\n\t\t\t\ttimeout: timeout,\r\n\t\t\t\twrapperOption: wrapperOption,\r\n\t\t\t\tcallsite: callsite,\r\n\t\t\t\tcucumberKey: shortUuid().new()\r\n\t\t\t};\r\n\r\n\t\t\tcollectStepBinding(stepBinding);\r\n\r\n\t\t\treturn;\r\n\t\t};\r\n\t}\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/runtime/worker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6DAA+C;AAI/C,0EAAgD;AAChD,oEAA8F;AAU9F,MAAa,MAAM;IAEA;IACA;IACA;IACA;IACA;IALlB,YACkB,QAA4B,EAC5B,gBAA8B,EAC9B,KAAwB,EACxB,OAAuB,EACvB,kBAAsC;QAJtC,aAAQ,GAAR,QAAQ,CAAoB;QAC5B,qBAAgB,GAAhB,gBAAgB,CAAc;QAC9B,UAAK,GAAL,KAAK,CAAmB;QACxB,YAAO,GAAP,OAAO,CAAgB;QACvB,uBAAkB,GAAlB,kBAAkB,CAAoB;IACrD,CAAC;IAEJ,KAAK,CAAC,iBAAiB;QAC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MAAM;oBAC5C,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;oBAClC,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,YAAY;oBACtC,SAAS,EAAE;wBACV,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,IAAI,OAAO;wBACxC,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,YAAY;qBACtC;iBACD;gBACD,KAAK;aACL,CAAC;QACH,CAAC;IACF,CAAC;CACD;AA7FD,wBA6FC","sourcesContent":["import { EventEmitter } from 'node:events';\r\nimport * as messages from '@cucumber/messages';\r\nimport { IdGenerator } from '@cucumber/messages';\r\nimport { AssembledTestCase } from '@cucumber/cucumber/lib/assemble/index';\r\nimport { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';\r\nimport TestCaseRunner from './test-case-runner';\r\nimport { retriesForPickle, shouldCauseFailure } from '@cucumber/cucumber/lib/runtime/helpers';\r\nimport { RuntimeOptions } from '@cucumber/cucumber/lib/runtime/index';\r\nimport { timestamp } from '@cucumber/cucumber/lib/runtime/stopwatch';\r\n\r\n/** Result of running a single test-run hook */\r\nexport interface RunHookResult {\r\n\tresult: messages.TestStepResult;\r\n\terror?: any;\r\n}\r\n\r\nexport class Worker {\r\n\tconstructor(\r\n\t\tprivate readonly workerId: string | undefined,\r\n\t\tprivate readonly eventBroadcaster: EventEmitter,\r\n\t\tprivate readonly newId: IdGenerator.NewId,\r\n\t\tprivate readonly options: RuntimeOptions,\r\n\t\tprivate readonly supportCodeLibrary: SupportCodeLibrary\r\n\t) {}\r\n\r\n\tasync runBeforeAllHooks(): Promise<RunHookResult[]> {\r\n\t\tconst results: RunHookResult[] = [];\r\n\t\tfor (const hookDefinition of this.supportCodeLibrary.beforeTestRunHookDefinitions) {\r\n\t\t\tconst result = await this.runTestRunHook(hookDefinition, 'a BeforeAll');\r\n\t\t\tresults.push(result);\r\n\t\t}\r\n\t\treturn results;\r\n\t}\r\n\r\n\tasync runTestCase({ gherkinDocument, pickle, testCase }: AssembledTestCase, failing: boolean): Promise<boolean> {\r\n\t\tconst testCaseRunner = new TestCaseRunner({\r\n\t\t\tworkerId: this.workerId,\r\n\t\t\teventBroadcaster: this.eventBroadcaster,\r\n\t\t\tnewId: this.newId,\r\n\t\t\tgherkinDocument,\r\n\t\t\tpickle,\r\n\t\t\ttestCase,\r\n\t\t\tretries: retriesForPickle(pickle, this.options),\r\n\t\t\tskip: this.options.dryRun || (this.options.failFast && failing),\r\n\t\t\tfilterStackTraces: this.options.filterStacktraces,\r\n\t\t\tsupportCodeLibrary: this.supportCodeLibrary,\r\n\t\t\tworldParameters: this.options.worldParameters\r\n\t\t});\r\n\r\n\t\tconst status = await testCaseRunner.run();\r\n\r\n\t\treturn !shouldCauseFailure(status, this.options);\r\n\t}\r\n\r\n\tasync runAfterAllHooks(): Promise<RunHookResult[]> {\r\n\t\tconst results: RunHookResult[] = [];\r\n\t\tconst hooks = this.supportCodeLibrary.afterTestRunHookDefinitions.slice(0).reverse();\r\n\t\tfor (const hookDefinition of hooks) {\r\n\t\t\tconst result = await this.runTestRunHook(hookDefinition, 'an AfterAll');\r\n\t\t\tresults.push(result);\r\n\t\t}\r\n\t\treturn results;\r\n\t}\r\n\r\n\t/**\r\n\t * Run a single test-run hook (BeforeAll/AfterAll).\r\n\t * Replicates the logic previously in makeRunTestRunHooks which was removed\r\n\t * from Cucumber 12.3+.\r\n\t */\r\n\tprivate async runTestRunHook(hookDefinition: any, name: string): Promise<RunHookResult> {\r\n\t\tif (this.options.dryRun) {\r\n\t\t\treturn {\r\n\t\t\t\tresult: {\r\n\t\t\t\t\tstatus: messages.TestStepResultStatus.SKIPPED,\r\n\t\t\t\t\tduration: { seconds: 0, nanos: 0 }\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\ttry {\r\n\t\t\tawait hookDefinition.code.apply(null, []);\r\n\t\t\treturn {\r\n\t\t\t\tresult: {\r\n\t\t\t\t\tstatus: messages.TestStepResultStatus.PASSED,\r\n\t\t\t\t\tduration: { seconds: 0, nanos: 0 }\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t} catch (error: any) {\r\n\t\t\tlet errorMessage = `${name} hook errored`;\r\n\t\t\tif (this.workerId) {\r\n\t\t\t\terrorMessage += ` on worker ${this.workerId}`;\r\n\t\t\t}\r\n\t\t\tconst location = `${hookDefinition.uri}:${hookDefinition.line}`;\r\n\t\t\terrorMessage += `, process exiting: ${location}`;\r\n\r\n\t\t\treturn {\r\n\t\t\t\tresult: {\r\n\t\t\t\t\tstatus: messages.TestStepResultStatus.FAILED,\r\n\t\t\t\t\tduration: { seconds: 0, nanos: 0 },\r\n\t\t\t\t\tmessage: error.message || errorMessage,\r\n\t\t\t\t\texception: {\r\n\t\t\t\t\t\ttype: error.constructor?.name || 'Error',\r\n\t\t\t\t\t\tmessage: error.message || errorMessage\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\terror\r\n\t\t\t};\r\n\t\t}\r\n\t}\r\n}\r\n"]}
1
+ {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/runtime/worker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6DAA+C;AAI/C,0EAAgD;AAChD,oEAA8F;AAS9F,MAAa,MAAM;IAEA;IACA;IACA;IACA;IACA;IALlB,YACkB,QAA4B,EAC5B,gBAA8B,EAC9B,KAAwB,EACxB,OAAuB,EACvB,kBAAsC;QAJtC,aAAQ,GAAR,QAAQ,CAAoB;QAC5B,qBAAgB,GAAhB,gBAAgB,CAAc;QAC9B,UAAK,GAAL,KAAK,CAAmB;QACxB,YAAO,GAAP,OAAO,CAAgB;QACvB,uBAAkB,GAAlB,kBAAkB,CAAoB;IACrD,CAAC;IAEJ,KAAK,CAAC,iBAAiB;QACtB,MAAM,OAAO,GAAoB,EAAE,CAAC;QACpC,KAAK,MAAM,cAAc,IAAI,IAAI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CAAC,EAAE;oBAClC,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,YAAY;oBACtC,SAAS,EAAE;wBACV,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,IAAI,OAAO;wBACxC,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,YAAY;qBACtC;iBACD;gBACD,KAAK;aACL,CAAC;QACH,CAAC;IACF,CAAC;CACD;AA7FD,wBA6FC","sourcesContent":["import { EventEmitter } from 'node:events';\r\nimport * as messages from '@cucumber/messages';\r\nimport { IdGenerator } from '@cucumber/messages';\r\nimport { AssembledTestCase } from '@cucumber/cucumber/lib/assemble/index';\r\nimport { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';\r\nimport TestCaseRunner from './test-case-runner';\r\nimport { retriesForPickle, shouldCauseFailure } from '@cucumber/cucumber/lib/runtime/helpers';\r\nimport { RuntimeOptions } from '@cucumber/cucumber/lib/runtime/index';\r\n\r\n/** Result of running a single test-run hook */\r\nexport interface RunHookResult {\r\n\tresult: messages.TestStepResult;\r\n\terror?: any;\r\n}\r\n\r\nexport class Worker {\r\n\tconstructor(\r\n\t\tprivate readonly workerId: string | undefined,\r\n\t\tprivate readonly eventBroadcaster: EventEmitter,\r\n\t\tprivate readonly newId: IdGenerator.NewId,\r\n\t\tprivate readonly options: RuntimeOptions,\r\n\t\tprivate readonly supportCodeLibrary: SupportCodeLibrary\r\n\t) {}\r\n\r\n\tasync runBeforeAllHooks(): Promise<RunHookResult[]> {\r\n\t\tconst results: RunHookResult[] = [];\r\n\t\tfor (const hookDefinition of this.supportCodeLibrary.beforeTestRunHookDefinitions) {\r\n\t\t\tconst result = await this.runTestRunHook(hookDefinition, 'a BeforeAll');\r\n\t\t\tresults.push(result);\r\n\t\t}\r\n\t\treturn results;\r\n\t}\r\n\r\n\tasync runTestCase({ gherkinDocument, pickle, testCase }: AssembledTestCase, failing: boolean): Promise<boolean> {\r\n\t\tconst testCaseRunner = new TestCaseRunner({\r\n\t\t\tworkerId: this.workerId,\r\n\t\t\teventBroadcaster: this.eventBroadcaster,\r\n\t\t\tnewId: this.newId,\r\n\t\t\tgherkinDocument,\r\n\t\t\tpickle,\r\n\t\t\ttestCase,\r\n\t\t\tretries: retriesForPickle(pickle, this.options),\r\n\t\t\tskip: this.options.dryRun || (this.options.failFast && failing),\r\n\t\t\tfilterStackTraces: this.options.filterStacktraces,\r\n\t\t\tsupportCodeLibrary: this.supportCodeLibrary,\r\n\t\t\tworldParameters: this.options.worldParameters\r\n\t\t});\r\n\r\n\t\tconst status = await testCaseRunner.run();\r\n\r\n\t\treturn !shouldCauseFailure(status, this.options);\r\n\t}\r\n\r\n\tasync runAfterAllHooks(): Promise<RunHookResult[]> {\r\n\t\tconst results: RunHookResult[] = [];\r\n\t\tconst hooks = this.supportCodeLibrary.afterTestRunHookDefinitions.slice(0).reverse();\r\n\t\tfor (const hookDefinition of hooks) {\r\n\t\t\tconst result = await this.runTestRunHook(hookDefinition, 'an AfterAll');\r\n\t\t\tresults.push(result);\r\n\t\t}\r\n\t\treturn results;\r\n\t}\r\n\r\n\t/**\r\n\t * Run a single test-run hook (BeforeAll/AfterAll).\r\n\t * Replicates the logic previously in makeRunTestRunHooks which was removed\r\n\t * from Cucumber 12.3+.\r\n\t */\r\n\tprivate async runTestRunHook(hookDefinition: any, name: string): Promise<RunHookResult> {\r\n\t\tif (this.options.dryRun) {\r\n\t\t\treturn {\r\n\t\t\t\tresult: {\r\n\t\t\t\t\tstatus: messages.TestStepResultStatus.SKIPPED,\r\n\t\t\t\t\tduration: { seconds: 0, nanos: 0 }\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\ttry {\r\n\t\t\tawait hookDefinition.code.apply(null, []);\r\n\t\t\treturn {\r\n\t\t\t\tresult: {\r\n\t\t\t\t\tstatus: messages.TestStepResultStatus.PASSED,\r\n\t\t\t\t\tduration: { seconds: 0, nanos: 0 }\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t} catch (error: any) {\r\n\t\t\tlet errorMessage = `${name} hook errored`;\r\n\t\t\tif (this.workerId) {\r\n\t\t\t\terrorMessage += ` on worker ${this.workerId}`;\r\n\t\t\t}\r\n\t\t\tconst location = `${hookDefinition.uri}:${hookDefinition.line}`;\r\n\t\t\terrorMessage += `, process exiting: ${location}`;\r\n\r\n\t\t\treturn {\r\n\t\t\t\tresult: {\r\n\t\t\t\t\tstatus: messages.TestStepResultStatus.FAILED,\r\n\t\t\t\t\tduration: { seconds: 0, nanos: 0 },\r\n\t\t\t\t\tmessage: error.message || errorMessage,\r\n\t\t\t\t\texception: {\r\n\t\t\t\t\t\ttype: error.constructor?.name || 'Error',\r\n\t\t\t\t\t\tmessage: error.message || errorMessage\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\terror\r\n\t\t\t};\r\n\t\t}\r\n\t}\r\n}\r\n"]}
package/lib/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "7.7.0";
1
+ export declare const version = "7.7.1";
package/lib/version.js CHANGED
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // Generated by genversion.
5
- exports.version = '7.7.0';
5
+ exports.version = '7.7.1';
6
6
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,OAAO,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '7.7.0'\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,OAAO,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '7.7.1'\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lynxwall/cucumber-tsflow",
3
3
  "description": "Provides 'specflow' like bindings for CucumberJS 12.7.0 in TypeScript 5.9+.",
4
- "version": "7.7.0",
4
+ "version": "7.7.1",
5
5
  "author": "Lonnie Wall <lynxdev@lynxwall.com>",
6
6
  "license": "MIT",
7
7
  "keywords": [