@lynxwall/cucumber-tsflow 7.5.0 → 7.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -5
- package/bin/cucumber-tsflow +3 -3
- package/bin/cucumber-tsflow.js +0 -0
- package/lib/api/convert-configuration.d.ts +1 -1
- package/lib/api/convert-configuration.js +62 -19
- package/lib/api/convert-configuration.js.map +1 -1
- package/lib/api/load-configuration.js +223 -101
- package/lib/api/load-configuration.js.map +1 -1
- package/lib/api/load-support.d.ts +14 -0
- package/lib/api/load-support.js +112 -0
- package/lib/api/load-support.js.map +1 -1
- package/lib/cli/index.js +61 -13
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/run.js +29 -15
- package/lib/cli/run.js.map +1 -1
- package/lib/transpilers/esm/esbuild-transpiler-cjs.js +118 -15
- package/lib/transpilers/esm/esbuild-transpiler.mjs +27 -6
- package/lib/transpilers/esm/esbuild.mjs +70 -26
- package/lib/transpilers/esm/esnode-loader.mjs +7 -0
- package/lib/transpilers/esm/esvue-loader.mjs +7 -0
- package/lib/transpilers/esm/loader-utils.mjs +283 -157
- package/lib/transpilers/esm/tsnode-loader.mjs +84 -38
- package/lib/transpilers/esm/tsnode-service.mjs +50 -6
- package/lib/transpilers/esm/vue-jsdom-setup.mjs +36 -7
- package/lib/transpilers/esm/vue-loader.mjs +48 -62
- package/lib/transpilers/esm/vue-sfc-compiler.mjs +17 -207
- package/lib/transpilers/esvue.js +6 -9
- package/lib/transpilers/esvue.js.map +1 -1
- package/lib/transpilers/tsvue-exp.js +6 -9
- package/lib/transpilers/tsvue-exp.js.map +1 -1
- package/lib/transpilers/tsvue.js +5 -8
- package/lib/transpilers/tsvue.js.map +1 -1
- package/lib/transpilers/vue-sfc-compiler.d.ts +23 -0
- package/lib/transpilers/vue-sfc-compiler.js +242 -0
- package/lib/transpilers/vue-sfc-compiler.js.map +1 -0
- package/lib/tsconfig.node.tsbuildinfo +1 -1
- package/lib/utils/tsflow-logger.d.ts +29 -0
- package/lib/utils/tsflow-logger.js +79 -0
- package/lib/utils/tsflow-logger.js.map +1 -0
- package/lib/utils/tsflow-logger.mjs +78 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +4 -5
- package/lib/support_code_library_builder/index.d.ts +0 -80
- package/lib/support_code_library_builder/index.js +0 -337
- package/lib/support_code_library_builder/index.js.map +0 -1
- package/lib/transpilers/esm/esmbuild-transpiler.d.ts +0 -4
- package/lib/transpilers/esm/esmbuild-transpiler.js +0 -19
- package/lib/transpilers/esm/esmbuild-transpiler.js.map +0 -1
- package/lib/transpilers/esm/esmbuild.d.ts +0 -12
- package/lib/transpilers/esm/esmbuild.js +0 -72
- package/lib/transpilers/esm/esmbuild.js.map +0 -1
- package/lib/transpilers/esm/esmnode.d.ts +0 -1
- package/lib/transpilers/esm/esmnode.js +0 -8
- package/lib/transpilers/esm/esmnode.js.map +0 -1
- package/lib/transpilers/esm/esmvue.d.ts +0 -1
- package/lib/transpilers/esm/esmvue.js +0 -29
- package/lib/transpilers/esm/esmvue.js.map +0 -1
- package/lib/transpilers/esm/tsnode-esm.d.ts +0 -1
- package/lib/transpilers/esm/tsnode-esm.js +0 -25
- package/lib/transpilers/esm/tsnode-esm.js.map +0 -1
- package/lib/transpilers/esm/tsnode-exp-esm.d.ts +0 -1
- package/lib/transpilers/esm/tsnode-exp-esm.js +0 -19
- package/lib/transpilers/esm/tsnode-exp-esm.js.map +0 -1
- package/lib/transpilers/esm/tsvue-esm.d.ts +0 -1
- package/lib/transpilers/esm/tsvue-esm.js +0 -40
- package/lib/transpilers/esm/tsvue-esm.js.map +0 -1
- package/lib/transpilers/esm/tsvue-exp-esm.d.ts +0 -1
- package/lib/transpilers/esm/tsvue-exp-esm.js +0 -40
- package/lib/transpilers/esm/tsvue-exp-esm.js.map +0 -1
- package/lib/transpilers/vue-sfc/compiler.d.ts +0 -7
- package/lib/transpilers/vue-sfc/compiler.js +0 -22
- package/lib/transpilers/vue-sfc/compiler.js.map +0 -1
- package/lib/transpilers/vue-sfc/index.d.ts +0 -23
- package/lib/transpilers/vue-sfc/index.js +0 -46
- package/lib/transpilers/vue-sfc/index.js.map +0 -1
- package/lib/transpilers/vue-sfc/main.d.ts +0 -8
- package/lib/transpilers/vue-sfc/main.js +0 -258
- package/lib/transpilers/vue-sfc/main.js.map +0 -1
- package/lib/transpilers/vue-sfc/script.d.ts +0 -5
- package/lib/transpilers/vue-sfc/script.js +0 -41
- package/lib/transpilers/vue-sfc/script.js.map +0 -1
- package/lib/transpilers/vue-sfc/template.d.ts +0 -8
- package/lib/transpilers/vue-sfc/template.js +0 -101
- package/lib/transpilers/vue-sfc/template.js.map +0 -1
- package/lib/transpilers/vue-sfc/types.d.ts +0 -55
- package/lib/transpilers/vue-sfc/types.js +0 -3
- package/lib/transpilers/vue-sfc/types.js.map +0 -1
- package/lib/transpilers/vue-sfc/utils/descriptorCache.d.ts +0 -13
- package/lib/transpilers/vue-sfc/utils/descriptorCache.js +0 -68
- package/lib/transpilers/vue-sfc/utils/descriptorCache.js.map +0 -1
- package/lib/transpilers/vue-sfc/utils/error.d.ts +0 -3
- package/lib/transpilers/vue-sfc/utils/error.js +0 -23
- package/lib/transpilers/vue-sfc/utils/error.js.map +0 -1
- package/lib/transpilers/vue-sfc/utils/query.d.ts +0 -13
- package/lib/transpilers/vue-sfc/utils/query.js +0 -36
- package/lib/transpilers/vue-sfc/utils/query.js.map +0 -1
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
|
|
package/bin/cucumber-tsflow
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
require('../lib/cli/run.js').default();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
require('../lib/cli/run.js').default();
|
package/bin/cucumber-tsflow.js
CHANGED
|
File without changes
|
|
@@ -4,4 +4,4 @@ import { ITsFlowRunConfiguration } from '../runtime/types';
|
|
|
4
4
|
export interface IConfigurationExt extends IConfiguration {
|
|
5
5
|
experimentalDecorators: boolean;
|
|
6
6
|
}
|
|
7
|
-
export declare function convertConfiguration(
|
|
7
|
+
export declare function convertConfiguration(cucumberLogger: ILogger, flatConfiguration: IConfigurationExt, env: typeof process.env): Promise<ITsFlowRunConfiguration>;
|
|
@@ -2,22 +2,37 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertConfiguration = convertConfiguration;
|
|
4
4
|
const index_1 = require("@cucumber/cucumber/lib/configuration/index");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const tsflow_logger_1 = require("../utils/tsflow-logger");
|
|
6
|
+
const logger = (0, tsflow_logger_1.createLogger)('convert');
|
|
7
|
+
async function convertConfiguration(cucumberLogger, flatConfiguration, env) {
|
|
8
|
+
logger.checkpoint('convertConfiguration() started');
|
|
9
|
+
try {
|
|
10
|
+
logger.checkpoint('Building sources config', {
|
|
11
|
+
pathCount: flatConfiguration.paths?.length,
|
|
12
|
+
language: flatConfiguration.language
|
|
13
|
+
});
|
|
14
|
+
const sources = {
|
|
8
15
|
paths: flatConfiguration.paths,
|
|
9
16
|
defaultDialect: flatConfiguration.language,
|
|
10
17
|
names: flatConfiguration.name,
|
|
11
18
|
tagExpression: flatConfiguration.tags,
|
|
12
19
|
order: flatConfiguration.order
|
|
13
|
-
}
|
|
14
|
-
support
|
|
20
|
+
};
|
|
21
|
+
logger.checkpoint('Building support config', {
|
|
22
|
+
requireModules: flatConfiguration.requireModule,
|
|
23
|
+
loaders: flatConfiguration.loader
|
|
24
|
+
});
|
|
25
|
+
const support = {
|
|
15
26
|
requireModules: flatConfiguration.requireModule,
|
|
16
27
|
requirePaths: flatConfiguration.require,
|
|
17
28
|
importPaths: flatConfiguration.import,
|
|
18
29
|
loaders: flatConfiguration.loader
|
|
19
|
-
}
|
|
20
|
-
runtime
|
|
30
|
+
};
|
|
31
|
+
logger.checkpoint('Building runtime config', {
|
|
32
|
+
parallel: flatConfiguration.parallel,
|
|
33
|
+
experimentalDecorators: flatConfiguration.experimentalDecorators
|
|
34
|
+
});
|
|
35
|
+
const runtime = {
|
|
21
36
|
dryRun: flatConfiguration.dryRun,
|
|
22
37
|
experimentalDecorators: flatConfiguration.experimentalDecorators,
|
|
23
38
|
failFast: flatConfiguration.failFast,
|
|
@@ -27,25 +42,53 @@ async function convertConfiguration(logger, flatConfiguration, env) {
|
|
|
27
42
|
retryTagFilter: flatConfiguration.retryTagFilter,
|
|
28
43
|
strict: flatConfiguration.strict,
|
|
29
44
|
worldParameters: flatConfiguration.worldParameters
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
45
|
+
};
|
|
46
|
+
logger.checkpoint('Building formats config');
|
|
47
|
+
const formats = convertFormats(cucumberLogger, flatConfiguration, env);
|
|
48
|
+
logger.checkpoint('convertConfiguration() completed');
|
|
49
|
+
return {
|
|
50
|
+
sources,
|
|
51
|
+
support,
|
|
52
|
+
runtime,
|
|
53
|
+
formats
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
logger.error('convertConfiguration() failed', error);
|
|
58
|
+
throw new Error(`Failed to convert configuration: ${error.message}`, { cause: error });
|
|
59
|
+
}
|
|
33
60
|
}
|
|
34
|
-
function convertFormats(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
61
|
+
function convertFormats(cucumberLogger, flatConfiguration, env) {
|
|
62
|
+
logger.checkpoint('convertFormats() started', { formatCount: flatConfiguration.format?.length });
|
|
63
|
+
try {
|
|
64
|
+
const splitFormats = flatConfiguration.format.map((item, index) => {
|
|
65
|
+
const result = Array.isArray(item) ? item : (0, index_1.splitFormatDescriptor)(cucumberLogger, item);
|
|
66
|
+
logger.checkpoint(`Format[${index}] processed`, { input: item, output: result });
|
|
67
|
+
return result;
|
|
68
|
+
});
|
|
69
|
+
const stdout = [...splitFormats].reverse().find(([, target]) => !target)?.[0] ?? 'progress';
|
|
70
|
+
logger.checkpoint('Stdout format', { stdout });
|
|
71
|
+
const files = splitFormats
|
|
39
72
|
.filter(([, target]) => !!target)
|
|
40
73
|
.reduce((mapped, [type, target]) => {
|
|
41
74
|
return {
|
|
42
75
|
...mapped,
|
|
43
76
|
[target]: type
|
|
44
77
|
};
|
|
45
|
-
}, {})
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
78
|
+
}, {});
|
|
79
|
+
logger.checkpoint('File formats', { files });
|
|
80
|
+
const publish = makePublishConfig(flatConfiguration, env);
|
|
81
|
+
return {
|
|
82
|
+
stdout,
|
|
83
|
+
files,
|
|
84
|
+
publish,
|
|
85
|
+
options: flatConfiguration.formatOptions
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
logger.error('convertFormats() failed', error);
|
|
90
|
+
throw new Error(`Failed to convert formats: ${error.message}`, { cause: error });
|
|
91
|
+
}
|
|
49
92
|
}
|
|
50
93
|
function makePublishConfig(flatConfiguration, env) {
|
|
51
94
|
const enabled = isPublishing(flatConfiguration, env);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-configuration.js","sourceRoot":"","sources":["../../src/api/convert-configuration.ts"],"names":[],"mappings":";;AAYA,
|
|
1
|
+
{"version":3,"file":"convert-configuration.js","sourceRoot":"","sources":["../../src/api/convert-configuration.ts"],"names":[],"mappings":";;AAYA,oDA8DC;AA1ED,sEAAmH;AAInH,0DAAsD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YAAY,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC;IACrD,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO;QACN,GAAG,EAAE,GAAG,CAAC,oBAAoB;QAC7B,KAAK,EAAE,GAAG,CAAC,sBAAsB;KACjC,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,iBAAiC,EAAE,GAAuB;IAC/E,OAAO,CACN,iBAAiB,CAAC,OAAO;QACzB,IAAA,sBAAc,EAAC,GAAG,CAAC,wBAAwB,CAAC;QAC5C,GAAG,CAAC,sBAAsB,KAAK,SAAS,CACxC,CAAC;AACH,CAAC","sourcesContent":["import { IConfiguration, isTruthyString, splitFormatDescriptor } from '@cucumber/cucumber/lib/configuration/index';\r\nimport { IPublishConfig } from '@cucumber/cucumber/lib/publish/index';\r\nimport { ILogger } from '@cucumber/cucumber/lib/environment/index';\r\nimport { ITsFlowRunConfiguration } from '../runtime/types';\r\nimport { createLogger } from '../utils/tsflow-logger';\r\n\r\nconst logger = createLogger('convert');\r\n\r\nexport interface IConfigurationExt extends IConfiguration {\r\n\texperimentalDecorators: boolean;\r\n}\r\n\r\nexport async function convertConfiguration(\r\n\tcucumberLogger: ILogger,\r\n\tflatConfiguration: IConfigurationExt,\r\n\tenv: typeof process.env\r\n): Promise<ITsFlowRunConfiguration> {\r\n\tlogger.checkpoint('convertConfiguration() started');\r\n\r\n\ttry {\r\n\t\tlogger.checkpoint('Building sources config', {\r\n\t\t\tpathCount: flatConfiguration.paths?.length,\r\n\t\t\tlanguage: flatConfiguration.language\r\n\t\t});\r\n\t\tconst sources = {\r\n\t\t\tpaths: flatConfiguration.paths,\r\n\t\t\tdefaultDialect: flatConfiguration.language,\r\n\t\t\tnames: flatConfiguration.name,\r\n\t\t\ttagExpression: flatConfiguration.tags,\r\n\t\t\torder: flatConfiguration.order\r\n\t\t};\r\n\r\n\t\tlogger.checkpoint('Building support config', {\r\n\t\t\trequireModules: flatConfiguration.requireModule,\r\n\t\t\tloaders: flatConfiguration.loader\r\n\t\t});\r\n\t\tconst support = {\r\n\t\t\trequireModules: flatConfiguration.requireModule,\r\n\t\t\trequirePaths: flatConfiguration.require,\r\n\t\t\timportPaths: flatConfiguration.import,\r\n\t\t\tloaders: flatConfiguration.loader\r\n\t\t};\r\n\r\n\t\tlogger.checkpoint('Building runtime config', {\r\n\t\t\tparallel: flatConfiguration.parallel,\r\n\t\t\texperimentalDecorators: flatConfiguration.experimentalDecorators\r\n\t\t});\r\n\t\tconst runtime = {\r\n\t\t\tdryRun: flatConfiguration.dryRun,\r\n\t\t\texperimentalDecorators: flatConfiguration.experimentalDecorators,\r\n\t\t\tfailFast: flatConfiguration.failFast,\r\n\t\t\tfilterStacktraces: !flatConfiguration.backtrace,\r\n\t\t\tparallel: flatConfiguration.parallel,\r\n\t\t\tretry: flatConfiguration.retry,\r\n\t\t\tretryTagFilter: flatConfiguration.retryTagFilter,\r\n\t\t\tstrict: flatConfiguration.strict,\r\n\t\t\tworldParameters: flatConfiguration.worldParameters\r\n\t\t};\r\n\r\n\t\tlogger.checkpoint('Building formats config');\r\n\t\tconst formats = convertFormats(cucumberLogger, flatConfiguration, env);\r\n\r\n\t\tlogger.checkpoint('convertConfiguration() completed');\r\n\r\n\t\treturn {\r\n\t\t\tsources,\r\n\t\t\tsupport,\r\n\t\t\truntime,\r\n\t\t\tformats\r\n\t\t};\r\n\t} catch (error: any) {\r\n\t\tlogger.error('convertConfiguration() failed', error);\r\n\t\tthrow new Error(`Failed to convert configuration: ${error.message}`, { cause: error });\r\n\t}\r\n}\r\n\r\nfunction convertFormats(cucumberLogger: ILogger, flatConfiguration: IConfiguration, env: typeof process.env) {\r\n\tlogger.checkpoint('convertFormats() started', { formatCount: flatConfiguration.format?.length });\r\n\r\n\ttry {\r\n\t\tconst splitFormats: string[][] = flatConfiguration.format.map((item, index) => {\r\n\t\t\tconst result = Array.isArray(item) ? item : splitFormatDescriptor(cucumberLogger, item);\r\n\t\t\tlogger.checkpoint(`Format[${index}] processed`, { input: item, output: result });\r\n\t\t\treturn result;\r\n\t\t});\r\n\r\n\t\tconst stdout = [...splitFormats].reverse().find(([, target]) => !target)?.[0] ?? 'progress';\r\n\t\tlogger.checkpoint('Stdout format', { stdout });\r\n\r\n\t\tconst files = splitFormats\r\n\t\t\t.filter(([, target]) => !!target)\r\n\t\t\t.reduce((mapped, [type, target]) => {\r\n\t\t\t\treturn {\r\n\t\t\t\t\t...mapped,\r\n\t\t\t\t\t[target]: type\r\n\t\t\t\t};\r\n\t\t\t}, {});\r\n\t\tlogger.checkpoint('File formats', { files });\r\n\r\n\t\tconst publish = makePublishConfig(flatConfiguration, env);\r\n\r\n\t\treturn {\r\n\t\t\tstdout,\r\n\t\t\tfiles,\r\n\t\t\tpublish,\r\n\t\t\toptions: flatConfiguration.formatOptions\r\n\t\t};\r\n\t} catch (error: any) {\r\n\t\tlogger.error('convertFormats() failed', error);\r\n\t\tthrow new Error(`Failed to convert formats: ${error.message}`, { cause: error });\r\n\t}\r\n}\r\n\r\nfunction makePublishConfig(flatConfiguration: IConfiguration, env: typeof process.env): IPublishConfig | false {\r\n\tconst enabled = isPublishing(flatConfiguration, env);\r\n\tif (!enabled) {\r\n\t\treturn false;\r\n\t}\r\n\treturn {\r\n\t\turl: env.CUCUMBER_PUBLISH_URL,\r\n\t\ttoken: env.CUCUMBER_PUBLISH_TOKEN\r\n\t};\r\n}\r\n\r\nfunction isPublishing(flatConfiguration: IConfiguration, env: typeof process.env): boolean {\r\n\treturn (\r\n\t\tflatConfiguration.publish ||\r\n\t\tisTruthyString(env.CUCUMBER_PUBLISH_ENABLED) ||\r\n\t\tenv.CUCUMBER_PUBLISH_TOKEN !== undefined\r\n\t);\r\n}\r\n"]}
|
|
@@ -14,6 +14,8 @@ const gherkin_manager_1 = __importDefault(require("../gherkin/gherkin-manager"))
|
|
|
14
14
|
const ansis_1 = __importDefault(require("ansis"));
|
|
15
15
|
const console_1 = require("console");
|
|
16
16
|
const path_1 = require("path");
|
|
17
|
+
const tsflow_logger_1 = require("../utils/tsflow-logger");
|
|
18
|
+
const logger = (0, tsflow_logger_1.createLogger)('config');
|
|
17
19
|
/**
|
|
18
20
|
* Load user-authored configuration to be used in a test run.
|
|
19
21
|
*
|
|
@@ -22,8 +24,36 @@ const path_1 = require("path");
|
|
|
22
24
|
* @param environment - Project environment.
|
|
23
25
|
*/
|
|
24
26
|
const loadConfiguration = async (options = {}, environment = {}) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
logger.checkpoint('loadConfiguration() started', {
|
|
28
|
+
optionsFile: options.file,
|
|
29
|
+
optionsProfiles: options.profiles
|
|
30
|
+
});
|
|
31
|
+
let cwd;
|
|
32
|
+
let env;
|
|
33
|
+
let cucumberLogger;
|
|
34
|
+
try {
|
|
35
|
+
logger.checkpoint('Creating environment');
|
|
36
|
+
const made = (0, index_2.makeEnvironment)(environment);
|
|
37
|
+
cwd = made.cwd;
|
|
38
|
+
env = made.env;
|
|
39
|
+
cucumberLogger = made.logger;
|
|
40
|
+
logger.checkpoint('Environment created', { cwd });
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
logger.error('Failed to create environment', error);
|
|
44
|
+
throw new Error(`Failed to create environment: ${error.message}`, { cause: error });
|
|
45
|
+
}
|
|
46
|
+
// Locate config file
|
|
47
|
+
let configFile;
|
|
48
|
+
try {
|
|
49
|
+
logger.checkpoint('Locating config file', { providedFile: options.file });
|
|
50
|
+
configFile = options.file ?? (0, locate_file_1.locateFile)(cwd);
|
|
51
|
+
logger.checkpoint('Config file resolved', { configFile });
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
logger.error('Failed to locate config file', error);
|
|
55
|
+
throw new Error(`Failed to locate configuration file: ${error.message}`, { cause: error });
|
|
56
|
+
}
|
|
27
57
|
let msg = '';
|
|
28
58
|
if (configFile) {
|
|
29
59
|
msg = `Loading configuration from "${configFile}".`;
|
|
@@ -34,150 +64,242 @@ const loadConfiguration = async (options = {}, environment = {}) => {
|
|
|
34
64
|
else {
|
|
35
65
|
msg = 'No configuration file found';
|
|
36
66
|
}
|
|
37
|
-
// log this to debug and console
|
|
38
67
|
const consoleLogger = new console_1.Console(environment.stdout, environment.stderr);
|
|
39
|
-
|
|
68
|
+
cucumberLogger.debug(msg);
|
|
40
69
|
consoleLogger.log(ansis_1.default.cyanBright(msg));
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
70
|
+
// Load profile configuration from file
|
|
71
|
+
let profileConfiguration = {};
|
|
72
|
+
if (configFile) {
|
|
73
|
+
try {
|
|
74
|
+
logger.checkpoint('Loading configuration from file', {
|
|
75
|
+
configFile,
|
|
76
|
+
profiles: options.profiles
|
|
77
|
+
});
|
|
78
|
+
profileConfiguration = await (0, index_1.fromFile)(cucumberLogger, cwd, configFile, options.profiles);
|
|
79
|
+
logger.checkpoint('Profile configuration loaded', {
|
|
80
|
+
keys: Object.keys(profileConfiguration),
|
|
81
|
+
transpiler: profileConfiguration.transpiler,
|
|
82
|
+
paths: profileConfiguration.paths
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
logger.error('Failed to load configuration from file', error, { configFile });
|
|
87
|
+
throw new Error(`Failed to load configuration from "${configFile}": ${error.message}`, { cause: error });
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// If a feature was passed in on command line, clear profile paths
|
|
91
|
+
const paths = options.provided?.paths;
|
|
47
92
|
if (paths && paths?.length > 0) {
|
|
93
|
+
logger.checkpoint('Clearing profile paths (feature passed via CLI)', { providedPaths: paths });
|
|
48
94
|
profileConfiguration.paths = [];
|
|
49
95
|
}
|
|
50
|
-
|
|
51
|
-
|
|
96
|
+
// Merge configurations
|
|
97
|
+
let original;
|
|
98
|
+
try {
|
|
99
|
+
logger.checkpoint('Merging configurations');
|
|
100
|
+
const parsedProvided = (0, index_1.parseConfiguration)(cucumberLogger, 'Provided', options.provided);
|
|
101
|
+
logger.checkpoint('Provided configuration parsed', { parsedKeys: Object.keys(parsedProvided) });
|
|
102
|
+
original = (0, index_1.mergeConfigurations)(index_1.DEFAULT_CONFIGURATION, profileConfiguration, parsedProvided);
|
|
103
|
+
logger.checkpoint('Configurations merged', {
|
|
104
|
+
transpiler: original.transpiler,
|
|
105
|
+
experimentalDecorators: original.experimentalDecorators,
|
|
106
|
+
pathCount: original.paths?.length
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
logger.error('Failed to merge configurations', error);
|
|
111
|
+
throw new Error(`Failed to merge configurations: ${error.message}`, { cause: error });
|
|
112
|
+
}
|
|
113
|
+
// Configure experimental decorators
|
|
52
114
|
if (original.experimentalDecorators === undefined) {
|
|
53
115
|
original.experimentalDecorators = false;
|
|
54
116
|
}
|
|
55
117
|
const experimentalDecorators = original.experimentalDecorators;
|
|
56
118
|
global.experimentalDecorators = experimentalDecorators;
|
|
57
|
-
process.env.CUCUMBER_EXPERIMENTAL_DECORATORS = String(experimentalDecorators);
|
|
119
|
+
process.env.CUCUMBER_EXPERIMENTAL_DECORATORS = String(experimentalDecorators);
|
|
120
|
+
logger.checkpoint('Experimental decorators configured', { experimentalDecorators });
|
|
58
121
|
/**
|
|
59
122
|
* Ensures JSDOM environment is initialized before any test files are loaded.
|
|
60
|
-
* This adds the Vue-specific JSDOM setup to the beginning of Cucumber's require array,
|
|
61
|
-
* establishing the DOM environment needed for Vue component testing.
|
|
62
|
-
*
|
|
63
|
-
* Must run before test execution begins (mise en place for Vue testing).
|
|
64
123
|
*/
|
|
65
124
|
const initJsDom = () => {
|
|
66
|
-
|
|
125
|
+
logger.checkpoint('Initializing JSDOM setup');
|
|
67
126
|
try {
|
|
68
127
|
const setupPath = require.resolve('@lynxwall/cucumber-tsflow/lib/transpilers/esm/vue-jsdom-setup');
|
|
128
|
+
logger.checkpoint('JSDOM setup path resolved', { setupPath });
|
|
69
129
|
original.require.unshift(setupPath);
|
|
70
130
|
}
|
|
71
131
|
catch (e) {
|
|
72
|
-
|
|
132
|
+
logger.checkpoint('require.resolve failed, using fallback', { error: e.message });
|
|
73
133
|
const setupPath = (0, path_1.join)(__dirname, '../../transpilers/esm/vue-jsdom-setup.mjs');
|
|
134
|
+
logger.checkpoint('JSDOM setup fallback path', { setupPath });
|
|
74
135
|
original.require.unshift(setupPath);
|
|
75
136
|
}
|
|
76
137
|
};
|
|
138
|
+
// Configure transpiler
|
|
77
139
|
if (original.transpiler) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
140
|
+
logger.checkpoint('Configuring transpiler', { transpiler: original.transpiler });
|
|
141
|
+
try {
|
|
142
|
+
switch (original.transpiler) {
|
|
143
|
+
case 'es-vue':
|
|
144
|
+
logger.checkpoint('Adding es-vue requireModule');
|
|
145
|
+
original.requireModule.push('@lynxwall/cucumber-tsflow/lib/transpilers/esvue');
|
|
146
|
+
break;
|
|
147
|
+
case 'ts-vue': {
|
|
148
|
+
const module = experimentalDecorators ? 'tsvue-exp' : 'tsvue';
|
|
149
|
+
logger.checkpoint('Adding ts-vue requireModule', { module });
|
|
150
|
+
original.requireModule.push(`@lynxwall/cucumber-tsflow/lib/transpilers/${module}`);
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
case 'es-node':
|
|
154
|
+
logger.checkpoint('Adding es-node requireModule');
|
|
155
|
+
original.requireModule.push('@lynxwall/cucumber-tsflow/lib/transpilers/esnode');
|
|
156
|
+
break;
|
|
157
|
+
case 'ts-node': {
|
|
158
|
+
const module = experimentalDecorators ? 'tsnode-exp' : 'tsnode';
|
|
159
|
+
logger.checkpoint('Adding ts-node requireModule', { module });
|
|
160
|
+
original.requireModule.push(`@lynxwall/cucumber-tsflow/lib/transpilers/${module}`);
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
case 'ts-node-esm':
|
|
164
|
+
logger.checkpoint('Adding ts-node-esm loader');
|
|
165
|
+
original.loader.push('@lynxwall/cucumber-tsflow/lib/transpilers/esm/tsnode-loader');
|
|
166
|
+
break;
|
|
167
|
+
case 'es-node-esm':
|
|
168
|
+
logger.checkpoint('Adding es-node-esm loader');
|
|
169
|
+
original.loader.push('@lynxwall/cucumber-tsflow/lib/transpilers/esm/esnode-loader');
|
|
170
|
+
break;
|
|
171
|
+
case 'ts-vue-esm':
|
|
172
|
+
logger.checkpoint('Adding ts-vue-esm loader + JSDOM');
|
|
173
|
+
original.loader.push('@lynxwall/cucumber-tsflow/lib/transpilers/esm/vue-loader');
|
|
174
|
+
initJsDom();
|
|
175
|
+
break;
|
|
176
|
+
case 'es-vue-esm':
|
|
177
|
+
logger.checkpoint('Adding es-vue-esm loader + JSDOM');
|
|
178
|
+
original.loader.push('@lynxwall/cucumber-tsflow/lib/transpilers/esm/esvue-loader');
|
|
179
|
+
initJsDom();
|
|
180
|
+
break;
|
|
181
|
+
default:
|
|
182
|
+
logger.checkpoint('No built-in transpiler (user-provided expected)', {
|
|
183
|
+
transpiler: original.transpiler
|
|
184
|
+
});
|
|
185
|
+
break;
|
|
113
186
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
187
|
+
logger.checkpoint('Transpiler configured', {
|
|
188
|
+
loaders: original.loader,
|
|
189
|
+
requireModules: original.requireModule,
|
|
190
|
+
requires: original.require
|
|
191
|
+
});
|
|
117
192
|
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
logger.error('Failed to configure transpiler', error, { transpiler: original.transpiler });
|
|
195
|
+
throw new Error(`Failed to configure transpiler "${original.transpiler}": ${error.message}`, { cause: error });
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
logger.checkpoint('No transpiler specified');
|
|
118
200
|
}
|
|
119
|
-
//
|
|
201
|
+
// Set snippet syntax
|
|
120
202
|
if (!original.formatOptions.snippetSyntax) {
|
|
121
203
|
original.formatOptions.snippetSyntax = '@lynxwall/cucumber-tsflow/snippet';
|
|
122
204
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
205
|
+
logger.checkpoint('Snippet syntax configured', { snippetSyntax: original.formatOptions.snippetSyntax });
|
|
206
|
+
// Process format options
|
|
207
|
+
logger.checkpoint('Processing format options', { formatCount: original.format?.length });
|
|
208
|
+
try {
|
|
209
|
+
for (let idx = 0; idx < original.format.length; idx++) {
|
|
210
|
+
if (typeof original.format[idx] === 'string') {
|
|
211
|
+
const formatItem = original.format[idx];
|
|
212
|
+
if (formatItem.startsWith('behave:')) {
|
|
213
|
+
original.format[idx] = formatItem.replace('behave', '@lynxwall/cucumber-tsflow/behave');
|
|
214
|
+
logger.checkpoint('Replaced behave format', { index: idx });
|
|
215
|
+
}
|
|
129
216
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
217
|
+
else if (original.format[idx].length > 0) {
|
|
218
|
+
const formatItem = original.format[idx][0];
|
|
219
|
+
if (formatItem.startsWith('behave')) {
|
|
220
|
+
const newVal = formatItem.replace('behave', '@lynxwall/cucumber-tsflow/behave');
|
|
221
|
+
original.format[idx] = original.format[idx].length > 1 ? [newVal, original.format[idx][1]] : [newVal];
|
|
222
|
+
logger.checkpoint('Replaced behave format (array)', { index: idx });
|
|
223
|
+
}
|
|
136
224
|
}
|
|
137
225
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
226
|
+
for (let idx = 0; idx < original.format.length; idx++) {
|
|
227
|
+
if (typeof original.format[idx] === 'string') {
|
|
228
|
+
const formatItem = original.format[idx];
|
|
229
|
+
if (formatItem.startsWith('junitbamboo:')) {
|
|
230
|
+
original.format[idx] = formatItem.replace('junitbamboo', '@lynxwall/cucumber-tsflow/junitbamboo');
|
|
231
|
+
logger.checkpoint('Replaced junitbamboo format', { index: idx });
|
|
232
|
+
}
|
|
145
233
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
234
|
+
else if (original.format[idx].length > 0) {
|
|
235
|
+
const formatItem = original.format[idx][0];
|
|
236
|
+
if (formatItem.startsWith('junitbamboo')) {
|
|
237
|
+
const newVal = formatItem.replace('junitbamboo', '@lynxwall/cucumber-tsflow/junitbamboo');
|
|
238
|
+
original.format[idx] = original.format[idx].length > 1 ? [newVal, original.format[idx][1]] : [newVal];
|
|
239
|
+
logger.checkpoint('Replaced junitbamboo format (array)', { index: idx });
|
|
240
|
+
}
|
|
152
241
|
}
|
|
153
242
|
}
|
|
243
|
+
logger.checkpoint('Format options processed');
|
|
154
244
|
}
|
|
155
|
-
|
|
245
|
+
catch (error) {
|
|
246
|
+
logger.error('Failed to process format options', error);
|
|
247
|
+
throw new Error(`Failed to process format options: ${error.message}`, { cause: error });
|
|
248
|
+
}
|
|
249
|
+
// Process debugFile
|
|
156
250
|
if ((0, helpers_1.hasStringValue)(original.debugFile)) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
251
|
+
logger.checkpoint('Processing debugFile', { debugFile: original.debugFile });
|
|
252
|
+
try {
|
|
253
|
+
const gherkin = new gherkin_manager_1.default();
|
|
254
|
+
await gherkin.loadFeatures(original.paths);
|
|
255
|
+
const features = gherkin.findFeaturesByStepFile(original.debugFile);
|
|
256
|
+
if (features.length > 0) {
|
|
257
|
+
original.paths = [];
|
|
258
|
+
features.forEach(x => original.paths.push(x.featureFile));
|
|
259
|
+
logger.checkpoint('Debug features found', { featureCount: features.length });
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
cucumberLogger.warn(ansis_1.default.yellow(`\nUnable to find feature for debugFile: ${original.debugFile}`));
|
|
263
|
+
cucumberLogger.warn(ansis_1.default.yellow('All tests will be executed\n'));
|
|
264
|
+
logger.checkpoint('No features found for debugFile');
|
|
265
|
+
}
|
|
164
266
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
logger.warn(ansis_1.default.yellow('All tests will be executed\n'));
|
|
267
|
+
catch (error) {
|
|
268
|
+
logger.error('Failed to process debugFile', error, { debugFile: original.debugFile });
|
|
269
|
+
throw new Error(`Failed to process debugFile "${original.debugFile}": ${error.message}`, { cause: error });
|
|
169
270
|
}
|
|
170
271
|
}
|
|
171
|
-
//
|
|
172
|
-
// if not, default it to false
|
|
272
|
+
// Configure Vue style
|
|
173
273
|
if (original.enableVueStyle === null || original.enableVueStyle === undefined) {
|
|
174
274
|
original.enableVueStyle = false;
|
|
175
275
|
}
|
|
176
|
-
// set our global parameter used by the Vue transpiler
|
|
177
|
-
// to determine if Vue Style Blocks should be enabled
|
|
178
276
|
global.enableVueStyle = original.enableVueStyle;
|
|
179
|
-
(
|
|
180
|
-
|
|
277
|
+
logger.checkpoint('Vue style configured', { enableVueStyle: original.enableVueStyle });
|
|
278
|
+
// Validate configuration
|
|
279
|
+
try {
|
|
280
|
+
logger.checkpoint('Validating configuration');
|
|
281
|
+
(0, validate_configuration_1.validateConfiguration)(original, cucumberLogger);
|
|
282
|
+
logger.checkpoint('Configuration validated');
|
|
283
|
+
}
|
|
284
|
+
catch (error) {
|
|
285
|
+
logger.error('Configuration validation failed', error);
|
|
286
|
+
throw new Error(`Configuration validation failed: ${error.message}`, { cause: error });
|
|
287
|
+
}
|
|
288
|
+
// Convert configuration
|
|
289
|
+
let runnable;
|
|
290
|
+
try {
|
|
291
|
+
logger.checkpoint('Converting configuration');
|
|
292
|
+
runnable = await (0, convert_configuration_1.convertConfiguration)(cucumberLogger, original, env);
|
|
293
|
+
logger.checkpoint('Configuration converted', {
|
|
294
|
+
importPaths: runnable.support?.importPaths,
|
|
295
|
+
loaders: runnable.support?.loaders
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
catch (error) {
|
|
299
|
+
logger.error('Failed to convert configuration', error);
|
|
300
|
+
throw new Error(`Failed to convert configuration: ${error.message}`, { cause: error });
|
|
301
|
+
}
|
|
302
|
+
logger.checkpoint('loadConfiguration() completed');
|
|
181
303
|
return {
|
|
182
304
|
useConfiguration: original,
|
|
183
305
|
runConfiguration: runnable
|