@lynxwall/cucumber-tsflow 7.5.0 → 7.5.5

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.
Files changed (58) hide show
  1. package/bin/cucumber-tsflow +3 -3
  2. package/bin/cucumber-tsflow.js +0 -0
  3. package/lib/api/convert-configuration.d.ts +1 -1
  4. package/lib/api/convert-configuration.js +62 -19
  5. package/lib/api/convert-configuration.js.map +1 -1
  6. package/lib/api/load-configuration.js +226 -101
  7. package/lib/api/load-configuration.js.map +1 -1
  8. package/lib/cli/index.js +61 -13
  9. package/lib/cli/index.js.map +1 -1
  10. package/lib/cli/run.js +29 -15
  11. package/lib/cli/run.js.map +1 -1
  12. package/lib/transpilers/esm/esbuild-transpiler-cjs.js +118 -15
  13. package/lib/transpilers/esm/esbuild-transpiler.mjs +27 -6
  14. package/lib/transpilers/esm/esbuild.mjs +70 -26
  15. package/lib/transpilers/esm/esnode-loader.mjs +7 -0
  16. package/lib/transpilers/esm/esvue-loader.mjs +7 -0
  17. package/lib/transpilers/esm/loader-utils.mjs +283 -157
  18. package/lib/transpilers/esm/tsnode-loader.mjs +84 -38
  19. package/lib/transpilers/esm/tsnode-service.mjs +50 -6
  20. package/lib/transpilers/esm/vue-jsdom-setup.mjs +36 -7
  21. package/lib/transpilers/esm/vue-loader.mjs +48 -62
  22. package/lib/transpilers/esm/vue-sfc-compiler.mjs +194 -65
  23. package/lib/tsconfig.node.tsbuildinfo +1 -1
  24. package/lib/utils/tsflow-logger.d.ts +29 -0
  25. package/lib/utils/tsflow-logger.js +79 -0
  26. package/lib/utils/tsflow-logger.js.map +1 -0
  27. package/lib/utils/tsflow-logger.mjs +78 -0
  28. package/lib/version.d.ts +1 -1
  29. package/lib/version.js +1 -1
  30. package/lib/version.js.map +1 -1
  31. package/package.json +4 -3
  32. package/lib/support_code_library_builder/index.d.ts +0 -80
  33. package/lib/support_code_library_builder/index.js +0 -337
  34. package/lib/support_code_library_builder/index.js.map +0 -1
  35. package/lib/transpilers/esm/esmbuild-transpiler.d.ts +0 -4
  36. package/lib/transpilers/esm/esmbuild-transpiler.js +0 -19
  37. package/lib/transpilers/esm/esmbuild-transpiler.js.map +0 -1
  38. package/lib/transpilers/esm/esmbuild.d.ts +0 -12
  39. package/lib/transpilers/esm/esmbuild.js +0 -72
  40. package/lib/transpilers/esm/esmbuild.js.map +0 -1
  41. package/lib/transpilers/esm/esmnode.d.ts +0 -1
  42. package/lib/transpilers/esm/esmnode.js +0 -8
  43. package/lib/transpilers/esm/esmnode.js.map +0 -1
  44. package/lib/transpilers/esm/esmvue.d.ts +0 -1
  45. package/lib/transpilers/esm/esmvue.js +0 -29
  46. package/lib/transpilers/esm/esmvue.js.map +0 -1
  47. package/lib/transpilers/esm/tsnode-esm.d.ts +0 -1
  48. package/lib/transpilers/esm/tsnode-esm.js +0 -25
  49. package/lib/transpilers/esm/tsnode-esm.js.map +0 -1
  50. package/lib/transpilers/esm/tsnode-exp-esm.d.ts +0 -1
  51. package/lib/transpilers/esm/tsnode-exp-esm.js +0 -19
  52. package/lib/transpilers/esm/tsnode-exp-esm.js.map +0 -1
  53. package/lib/transpilers/esm/tsvue-esm.d.ts +0 -1
  54. package/lib/transpilers/esm/tsvue-esm.js +0 -40
  55. package/lib/transpilers/esm/tsvue-esm.js.map +0 -1
  56. package/lib/transpilers/esm/tsvue-exp-esm.d.ts +0 -1
  57. package/lib/transpilers/esm/tsvue-exp-esm.js +0 -40
  58. package/lib/transpilers/esm/tsvue-exp-esm.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,G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Q,CAAC,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,CAAC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AAK,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACxF,CAAC;IAED,wBAAwB;IACxB,IAAI,QAAiC,CAAC;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;AAtSW,QAAA,iBAAiB,qBAsS5B","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\tif (experimentalDecorators) {\r\n\t\tconsoleLogger.log(ansis.cyanBright('Using Experimental Decorators.'));\r\n\t}\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"]}
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
- // load the configuration
53
- const { useConfiguration: configuration, runConfiguration } = await (0, load_configuration_1.loadConfiguration)({
54
- file: options.config,
55
- profiles: options.profile,
56
- provided: argvConfiguration
57
- }, environment);
58
- // now we can run cucumber
59
- const { success } = await (0, run_cucumber_1.runCucumber)(runConfiguration, environment);
60
- return {
61
- shouldExitImmediately: configuration.forceExit,
62
- success
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;
@@ -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;AAO1B,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,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,GAAG;QACR,MAAM,YAAY,GAAG,eAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC/C,IAAI,YAAY,EAAE,CAAC;YAClB,MAAM,IAAA,mCAAe,GAAE,CAAC;QACzB,CAAC;QAED,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,GAAG,qBAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClF,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;YAC1B,IAAI,CAAC,MAAc,CAAC,KAAK,CAAC,IAAA,mBAAY,GAAE,CAAC,CAAC;YAC3C,OAAO;gBACN,qBAAqB,EAAE,IAAI;gBAC3B,OAAO,EAAE,IAAI;aACb,CAAC;QACH,CAAC;QACD,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;YACzB,IAAI,CAAC,MAAc,CAAC,KAAK,CAAC,IAAA,kBAAW,EAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;YAC9D,OAAO;gBACN,qBAAqB,EAAE,IAAI;gBAC3B,OAAO,EAAE,IAAI;aACb,CAAC;QACH,CAAC;QAED,MAAM,WAAW,GAAG;YACnB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAE,YAAY;SACnB,CAAC;QAEF,yBAAyB;QACzB,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,MAAM,IAAA,sCAAiB,EACpF;YACC,IAAI,EAAE,OAAO,CAAC,MAAM;YACpB,QAAQ,EAAE,OAAO,CAAC,OAAO;YACzB,QAAQ,EAAE,iBAAiB;SAC3B,EACD,WAAW,CACX,CAAC;QAEF,0BAA0B;QAC1B,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,0BAAW,EAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;QACrE,OAAO;YACN,qBAAqB,EAAE,aAAa,CAAC,SAAS;YAC9C,OAAO;SACP,CAAC;IACH,CAAC;CACD;AA1ED,sBA0EC","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\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\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\tconst debugEnabled = debug.enabled('cucumber');\r\n\t\tif (debugEnabled) {\r\n\t\t\tawait validateInstall();\r\n\t\t}\r\n\r\n\t\tconst { options, configuration: argvConfiguration } = ArgvParser.parse(this.argv);\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\r\n\t\t// load the configuration\r\n\t\tconst { useConfiguration: configuration, runConfiguration } = await loadConfiguration(\r\n\t\t\t{\r\n\t\t\t\tfile: options.config,\r\n\t\t\t\tprofiles: options.profile,\r\n\t\t\t\tprovided: argvConfiguration\r\n\t\t\t},\r\n\t\t\tenvironment\r\n\t\t);\r\n\r\n\t\t// now we can run cucumber\r\n\t\tconst { success } = await runCucumber(runConfiguration, environment);\r\n\t\treturn {\r\n\t\t\tshouldExitImmediately: configuration.forceExit,\r\n\t\t\tsuccess\r\n\t\t};\r\n\t}\r\n}\r\n"]}
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,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,GAAG;QACR,MAAM,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;QAEvC,MAAM,YAAY,GAAG,eAAK,CAA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,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
- function logErrorMessageAndExit(message) {
12
- console.error(message);
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
- console.error(error);
17
+ logger.error('Node version validation failed', error);
18
18
  process.exit(1);
19
19
  }, console.warn);
20
- const cli = new index_1.default({
21
- argv: process.argv,
22
- cwd: process.cwd(),
23
- stdout: process.stdout,
24
- stderr: process.stderr,
25
- env: process.env
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
- logErrorMessageAndExit(error);
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
  }
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":";;;;;AASA,sBAqCC;AA9CD;uEACuE;AACvE,oDAA6C;AAC7C,0GAAoG;AACpG,SAAS,sBAAsB,CAAC,OAAe;IAC9C,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACvB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC;AAEc,KAAK,UAAU,GAAG;IAChC,IAAA,wDAAyB,EACxB,OAAO,CAAC,OAAO,EACf,CAAC,KAAU,EAAE,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,EACD,OAAO,CAAC,IAAI,CACZ,CAAC;IAEF,MAAM,GAAG,GAAG,IAAI,eAAG,CAAC;QACnB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,GAAG,EAAE,OAAO,CAAC,GAAG;KAChB,CAAC,CAAC;IAEH,IAAI,MAAsB,CAAC;IAC3B,IAAI,CAAC;QACJ,MAAM,GAAG,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC;IAC1B,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACrB,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC/B,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,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":["/* This is one rare place where we're fine to use process/console directly,\r\n * but other code abstracts those to remain composable and testable. */\r\nimport Cli, { ICliRunResult } from './index';\r\nimport { validateNodeEngineVersion } from '@cucumber/cucumber/lib/cli/validate_node_engine_version';\r\nfunction logErrorMessageAndExit(message: string): void {\r\n\tconsole.error(message);\r\n\tprocess.exit(1);\r\n}\r\n\r\nexport default async function run(): Promise<void> {\r\n\tvalidateNodeEngineVersion(\r\n\t\tprocess.version,\r\n\t\t(error: any) => {\r\n\t\t\tconsole.error(error);\r\n\t\t\tprocess.exit(1);\r\n\t\t},\r\n\t\tconsole.warn\r\n\t);\r\n\r\n\tconst cli = new Cli({\r\n\t\targv: process.argv,\r\n\t\tcwd: process.cwd(),\r\n\t\tstdout: process.stdout,\r\n\t\tstderr: process.stderr,\r\n\t\tenv: process.env\r\n\t});\r\n\r\n\tlet result!: ICliRunResult;\r\n\ttry {\r\n\t\tresult = await cli.run();\r\n\t} catch (error: any) {\r\n\t\tlogErrorMessageAndExit(error);\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\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"]}
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,OAA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,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"]}
@@ -2065,29 +2065,82 @@ var import_esbuild = require("esbuild");
2065
2065
  var import_path = __toESM(require("path"), 1);
2066
2066
  var import_tsconfig_paths = __toESM(require_lib2(), 1);
2067
2067
  var import_url = require("url");
2068
+
2069
+ // src/utils/tsflow-logger.mjs
2070
+ var VERBOSE = process.env.TSFLOW_VERBOSE === "true";
2071
+ function createLogger(namespace) {
2072
+ const prefix = `[tsflow:${namespace}]`;
2073
+ return {
2074
+ checkpoint: (stage, detail) => {
2075
+ if (!VERBOSE) return;
2076
+ console.log(`${prefix} ${stage}`);
2077
+ if (detail !== void 0) {
2078
+ console.log(`${prefix} \u2514\u2500`, detail);
2079
+ }
2080
+ },
2081
+ error: (stage, error, detail) => {
2082
+ console.error(`${prefix}:ERROR ${stage}`);
2083
+ if (error) {
2084
+ console.error(`${prefix} \u2514\u2500 ${error.name}: ${error.message}`);
2085
+ if (VERBOSE && error.stack) {
2086
+ console.error(`${prefix} \u2514\u2500 Stack:`, error.stack);
2087
+ }
2088
+ }
2089
+ if (detail !== void 0 && VERBOSE) {
2090
+ console.error(`${prefix} \u2514\u2500 Detail:`, detail);
2091
+ }
2092
+ },
2093
+ warn: (stage, detail) => {
2094
+ if (!VERBOSE) return;
2095
+ console.warn(`${prefix}:WARN ${stage}`);
2096
+ if (detail !== void 0) {
2097
+ console.warn(`${prefix} \u2514\u2500`, detail);
2098
+ }
2099
+ }
2100
+ };
2101
+ }
2102
+
2103
+ // src/transpilers/esm/esbuild.mjs
2104
+ var logger = createLogger("esbuild");
2068
2105
  var defaultOptions = {
2069
2106
  debug: true
2070
2107
  };
2071
2108
  var tsconfigCache = null;
2072
2109
  function loadTsConfigPaths() {
2073
- if (tsconfigCache) return tsconfigCache;
2110
+ if (tsconfigCache) {
2111
+ logger.checkpoint("loadTsConfigPaths (cached)");
2112
+ return tsconfigCache;
2113
+ }
2114
+ logger.checkpoint("loadTsConfigPaths");
2074
2115
  try {
2075
2116
  const configLoaderResult = (0, import_tsconfig_paths.loadConfig)(process.cwd());
2117
+ logger.checkpoint("tsconfig loadConfig result", {
2118
+ resultType: configLoaderResult.resultType,
2119
+ cwd: process.cwd()
2120
+ });
2076
2121
  if (configLoaderResult.resultType === "success") {
2077
2122
  tsconfigCache = {
2078
2123
  absoluteBaseUrl: configLoaderResult.absoluteBaseUrl,
2079
2124
  paths: configLoaderResult.paths
2080
2125
  };
2126
+ logger.checkpoint("tsconfig paths cached", {
2127
+ absoluteBaseUrl: tsconfigCache.absoluteBaseUrl,
2128
+ pathCount: Object.keys(tsconfigCache.paths || {}).length
2129
+ });
2081
2130
  }
2082
2131
  } catch (error) {
2083
- console.error("Failed to load tsconfig for aliases:", error);
2132
+ logger.error("Failed to load tsconfig for aliases", error);
2084
2133
  }
2085
2134
  return tsconfigCache || { paths: {} };
2086
2135
  }
2087
- function rewritePathMappings(code) {
2136
+ function rewritePathMappings(code, filename) {
2088
2137
  const { absoluteBaseUrl, paths } = loadTsConfigPaths();
2089
- if (!paths || !absoluteBaseUrl) return code;
2138
+ if (!paths || !absoluteBaseUrl) {
2139
+ logger.checkpoint("rewritePathMappings skipped (no paths)", { filename });
2140
+ return code;
2141
+ }
2090
2142
  let modifiedCode = code;
2143
+ let replacementCount = 0;
2091
2144
  for (const [pattern, replacements] of Object.entries(paths)) {
2092
2145
  const searchPattern = pattern.replace("/*", "");
2093
2146
  const replacementPath = replacements[0].replace("/*", "");
@@ -2096,9 +2149,17 @@ function rewritePathMappings(code) {
2096
2149
  const pathSuffix = subPath ? subPath.substring(1) : "";
2097
2150
  const absolutePath = import_path.default.resolve(absoluteBaseUrl, replacementPath, pathSuffix);
2098
2151
  const fileUrl = (0, import_url.pathToFileURL)(absolutePath).href;
2152
+ replacementCount++;
2153
+ logger.checkpoint("Path mapping replaced", {
2154
+ from: `${searchPattern}${subPath || ""}`,
2155
+ to: fileUrl
2156
+ });
2099
2157
  return `${prefix}${fileUrl}${suffix}`;
2100
2158
  });
2101
2159
  }
2160
+ if (replacementCount > 0) {
2161
+ logger.checkpoint("rewritePathMappings complete", { filename, replacementCount });
2162
+ }
2102
2163
  return modifiedCode;
2103
2164
  }
2104
2165
  var commonOptions = {
@@ -2110,6 +2171,7 @@ var commonOptions = {
2110
2171
  platform: "node"
2111
2172
  };
2112
2173
  if (process.env.CUCUMBER_EXPERIMENTAL_DECORATORS === "true") {
2174
+ logger.checkpoint("Experimental decorators enabled");
2113
2175
  commonOptions.tsconfigRaw = {
2114
2176
  compilerOptions: {
2115
2177
  experimentalDecorators: true,
@@ -2142,28 +2204,69 @@ var getLoaders = (options) => {
2142
2204
  return ret;
2143
2205
  };
2144
2206
  var transpileCode = (code, filename, ext, _options) => {
2207
+ logger.checkpoint("transpileCode", {
2208
+ filename,
2209
+ ext,
2210
+ codeLength: code?.length
2211
+ });
2145
2212
  const options = { ...defaultOptions, ..._options };
2146
2213
  const loadersMap = getLoaders(options);
2147
2214
  const loaderExt = ext != void 0 ? ext : import_path.default.extname(filename);
2148
- let processedCode = rewritePathMappings(code);
2149
- const ret = (0, import_esbuild.transformSync)(processedCode, {
2150
- ...commonOptions,
2151
- ...options.esbuild || {},
2215
+ logger.checkpoint("Rewriting path mappings", { filename });
2216
+ let processedCode = rewritePathMappings(code, filename);
2217
+ logger.checkpoint("Calling esbuild transformSync", {
2218
+ filename,
2152
2219
  loader: loadersMap[loaderExt],
2153
- sourcefile: filename
2220
+ processedCodeLength: processedCode?.length
2154
2221
  });
2155
- return { output: ret.code, sourceMap: ret.map };
2222
+ try {
2223
+ const ret = (0, import_esbuild.transformSync)(processedCode, {
2224
+ ...commonOptions,
2225
+ ...options.esbuild || {},
2226
+ loader: loadersMap[loaderExt],
2227
+ sourcefile: filename
2228
+ });
2229
+ logger.checkpoint("esbuild transformSync success", {
2230
+ filename,
2231
+ outputLength: ret.code?.length
2232
+ });
2233
+ return { output: ret.code, sourceMap: ret.map };
2234
+ } catch (error) {
2235
+ logger.error("esbuild transformSync failed", error, {
2236
+ filename,
2237
+ loader: loadersMap[loaderExt],
2238
+ codePreview: processedCode?.substring(0, 200)
2239
+ });
2240
+ throw error;
2241
+ }
2156
2242
  };
2157
2243
 
2158
2244
  // src/transpilers/esm/esbuild-transpiler.mjs
2245
+ var logger2 = createLogger("esbuild-transpiler");
2159
2246
  function create(_createOptions) {
2247
+ logger2.checkpoint("create() called");
2160
2248
  return {
2161
2249
  transpile(input, options) {
2162
- const result = transpileCode(input, options.fileName);
2163
- return {
2164
- outputText: result.output,
2165
- sourceMapText: result.sourceMap
2166
- };
2250
+ logger2.checkpoint("transpile", {
2251
+ fileName: options.fileName,
2252
+ inputLength: input?.length
2253
+ });
2254
+ try {
2255
+ const result = transpileCode(input, options.fileName);
2256
+ logger2.checkpoint("transpile success", {
2257
+ fileName: options.fileName,
2258
+ outputLength: result.output?.length
2259
+ });
2260
+ return {
2261
+ outputText: result.output,
2262
+ sourceMapText: result.sourceMap
2263
+ };
2264
+ } catch (error) {
2265
+ logger2.error("transpile failed", error, {
2266
+ fileName: options.fileName
2267
+ });
2268
+ throw error;
2269
+ }
2167
2270
  }
2168
2271
  };
2169
2272
  }
@@ -1,19 +1,40 @@
1
1
  // This file gets transpiled to CJS via scripts/build-esm-transpiler-cjs as part of the build
2
2
 
3
3
  import { transpileCode } from './esbuild.mjs';
4
+ import { createLogger } from '../../utils/tsflow-logger.mjs';
5
+
6
+ const logger = createLogger('esbuild-transpiler');
4
7
 
5
8
  export function create(_createOptions) {
9
+ logger.checkpoint('create() called');
10
+
6
11
  return {
7
12
  transpile(input, options) {
8
- const result = transpileCode(input, options.fileName);
13
+ logger.checkpoint('transpile', {
14
+ fileName: options.fileName,
15
+ inputLength: input?.length
16
+ });
17
+
18
+ try {
19
+ const result = transpileCode(input, options.fileName);
20
+
21
+ logger.checkpoint('transpile success', {
22
+ fileName: options.fileName,
23
+ outputLength: result.output?.length
24
+ });
9
25
 
10
- return {
11
- outputText: result.output,
12
- sourceMapText: result.sourceMap
13
- };
26
+ return {
27
+ outputText: result.output,
28
+ sourceMapText: result.sourceMap
29
+ };
30
+ } catch (error) {
31
+ logger.error('transpile failed', error, {
32
+ fileName: options.fileName
33
+ });
34
+ throw error;
35
+ }
14
36
  }
15
37
  };
16
38
  }
17
39
 
18
- // Also export as default in case ts-node expects that
19
40
  export default { create };