@lynxwall/cucumber-tsflow 7.4.0 → 7.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,10 +12,6 @@ This is a detached fork of <https://github.com/timjroberts/cucumber-js-tsflow>.
12
12
 
13
13
  This fork has been drastically modified from the original and will eventually be moved to a new project. In addition, the SpecFlow project has reached [end of life](https://reqnroll.net/news/2025/01/specflow-end-of-life-has-been-announced/), and this project will be rebranded. Further details will be provided in future updates. However, the new project will support the same functionality as cucumber-tsflow while providing additional tools and extensions.
14
14
 
15
- ## Release Updates (7.4.0)
16
-
17
- This release shifts from importing @cumber/cumber as a dependency to making it a peer dependency. This update was necessary to avoid cucumber runtime instance conflicts when importing cucumber-tsflow into the companion VS Code extension. Importing @cucumber/cucumber as a peer dependency is also recommended in Cucumber.JS documentation.
18
-
19
15
  ## Release Updates (7.3.0)
20
16
 
21
17
  With this release, we've finally added support for ESM Modules. For details on the new transpilers/loaders please see: [cucumber-tsflow ESM implementation](https://github.com/LynxWall/cucumber-js-tsflow/blob/master/cucumber-tsflow/src/transpilers/esm/README.md).
@@ -4,7 +4,7 @@ exports.loadSupport = loadSupport;
4
4
  const messages_1 = require("@cucumber/messages");
5
5
  const index_1 = require("@cucumber/cucumber/lib/paths/index");
6
6
  const index_2 = require("@cucumber/cucumber/lib/environment/index");
7
- const support_1 = require("@cucumber/cucumber/lib/api/support");
7
+ const support_1 = require("./support");
8
8
  const plugins_1 = require("@cucumber/cucumber/lib/api/plugins");
9
9
  const binding_registry_1 = require("../bindings/binding-registry");
10
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"load-support.js","sourceRoot":"","sources":["../../src/api/load-support.ts"],"names":[],"mappings":";;AAeA,kCAsCC;AArDD,iDAAiD;AACjD,8DAAkE;AAClE,oEAA4F;AAE5F,gEAA2E;AAC3E,gEAA8E;AAC9E,mEAA+D;AAE/D;;;;;;GAMG;AACI,KAAK,UAA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sourcesContent":["import { IdGenerator } from '@cucumber/messages';\r\nimport { resolvePaths } from '@cucumber/cucumber/lib/paths/index';\r\nimport { IRunEnvironment, makeEnvironment } from '@cucumber/cucumber/lib/environment/index';\r\nimport { ILoadSupportOptions, ISupportCodeLibrary } from '@cucumber/cucumber/lib/api/types';\r\nimport { getSupportCodeLibrary } from '@cucumber/cucumber/lib/api/support';\r\nimport { initializeForLoadSupport } from '@cucumber/cucumber/lib/api/plugins';\r\nimport { BindingRegistry } from '../bindings/binding-registry';\r\n\r\n/**\r\n * Load support code for use in test runs\r\n *\r\n * @public\r\n * @param options - Options required to find the support code\r\n * @param environment - Project environment\r\n */\r\nexport async function loadSupport(\r\n\toptions: ILoadSupportOptions,\r\n\tenvironment: IRunEnvironment = {}\r\n): Promise<ISupportCodeLibrary> {\r\n\tconst mergedEnvironment = makeEnvironment(environment);\r\n\tconst { cwd, logger } = mergedEnvironment;\r\n\tconst newId = IdGenerator.uuid();\r\n\tconst supportCoordinates = Object.assign(\r\n\t\t{\r\n\t\t\trequireModules: [],\r\n\t\t\trequirePaths: [],\r\n\t\t\tloaders: [],\r\n\t\t\timportPaths: []\r\n\t\t},\r\n\t\toptions.support\r\n\t);\r\n\tconst pluginManager = await initializeForLoadSupport(mergedEnvironment);\r\n\tconst resolvedPaths = await resolvePaths(logger, cwd, options.sources, supportCoordinates);\r\n\tpluginManager.emit('paths:resolve', resolvedPaths);\r\n\tconst { requirePaths, importPaths } = resolvedPaths;\r\n\tlet supportCodeLibrary = await getSupportCodeLibrary({\r\n\t\tlogger,\r\n\t\tcwd,\r\n\t\tnewId,\r\n\t\trequireModules: supportCoordinates.requireModules,\r\n\t\trequirePaths,\r\n\t\tloaders: supportCoordinates.loaders,\r\n\t\timportPaths\r\n\t});\r\n\tawait pluginManager.cleanup();\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\r\n\treturn supportCodeLibrary;\r\n}\r\n"]}
1
+ {"version":3,"file":"load-support.js","sourceRoot":"","sources":["../../src/api/load-support.ts"],"names":[],"mappings":";;AAeA,kCAsCC;AArDD,iDAAiD;AACjD,8DAAkE;AAClE,oEAA4F;AAE5F,uCAAkD;AAClD,gEAA8E;AAC9E,mEAA+D;AAE/D;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAChC,OAA4B,EAC5B,cAA+B,EAAE;IAEjC,MAAM,iBAAiB,GAAG,IAAA,uBAAe,EAAC,WAAW,CAAC,CAAC;IACvD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC;IAC1C,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAC;IACjC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CACvC;QACC,cAAc,EAAE,EAAE;QAClB,YAAY,EAAE,EAAE;QAChB,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,EAAE;KACf,EACD,OAAO,CAAC,OAAO,CACf,CAAC;IACF,MAAM,aAAa,GAAG,MAAM,IAAA,kCAAwB,EAAC,iBAAiB,CAAC,CAAC;IACxE,MAAM,aAAa,GAAG,MAAM,IAAA,oBAAY,EAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;IAC3F,aAAa,CAAC,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;IACnD,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,aAAa,CAAC;IACpD,IAAI,kBAAkB,GAAG,MAAM,IAAA,+BAAqB,EAAC;QACpD,MAAM;QACN,GAAG;QACH,KAAK;QACL,cAAc,EAAE,kBAAkB,CAAC,cAAc;QACjD,YAAY;QACZ,OAAO,EAAE,kBAAkB,CAAC,OAAO;QACnC,WAAW;KACX,CAAC,CAAC;IACH,MAAM,aAAa,CAAC,OAAO,EAAE,CAAC;IAE9B,uDAAuD;IACvD,4EAA4E;IAC5E,iCAAiC;IACjC,kBAAkB,GAAG,kCAAe,CAAC,QAAQ,CAAC,wBAAwB,CAAC,kBAAkB,CAAC,CAAC;IAC3F,kBAAkB,GAAG,EAAE,GAAG,kBAAkB,EAAE,GAAG,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,EAAE,CAAC;IAE/F,OAAO,kBAAkB,CAAC;AAC3B,CAAC","sourcesContent":["import { IdGenerator } from '@cucumber/messages';\r\nimport { resolvePaths } from '@cucumber/cucumber/lib/paths/index';\r\nimport { IRunEnvironment, makeEnvironment } from '@cucumber/cucumber/lib/environment/index';\r\nimport { ILoadSupportOptions, ISupportCodeLibrary } from '@cucumber/cucumber/lib/api/types';\r\nimport { getSupportCodeLibrary } from './support';\r\nimport { initializeForLoadSupport } from '@cucumber/cucumber/lib/api/plugins';\r\nimport { BindingRegistry } from '../bindings/binding-registry';\r\n\r\n/**\r\n * Load support code for use in test runs\r\n *\r\n * @public\r\n * @param options - Options required to find the support code\r\n * @param environment - Project environment\r\n */\r\nexport async function loadSupport(\r\n\toptions: ILoadSupportOptions,\r\n\tenvironment: IRunEnvironment = {}\r\n): Promise<ISupportCodeLibrary> {\r\n\tconst mergedEnvironment = makeEnvironment(environment);\r\n\tconst { cwd, logger } = mergedEnvironment;\r\n\tconst newId = IdGenerator.uuid();\r\n\tconst supportCoordinates = Object.assign(\r\n\t\t{\r\n\t\t\trequireModules: [],\r\n\t\t\trequirePaths: [],\r\n\t\t\tloaders: [],\r\n\t\t\timportPaths: []\r\n\t\t},\r\n\t\toptions.support\r\n\t);\r\n\tconst pluginManager = await initializeForLoadSupport(mergedEnvironment);\r\n\tconst resolvedPaths = await resolvePaths(logger, cwd, options.sources, supportCoordinates);\r\n\tpluginManager.emit('paths:resolve', resolvedPaths);\r\n\tconst { requirePaths, importPaths } = resolvedPaths;\r\n\tlet supportCodeLibrary = await getSupportCodeLibrary({\r\n\t\tlogger,\r\n\t\tcwd,\r\n\t\tnewId,\r\n\t\trequireModules: supportCoordinates.requireModules,\r\n\t\trequirePaths,\r\n\t\tloaders: supportCoordinates.loaders,\r\n\t\timportPaths\r\n\t});\r\n\tawait pluginManager.cleanup();\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\r\n\treturn supportCodeLibrary;\r\n}\r\n"]}
@@ -10,7 +10,7 @@ const helpers_1 = require("@cucumber/cucumber/lib/cli/helpers");
10
10
  const index_1 = require("@cucumber/cucumber/lib/paths/index");
11
11
  const make_runtime_1 = require("../runtime/make-runtime");
12
12
  const formatters_1 = require("@cucumber/cucumber/lib/api/formatters");
13
- const support_1 = require("@cucumber/cucumber/lib/api/support");
13
+ const support_1 = require("./support");
14
14
  const index_2 = require("@cucumber/cucumber/lib/environment/index");
15
15
  const gherkin_1 = require("@cucumber/cucumber/lib/api/gherkin");
16
16
  const message_collector_1 = __importDefault(require("../runtime/message-collector"));
@@ -1 +1 @@
1
- {"version":3,"file":"run-cucumber.js","sourceRoot":"","sources":["../../src/api/run-cucumber.ts"],"names":[],"mappings":";;;;;AAqCA,kCA4JC;AAjMD,iDAAuE;AACvE,mCAAsC;AAEtC,gEAA8F;AAE9F,8DAAkE;AAElE,0DAAsD;AACtD,sEAA6E;AAC7E,gEAA2E;AAC3E,oEAA4F;AAC5F,gEAAyE;AACzE,qFAA4D;AAC5D,wCAAqC;AACrC,gEAA8E;AAE9E,oCAAkC;AAClC,mEAA+D;AAE/D,qCAAkC;AAClC,kDAA0B;AAM1B;;;;;;;;;;GAUG;AACI,KAAK,UAAU,WAAW,CAChC,OAA0B,EAC1B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C,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,iCAAuB,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/cli/helpers';\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 '@cucumber/cucumber/lib/api/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\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 getSupportCodeLibrary({\r\n\t\t\t\t\tlogger,\r\n\t\t\t\t\tcwd,\r\n\t\t\t\t\tnewId,\r\n\t\t\t\t\trequirePaths,\r\n\t\t\t\t\trequireModules: supportCoordinates.requireModules,\r\n\t\t\t\t\timportPaths,\r\n\t\t\t\t\tloaders: supportCoordinates.loaders\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":";;;;;AAsCA,kCA4JC;AAlMD,iDAAuE;AACvE,mCAAsC;AAEtC,gEAA8F;AAE9F,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;AAO1B;;;;;;;;;;GAUG;AACI,KAAK,UAAU,WAAW,CAChC,OAA0B,EAC1B,cAA+B,EAAE,EACjC,SAAuC;IAEvC,MAAM,iBAAiB,GAAG,IAAA,uBAAe,EAAC,WAAW,CAAC,CAAC;IACvD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC;IAE/D,MAAM,CAAC,KAAK,CAAC,2BAA2B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YACd,OAAO,EAAE,kBAAkB;SAC3B,CAAC;IACH,CAAC;IAED,IAAA,iCAAuB,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/cli/helpers';\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\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 getSupportCodeLibrary({\r\n\t\t\t\t\tlogger,\r\n\t\t\t\t\tcwd,\r\n\t\t\t\t\tnewId,\r\n\t\t\t\t\trequirePaths,\r\n\t\t\t\t\trequireModules: supportCoordinates.requireModules,\r\n\t\t\t\t\timportPaths,\r\n\t\t\t\t\tloaders: supportCoordinates.loaders\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"]}
@@ -0,0 +1,12 @@
1
+ import { IdGenerator } from '@cucumber/messages';
2
+ import { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';
3
+ import { ILogger } from '@cucumber/cucumber/lib/environment/index';
4
+ export declare function getSupportCodeLibrary({ logger, cwd, newId, requireModules, requirePaths, importPaths, loaders }: {
5
+ logger: ILogger;
6
+ cwd: string;
7
+ newId: IdGenerator.NewId;
8
+ requireModules: string[];
9
+ requirePaths: string[];
10
+ importPaths: string[];
11
+ loaders: string[];
12
+ }): Promise<SupportCodeLibrary>;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getSupportCodeLibrary = getSupportCodeLibrary;
7
+ const node_module_1 = require("node:module");
8
+ const node_url_1 = require("node:url");
9
+ const index_1 = __importDefault(require("@cucumber/cucumber/lib/support_code_library_builder/index"));
10
+ const try_require_1 = __importDefault(require("@cucumber/cucumber/lib/try_require"));
11
+ async function getSupportCodeLibrary({ logger, cwd, newId, requireModules, requirePaths, importPaths, loaders }) {
12
+ index_1.default.reset(cwd, newId, {
13
+ requireModules,
14
+ requirePaths,
15
+ importPaths,
16
+ loaders
17
+ });
18
+ // Define the boolean type before loading any support code
19
+ index_1.default.defineParameterType({
20
+ name: 'boolean',
21
+ regexp: /true|false/,
22
+ transformer: s => (s === 'true' ? true : false)
23
+ });
24
+ requireModules.map(path => {
25
+ logger.debug(`Attempting to require code from "${path}"`);
26
+ (0, try_require_1.default)(path);
27
+ });
28
+ requirePaths.map(path => {
29
+ logger.debug(`Attempting to require code from "${path}"`);
30
+ (0, try_require_1.default)(path);
31
+ });
32
+ for (const specifier of loaders) {
33
+ logger.debug(`Attempting to register loader "${specifier}"`);
34
+ (0, node_module_1.register)(specifier, (0, node_url_1.pathToFileURL)('./'));
35
+ }
36
+ for (const path of importPaths) {
37
+ logger.debug(`Attempting to import code from "${path}"`);
38
+ await import((0, node_url_1.pathToFileURL)(path).toString());
39
+ }
40
+ return index_1.default.finalize();
41
+ }
42
+ //# sourceMappingURL=support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/api/support.ts"],"names":[],"mappings":";;;;;AAQA,sDAmDC;AA3DD,6CAAuC;AACvC,uCAAyC;AAGzC,sGAAkG;AAClG,qFAA4D;AAGrD,KAAK,UAAU,qBAAqB,CAAC,EAC3C,MAAM,EACN,GAAG,EACH,KAAK,EACL,cAAc,EACd,YAAY,EACZ,WAAW,EACX,OAAO,EASP;IACA,eAAyB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE;QAC3C,cAAc;QACd,YAAY;QACZ,WAAW;QACX,OAAO;KACP,CAAC,CAAC;IAEH,0DAA0D;IAC1D,eAAyB,CAAC,mBAAmB,CAAC;QAC7C,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,YAAY;QACpB,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;KAC/C,CAAC,CAAC;IAEH,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACzB,MAAM,CAAC,KAAK,CAAC,oCAAoC,IAAI,GAAG,CAAC,CAAC;QAC1D,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IACH,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACvB,MAAM,CAAC,KAAK,CAAC,oCAAoC,IAAI,GAAG,CAAC,CAAC;QAC1D,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,KAAK,MAAM,SAAS,IAAI,OAAO,EAAE,CAAC;QACjC,MAAM,CAAC,KAAK,CAAC,kCAAkC,SAAS,GAAG,CAAC,CAAC;QAC7D,IAAA,sBAAQ,EAAC,SAAS,EAAE,IAAA,wBAAa,EAAC,IAAI,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAChC,MAAM,CAAC,KAAK,CAAC,mCAAmC,IAAI,GAAG,CAAC,CAAC;QACzD,MAAM,MAAM,CAAC,IAAA,wBAAa,EAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,eAAyB,CAAC,QAAQ,EAAE,CAAC;AAC7C,CAAC","sourcesContent":["import { register } from 'node:module';\r\nimport { pathToFileURL } from 'node:url';\r\nimport { IdGenerator } from '@cucumber/messages';\r\nimport { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';\r\nimport supportCodeLibraryBuilder from '@cucumber/cucumber/lib/support_code_library_builder/index';\r\nimport tryRequire from '@cucumber/cucumber/lib/try_require';\r\nimport { ILogger } from '@cucumber/cucumber/lib/environment/index';\r\n\r\nexport async function getSupportCodeLibrary({\r\n\tlogger,\r\n\tcwd,\r\n\tnewId,\r\n\trequireModules,\r\n\trequirePaths,\r\n\timportPaths,\r\n\tloaders\r\n}: {\r\n\tlogger: ILogger;\r\n\tcwd: string;\r\n\tnewId: IdGenerator.NewId;\r\n\trequireModules: string[];\r\n\trequirePaths: string[];\r\n\timportPaths: string[];\r\n\tloaders: string[];\r\n}): Promise<SupportCodeLibrary> {\r\n\tsupportCodeLibraryBuilder.reset(cwd, newId, {\r\n\t\trequireModules,\r\n\t\trequirePaths,\r\n\t\timportPaths,\r\n\t\tloaders\r\n\t});\r\n\r\n\t// Define the boolean type before loading any support code\r\n\tsupportCodeLibraryBuilder.defineParameterType({\r\n\t\tname: 'boolean',\r\n\t\tregexp: /true|false/,\r\n\t\ttransformer: s => (s === 'true' ? true : false)\r\n\t});\r\n\r\n\trequireModules.map(path => {\r\n\t\tlogger.debug(`Attempting to require code from \"${path}\"`);\r\n\t\ttryRequire(path);\r\n\t});\r\n\trequirePaths.map(path => {\r\n\t\tlogger.debug(`Attempting to require code from \"${path}\"`);\r\n\t\ttryRequire(path);\r\n\t});\r\n\r\n\tfor (const specifier of loaders) {\r\n\t\tlogger.debug(`Attempting to register loader \"${specifier}\"`);\r\n\t\tregister(specifier, pathToFileURL('./'));\r\n\t}\r\n\r\n\tfor (const path of importPaths) {\r\n\t\tlogger.debug(`Attempting to import code from \"${path}\"`);\r\n\t\tawait import(pathToFileURL(path).toString());\r\n\t}\r\n\r\n\treturn supportCodeLibraryBuilder.finalize();\r\n}\r\n"]}
@@ -1,15 +1,10 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.binding = binding;
7
4
  const cucumber_1 = require("@cucumber/cucumber");
8
5
  const binding_context_1 = require("./binding-context");
9
6
  const binding_registry_1 = require("./binding-registry");
10
7
  const step_binding_1 = require("./step-binding");
11
- const index_1 = require("../index");
12
- const underscore_1 = __importDefault(require("underscore"));
13
8
  /**
14
9
  * A set of step patterns that have been registered with Cucumber.
15
10
  *
@@ -32,7 +27,6 @@ function binding(requiredContextTypes) {
32
27
  return (target) => {
33
28
  const bindingRegistry = binding_registry_1.BindingRegistry.instance;
34
29
  bindingRegistry.registerContextTypesForClass(target.prototype, requiredContextTypes);
35
- defineParameters();
36
30
  // the class decorator is called last when decorators on a type are initialized. All other decorators
37
31
  // are added to DecoratorContext.metadata before this is called.
38
32
  // This will get all those bindings and then clear metadata for the next type that's loaded.
@@ -55,7 +49,6 @@ function binding(requiredContextTypes) {
55
49
  return function classDecorator(target, context) {
56
50
  const bindingRegistry = binding_registry_1.BindingRegistry.instance;
57
51
  bindingRegistry.registerContextTypesForClass(target.prototype, requiredContextTypes);
58
- defineParameters();
59
52
  // the class decorator is called last when decorators on a type are initialized. All other decorators
60
53
  // are added to DecoratorContext.metadata before this is called.
61
54
  // This will get all those bindings and then clear metadata for the next type that's loaded.
@@ -83,19 +76,6 @@ function binding(requiredContextTypes) {
83
76
  };
84
77
  }
85
78
  }
86
- /**
87
- * Called only once to register new parameters. This has to be
88
- * executed here during binding initialization for cucumber to
89
- * to use it when matching expressions. Attempting to add it
90
- * before the test run doesn't work
91
- */
92
- const defineParameters = underscore_1.default.once(() => {
93
- (0, index_1.defineParameterType)({
94
- name: 'boolean',
95
- regexp: /true|false/,
96
- transformer: s => (s === 'true' ? true : false)
97
- });
98
- });
99
79
  /**
100
80
  * Common helper used to add StepBindings to the binding registry
101
81
  * @param stepBinding
@@ -1 +1 @@
1
- {"version":3,"file":"binding-decorator.js","sourceRoot":"","sources":["../../src/bindings/binding-decorator.ts"],"names":[],"mappings":";;;;;AAyCA,0BA8DC;AAvGD,iDAW4B;AAC5B,uDAA8F;AAC9F,yDAAkE;AAClE,iDAA+D;AAE/D,oCAA+C;AAC/C,4DAA2B;AAM3B;;;;;;;GAOG;AACH,MAAM,wBAAwB,GAAG,IAAI,GAAG,EAAiC,CAAC;AAE1E;;;;;;;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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,GAAG,EAAE,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC;YACnG,IAAA,qBAAU,EAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YAClC,MAAM;QACP,CAAC;QACD,KAAK,+BAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;YAChC,MAAM,OAAO,GAAG,EAAE,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC;YACvF,IAAA,mBAAQ,EAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;YACtC,MAAM;QACP,CAAC;QACD,KAAK,+BAAgB,CAAC,KAAK,CAAC,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\nimport _ from 'underscore';\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 * 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\t\t\tdefineParameters();\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\t\t\tdefineParameters();\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 * Called only once to register new parameters. This has to be\r\n * executed here during binding initialization for cucumber to\r\n * to use it when matching expressions. Attempting to add it\r\n * before the test run doesn't work\r\n */\r\nconst defineParameters = _.once(() => {\r\n\tdefineParameterType({\r\n\t\tname: 'boolean',\r\n\t\tregexp: /true|false/,\r\n\t\ttransformer: s => (s === 'true' ? true : false)\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\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":";;AAyCA,0BA4DC;AArGD,iDAW4B;AAC5B,uDAA8F;AAC9F,yDAAkE;AAClE,iDAA+D;AAS/D;;;;;;;GAOG;AACH,MAAM,wBAAwB,GAAG,IAAI,GAAG,EAAiC,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QACD,KAAK,+BAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;YAChC,MAAM,OAAO,GAAG,EAAE,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC;YACvF,IAAA,mBAAQ,EAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;YACtC,MAAM;QACP,CAAC;QACD,KAAK,+BAAgB,CAAC,KAAK,CAAC,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\nimport _ from 'underscore';\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 * 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\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"]}
@@ -60,6 +60,12 @@ class ChildProcessWorker {
60
60
  importPaths,
61
61
  loaders: supportCodeCoordinates.loaders
62
62
  });
63
+ // Define the boolean type before loading any support code
64
+ index_1.default.defineParameterType({
65
+ name: 'boolean',
66
+ regexp: /true|false/,
67
+ transformer: s => (s === 'true' ? true : false)
68
+ });
63
69
  // Load any require modules for CommonJS or loaders and imports for ESM
64
70
  supportCodeCoordinates.requireModules.map(module => (0, try_require_1.default)(module));
65
71
  requirePaths.map(module => (0, try_require_1.default)(module));
@@ -1 +1 @@
1
- {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/runtime/parallel/worker.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA2C;AAC3C,uCAAyC;AACzC,6CAAuC;AACvC,iDAA2D;AAC3D,sGAAkG;AAElG,qFAA4D;AAC5D,sCAAmC;AAEnC,gEAAwC;AACxC,8DAAkE;AAClE,sEAAkE;AAElE,6EAAoD;AAEpD,MAAM,EAAE,IAAI,EAAE,GAAG,sBAAW,CAAC;AAK7B;;GAEG;AACH,MAAa,kBAAkB;IACb,GAAG,CAAS;IACZ,IAAI,CAA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AC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACtC,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ;QACb,MAAM,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;QACrC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,cAAc,CAAC,OAAmC;QACvD,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;YACtB,KAAK,YAAY;gBAChB,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBAC/B,MAAM;YACP,KAAK,KAAK;gBACT,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;gBAChC,MAAM;YACP,KAAK,UAAU;gBACd,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACtB,MAAM;QACR,CAAC;IACF,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,WAAW,CAAC,OAAmB;QACpC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1F,IAAI,CAAC,WAAW,CAAC;YAChB,IAAI,EAAE,UAAU;YAChB,OAAO;SACP,CAAC,CAAC;IACJ,CAAC;CACD;AA5HD,gDA4HC","sourcesContent":["import { EventEmitter } from 'node:events';\r\nimport { pathToFileURL } from 'node:url';\r\nimport { register } from 'node:module';\r\nimport { Envelope, IdGenerator } from '@cucumber/messages';\r\nimport supportCodeLibraryBuilder from '@cucumber/cucumber/lib/support_code_library_builder/index';\r\nimport { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';\r\nimport tryRequire from '@cucumber/cucumber/lib/try_require';\r\nimport { Worker } from '../worker';\r\nimport { WorkerToCoordinatorEvent, RunCommand } from '@cucumber/cucumber/lib/runtime/parallel/types';\r\nimport logger from '../../utils/logger';\r\nimport { resolvePaths } from '@cucumber/cucumber/lib/paths/paths';\r\nimport { BindingRegistry } from '../../bindings/binding-registry';\r\nimport { InitializeTsflowCommand, CoordinatorToWorkerCommand, TsFlowRuntimeOptions } from '../types';\r\nimport MessageCollector from '../message-collector';\r\n\r\nconst { uuid } = IdGenerator;\r\n\r\ntype IExitFunction = (exitCode: number, error?: Error, message?: string) => void;\r\ntype IMessageSender = (command: WorkerToCoordinatorEvent) => void;\r\n\r\n/**\r\n * Represents a child process running in parallel executions\r\n */\r\nexport class ChildProcessWorker {\r\n\tprivate readonly cwd: string;\r\n\tprivate readonly exit: IExitFunction;\r\n\r\n\tprivate readonly id: string;\r\n\tprivate readonly eventBroadcaster: EventEmitter;\r\n\tprivate readonly newId: IdGenerator.NewId;\r\n\tprivate readonly sendMessage: IMessageSender;\r\n\tprivate options!: TsFlowRuntimeOptions;\r\n\tprivate supportCodeLibrary!: SupportCodeLibrary;\r\n\tprivate worker!: Worker;\r\n\r\n\tconstructor({\r\n\t\tcwd,\r\n\t\texit,\r\n\t\tid,\r\n\t\tsendMessage,\r\n\t\texperimentalDecorators\r\n\t}: {\r\n\t\tcwd: string;\r\n\t\texit: IExitFunction;\r\n\t\tid: string;\r\n\t\tsendMessage: IMessageSender;\r\n\t\texperimentalDecorators: boolean;\r\n\t}) {\r\n\t\tthis.id = id;\r\n\t\tthis.newId = uuid();\r\n\t\tthis.cwd = cwd;\r\n\t\tthis.exit = exit;\r\n\t\tthis.sendMessage = sendMessage;\r\n\t\tthis.eventBroadcaster = new EventEmitter();\r\n\r\n\t\t// initialize a message collector for this process to handle our\r\n\t\t// integration with event data\r\n\t\tglobal.messageCollector = new MessageCollector(this.eventBroadcaster);\r\n\r\n\t\t// initialize the global experimentalDecorators setting\r\n\t\tglobal.experimentalDecorators = experimentalDecorators;\r\n\r\n\t\t// pass any envelope messages up to the parent process to keep our main\r\n\t\t// message collector in sync with this one.\r\n\t\tthis.eventBroadcaster.on('envelope', (envelope: Envelope) => this.sendMessage({ type: 'ENVELOPE', envelope }));\r\n\t}\r\n\r\n\t/**\r\n\t * Initialize this child process worker\r\n\t */\r\n\tasync initialize({\r\n\t\tsupportCodeCoordinates,\r\n\t\tsupportCodeIds,\r\n\t\toptions,\r\n\t\tmessageData\r\n\t}: InitializeTsflowCommand): Promise<void> {\r\n\t\t// reset the message collector with message data passed in\r\n\t\tglobal.messageCollector.reset(messageData);\r\n\r\n\t\t// Get correct paths and reset the support code library\r\n\t\tconst resolvedPaths = await resolvePaths(logger, this.cwd, messageData.coordinates, supportCodeCoordinates);\r\n\t\tconst { requirePaths, importPaths } = resolvedPaths;\r\n\t\tsupportCodeLibraryBuilder.reset(this.cwd, this.newId, {\r\n\t\t\trequirePaths,\r\n\t\t\trequireModules: supportCodeCoordinates.requireModules,\r\n\t\t\timportPaths,\r\n\t\t\tloaders: supportCodeCoordinates.loaders\r\n\t\t});\r\n\t\t// Load any require modules for CommonJS or loaders and imports for ESM\r\n\t\tsupportCodeCoordinates.requireModules.map(module => tryRequire(module));\r\n\t\trequirePaths.map(module => tryRequire(module));\r\n\t\tfor (const specifier of supportCodeCoordinates.loaders) {\r\n\t\t\tregister(specifier, pathToFileURL('./'));\r\n\t\t}\r\n\t\tfor (const path of importPaths) {\r\n\t\t\tawait import(pathToFileURL(path).toString());\r\n\t\t}\r\n\t\t// Finalize the support code library with IDs passed in and\r\n\t\t// update entries in the library with info from our binding registry.\r\n\t\tthis.supportCodeLibrary = supportCodeLibraryBuilder.finalize(supportCodeIds);\r\n\t\tthis.supportCodeLibrary = BindingRegistry.instance.updateSupportCodeLibrary(this.supportCodeLibrary);\r\n\r\n\t\t// Initialize a worker and run BeforeAll hooks\r\n\t\tthis.options = options;\r\n\t\tthis.worker = new Worker(this.id, this.eventBroadcaster, this.newId, this.options, this.supportCodeLibrary);\r\n\t\tawait this.worker.runBeforeAllHooks();\r\n\t\tthis.sendMessage({ type: 'READY' });\r\n\t}\r\n\r\n\t/**\r\n\t * Finialize the worker, which runs AfterAll hooks\r\n\t */\r\n\tasync finalize(): Promise<void> {\r\n\t\tawait this.worker.runAfterAllHooks();\r\n\t\tthis.exit(0);\r\n\t}\r\n\r\n\t/**\r\n\t * Interaction with the main process and child workers is done through IPC communications\r\n\t * This receives commands from the parent process and calls appropriate child operations.\r\n\t * @param command commands sent to this worker\r\n\t */\r\n\tasync receiveMessage(command: CoordinatorToWorkerCommand): Promise<void> {\r\n\t\tswitch (command.type) {\r\n\t\t\tcase 'INITIALIZE':\r\n\t\t\t\tawait this.initialize(command);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'RUN':\r\n\t\t\t\tawait this.runTestCase(command);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'FINALIZE':\r\n\t\t\t\tawait this.finalize();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Run all test cases on the worker\r\n\t * @param command RunCommand\r\n\t */\r\n\tasync runTestCase(command: RunCommand): Promise<void> {\r\n\t\tconst success = await this.worker.runTestCase(command.assembledTestCase, command.failing);\r\n\t\tthis.sendMessage({\r\n\t\t\ttype: 'FINISHED',\r\n\t\t\tsuccess\r\n\t\t});\r\n\t}\r\n}\r\n"]}
1
+ {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/runtime/parallel/worker.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA2C;AAC3C,uCAAyC;AACzC,6CAAuC;AACvC,iDAA2D;AAC3D,sGAAkG;AAElG,qFAA4D;AAC5D,sCAAmC;AAEnC,gEAAwC;AACxC,8DAAkE;AAClE,sEAAkE;AAElE,6EAAoD;AAEpD,MAAM,EAAE,IAAI,EAAE,GAAG,sBAAW,CAAC;AAK7B;;GAEG;AACH,MAAa,kBAAkB;IACb,GAAG,CAAS;IACZ,IAAI,CAAgB;IAEpB,EAAE,CAAS;IACX,gBAAgB,CAAe;IAC/B,KAAK,CAAoB;IACzB,WA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I,eAAM,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC5G,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACtC,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ;QACb,MAAM,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;QACrC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,cAAc,CAAC,OAAmC;QACvD,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;YACtB,KAAK,YAAY;gBAChB,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBAC/B,MAAM;YACP,KAAK,KAAK;gBACT,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;gBAChC,MAAM;YACP,KAAK,UAAU;gBACd,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACtB,MAAM;QACR,CAAC;IACF,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,WAAW,CAAC,OAAmB;QACpC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1F,IAAI,CAAC,WAAW,CAAC;YAChB,IAAI,EAAE,UAAU;YAChB,OAAO;SACP,CAAC,CAAC;IACJ,CAAC;CACD;AApID,gDAoIC","sourcesContent":["import { EventEmitter } from 'node:events';\r\nimport { pathToFileURL } from 'node:url';\r\nimport { register } from 'node:module';\r\nimport { Envelope, IdGenerator } from '@cucumber/messages';\r\nimport supportCodeLibraryBuilder from '@cucumber/cucumber/lib/support_code_library_builder/index';\r\nimport { SupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';\r\nimport tryRequire from '@cucumber/cucumber/lib/try_require';\r\nimport { Worker } from '../worker';\r\nimport { WorkerToCoordinatorEvent, RunCommand } from '@cucumber/cucumber/lib/runtime/parallel/types';\r\nimport logger from '../../utils/logger';\r\nimport { resolvePaths } from '@cucumber/cucumber/lib/paths/paths';\r\nimport { BindingRegistry } from '../../bindings/binding-registry';\r\nimport { InitializeTsflowCommand, CoordinatorToWorkerCommand, TsFlowRuntimeOptions } from '../types';\r\nimport MessageCollector from '../message-collector';\r\n\r\nconst { uuid } = IdGenerator;\r\n\r\ntype IExitFunction = (exitCode: number, error?: Error, message?: string) => void;\r\ntype IMessageSender = (command: WorkerToCoordinatorEvent) => void;\r\n\r\n/**\r\n * Represents a child process running in parallel executions\r\n */\r\nexport class ChildProcessWorker {\r\n\tprivate readonly cwd: string;\r\n\tprivate readonly exit: IExitFunction;\r\n\r\n\tprivate readonly id: string;\r\n\tprivate readonly eventBroadcaster: EventEmitter;\r\n\tprivate readonly newId: IdGenerator.NewId;\r\n\tprivate readonly sendMessage: IMessageSender;\r\n\tprivate options!: TsFlowRuntimeOptions;\r\n\tprivate supportCodeLibrary!: SupportCodeLibrary;\r\n\tprivate worker!: Worker;\r\n\r\n\tconstructor({\r\n\t\tcwd,\r\n\t\texit,\r\n\t\tid,\r\n\t\tsendMessage,\r\n\t\texperimentalDecorators\r\n\t}: {\r\n\t\tcwd: string;\r\n\t\texit: IExitFunction;\r\n\t\tid: string;\r\n\t\tsendMessage: IMessageSender;\r\n\t\texperimentalDecorators: boolean;\r\n\t}) {\r\n\t\tthis.id = id;\r\n\t\tthis.newId = uuid();\r\n\t\tthis.cwd = cwd;\r\n\t\tthis.exit = exit;\r\n\t\tthis.sendMessage = sendMessage;\r\n\t\tthis.eventBroadcaster = new EventEmitter();\r\n\r\n\t\t// initialize a message collector for this process to handle our\r\n\t\t// integration with event data\r\n\t\tglobal.messageCollector = new MessageCollector(this.eventBroadcaster);\r\n\r\n\t\t// initialize the global experimentalDecorators setting\r\n\t\tglobal.experimentalDecorators = experimentalDecorators;\r\n\r\n\t\t// pass any envelope messages up to the parent process to keep our main\r\n\t\t// message collector in sync with this one.\r\n\t\tthis.eventBroadcaster.on('envelope', (envelope: Envelope) => this.sendMessage({ type: 'ENVELOPE', envelope }));\r\n\t}\r\n\r\n\t/**\r\n\t * Initialize this child process worker\r\n\t */\r\n\tasync initialize({\r\n\t\tsupportCodeCoordinates,\r\n\t\tsupportCodeIds,\r\n\t\toptions,\r\n\t\tmessageData\r\n\t}: InitializeTsflowCommand): Promise<void> {\r\n\t\t// reset the message collector with message data passed in\r\n\t\tglobal.messageCollector.reset(messageData);\r\n\r\n\t\t// Get correct paths and reset the support code library\r\n\t\tconst resolvedPaths = await resolvePaths(logger, this.cwd, messageData.coordinates, supportCodeCoordinates);\r\n\t\tconst { requirePaths, importPaths } = resolvedPaths;\r\n\t\tsupportCodeLibraryBuilder.reset(this.cwd, this.newId, {\r\n\t\t\trequirePaths,\r\n\t\t\trequireModules: supportCodeCoordinates.requireModules,\r\n\t\t\timportPaths,\r\n\t\t\tloaders: supportCodeCoordinates.loaders\r\n\t\t});\r\n\r\n\t\t// Define the boolean type before loading any support code\r\n\t\tsupportCodeLibraryBuilder.defineParameterType({\r\n\t\t\tname: 'boolean',\r\n\t\t\tregexp: /true|false/,\r\n\t\t\ttransformer: s => (s === 'true' ? true : false)\r\n\t\t});\r\n\r\n\t\t// Load any require modules for CommonJS or loaders and imports for ESM\r\n\t\tsupportCodeCoordinates.requireModules.map(module => tryRequire(module));\r\n\t\trequirePaths.map(module => tryRequire(module));\r\n\t\tfor (const specifier of supportCodeCoordinates.loaders) {\r\n\t\t\tregister(specifier, pathToFileURL('./'));\r\n\t\t}\r\n\t\tfor (const path of importPaths) {\r\n\t\t\tawait import(pathToFileURL(path).toString());\r\n\t\t}\r\n\t\t// Finalize the support code library with IDs passed in and\r\n\t\t// update entries in the library with info from our binding registry.\r\n\t\tthis.supportCodeLibrary = supportCodeLibraryBuilder.finalize(supportCodeIds);\r\n\t\tthis.supportCodeLibrary = BindingRegistry.instance.updateSupportCodeLibrary(this.supportCodeLibrary);\r\n\r\n\t\t// Initialize a worker and run BeforeAll hooks\r\n\t\tthis.options = options;\r\n\t\tthis.worker = new Worker(this.id, this.eventBroadcaster, this.newId, this.options, this.supportCodeLibrary);\r\n\t\tawait this.worker.runBeforeAllHooks();\r\n\t\tthis.sendMessage({ type: 'READY' });\r\n\t}\r\n\r\n\t/**\r\n\t * Finialize the worker, which runs AfterAll hooks\r\n\t */\r\n\tasync finalize(): Promise<void> {\r\n\t\tawait this.worker.runAfterAllHooks();\r\n\t\tthis.exit(0);\r\n\t}\r\n\r\n\t/**\r\n\t * Interaction with the main process and child workers is done through IPC communications\r\n\t * This receives commands from the parent process and calls appropriate child operations.\r\n\t * @param command commands sent to this worker\r\n\t */\r\n\tasync receiveMessage(command: CoordinatorToWorkerCommand): Promise<void> {\r\n\t\tswitch (command.type) {\r\n\t\t\tcase 'INITIALIZE':\r\n\t\t\t\tawait this.initialize(command);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'RUN':\r\n\t\t\t\tawait this.runTestCase(command);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'FINALIZE':\r\n\t\t\t\tawait this.finalize();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Run all test cases on the worker\r\n\t * @param command RunCommand\r\n\t */\r\n\tasync runTestCase(command: RunCommand): Promise<void> {\r\n\t\tconst success = await this.worker.runTestCase(command.assembledTestCase, command.failing);\r\n\t\tthis.sendMessage({\r\n\t\t\ttype: 'FINISHED',\r\n\t\t\tsuccess\r\n\t\t});\r\n\t}\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"root":["../src/behave.ts","../src/index.ts","../src/junitbamboo.ts","../src/snippet.ts","../src/version.ts","../src/api/convert-configuration.ts","../src/api/index.ts","../src/api/load-configuration.ts","../src/api/load-support.ts","../src/api/run-cucumber.ts","../src/bindings/binding-context.ts","../src/bindings/binding-decorator.ts","../src/bindings/binding-registry.ts","../src/bindings/hook-decorators.ts","../src/bindings/step-binding.ts","../src/bindings/step-decorators.ts","../src/bindings/types.ts","../src/cli/argv-parser.ts","../src/cli/index.ts","../src/cli/run.ts","../src/formatter/behave-json-formatter.ts","../src/formatter/junit-bamboo-formatter.ts","../src/formatter/step-definition-snippit-syntax/tsflow-snippet-syntax.ts","../src/gherkin/configuration.ts","../src/gherkin/gherkin-feature.ts","../src/gherkin/gherkin-manager.ts","../src/gherkin/models.ts","../src/runtime/coordinator.ts","../src/runtime/make-runtime.ts","../src/runtime/managed-scenario-context.ts","../src/runtime/message-collector.ts","../src/runtime/scenario-context.ts","../src/runtime/scenario-info.ts","../src/runtime/test-case-info.ts","../src/runtime/test-case-runner.ts","../src/runtime/types.ts","../src/runtime/utils.ts","../src/runtime/worker.ts","../src/runtime/parallel/adapter.ts","../src/runtime/parallel/run-worker.ts","../src/runtime/parallel/worker.ts","../src/runtime/serial/adapter.ts","../src/transpilers/esbuild-transpiler.ts","../src/transpilers/esbuild.ts","../src/transpilers/esnode.ts","../src/transpilers/esvue.ts","../src/transpilers/tsnode-exp.ts","../src/transpilers/tsnode.ts","../src/transpilers/tsvue-exp.ts","../src/transpilers/tsvue.ts","../src/transpilers/vue-sfc/compiler.ts","../src/transpilers/vue-sfc/index.ts","../src/transpilers/vue-sfc/main.ts","../src/transpilers/vue-sfc/script.ts","../src/transpilers/vue-sfc/template.ts","../src/transpilers/vue-sfc/types.ts","../src/transpilers/vue-sfc/utils/descriptorcache.ts","../src/transpilers/vue-sfc/utils/error.ts","../src/transpilers/vue-sfc/utils/query.ts","../src/types/durations.d.ts","../src/types/global.d.ts","../src/types/lep.d.ts","../src/types/vue-shim.d.ts","../src/utils/helpers.ts","../src/utils/logger.ts","../src/utils/our-callsite.ts"],"version":"5.9.2"}
1
+ {"root":["../src/behave.ts","../src/index.ts","../src/junitbamboo.ts","../src/snippet.ts","../src/version.ts","../src/api/convert-configuration.ts","../src/api/index.ts","../src/api/load-configuration.ts","../src/api/load-support.ts","../src/api/run-cucumber.ts","../src/api/support.ts","../src/bindings/binding-context.ts","../src/bindings/binding-decorator.ts","../src/bindings/binding-registry.ts","../src/bindings/hook-decorators.ts","../src/bindings/step-binding.ts","../src/bindings/step-decorators.ts","../src/bindings/types.ts","../src/cli/argv-parser.ts","../src/cli/index.ts","../src/cli/run.ts","../src/formatter/behave-json-formatter.ts","../src/formatter/junit-bamboo-formatter.ts","../src/formatter/step-definition-snippit-syntax/tsflow-snippet-syntax.ts","../src/gherkin/configuration.ts","../src/gherkin/gherkin-feature.ts","../src/gherkin/gherkin-manager.ts","../src/gherkin/models.ts","../src/runtime/coordinator.ts","../src/runtime/make-runtime.ts","../src/runtime/managed-scenario-context.ts","../src/runtime/message-collector.ts","../src/runtime/scenario-context.ts","../src/runtime/scenario-info.ts","../src/runtime/test-case-info.ts","../src/runtime/test-case-runner.ts","../src/runtime/types.ts","../src/runtime/utils.ts","../src/runtime/worker.ts","../src/runtime/parallel/adapter.ts","../src/runtime/parallel/run-worker.ts","../src/runtime/parallel/worker.ts","../src/runtime/serial/adapter.ts","../src/transpilers/esbuild-transpiler.ts","../src/transpilers/esbuild.ts","../src/transpilers/esnode.ts","../src/transpilers/esvue.ts","../src/transpilers/tsnode-exp.ts","../src/transpilers/tsnode.ts","../src/transpilers/tsvue-exp.ts","../src/transpilers/tsvue.ts","../src/transpilers/vue-sfc/compiler.ts","../src/transpilers/vue-sfc/index.ts","../src/transpilers/vue-sfc/main.ts","../src/transpilers/vue-sfc/script.ts","../src/transpilers/vue-sfc/template.ts","../src/transpilers/vue-sfc/types.ts","../src/transpilers/vue-sfc/utils/descriptorcache.ts","../src/transpilers/vue-sfc/utils/error.ts","../src/transpilers/vue-sfc/utils/query.ts","../src/types/durations.d.ts","../src/types/global.d.ts","../src/types/lep.d.ts","../src/types/vue-shim.d.ts","../src/utils/helpers.ts","../src/utils/logger.ts","../src/utils/our-callsite.ts"],"version":"5.9.2"}
package/lib/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "7.4.0";
1
+ export declare const version = "7.4.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.4.0';
5
+ exports.version = '7.4.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.4.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.4.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 11.2.0 in TypeScript 5.8+.",
4
- "version": "7.4.0",
4
+ "version": "7.4.1",
5
5
  "author": "Lonnie Wall <lynxdev@lynxwall.com>",
6
6
  "license": "MIT",
7
7
  "keywords": [