@lynxwall/cucumber-tsflow 7.5.0 → 7.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -5
- package/bin/cucumber-tsflow +3 -3
- package/bin/cucumber-tsflow.js +0 -0
- package/lib/api/convert-configuration.d.ts +1 -1
- package/lib/api/convert-configuration.js +62 -19
- package/lib/api/convert-configuration.js.map +1 -1
- package/lib/api/load-configuration.js +223 -101
- package/lib/api/load-configuration.js.map +1 -1
- package/lib/api/load-support.d.ts +14 -0
- package/lib/api/load-support.js +112 -0
- package/lib/api/load-support.js.map +1 -1
- package/lib/cli/index.js +61 -13
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/run.js +29 -15
- package/lib/cli/run.js.map +1 -1
- package/lib/transpilers/esm/esbuild-transpiler-cjs.js +118 -15
- package/lib/transpilers/esm/esbuild-transpiler.mjs +27 -6
- package/lib/transpilers/esm/esbuild.mjs +70 -26
- package/lib/transpilers/esm/esnode-loader.mjs +7 -0
- package/lib/transpilers/esm/esvue-loader.mjs +7 -0
- package/lib/transpilers/esm/loader-utils.mjs +283 -157
- package/lib/transpilers/esm/tsnode-loader.mjs +84 -38
- package/lib/transpilers/esm/tsnode-service.mjs +50 -6
- package/lib/transpilers/esm/vue-jsdom-setup.mjs +36 -7
- package/lib/transpilers/esm/vue-loader.mjs +48 -62
- package/lib/transpilers/esm/vue-sfc-compiler.mjs +17 -207
- package/lib/transpilers/esvue.js +6 -9
- package/lib/transpilers/esvue.js.map +1 -1
- package/lib/transpilers/tsvue-exp.js +6 -9
- package/lib/transpilers/tsvue-exp.js.map +1 -1
- package/lib/transpilers/tsvue.js +5 -8
- package/lib/transpilers/tsvue.js.map +1 -1
- package/lib/transpilers/vue-sfc-compiler.d.ts +23 -0
- package/lib/transpilers/vue-sfc-compiler.js +242 -0
- package/lib/transpilers/vue-sfc-compiler.js.map +1 -0
- package/lib/tsconfig.node.tsbuildinfo +1 -1
- package/lib/utils/tsflow-logger.d.ts +29 -0
- package/lib/utils/tsflow-logger.js +79 -0
- package/lib/utils/tsflow-logger.js.map +1 -0
- package/lib/utils/tsflow-logger.mjs +78 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +4 -5
- package/lib/support_code_library_builder/index.d.ts +0 -80
- package/lib/support_code_library_builder/index.js +0 -337
- package/lib/support_code_library_builder/index.js.map +0 -1
- package/lib/transpilers/esm/esmbuild-transpiler.d.ts +0 -4
- package/lib/transpilers/esm/esmbuild-transpiler.js +0 -19
- package/lib/transpilers/esm/esmbuild-transpiler.js.map +0 -1
- package/lib/transpilers/esm/esmbuild.d.ts +0 -12
- package/lib/transpilers/esm/esmbuild.js +0 -72
- package/lib/transpilers/esm/esmbuild.js.map +0 -1
- package/lib/transpilers/esm/esmnode.d.ts +0 -1
- package/lib/transpilers/esm/esmnode.js +0 -8
- package/lib/transpilers/esm/esmnode.js.map +0 -1
- package/lib/transpilers/esm/esmvue.d.ts +0 -1
- package/lib/transpilers/esm/esmvue.js +0 -29
- package/lib/transpilers/esm/esmvue.js.map +0 -1
- package/lib/transpilers/esm/tsnode-esm.d.ts +0 -1
- package/lib/transpilers/esm/tsnode-esm.js +0 -25
- package/lib/transpilers/esm/tsnode-esm.js.map +0 -1
- package/lib/transpilers/esm/tsnode-exp-esm.d.ts +0 -1
- package/lib/transpilers/esm/tsnode-exp-esm.js +0 -19
- package/lib/transpilers/esm/tsnode-exp-esm.js.map +0 -1
- package/lib/transpilers/esm/tsvue-esm.d.ts +0 -1
- package/lib/transpilers/esm/tsvue-esm.js +0 -40
- package/lib/transpilers/esm/tsvue-esm.js.map +0 -1
- package/lib/transpilers/esm/tsvue-exp-esm.d.ts +0 -1
- package/lib/transpilers/esm/tsvue-exp-esm.js +0 -40
- package/lib/transpilers/esm/tsvue-exp-esm.js.map +0 -1
- package/lib/transpilers/vue-sfc/compiler.d.ts +0 -7
- package/lib/transpilers/vue-sfc/compiler.js +0 -22
- package/lib/transpilers/vue-sfc/compiler.js.map +0 -1
- package/lib/transpilers/vue-sfc/index.d.ts +0 -23
- package/lib/transpilers/vue-sfc/index.js +0 -46
- package/lib/transpilers/vue-sfc/index.js.map +0 -1
- package/lib/transpilers/vue-sfc/main.d.ts +0 -8
- package/lib/transpilers/vue-sfc/main.js +0 -258
- package/lib/transpilers/vue-sfc/main.js.map +0 -1
- package/lib/transpilers/vue-sfc/script.d.ts +0 -5
- package/lib/transpilers/vue-sfc/script.js +0 -41
- package/lib/transpilers/vue-sfc/script.js.map +0 -1
- package/lib/transpilers/vue-sfc/template.d.ts +0 -8
- package/lib/transpilers/vue-sfc/template.js +0 -101
- package/lib/transpilers/vue-sfc/template.js.map +0 -1
- package/lib/transpilers/vue-sfc/types.d.ts +0 -55
- package/lib/transpilers/vue-sfc/types.js +0 -3
- package/lib/transpilers/vue-sfc/types.js.map +0 -1
- package/lib/transpilers/vue-sfc/utils/descriptorCache.d.ts +0 -13
- package/lib/transpilers/vue-sfc/utils/descriptorCache.js +0 -68
- package/lib/transpilers/vue-sfc/utils/descriptorCache.js.map +0 -1
- package/lib/transpilers/vue-sfc/utils/error.d.ts +0 -3
- package/lib/transpilers/vue-sfc/utils/error.js +0 -23
- package/lib/transpilers/vue-sfc/utils/error.js.map +0 -1
- package/lib/transpilers/vue-sfc/utils/query.d.ts +0 -13
- package/lib/transpilers/vue-sfc/utils/query.js +0 -36
- package/lib/transpilers/vue-sfc/utils/query.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-configuration.js","sourceRoot":"","sources":["../../src/api/load-configuration.ts"],"names":[],"mappings":";;;;;;AACA,kFAA8E;AAC9E,sEAMoD;AACpD,wGAAoG;AACpG,mEAA+D;AAC/D,oEAA4F;AAE5F,8CAAkD;AAClD,iFAAwD;AACxD,kDAA0B;AAE1B,qCAAkC;AAClC,+BAA4B;AAa5B;;;;;;GAMG;AACI,MAAM,iBAAiB,GAAG,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AAC,KAAK,GAAG,EAAE,CAAC;YACpB,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;QAC3D,CAAC;aAAM,CAAC;YACP,iDAAiD;YACjD,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC,MAAM,CAAC,2CAA2C,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;YAC3F,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC,MAAM,CAAC,8BAA8B,CAAC,CAAC,CAAC;QAC3D,CAAC;IACF,CAAC;IAED,2CAA2C;IAC3C,8BAA8B;IAC9B,IAAI,QAAQ,CAAC,cAAc,KAAK,IAAI,IAAI,QAAQ,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;QAC/E,QAAQ,CAAC,cAAc,GAAG,KAAK,CAAC;IACjC,CAAC;IACD,sDAAsD;IACtD,qDAAqD;IACrD,MAAM,CAAC,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAC;IAEhD,IAAA,8CAAqB,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,MAAM,IAAA,4CAAoB,EAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;IAEnE,OAAO;QACN,gBAAgB,EAAE,QAAQ;QAC1B,gBAAgB,EAAE,QAAQ;KAC1B,CAAC;AACH,CAAC,CAAC;AA9KW,QAAA,iBAAiB,qBA8K5B","sourcesContent":["import { ILoadConfigurationOptions } from '@cucumber/cucumber/lib/api/types';\r\nimport { locateFile } from '@cucumber/cucumber/lib/configuration/locate_file';\r\nimport {\r\n\tDEFAULT_CONFIGURATION,\r\n\tfromFile,\r\n\tIConfiguration,\r\n\tparseConfiguration,\r\n\tmergeConfigurations\r\n} from '@cucumber/cucumber/lib/configuration/index';\r\nimport { validateConfiguration } from '@cucumber/cucumber/lib/configuration/validate_configuration';\r\nimport { convertConfiguration } from './convert-configuration';\r\nimport { IRunEnvironment, makeEnvironment } from '@cucumber/cucumber/lib/environment/index';\r\nimport { ITsflowConfiguration } from '../cli/argv-parser';\r\nimport { hasStringValue } from '../utils/helpers';\r\nimport GherkinManager from '../gherkin/gherkin-manager';\r\nimport ansis from 'ansis';\r\nimport { ITsFlowRunConfiguration } from '../runtime/types';\r\nimport { Console } from 'console';\r\nimport { join } from 'path';\r\n\r\nexport interface ITsflowResolvedConfiguration {\r\n\t/**\r\n\t * The final flat configuration object resolved from the configuration file/profiles plus any extra provided.\r\n\t */\r\n\tuseConfiguration: ITsflowConfiguration;\r\n\t/**\r\n\t * The format that can be passed into `runCucumber`.\r\n\t */\r\n\trunConfiguration: ITsFlowRunConfiguration;\r\n}\r\n\r\n/**\r\n * Load user-authored configuration to be used in a test run.\r\n *\r\n * @public\r\n * @param options - Coordinates required to find configuration.\r\n * @param environment - Project environment.\r\n */\r\nexport const loadConfiguration = async (\r\n\toptions: ILoadConfigurationOptions = {},\r\n\tenvironment: IRunEnvironment = {}\r\n): Promise<ITsflowResolvedConfiguration> => {\r\n\tconst { cwd, env, logger } = makeEnvironment(environment);\r\n\tconst configFile = options.file ?? locateFile(cwd);\r\n\tlet msg = '';\r\n\tif (configFile) {\r\n\t\tmsg = `Loading configuration from \"${configFile}\".`;\r\n\t} else if (configFile === false) {\r\n\t\tmsg = 'Skipping configuration file resolution';\r\n\t} else {\r\n\t\tmsg = 'No configuration file found';\r\n\t}\r\n\t// log this to debug and console\r\n\tconst consoleLogger = new Console(environment.stdout as any, environment.stderr);\r\n\tlogger.debug(msg);\r\n\tconsoleLogger.log(ansis.cyanBright(msg));\r\n\r\n\tconst profileConfiguration = configFile ? await fromFile(logger, cwd, configFile, options.profiles) : {};\r\n\r\n\t// if a feature was passed in on command line it's added\r\n\t// to the provided configuration as paths. We need to clear\r\n\t// any paths from configuration so that only the feature passed\r\n\t// in is executed.\r\n\tconst paths = (options.provided as Partial<IConfiguration>).paths;\r\n\tif (paths && paths?.length > 0) {\r\n\t\tprofileConfiguration.paths = [];\r\n\t}\r\n\r\n\tconst original = mergeConfigurations(\r\n\t\tDEFAULT_CONFIGURATION,\r\n\t\tprofileConfiguration,\r\n\t\tparseConfiguration(logger, 'Provided', options.provided)\r\n\t) as ITsflowConfiguration;\r\n\r\n\t// Get the experimental decorators setting\r\n\tif (original.experimentalDecorators === undefined) {\r\n\t\toriginal.experimentalDecorators = false;\r\n\t}\r\n\r\n\tconst experimentalDecorators = original.experimentalDecorators;\r\n\tglobal.experimentalDecorators = experimentalDecorators;\r\n\tprocess.env.CUCUMBER_EXPERIMENTAL_DECORATORS = String(experimentalDecorators); // need to set here so can be accessed in mjs files\r\n\r\n\t/**\r\n\t * Ensures JSDOM environment is initialized before any test files are loaded.\r\n\t * This adds the Vue-specific JSDOM setup to the beginning of Cucumber's require array,\r\n\t * establishing the DOM environment needed for Vue component testing.\r\n\t *\r\n\t * Must run before test execution begins (mise en place for Vue testing).\r\n\t */\r\n\tconst initJsDom = () => {\r\n\t\t// Use require.resolve to get the absolute path\r\n\t\ttry {\r\n\t\t\tconst setupPath = require.resolve('@lynxwall/cucumber-tsflow/lib/transpilers/esm/vue-jsdom-setup');\r\n\t\t\toriginal.require.unshift(setupPath);\r\n\t\t} catch (e) {\r\n\t\t\t// Fallback to relative path from lib directory\r\n\t\t\tconst setupPath = join(__dirname, '../../transpilers/esm/vue-jsdom-setup.mjs');\r\n\t\t\toriginal.require.unshift(setupPath);\r\n\t\t}\r\n\t};\r\n\r\n\tif (original.transpiler) {\r\n\t\tswitch (original.transpiler) {\r\n\t\t\tcase 'es-vue':\r\n\t\t\t\toriginal.requireModule.push('@lynxwall/cucumber-tsflow/lib/transpilers/esvue');\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'ts-vue': {\r\n\t\t\t\tconst module = experimentalDecorators ? 'tsvue-exp' : 'tsvue';\r\n\t\t\t\toriginal.requireModule.push(`@lynxwall/cucumber-tsflow/lib/transpilers/${module}`);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tcase 'es-node': {\r\n\t\t\t\toriginal.requireModule.push('@lynxwall/cucumber-tsflow/lib/transpilers/esnode');\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tcase 'ts-node': {\r\n\t\t\t\tconst module = experimentalDecorators ? 'tsnode-exp' : 'tsnode';\r\n\t\t\t\toriginal.requireModule.push(`@lynxwall/cucumber-tsflow/lib/transpilers/${module}`);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tcase 'ts-node-esm': {\r\n\t\t\t\toriginal.loader.push(`@lynxwall/cucumber-tsflow/lib/transpilers/esm/tsnode-loader`); // per cucumber docs, we want to add this to the loader for esm\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tcase 'es-node-esm': {\r\n\t\t\t\toriginal.loader.push(`@lynxwall/cucumber-tsflow/lib/transpilers/esm/esnode-loader`); // per cucumber docs, we want to add this to the loader for esm\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tcase 'ts-vue-esm': {\r\n\t\t\t\toriginal.loader.push(`@lynxwall/cucumber-tsflow/lib/transpilers/esm/vue-loader`); // per cucumber docs, we want to add this to the loader for esm\r\n\t\t\t\tinitJsDom();\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tcase 'es-vue-esm': {\r\n\t\t\t\toriginal.loader.push(`@lynxwall/cucumber-tsflow/lib/transpilers/esm/esvue-loader`); // per cucumber docs, we want to add this to the loader for esm\r\n\t\t\t\tinitJsDom();\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tdefault:\r\n\t\t\t\t// default sets nothing -- this allows users to not set the transpiler & use their own loaders/transpilers\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t// set the snippet syntax\r\n\tif (!original.formatOptions.snippetSyntax) {\r\n\t\toriginal.formatOptions.snippetSyntax = '@lynxwall/cucumber-tsflow/snippet';\r\n\t}\r\n\t// look for behave format\r\n\tfor (let idx = 0; idx < original.format.length; idx++) {\r\n\t\tif (typeof original.format[idx] === 'string') {\r\n\t\t\tconst formatItem = original.format[idx] as string;\r\n\t\t\tif (formatItem.startsWith('behave:')) {\r\n\t\t\t\toriginal.format[idx] = formatItem.replace('behave', '@lynxwall/cucumber-tsflow/behave');\r\n\t\t\t}\r\n\t\t} else if (original.format[idx].length > 0) {\r\n\t\t\tconst formatItem = original.format[idx][0] as string;\r\n\t\t\tif (formatItem.startsWith('behave')) {\r\n\t\t\t\tconst newVal = formatItem.replace('behave', '@lynxwall/cucumber-tsflow/behave');\r\n\t\t\t\toriginal.format[idx] = original.format[idx].length > 1 ? [newVal, original.format[idx][1]] : [newVal];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// look for junitbamboo format\r\n\tfor (let idx = 0; idx < original.format.length; idx++) {\r\n\t\tif (typeof original.format[idx] === 'string') {\r\n\t\t\tconst formatItem = original.format[idx] as string;\r\n\t\t\tif (formatItem.startsWith('junitbamboo:')) {\r\n\t\t\t\toriginal.format[idx] = formatItem.replace('junitbamboo', '@lynxwall/cucumber-tsflow/junitbamboo');\r\n\t\t\t}\r\n\t\t} else if (original.format[idx].length > 0) {\r\n\t\t\tconst formatItem = original.format[idx][0] as string;\r\n\t\t\tif (formatItem.startsWith('junitbamboo')) {\r\n\t\t\t\tconst newVal = formatItem.replace('junitbamboo', '@lynxwall/cucumber-tsflow/junitbamboo');\r\n\t\t\t\toriginal.format[idx] = original.format[idx].length > 1 ? [newVal, original.format[idx][1]] : [newVal];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// check to see if a debugFile was passed in\r\n\tif (hasStringValue(original.debugFile)) {\r\n\t\t// Initialize gherkin manager with path to feature files\r\n\t\tconst gherkin = new GherkinManager();\r\n\t\tawait gherkin.loadFeatures(original.paths);\r\n\t\tconst features = gherkin.findFeaturesByStepFile(original.debugFile);\r\n\t\tif (features.length > 0) {\r\n\t\t\toriginal.paths = [];\r\n\t\t\tfeatures.forEach(x => original.paths.push(x.featureFile));\r\n\t\t} else {\r\n\t\t\t// log a message if the feature path is not found\r\n\t\t\tlogger.warn(ansis.yellow(`\\nUnable to find feature for debugFile: ${original.debugFile}`));\r\n\t\t\tlogger.warn(ansis.yellow('All tests will be executed\\n'));\r\n\t\t}\r\n\t}\r\n\r\n\t// check to see if enable-vue-style was set\r\n\t// if not, default it to false\r\n\tif (original.enableVueStyle === null || original.enableVueStyle === undefined) {\r\n\t\toriginal.enableVueStyle = false;\r\n\t}\r\n\t// set our global parameter used by the Vue transpiler\r\n\t// to determine if Vue Style Blocks should be enabled\r\n\tglobal.enableVueStyle = original.enableVueStyle;\r\n\r\n\tvalidateConfiguration(original, logger);\r\n\tconst runnable = await convertConfiguration(logger, original, env);\r\n\r\n\treturn {\r\n\t\tuseConfiguration: original,\r\n\t\trunConfiguration: runnable\r\n\t};\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"load-configuration.js","sourceRoot":"","sources":["../../src/api/load-configuration.ts"],"names":[],"mappings":";;;;;;AACA,kFAA8E;AAC9E,sEAMoD;AACpD,wGAAoG;AACpG,mEAA+D;AAC/D,oEAA4F;AAE5F,8CAAkD;AAClD,iFAAwD;AACxD,kDAA0B;AAE1B,qCAAkC;AAClC,+BAA4B;AAC5B,0DAAsD;AAEtD,MAAM,MAAM,GAAG,IAAA,4BAAY,EAAC,QAAQ,CAAC,CAAC;AAatC;;;;;;GAMG;AACI,MAAM,iBAAiB,GAAG,KAAK,EACrC,UAAqC,EAAE,EACvC,cAA+B,EAAE,EACO,EAAE;IAC1C,MAAM,CAAC,UAAU,CAAC,6BAA6B,EAAE;QAChD,WAAW,EAAE,OAAO,CAAC,IAAI;QACzB,eAAe,EAAE,OAAO,CAAC,QAAQ;KACjC,CAAC,CAAC;IAEH,IAAI,GAAW,CAAC;IAChB,IAAI,GAAuB,CAAC;IAC5B,IAAI,cAAmB,CAAC;IAExB,IAAI,CAAC;QACJ,MAAM,CA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IACtC,IAAI,CAAC;QACJ,MAAM,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC;QAC9C,QAAQ,GAAG,MAAM,IAAA,4CAAoB,EAAC,cAAc,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;QACrE,MAAM,CAAC,UAAU,CAAC,yBAAyB,EAAE;YAC5C,WAAW,EAAE,QAAQ,CAAC,OAAO,EAAE,WAAW;YAC1C,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,OAAO;SAClC,CAAC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACrB,MAAM,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;QACvD,MAAM,IAAI,KAAK,CAAC,oCAAoC,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACxF,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,+BAA+B,CAAC,CAAC;IAEnD,OAAO;QACN,gBAAgB,EAAE,QAAQ;QAC1B,gBAAgB,EAAE,QAAQ;KAC1B,CAAC;AACH,CAAC,CAAC;AAnSW,QAAA,iBAAiB,qBAmS5B","sourcesContent":["import { ILoadConfigurationOptions } from '@cucumber/cucumber/lib/api/types';\r\nimport { locateFile } from '@cucumber/cucumber/lib/configuration/locate_file';\r\nimport {\r\n\tDEFAULT_CONFIGURATION,\r\n\tfromFile,\r\n\tIConfiguration,\r\n\tparseConfiguration,\r\n\tmergeConfigurations\r\n} from '@cucumber/cucumber/lib/configuration/index';\r\nimport { validateConfiguration } from '@cucumber/cucumber/lib/configuration/validate_configuration';\r\nimport { convertConfiguration } from './convert-configuration';\r\nimport { IRunEnvironment, makeEnvironment } from '@cucumber/cucumber/lib/environment/index';\r\nimport { ITsflowConfiguration } from '../cli/argv-parser';\r\nimport { hasStringValue } from '../utils/helpers';\r\nimport GherkinManager from '../gherkin/gherkin-manager';\r\nimport ansis from 'ansis';\r\nimport { ITsFlowRunConfiguration } from '../runtime/types';\r\nimport { Console } from 'console';\r\nimport { join } from 'path';\r\nimport { createLogger } from '../utils/tsflow-logger';\r\n\r\nconst logger = createLogger('config');\r\n\r\nexport interface ITsflowResolvedConfiguration {\r\n\t/**\r\n\t * The final flat configuration object resolved from the configuration file/profiles plus any extra provided.\r\n\t */\r\n\tuseConfiguration: ITsflowConfiguration;\r\n\t/**\r\n\t * The format that can be passed into `runCucumber`.\r\n\t */\r\n\trunConfiguration: ITsFlowRunConfiguration;\r\n}\r\n\r\n/**\r\n * Load user-authored configuration to be used in a test run.\r\n *\r\n * @public\r\n * @param options - Coordinates required to find configuration.\r\n * @param environment - Project environment.\r\n */\r\nexport const loadConfiguration = async (\r\n\toptions: ILoadConfigurationOptions = {},\r\n\tenvironment: IRunEnvironment = {}\r\n): Promise<ITsflowResolvedConfiguration> => {\r\n\tlogger.checkpoint('loadConfiguration() started', {\r\n\t\toptionsFile: options.file,\r\n\t\toptionsProfiles: options.profiles\r\n\t});\r\n\r\n\tlet cwd: string;\r\n\tlet env: typeof process.env;\r\n\tlet cucumberLogger: any;\r\n\r\n\ttry {\r\n\t\tlogger.checkpoint('Creating environment');\r\n\t\tconst made = makeEnvironment(environment);\r\n\t\tcwd = made.cwd;\r\n\t\tenv = made.env;\r\n\t\tcucumberLogger = made.logger;\r\n\t\tlogger.checkpoint('Environment created', { cwd });\r\n\t} catch (error: any) {\r\n\t\tlogger.error('Failed to create environment', error);\r\n\t\tthrow new Error(`Failed to create environment: ${error.message}`, { cause: error });\r\n\t}\r\n\r\n\t// Locate config file\r\n\tlet configFile: string | false | undefined;\r\n\ttry {\r\n\t\tlogger.checkpoint('Locating config file', { providedFile: options.file });\r\n\t\tconfigFile = options.file ?? locateFile(cwd);\r\n\t\tlogger.checkpoint('Config file resolved', { configFile });\r\n\t} catch (error: any) {\r\n\t\tlogger.error('Failed to locate config file', error);\r\n\t\tthrow new Error(`Failed to locate configuration file: ${error.message}`, { cause: error });\r\n\t}\r\n\r\n\tlet msg = '';\r\n\tif (configFile) {\r\n\t\tmsg = `Loading configuration from \"${configFile}\".`;\r\n\t} else if (configFile === false) {\r\n\t\tmsg = 'Skipping configuration file resolution';\r\n\t} else {\r\n\t\tmsg = 'No configuration file found';\r\n\t}\r\n\r\n\tconst consoleLogger = new Console(environment.stdout as any, environment.stderr);\r\n\tcucumberLogger.debug(msg);\r\n\tconsoleLogger.log(ansis.cyanBright(msg));\r\n\r\n\t// Load profile configuration from file\r\n\tlet profileConfiguration: Partial<IConfiguration> = {};\r\n\tif (configFile) {\r\n\t\ttry {\r\n\t\t\tlogger.checkpoint('Loading configuration from file', {\r\n\t\t\t\tconfigFile,\r\n\t\t\t\tprofiles: options.profiles\r\n\t\t\t});\r\n\t\t\tprofileConfiguration = await fromFile(cucumberLogger, cwd, configFile, options.profiles);\r\n\t\t\tlogger.checkpoint('Profile configuration loaded', {\r\n\t\t\t\tkeys: Object.keys(profileConfiguration),\r\n\t\t\t\ttranspiler: (profileConfiguration as any).transpiler,\r\n\t\t\t\tpaths: (profileConfiguration as any).paths\r\n\t\t\t});\r\n\t\t} catch (error: any) {\r\n\t\t\tlogger.error('Failed to load configuration from file', error, { configFile });\r\n\t\t\tthrow new Error(`Failed to load configuration from \"${configFile}\": ${error.message}`, { cause: error });\r\n\t\t}\r\n\t}\r\n\r\n\t// If a feature was passed in on command line, clear profile paths\r\n\tconst paths = (options.provided as Partial<IConfiguration>)?.paths;\r\n\tif (paths && paths?.length > 0) {\r\n\t\tlogger.checkpoint('Clearing profile paths (feature passed via CLI)', { providedPaths: paths });\r\n\t\tprofileConfiguration.paths = [];\r\n\t}\r\n\r\n\t// Merge configurations\r\n\tlet original: ITsflowConfiguration;\r\n\ttry {\r\n\t\tlogger.checkpoint('Merging configurations');\r\n\t\tconst parsedProvided = parseConfiguration(cucumberLogger, 'Provided', options.provided);\r\n\t\tlogger.checkpoint('Provided configuration parsed', { parsedKeys: Object.keys(parsedProvided) });\r\n\r\n\t\toriginal = mergeConfigurations(DEFAULT_CONFIGURATION, profileConfiguration, parsedProvided) as ITsflowConfiguration;\r\n\r\n\t\tlogger.checkpoint('Configurations merged', {\r\n\t\t\ttranspiler: original.transpiler,\r\n\t\t\texperimentalDecorators: original.experimentalDecorators,\r\n\t\t\tpathCount: original.paths?.length\r\n\t\t});\r\n\t} catch (error: any) {\r\n\t\tlogger.error('Failed to merge configurations', error);\r\n\t\tthrow new Error(`Failed to merge configurations: ${error.message}`, { cause: error });\r\n\t}\r\n\r\n\t// Configure experimental decorators\r\n\tif (original.experimentalDecorators === undefined) {\r\n\t\toriginal.experimentalDecorators = false;\r\n\t}\r\n\tconst experimentalDecorators = original.experimentalDecorators;\r\n\tglobal.experimentalDecorators = experimentalDecorators;\r\n\tprocess.env.CUCUMBER_EXPERIMENTAL_DECORATORS = String(experimentalDecorators);\r\n\r\n\tlogger.checkpoint('Experimental decorators configured', { experimentalDecorators });\r\n\r\n\t/**\r\n\t * Ensures JSDOM environment is initialized before any test files are loaded.\r\n\t */\r\n\tconst initJsDom = () => {\r\n\t\tlogger.checkpoint('Initializing JSDOM setup');\r\n\t\ttry {\r\n\t\t\tconst setupPath = require.resolve('@lynxwall/cucumber-tsflow/lib/transpilers/esm/vue-jsdom-setup');\r\n\t\t\tlogger.checkpoint('JSDOM setup path resolved', { setupPath });\r\n\t\t\toriginal.require.unshift(setupPath);\r\n\t\t} catch (e: any) {\r\n\t\t\tlogger.checkpoint('require.resolve failed, using fallback', { error: e.message });\r\n\t\t\tconst setupPath = join(__dirname, '../../transpilers/esm/vue-jsdom-setup.mjs');\r\n\t\t\tlogger.checkpoint('JSDOM setup fallback path', { setupPath });\r\n\t\t\toriginal.require.unshift(setupPath);\r\n\t\t}\r\n\t};\r\n\r\n\t// Configure transpiler\r\n\tif (original.transpiler) {\r\n\t\tlogger.checkpoint('Configuring transpiler', { transpiler: original.transpiler });\r\n\t\ttry {\r\n\t\t\tswitch (original.transpiler) {\r\n\t\t\t\tcase 'es-vue':\r\n\t\t\t\t\tlogger.checkpoint('Adding es-vue requireModule');\r\n\t\t\t\t\toriginal.requireModule.push('@lynxwall/cucumber-tsflow/lib/transpilers/esvue');\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'ts-vue': {\r\n\t\t\t\t\tconst module = experimentalDecorators ? 'tsvue-exp' : 'tsvue';\r\n\t\t\t\t\tlogger.checkpoint('Adding ts-vue requireModule', { module });\r\n\t\t\t\t\toriginal.requireModule.push(`@lynxwall/cucumber-tsflow/lib/transpilers/${module}`);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tcase 'es-node':\r\n\t\t\t\t\tlogger.checkpoint('Adding es-node requireModule');\r\n\t\t\t\t\toriginal.requireModule.push('@lynxwall/cucumber-tsflow/lib/transpilers/esnode');\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'ts-node': {\r\n\t\t\t\t\tconst module = experimentalDecorators ? 'tsnode-exp' : 'tsnode';\r\n\t\t\t\t\tlogger.checkpoint('Adding ts-node requireModule', { module });\r\n\t\t\t\t\toriginal.requireModule.push(`@lynxwall/cucumber-tsflow/lib/transpilers/${module}`);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tcase 'ts-node-esm':\r\n\t\t\t\t\tlogger.checkpoint('Adding ts-node-esm loader');\r\n\t\t\t\t\toriginal.loader.push('@lynxwall/cucumber-tsflow/lib/transpilers/esm/tsnode-loader');\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'es-node-esm':\r\n\t\t\t\t\tlogger.checkpoint('Adding es-node-esm loader');\r\n\t\t\t\t\toriginal.loader.push('@lynxwall/cucumber-tsflow/lib/transpilers/esm/esnode-loader');\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'ts-vue-esm':\r\n\t\t\t\t\tlogger.checkpoint('Adding ts-vue-esm loader + JSDOM');\r\n\t\t\t\t\toriginal.loader.push('@lynxwall/cucumber-tsflow/lib/transpilers/esm/vue-loader');\r\n\t\t\t\t\tinitJsDom();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'es-vue-esm':\r\n\t\t\t\t\tlogger.checkpoint('Adding es-vue-esm loader + JSDOM');\r\n\t\t\t\t\toriginal.loader.push('@lynxwall/cucumber-tsflow/lib/transpilers/esm/esvue-loader');\r\n\t\t\t\t\tinitJsDom();\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tlogger.checkpoint('No built-in transpiler (user-provided expected)', {\r\n\t\t\t\t\t\ttranspiler: original.transpiler\r\n\t\t\t\t\t});\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tlogger.checkpoint('Transpiler configured', {\r\n\t\t\t\tloaders: original.loader,\r\n\t\t\t\trequireModules: original.requireModule,\r\n\t\t\t\trequires: original.require\r\n\t\t\t});\r\n\t\t} catch (error: any) {\r\n\t\t\tlogger.error('Failed to configure transpiler', error, { transpiler: original.transpiler });\r\n\t\t\tthrow new Error(`Failed to configure transpiler \"${original.transpiler}\": ${error.message}`, { cause: error });\r\n\t\t}\r\n\t} else {\r\n\t\tlogger.checkpoint('No transpiler specified');\r\n\t}\r\n\r\n\t// Set snippet syntax\r\n\tif (!original.formatOptions.snippetSyntax) {\r\n\t\toriginal.formatOptions.snippetSyntax = '@lynxwall/cucumber-tsflow/snippet';\r\n\t}\r\n\tlogger.checkpoint('Snippet syntax configured', { snippetSyntax: original.formatOptions.snippetSyntax });\r\n\r\n\t// Process format options\r\n\tlogger.checkpoint('Processing format options', { formatCount: original.format?.length });\r\n\ttry {\r\n\t\tfor (let idx = 0; idx < original.format.length; idx++) {\r\n\t\t\tif (typeof original.format[idx] === 'string') {\r\n\t\t\t\tconst formatItem = original.format[idx] as string;\r\n\t\t\t\tif (formatItem.startsWith('behave:')) {\r\n\t\t\t\t\toriginal.format[idx] = formatItem.replace('behave', '@lynxwall/cucumber-tsflow/behave');\r\n\t\t\t\t\tlogger.checkpoint('Replaced behave format', { index: idx });\r\n\t\t\t\t}\r\n\t\t\t} else if (original.format[idx].length > 0) {\r\n\t\t\t\tconst formatItem = original.format[idx][0] as string;\r\n\t\t\t\tif (formatItem.startsWith('behave')) {\r\n\t\t\t\t\tconst newVal = formatItem.replace('behave', '@lynxwall/cucumber-tsflow/behave');\r\n\t\t\t\t\toriginal.format[idx] = original.format[idx].length > 1 ? [newVal, original.format[idx][1]] : [newVal];\r\n\t\t\t\t\tlogger.checkpoint('Replaced behave format (array)', { index: idx });\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (let idx = 0; idx < original.format.length; idx++) {\r\n\t\t\tif (typeof original.format[idx] === 'string') {\r\n\t\t\t\tconst formatItem = original.format[idx] as string;\r\n\t\t\t\tif (formatItem.startsWith('junitbamboo:')) {\r\n\t\t\t\t\toriginal.format[idx] = formatItem.replace('junitbamboo', '@lynxwall/cucumber-tsflow/junitbamboo');\r\n\t\t\t\t\tlogger.checkpoint('Replaced junitbamboo format', { index: idx });\r\n\t\t\t\t}\r\n\t\t\t} else if (original.format[idx].length > 0) {\r\n\t\t\t\tconst formatItem = original.format[idx][0] as string;\r\n\t\t\t\tif (formatItem.startsWith('junitbamboo')) {\r\n\t\t\t\t\tconst newVal = formatItem.replace('junitbamboo', '@lynxwall/cucumber-tsflow/junitbamboo');\r\n\t\t\t\t\toriginal.format[idx] = original.format[idx].length > 1 ? [newVal, original.format[idx][1]] : [newVal];\r\n\t\t\t\t\tlogger.checkpoint('Replaced junitbamboo format (array)', { index: idx });\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tlogger.checkpoint('Format options processed');\r\n\t} catch (error: any) {\r\n\t\tlogger.error('Failed to process format options', error);\r\n\t\tthrow new Error(`Failed to process format options: ${error.message}`, { cause: error });\r\n\t}\r\n\r\n\t// Process debugFile\r\n\tif (hasStringValue(original.debugFile)) {\r\n\t\tlogger.checkpoint('Processing debugFile', { debugFile: original.debugFile });\r\n\t\ttry {\r\n\t\t\tconst gherkin = new GherkinManager();\r\n\t\t\tawait gherkin.loadFeatures(original.paths);\r\n\t\t\tconst features = gherkin.findFeaturesByStepFile(original.debugFile);\r\n\t\t\tif (features.length > 0) {\r\n\t\t\t\toriginal.paths = [];\r\n\t\t\t\tfeatures.forEach(x => original.paths.push(x.featureFile));\r\n\t\t\t\tlogger.checkpoint('Debug features found', { featureCount: features.length });\r\n\t\t\t} else {\r\n\t\t\t\tcucumberLogger.warn(ansis.yellow(`\\nUnable to find feature for debugFile: ${original.debugFile}`));\r\n\t\t\t\tcucumberLogger.warn(ansis.yellow('All tests will be executed\\n'));\r\n\t\t\t\tlogger.checkpoint('No features found for debugFile');\r\n\t\t\t}\r\n\t\t} catch (error: any) {\r\n\t\t\tlogger.error('Failed to process debugFile', error, { debugFile: original.debugFile });\r\n\t\t\tthrow new Error(`Failed to process debugFile \"${original.debugFile}\": ${error.message}`, { cause: error });\r\n\t\t}\r\n\t}\r\n\r\n\t// Configure Vue style\r\n\tif (original.enableVueStyle === null || original.enableVueStyle === undefined) {\r\n\t\toriginal.enableVueStyle = false;\r\n\t}\r\n\tglobal.enableVueStyle = original.enableVueStyle;\r\n\tlogger.checkpoint('Vue style configured', { enableVueStyle: original.enableVueStyle });\r\n\r\n\t// Validate configuration\r\n\ttry {\r\n\t\tlogger.checkpoint('Validating configuration');\r\n\t\tvalidateConfiguration(original, cucumberLogger);\r\n\t\tlogger.checkpoint('Configuration validated');\r\n\t} catch (error: any) {\r\n\t\tlogger.error('Configuration validation failed', error);\r\n\t\tthrow new Error(`Configuration validation failed: ${error.message}`, { cause: error });\r\n\t}\r\n\r\n\t// Convert configuration\r\n\tlet runnable: ITsFlowRunConfiguration;\r\n\ttry {\r\n\t\tlogger.checkpoint('Converting configuration');\r\n\t\trunnable = await convertConfiguration(cucumberLogger, original, env);\r\n\t\tlogger.checkpoint('Configuration converted', {\r\n\t\t\timportPaths: runnable.support?.importPaths,\r\n\t\t\tloaders: runnable.support?.loaders\r\n\t\t});\r\n\t} catch (error: any) {\r\n\t\tlogger.error('Failed to convert configuration', error);\r\n\t\tthrow new Error(`Failed to convert configuration: ${error.message}`, { cause: error });\r\n\t}\r\n\r\n\tlogger.checkpoint('loadConfiguration() completed');\r\n\r\n\treturn {\r\n\t\tuseConfiguration: original,\r\n\t\trunConfiguration: runnable\r\n\t};\r\n};\r\n"]}
|
|
@@ -8,3 +8,17 @@ import { ILoadSupportOptions, ISupportCodeLibrary } from '@cucumber/cucumber/lib
|
|
|
8
8
|
* @param environment - Project environment
|
|
9
9
|
*/
|
|
10
10
|
export declare function loadSupport(options: ILoadSupportOptions, environment?: IRunEnvironment): Promise<ISupportCodeLibrary>;
|
|
11
|
+
/**
|
|
12
|
+
* Incrementally reload support code. Evicts support modules from Node's
|
|
13
|
+
* require cache so they are re-evaluated (re-running decorator registrations).
|
|
14
|
+
* Transpiler caches (ts-node, swc, etc.) handle skipping recompilation for
|
|
15
|
+
* unchanged files, making this significantly faster than a full loadSupport.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
* @param options - The same run options used for the original loadSupport call
|
|
19
|
+
* @param changedPaths - Absolute paths to files that have changed since the
|
|
20
|
+
* last load. If empty, all support modules are evicted
|
|
21
|
+
* and re-evaluated (equivalent to a full reload).
|
|
22
|
+
* @param environment - Project environment
|
|
23
|
+
*/
|
|
24
|
+
export declare function reloadSupport(options: ILoadSupportOptions, changedPaths: string[], environment?: IRunEnvironment): Promise<ISupportCodeLibrary>;
|
package/lib/api/load-support.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadSupport = loadSupport;
|
|
4
|
+
exports.reloadSupport = reloadSupport;
|
|
4
5
|
const messages_1 = require("@cucumber/messages");
|
|
5
6
|
const index_1 = require("@cucumber/cucumber/lib/paths/index");
|
|
6
7
|
const index_2 = require("@cucumber/cucumber/lib/environment/index");
|
|
@@ -45,4 +46,115 @@ async function loadSupport(options, environment = {}) {
|
|
|
45
46
|
supportCodeLibrary = { ...supportCodeLibrary, ...{ originalCoordinates: supportCoordinates } };
|
|
46
47
|
return supportCodeLibrary;
|
|
47
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Incrementally reload support code. Evicts support modules from Node's
|
|
51
|
+
* require cache so they are re-evaluated (re-running decorator registrations).
|
|
52
|
+
* Transpiler caches (ts-node, swc, etc.) handle skipping recompilation for
|
|
53
|
+
* unchanged files, making this significantly faster than a full loadSupport.
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
* @param options - The same run options used for the original loadSupport call
|
|
57
|
+
* @param changedPaths - Absolute paths to files that have changed since the
|
|
58
|
+
* last load. If empty, all support modules are evicted
|
|
59
|
+
* and re-evaluated (equivalent to a full reload).
|
|
60
|
+
* @param environment - Project environment
|
|
61
|
+
*/
|
|
62
|
+
async function reloadSupport(options, changedPaths, environment = {}) {
|
|
63
|
+
const mergedEnvironment = (0, index_2.makeEnvironment)(environment);
|
|
64
|
+
const { cwd, logger } = mergedEnvironment;
|
|
65
|
+
const newId = messages_1.IdGenerator.uuid();
|
|
66
|
+
const supportCoordinates = Object.assign({
|
|
67
|
+
requireModules: [],
|
|
68
|
+
requirePaths: [],
|
|
69
|
+
loaders: [],
|
|
70
|
+
importPaths: []
|
|
71
|
+
}, options.support);
|
|
72
|
+
const pluginManager = await (0, plugins_1.initializeForLoadSupport)(mergedEnvironment);
|
|
73
|
+
const resolvedPaths = await (0, index_1.resolvePaths)(logger, cwd, options.sources, supportCoordinates);
|
|
74
|
+
pluginManager.emit('paths:resolve', resolvedPaths);
|
|
75
|
+
const { requirePaths, importPaths } = resolvedPaths;
|
|
76
|
+
// Evict support modules from require.cache so they re-evaluate on next require().
|
|
77
|
+
// Transpiler caches ensure unchanged files don't pay recompilation cost.
|
|
78
|
+
if (changedPaths.length > 0) {
|
|
79
|
+
evictChangedAndDependents(changedPaths, requirePaths);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
evictAllSupportModules(requirePaths);
|
|
83
|
+
}
|
|
84
|
+
let supportCodeLibrary = await (0, support_1.getSupportCodeLibrary)({
|
|
85
|
+
logger,
|
|
86
|
+
cwd,
|
|
87
|
+
newId,
|
|
88
|
+
requireModules: supportCoordinates.requireModules,
|
|
89
|
+
requirePaths,
|
|
90
|
+
loaders: supportCoordinates.loaders,
|
|
91
|
+
importPaths
|
|
92
|
+
});
|
|
93
|
+
await pluginManager.cleanup();
|
|
94
|
+
supportCodeLibrary = binding_registry_1.BindingRegistry.instance.updateSupportCodeLibrary(supportCodeLibrary);
|
|
95
|
+
supportCodeLibrary = { ...supportCodeLibrary, ...{ originalCoordinates: supportCoordinates } };
|
|
96
|
+
return supportCodeLibrary;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Evict changed files and any support modules that depend on them
|
|
100
|
+
* from Node's require cache.
|
|
101
|
+
*/
|
|
102
|
+
function evictChangedAndDependents(changedPaths, allSupportPaths) {
|
|
103
|
+
// Resolve all changed paths
|
|
104
|
+
const changedResolved = new Set();
|
|
105
|
+
for (const p of changedPaths) {
|
|
106
|
+
try {
|
|
107
|
+
changedResolved.add(require.resolve(p));
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
// File may have been deleted — skip
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Build set of modules to evict: changed files + any support module
|
|
114
|
+
// whose dependency subtree includes a changed file
|
|
115
|
+
const toEvict = new Set(changedResolved);
|
|
116
|
+
// Walk require.cache to find transitive dependents
|
|
117
|
+
let found = true;
|
|
118
|
+
while (found) {
|
|
119
|
+
found = false;
|
|
120
|
+
for (const [key, mod] of Object.entries(require.cache)) {
|
|
121
|
+
if (!toEvict.has(key) && mod?.children?.some(child => toEvict.has(child.id))) {
|
|
122
|
+
toEvict.add(key);
|
|
123
|
+
found = true;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// Only evict modules that are changed or in the support paths set
|
|
128
|
+
// (don't evict node_modules or unrelated files)
|
|
129
|
+
const supportResolved = new Set(allSupportPaths
|
|
130
|
+
.map(p => {
|
|
131
|
+
try {
|
|
132
|
+
return require.resolve(p);
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
return '';
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
.filter(Boolean));
|
|
139
|
+
for (const key of toEvict) {
|
|
140
|
+
if (changedResolved.has(key) || supportResolved.has(key)) {
|
|
141
|
+
delete require.cache[key];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Evict all support modules from Node's require cache.
|
|
147
|
+
* Used when no specific changed paths are provided.
|
|
148
|
+
*/
|
|
149
|
+
function evictAllSupportModules(supportPaths) {
|
|
150
|
+
for (const filePath of supportPaths) {
|
|
151
|
+
try {
|
|
152
|
+
const resolved = require.resolve(filePath);
|
|
153
|
+
delete require.cache[resolved];
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
// File may not be resolvable — skip
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
48
160
|
//# sourceMappingURL=load-support.js.map
|
|
@@ -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,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"]}
|
|
1
|
+
{"version":3,"file":"load-support.js","sourceRoot":"","sources":["../../src/api/load-support.ts"],"names":[],"mappings":";;AAgBA,kCAsCC;AAeD,sCA6CC;AAlHD,iDAAiD;AACjD,8DAAkE;AAClE,oEAA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CAAC;IACF,CAAC;IAED,kEAAkE;IAClE,gDAAgD;IAChD,MAAM,eAAe,GAAG,IAAI,GAAG,CAC9B,eAAe;SACb,GAAG,CAAC,CAAC,CAAC,EAAE;QACR,IAAI,CAAC;YACJ,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC3B,CAAC;QAAC,MAAM,CAAC;YACR,OAAO,EAAE,CAAC;QACX,CAAC;IACF,CAAC,CAAC;SACD,MAAM,CAAC,OAAO,CAAC,CACjB,CAAC;IAEF,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC3B,IAAI,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1D,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;IACF,CAAC;AACF,CAAC;AAED;;;GAGG;AACH,SAAS,sBAAsB,CAAC,YAAsB;IACrD,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE,CAAC;QACrC,IAAI,CAAC;YACJ,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC3C,OAAO,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChC,CAAC;QAAC,MAAM,CAAC;YACR,oCAAoC;QACrC,CAAC;IACF,CAAC;AACF,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 type { ISupportCodeCoordinates } from '@cucumber/cucumber/lib/support_code_library_builder/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\r\n/**\r\n * Incrementally reload support code. Evicts support modules from Node's\r\n * require cache so they are re-evaluated (re-running decorator registrations).\r\n * Transpiler caches (ts-node, swc, etc.) handle skipping recompilation for\r\n * unchanged files, making this significantly faster than a full loadSupport.\r\n *\r\n * @public\r\n * @param options - The same run options used for the original loadSupport call\r\n * @param changedPaths - Absolute paths to files that have changed since the\r\n * last load. If empty, all support modules are evicted\r\n * and re-evaluated (equivalent to a full reload).\r\n * @param environment - Project environment\r\n */\r\nexport async function reloadSupport(\r\n\toptions: ILoadSupportOptions,\r\n\tchangedPaths: string[],\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: ISupportCodeCoordinates = 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\r\n\t// Evict support modules from require.cache so they re-evaluate on next require().\r\n\t// Transpiler caches ensure unchanged files don't pay recompilation cost.\r\n\tif (changedPaths.length > 0) {\r\n\t\tevictChangedAndDependents(changedPaths, requirePaths);\r\n\t} else {\r\n\t\tevictAllSupportModules(requirePaths);\r\n\t}\r\n\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\tsupportCodeLibrary = BindingRegistry.instance.updateSupportCodeLibrary(supportCodeLibrary);\r\n\tsupportCodeLibrary = { ...supportCodeLibrary, ...{ originalCoordinates: supportCoordinates } };\r\n\r\n\treturn supportCodeLibrary;\r\n}\r\n\r\n/**\r\n * Evict changed files and any support modules that depend on them\r\n * from Node's require cache.\r\n */\r\nfunction evictChangedAndDependents(changedPaths: string[], allSupportPaths: string[]): void {\r\n\t// Resolve all changed paths\r\n\tconst changedResolved = new Set<string>();\r\n\tfor (const p of changedPaths) {\r\n\t\ttry {\r\n\t\t\tchangedResolved.add(require.resolve(p));\r\n\t\t} catch {\r\n\t\t\t// File may have been deleted — skip\r\n\t\t}\r\n\t}\r\n\r\n\t// Build set of modules to evict: changed files + any support module\r\n\t// whose dependency subtree includes a changed file\r\n\tconst toEvict = new Set<string>(changedResolved);\r\n\r\n\t// Walk require.cache to find transitive dependents\r\n\tlet found = true;\r\n\twhile (found) {\r\n\t\tfound = false;\r\n\t\tfor (const [key, mod] of Object.entries(require.cache)) {\r\n\t\t\tif (!toEvict.has(key) && mod?.children?.some(child => toEvict.has(child.id))) {\r\n\t\t\t\ttoEvict.add(key);\r\n\t\t\t\tfound = true;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// Only evict modules that are changed or in the support paths set\r\n\t// (don't evict node_modules or unrelated files)\r\n\tconst supportResolved = new Set(\r\n\t\tallSupportPaths\r\n\t\t\t.map(p => {\r\n\t\t\t\ttry {\r\n\t\t\t\t\treturn require.resolve(p);\r\n\t\t\t\t} catch {\r\n\t\t\t\t\treturn '';\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t\t.filter(Boolean)\r\n\t);\r\n\r\n\tfor (const key of toEvict) {\r\n\t\tif (changedResolved.has(key) || supportResolved.has(key)) {\r\n\t\t\tdelete require.cache[key];\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * Evict all support modules from Node's require cache.\r\n * Used when no specific changed paths are provided.\r\n */\r\nfunction evictAllSupportModules(supportPaths: string[]): void {\r\n\tfor (const filePath of supportPaths) {\r\n\t\ttry {\r\n\t\t\tconst resolved = require.resolve(filePath);\r\n\t\t\tdelete require.cache[resolved];\r\n\t\t} catch {\r\n\t\t\t// File may not be resolvable — skip\r\n\t\t}\r\n\t}\r\n}\r\n"]}
|
package/lib/cli/index.js
CHANGED
|
@@ -9,6 +9,8 @@ const i18n_1 = require("@cucumber/cucumber/lib/cli/i18n");
|
|
|
9
9
|
const install_validator_1 = require("@cucumber/cucumber/lib/cli/install_validator");
|
|
10
10
|
const argv_parser_1 = __importDefault(require("./argv-parser"));
|
|
11
11
|
const debug_1 = __importDefault(require("debug"));
|
|
12
|
+
const tsflow_logger_1 = require("../utils/tsflow-logger");
|
|
13
|
+
const logger = (0, tsflow_logger_1.createLogger)('cli');
|
|
12
14
|
class Cli {
|
|
13
15
|
argv;
|
|
14
16
|
cwd;
|
|
@@ -16,6 +18,7 @@ class Cli {
|
|
|
16
18
|
stderr;
|
|
17
19
|
env;
|
|
18
20
|
constructor({ argv, cwd, stdout, stderr = process.stderr, env }) {
|
|
21
|
+
logger.checkpoint('Cli constructor', { cwd, argvLength: argv.length });
|
|
19
22
|
this.argv = argv;
|
|
20
23
|
this.cwd = cwd;
|
|
21
24
|
this.stdout = stdout;
|
|
@@ -23,11 +26,28 @@ class Cli {
|
|
|
23
26
|
this.env = env;
|
|
24
27
|
}
|
|
25
28
|
async run() {
|
|
29
|
+
logger.checkpoint('Cli.run() started');
|
|
26
30
|
const debugEnabled = debug_1.default.enabled('cucumber');
|
|
31
|
+
logger.checkpoint('Debug status', { debugEnabled });
|
|
27
32
|
if (debugEnabled) {
|
|
33
|
+
logger.checkpoint('Validating install');
|
|
28
34
|
await (0, install_validator_1.validateInstall)();
|
|
35
|
+
logger.checkpoint('Install validated');
|
|
36
|
+
}
|
|
37
|
+
// Parse argv
|
|
38
|
+
let options;
|
|
39
|
+
let argvConfiguration;
|
|
40
|
+
try {
|
|
41
|
+
logger.checkpoint('Parsing argv', { argv: this.argv });
|
|
42
|
+
const parsed = argv_parser_1.default.parse(this.argv);
|
|
43
|
+
options = parsed.options;
|
|
44
|
+
argvConfiguration = parsed.configuration;
|
|
45
|
+
logger.checkpoint('Argv parsed', { options });
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
logger.error('Argv parsing failed', error, { argv: this.argv });
|
|
49
|
+
throw new Error(`Failed to parse command line arguments: ${error.message}`, { cause: error });
|
|
29
50
|
}
|
|
30
|
-
const { options, configuration: argvConfiguration } = argv_parser_1.default.parse(this.argv);
|
|
31
51
|
if (options.i18nLanguages) {
|
|
32
52
|
this.stdout.write((0, i18n_1.getLanguages)());
|
|
33
53
|
return {
|
|
@@ -49,18 +69,46 @@ class Cli {
|
|
|
49
69
|
env: this.env,
|
|
50
70
|
debug: debugEnabled
|
|
51
71
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
72
|
+
logger.checkpoint('Environment constructed', { cwd: this.cwd, debug: debugEnabled });
|
|
73
|
+
// Load configuration
|
|
74
|
+
let configuration;
|
|
75
|
+
let runConfiguration;
|
|
76
|
+
try {
|
|
77
|
+
logger.checkpoint('Loading configuration', {
|
|
78
|
+
configFile: options.config,
|
|
79
|
+
profiles: options.profile
|
|
80
|
+
});
|
|
81
|
+
const loaded = await (0, load_configuration_1.loadConfiguration)({
|
|
82
|
+
file: options.config,
|
|
83
|
+
profiles: options.profile,
|
|
84
|
+
provided: argvConfiguration
|
|
85
|
+
}, environment);
|
|
86
|
+
configuration = loaded.useConfiguration;
|
|
87
|
+
runConfiguration = loaded.runConfiguration;
|
|
88
|
+
logger.checkpoint('Configuration loaded', {
|
|
89
|
+
transpiler: configuration.transpiler,
|
|
90
|
+
loaders: runConfiguration.support?.loaders,
|
|
91
|
+
parallel: runConfiguration.runtime?.parallel
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
logger.error('Configuration loading failed', error);
|
|
96
|
+
throw new Error(`Failed to load configuration: ${error.message}`, { cause: error });
|
|
97
|
+
}
|
|
98
|
+
// Run cucumber
|
|
99
|
+
try {
|
|
100
|
+
logger.checkpoint('Running cucumber');
|
|
101
|
+
const { success } = await (0, run_cucumber_1.runCucumber)(runConfiguration, environment);
|
|
102
|
+
logger.checkpoint('Cucumber completed', { success });
|
|
103
|
+
return {
|
|
104
|
+
shouldExitImmediately: configuration.forceExit,
|
|
105
|
+
success
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
logger.error('Cucumber execution failed', error);
|
|
110
|
+
throw new Error(`Failed during cucumber execution: ${error.message}`, { cause: error });
|
|
111
|
+
}
|
|
64
112
|
}
|
|
65
113
|
}
|
|
66
114
|
exports.default = Cli;
|
package/lib/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;AAEA,sDAAkD;AAClD,kEAA8D;AAC9D,0DAA4E;AAC5E,oFAA+E;AAC/E,gEAAuC;AACvC,kDAA0B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;AAEA,sDAAkD;AAClD,kEAA8D;AAC9D,0DAA4E;AAC5E,oFAA+E;AAC/E,gEAAuC;AACvC,kDAA0B;AAC1B,0DAAsD;AAEtD,MAAM,MAAM,GAAG,IAAA,4BAAY,EAAC,KAAK,CAAC,CAAC;AAOnC,MAAqB,GAAG;IACN,IAAI,CAAW;IACf,GAAG,CAAS;IACZ,MAAM,CAAmB;IACzB,MAAM,CAAmB;IACzB,GAAG,CAAoB;IAExC,YAAY,EACX,IAAI,EACJ,GAAG,EACH,MAAM,EACN,MAAM,GAAG,OAAO,CAAC,MAAM,EACvB,GAAG,EAOH;QACA,MAAM,CAAC,UAAU,CAAC,iBAAiB,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACvE,IAAI,CAAC,IAAI,GAAG,IAAI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gBAAgB,CAAC;YACxC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;YAC3C,MAAM,CAAC,UAAU,CAAC,sBAAsB,EAAE;gBACzC,UAAU,EAAE,aAAa,CAAC,UAAU;gBACpC,OAAO,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO;gBAC1C,QAAQ,EAAE,gBAAgB,CAAC,OAAO,EAAE,QAAQ;aAC5C,CAAC,CAAC;QACJ,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACrB,MAAM,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;YACpD,MAAM,IAAI,KAAK,CAAC,iCAAiC,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACrF,CAAC;QAED,eAAe;QACf,IAAI,CAAC;YACJ,MAAM,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;YACtC,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,0BAAW,EAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;YACrE,MAAM,CAAC,UAAU,CAAC,oBAAoB,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;YAErD,OAAO;gBACN,qBAAqB,EAAE,aAAa,CAAC,SAAS;gBAC9C,OAAO;aACP,CAAC;QACH,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACrB,MAAM,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;YACjD,MAAM,IAAI,KAAK,CAAC,qCAAqC,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACzF,CAAC;IACF,CAAC;CACD;AA3HD,sBA2HC","sourcesContent":["/* eslint-disable no-undef */\r\nimport { IFormatterStream } from '@cucumber/cucumber/lib/formatter/index';\r\nimport { runCucumber } from '../api/run-cucumber';\r\nimport { loadConfiguration } from '../api/load-configuration';\r\nimport { getKeywords, getLanguages } from '@cucumber/cucumber/lib/cli/i18n';\r\nimport { validateInstall } from '@cucumber/cucumber/lib/cli/install_validator';\r\nimport ArgvParser from './argv-parser';\r\nimport debug from 'debug';\r\nimport { createLogger } from '../utils/tsflow-logger';\r\n\r\nconst logger = createLogger('cli');\r\n\r\nexport interface ICliRunResult {\r\n\tshouldExitImmediately: boolean;\r\n\tsuccess: boolean;\r\n}\r\n\r\nexport default class Cli {\r\n\tprivate readonly argv: string[];\r\n\tprivate readonly cwd: string;\r\n\tprivate readonly stdout: IFormatterStream;\r\n\tprivate readonly stderr: IFormatterStream;\r\n\tprivate readonly env: NodeJS.ProcessEnv;\r\n\r\n\tconstructor({\r\n\t\targv,\r\n\t\tcwd,\r\n\t\tstdout,\r\n\t\tstderr = process.stderr,\r\n\t\tenv\r\n\t}: {\r\n\t\targv: string[];\r\n\t\tcwd: string;\r\n\t\tstdout: IFormatterStream;\r\n\t\tstderr: IFormatterStream;\r\n\t\tenv: NodeJS.ProcessEnv;\r\n\t}) {\r\n\t\tlogger.checkpoint('Cli constructor', { cwd, argvLength: argv.length });\r\n\t\tthis.argv = argv;\r\n\t\tthis.cwd = cwd;\r\n\t\tthis.stdout = stdout;\r\n\t\tthis.stderr = stderr;\r\n\t\tthis.env = env;\r\n\t}\r\n\r\n\tasync run(): Promise<ICliRunResult> {\r\n\t\tlogger.checkpoint('Cli.run() started');\r\n\r\n\t\tconst debugEnabled = debug.enabled('cucumber');\r\n\t\tlogger.checkpoint('Debug status', { debugEnabled });\r\n\r\n\t\tif (debugEnabled) {\r\n\t\t\tlogger.checkpoint('Validating install');\r\n\t\t\tawait validateInstall();\r\n\t\t\tlogger.checkpoint('Install validated');\r\n\t\t}\r\n\r\n\t\t// Parse argv\r\n\t\tlet options: ReturnType<typeof ArgvParser.parse>['options'];\r\n\t\tlet argvConfiguration: ReturnType<typeof ArgvParser.parse>['configuration'];\r\n\r\n\t\ttry {\r\n\t\t\tlogger.checkpoint('Parsing argv', { argv: this.argv });\r\n\t\t\tconst parsed = ArgvParser.parse(this.argv);\r\n\t\t\toptions = parsed.options;\r\n\t\t\targvConfiguration = parsed.configuration;\r\n\t\t\tlogger.checkpoint('Argv parsed', { options });\r\n\t\t} catch (error: any) {\r\n\t\t\tlogger.error('Argv parsing failed', error, { argv: this.argv });\r\n\t\t\tthrow new Error(`Failed to parse command line arguments: ${error.message}`, { cause: error });\r\n\t\t}\r\n\r\n\t\tif (options.i18nLanguages) {\r\n\t\t\t(this.stdout as any).write(getLanguages());\r\n\t\t\treturn {\r\n\t\t\t\tshouldExitImmediately: true,\r\n\t\t\t\tsuccess: true\r\n\t\t\t};\r\n\t\t}\r\n\t\tif (options.i18nKeywords) {\r\n\t\t\t(this.stdout as any).write(getKeywords(options.i18nKeywords));\r\n\t\t\treturn {\r\n\t\t\t\tshouldExitImmediately: true,\r\n\t\t\t\tsuccess: true\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tconst environment = {\r\n\t\t\tcwd: this.cwd,\r\n\t\t\tstdout: this.stdout,\r\n\t\t\tstderr: this.stderr,\r\n\t\t\tenv: this.env,\r\n\t\t\tdebug: debugEnabled\r\n\t\t};\r\n\t\tlogger.checkpoint('Environment constructed', { cwd: this.cwd, debug: debugEnabled });\r\n\r\n\t\t// Load configuration\r\n\t\tlet configuration: Awaited<ReturnType<typeof loadConfiguration>>['useConfiguration'];\r\n\t\tlet runConfiguration: Awaited<ReturnType<typeof loadConfiguration>>['runConfiguration'];\r\n\r\n\t\ttry {\r\n\t\t\tlogger.checkpoint('Loading configuration', {\r\n\t\t\t\tconfigFile: options.config,\r\n\t\t\t\tprofiles: options.profile\r\n\t\t\t});\r\n\t\t\tconst loaded = await loadConfiguration(\r\n\t\t\t\t{\r\n\t\t\t\t\tfile: options.config,\r\n\t\t\t\t\tprofiles: options.profile,\r\n\t\t\t\t\tprovided: argvConfiguration\r\n\t\t\t\t},\r\n\t\t\t\tenvironment\r\n\t\t\t);\r\n\t\t\tconfiguration = loaded.useConfiguration;\r\n\t\t\trunConfiguration = loaded.runConfiguration;\r\n\t\t\tlogger.checkpoint('Configuration loaded', {\r\n\t\t\t\ttranspiler: configuration.transpiler,\r\n\t\t\t\tloaders: runConfiguration.support?.loaders,\r\n\t\t\t\tparallel: runConfiguration.runtime?.parallel\r\n\t\t\t});\r\n\t\t} catch (error: any) {\r\n\t\t\tlogger.error('Configuration loading failed', error);\r\n\t\t\tthrow new Error(`Failed to load configuration: ${error.message}`, { cause: error });\r\n\t\t}\r\n\r\n\t\t// Run cucumber\r\n\t\ttry {\r\n\t\t\tlogger.checkpoint('Running cucumber');\r\n\t\t\tconst { success } = await runCucumber(runConfiguration, environment);\r\n\t\t\tlogger.checkpoint('Cucumber completed', { success });\r\n\r\n\t\t\treturn {\r\n\t\t\t\tshouldExitImmediately: configuration.forceExit,\r\n\t\t\t\tsuccess\r\n\t\t\t};\r\n\t\t} catch (error: any) {\r\n\t\t\tlogger.error('Cucumber execution failed', error);\r\n\t\t\tthrow new Error(`Failed during cucumber execution: ${error.message}`, { cause: error });\r\n\t\t}\r\n\t}\r\n}\r\n"]}
|
package/lib/cli/run.js
CHANGED
|
@@ -4,32 +4,45 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.default = run;
|
|
7
|
-
/* This is one rare place where we're fine to use process/console directly,
|
|
8
|
-
* but other code abstracts those to remain composable and testable. */
|
|
9
7
|
const index_1 = __importDefault(require("./index"));
|
|
10
8
|
const validate_node_engine_version_1 = require("@cucumber/cucumber/lib/cli/validate_node_engine_version");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
process.exit(1);
|
|
14
|
-
}
|
|
9
|
+
const tsflow_logger_1 = require("../utils/tsflow-logger");
|
|
10
|
+
const logger = (0, tsflow_logger_1.createLogger)('run');
|
|
15
11
|
async function run() {
|
|
12
|
+
logger.checkpoint('Starting cucumber-tsflow', {
|
|
13
|
+
nodeVersion: process.version,
|
|
14
|
+
cwd: process.cwd()
|
|
15
|
+
});
|
|
16
16
|
(0, validate_node_engine_version_1.validateNodeEngineVersion)(process.version, (error) => {
|
|
17
|
-
|
|
17
|
+
logger.error('Node version validation failed', error);
|
|
18
18
|
process.exit(1);
|
|
19
19
|
}, console.warn);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
logger.checkpoint('Node version validated');
|
|
21
|
+
let cli;
|
|
22
|
+
try {
|
|
23
|
+
logger.checkpoint('Constructing CLI');
|
|
24
|
+
cli = new index_1.default({
|
|
25
|
+
argv: process.argv,
|
|
26
|
+
cwd: process.cwd(),
|
|
27
|
+
stdout: process.stdout,
|
|
28
|
+
stderr: process.stderr,
|
|
29
|
+
env: process.env
|
|
30
|
+
});
|
|
31
|
+
logger.checkpoint('CLI constructed');
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
logger.error('Failed during CLI initialization', error);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
27
37
|
let result;
|
|
28
38
|
try {
|
|
39
|
+
logger.checkpoint('Running CLI');
|
|
29
40
|
result = await cli.run();
|
|
41
|
+
logger.checkpoint('CLI run completed', { success: result.success });
|
|
30
42
|
}
|
|
31
43
|
catch (error) {
|
|
32
|
-
|
|
44
|
+
logger.error('Failed during CLI execution', error);
|
|
45
|
+
process.exit(1);
|
|
33
46
|
}
|
|
34
47
|
// 0 = success, 2 = failed or has pending, undefined or unknown steps
|
|
35
48
|
let exitCode = result.success ? 0 : 2;
|
|
@@ -37,6 +50,7 @@ async function run() {
|
|
|
37
50
|
// 3 = implemented tests have failed
|
|
38
51
|
exitCode = 3;
|
|
39
52
|
}
|
|
53
|
+
logger.checkpoint('Exiting', { exitCode });
|
|
40
54
|
if (result.shouldExitImmediately) {
|
|
41
55
|
process.exit(exitCode);
|
|
42
56
|
}
|
package/lib/cli/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":";;;;;AAMA,sBAyDC;AA/DD,oDAA6C;AAC7C,0GAAoG;AACpG,0DAAsD;AAEtD,MAAM,MAAM,GAAG,IAAA,4BAAY,EAAC,KAAK,CAAC,CAAC;AAEpB,KAAK,UAAU,GAAG;IAChC,MAAM,CAAC,UAAU,CAAC,0BAA0B,EAAE;QAC7C,WAAW,EAAE,OAAO,CAAC,OAAO;QAC5B,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;KAClB,CAAC,CAAC;IAEH,IAAA,wDAAyB,EACxB,OAAO,CAAC,OAAO,EACf,CAAC,KAAU,EAAE,EAAE;QACd,MAAM,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;QACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,EACD,OAAO,CAAC,IAAI,CACZ,CAAC;IAEF,MAAM,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC;IAE5C,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACJ,MAAM,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;QACtC,GAAG,GAAG,IAAI,eAAG,CAAC;YACb,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;YAClB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,GAAG,EAAE,OAAO,CAAC,GAAG;SAChB,CAAC,CAAC;QACH,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACrB,MAAM,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;QACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IAED,IAAI,MAAsB,CAAC;IAC3B,IAAI,CAAC;QACJ,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;QACjC,MAAM,GAAG,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC;QACzB,MAAM,CAAC,UAAU,CAAC,mBAAmB,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACrB,MAAM,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;QACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IAED,qEAAqE;IACrE,IAAI,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,EAAE,CAAC;QAC9D,oCAAoC;QACpC,QAAQ,GAAG,CAAC,CAAC;IACd,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;IAE3C,IAAI,MAAM,CAAC,qBAAqB,EAAE,CAAC;QAClC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxB,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;AACF,CAAC","sourcesContent":["import Cli, { ICliRunResult } from './index';\r\nimport { validateNodeEngineVersion } from '@cucumber/cucumber/lib/cli/validate_node_engine_version';\r\nimport { createLogger } from '../utils/tsflow-logger';\r\n\r\nconst logger = createLogger('run');\r\n\r\nexport default async function run(): Promise<void> {\r\n\tlogger.checkpoint('Starting cucumber-tsflow', {\r\n\t\tnodeVersion: process.version,\r\n\t\tcwd: process.cwd()\r\n\t});\r\n\r\n\tvalidateNodeEngineVersion(\r\n\t\tprocess.version,\r\n\t\t(error: any) => {\r\n\t\t\tlogger.error('Node version validation failed', error);\r\n\t\t\tprocess.exit(1);\r\n\t\t},\r\n\t\tconsole.warn\r\n\t);\r\n\r\n\tlogger.checkpoint('Node version validated');\r\n\r\n\tlet cli: Cli;\r\n\ttry {\r\n\t\tlogger.checkpoint('Constructing CLI');\r\n\t\tcli = new Cli({\r\n\t\t\targv: process.argv,\r\n\t\t\tcwd: process.cwd(),\r\n\t\t\tstdout: process.stdout,\r\n\t\t\tstderr: process.stderr,\r\n\t\t\tenv: process.env\r\n\t\t});\r\n\t\tlogger.checkpoint('CLI constructed');\r\n\t} catch (error: any) {\r\n\t\tlogger.error('Failed during CLI initialization', error);\r\n\t\tprocess.exit(1);\r\n\t}\r\n\r\n\tlet result!: ICliRunResult;\r\n\ttry {\r\n\t\tlogger.checkpoint('Running CLI');\r\n\t\tresult = await cli.run();\r\n\t\tlogger.checkpoint('CLI run completed', { success: result.success });\r\n\t} catch (error: any) {\r\n\t\tlogger.error('Failed during CLI execution', error);\r\n\t\tprocess.exit(1);\r\n\t}\r\n\r\n\t// 0 = success, 2 = failed or has pending, undefined or unknown steps\r\n\tlet exitCode = result.success ? 0 : 2;\r\n\tif (!result.success && global.messageCollector.hasFailures()) {\r\n\t\t// 3 = implemented tests have failed\r\n\t\texitCode = 3;\r\n\t}\r\n\r\n\tlogger.checkpoint('Exiting', { exitCode });\r\n\r\n\tif (result.shouldExitImmediately) {\r\n\t\tprocess.exit(exitCode);\r\n\t} else {\r\n\t\tprocess.exitCode = exitCode;\r\n\t}\r\n}\r\n"]}
|