@lynxwall/cucumber-tsflow 7.5.5 → 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/lib/api/load-configuration.js +0 -3
- 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/transpilers/esm/vue-sfc-compiler.mjs +14 -333
- 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/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +1 -3
- 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
package/README.md
CHANGED
|
@@ -12,6 +12,22 @@ This is a detached fork of <https://github.com/timjroberts/cucumber-js-tsflow>.
|
|
|
12
12
|
|
|
13
13
|
This fork has been drastically modified from the original and will eventually be moved to a new project. In addition, the SpecFlow project has reached [end of life](https://reqnroll.net/news/2025/01/specflow-end-of-life-has-been-announced/), and this project will be rebranded. Further details will be provided in future updates. However, the new project will support the same functionality as cucumber-tsflow while providing additional tools and extensions.
|
|
14
14
|
|
|
15
|
+
## Release Updates (7.6.0)
|
|
16
|
+
|
|
17
|
+
This release adds a new API function for incremental support-code reloading and consolidates the internal Vue SFC compiler.
|
|
18
|
+
|
|
19
|
+
### `reloadSupport` API
|
|
20
|
+
|
|
21
|
+
- **`reloadSupport(options, changedPaths, environment?)`** — evicts only the changed files (and their dependents) from Node's `require.cache`, then re-requires all support files. Unchanged files resolve instantly from transpiler cache; only changed files pay the full compilation cost. Pass an empty `changedPaths` array to evict and reload all support modules.
|
|
22
|
+
- Designed for use by persistent worker processes such as the companion [VS Code Extension](https://marketplace.visualstudio.com/items?itemName=lynxwall.cucumber-tsflow-vscode), which can call `reloadSupport` when a step file is saved instead of doing a full `loadSupport` on every run.
|
|
23
|
+
|
|
24
|
+
### Vue SFC compiler consolidation
|
|
25
|
+
|
|
26
|
+
- The CJS Vue SFC compiler (previously a 9-file Vite-plugin-derived implementation in `vue-sfc/`) has been replaced by a single shared `vue-sfc-compiler.ts` that both the CJS transpilers and the ESM loaders delegate to.
|
|
27
|
+
- Removed the `rollup` and `@rollup/pluginutils` dependencies, which were only used by the old CJS implementation.
|
|
28
|
+
- Fixed a bug where image assets referenced in Vue templates (e.g. `<img src="...">`) caused a `SyntaxError: Invalid or unexpected token` in CJS mode. Asset URL transforms are now disabled — `src` attributes remain as literal strings, which is the correct behaviour for unit testing Vue components with `@vue/test-utils`.
|
|
29
|
+
- Fixed duplicate **"Using Experimental Decorators."** console message that appeared twice when `experimentalDecorators: true` was set.
|
|
30
|
+
|
|
15
31
|
## Release Updates (7.3.0)
|
|
16
32
|
|
|
17
33
|
With this release, we've finally added support for ESM Modules. For details on the new transpilers/loaders please see: [cucumber-tsflow ESM implementation](https://github.com/LynxWall/cucumber-js-tsflow/blob/master/cucumber-tsflow/src/transpilers/esm/README.md).
|
|
@@ -437,7 +453,7 @@ In the table above:
|
|
|
437
453
|
|
|
438
454
|
**NOTE:** When using Vue transpilers **jsdom** is also loaded globally to support loading and testing Vue SFC components.
|
|
439
455
|
|
|
440
|
-
|
|
456
|
+
#### Using the transpiler configuration option
|
|
441
457
|
|
|
442
458
|
When configuring cucumber to execute tests you can specify which transpiler to use with the `transpiler` configuration option as shown below:
|
|
443
459
|
|
|
@@ -449,7 +465,7 @@ When configuring cucumber to execute tests you can specify which transpiler to u
|
|
|
449
465
|
}
|
|
450
466
|
```
|
|
451
467
|
|
|
452
|
-
|
|
468
|
+
#### Alternate without using the transpiler option
|
|
453
469
|
|
|
454
470
|
You can also use the `requireModule` parameter to configure a transpiler. The following example shows how to configure cucumber to use the `esvue` transpiler with the `requireModule` option.
|
|
455
471
|
|
|
@@ -467,7 +483,7 @@ The new `debugFile` configuration option allows you to specify a .ts file with s
|
|
|
467
483
|
|
|
468
484
|
If using VSCode to edit your project the following launch configurations can be used:
|
|
469
485
|
|
|
470
|
-
|
|
486
|
+
#### Debug All
|
|
471
487
|
|
|
472
488
|
```json
|
|
473
489
|
{
|
|
@@ -488,7 +504,7 @@ If using VSCode to edit your project the following launch configurations can be
|
|
|
488
504
|
}
|
|
489
505
|
```
|
|
490
506
|
|
|
491
|
-
|
|
507
|
+
#### Debug Feature
|
|
492
508
|
|
|
493
509
|
```json
|
|
494
510
|
{
|
|
@@ -756,7 +772,7 @@ Each scenario in a feature will get a new instance of the _Context_ object when
|
|
|
756
772
|
- Context classes now support an `initialize()` function that can be defined synchronous or asynchronous. The `initialize()` function is called after the `BeforeAll` hook and before any other hooks or steps. This provides the ability to initialize a scenario context before any tests are executed with support for async operations.
|
|
757
773
|
- Context classes have always supported a `dispose()` function for cleanup. However, with latest updates the `dispose()` function can be defined synchronously or asynchronously.
|
|
758
774
|
- versions >= 6.4.0
|
|
759
|
-
- The current Cucumber World object is now available as a constructor parameter on all classes defined for Context Injection. For more information on the World object see: [Access to Cucumber.js World object](#access-to-
|
|
775
|
+
- The current Cucumber World object is now available as a constructor parameter on all classes defined for Context Injection. For more information on the World object see: [Access to Cucumber.js World object](#access-to-cucumberjs-world-object).
|
|
760
776
|
|
|
761
777
|
### Using Context Injection
|
|
762
778
|
|
|
@@ -118,9 +118,6 @@ const loadConfiguration = async (options = {}, environment = {}) => {
|
|
|
118
118
|
global.experimentalDecorators = experimentalDecorators;
|
|
119
119
|
process.env.CUCUMBER_EXPERIMENTAL_DECORATORS = String(experimentalDecorators);
|
|
120
120
|
logger.checkpoint('Experimental decorators configured', { experimentalDecorators });
|
|
121
|
-
if (experimentalDecorators) {
|
|
122
|
-
consoleLogger.log(ansis_1.default.cyanBright('Using Experimental Decorators.'));
|
|
123
|
-
}
|
|
124
121
|
/**
|
|
125
122
|
* Ensures JSDOM environment is initialized before any test files are loaded.
|
|
126
123
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-configuration.js","sourceRoot":"","sources":["../../src/api/load-configuration.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,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"]}
|
|
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,+B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ber/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":["../../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AC,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,oEAA4F;AAG5F,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;I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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"]}
|