@lynxwall/cucumber-tsflow 7.4.1 → 7.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +226 -101
- package/lib/api/load-configuration.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 +285 -148
- 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 +194 -65
- 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 +6 -8
- 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/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;AAEtD,MAAM,MAAM,GAAG,IAAA,4BAAY,EAAC,SAAS,CAAC,CAAC;AAMhC,KAAK,UAAU,oBAAoB,CACzC,cAAuB,EACvB,iBAAoC,EACpC,GAAuB;IAEvB,MAAM,CAAC,UAAU,CAAC,gCAAgC,CAAC,CAAC;IAEpD,IAAI,CAAC;QACJ,MAAM,CAAC,UAAU,CAAC,yBAAyB,EAAE;YAC5C,SAAS,EAAE,iBAAiB,CAAC,KAAK,EAAE,MAAM;YAC1C,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;SACpC,CAAC,CAAC;QACH,MAAM,OAAO,GAAG;YACf,KAAK,EAAE,iBAAiB,CAAC,KAAK;YAC9B,cAAc,EAAE,iBAAiB,CAAC,QAAQ;YAC1C,KAAK,EAAE,iBAAiB,CAAC,IAAI;YAC7B,aAAa,EAAE,iBAAiB,CAAC,IAAI;Y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,EAAE,MAAM,CAAC,EAAE,EAAE;YAClC,OAAO;gBACN,GAAG,MAAM;gBACT,CAAC,MAAM,CAAC,EAAE,IAAI;aACd,CAAC;QACH,CAAC,EAAE,EAAE,CAAC,CAAC;QACR,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAE7C,MAAM,OAAO,GAAG,iBAAiB,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC;QAE1D,OAAO;YACN,MAAM;YACN,KAAK;YACL,OAAO;YACP,OAAO,EAAE,iBAAiB,CAAC,aAAa;SACxC,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACrB,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,8BAA8B,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAClF,CAAC;AACF,CAAC;AAED,SAAS,iBAAiB,CAAC,iBAAiC,EAAE,GAAuB;IACpF,MAAM,OAAO,GAAG,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,245 @@ 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 });
|
|
121
|
+
if (experimentalDecorators) {
|
|
122
|
+
consoleLogger.log(ansis_1.default.cyanBright('Using Experimental Decorators.'));
|
|
123
|
+
}
|
|
58
124
|
/**
|
|
59
125
|
* 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
126
|
*/
|
|
65
127
|
const initJsDom = () => {
|
|
66
|
-
|
|
128
|
+
logger.checkpoint('Initializing JSDOM setup');
|
|
67
129
|
try {
|
|
68
130
|
const setupPath = require.resolve('@lynxwall/cucumber-tsflow/lib/transpilers/esm/vue-jsdom-setup');
|
|
131
|
+
logger.checkpoint('JSDOM setup path resolved', { setupPath });
|
|
69
132
|
original.require.unshift(setupPath);
|
|
70
133
|
}
|
|
71
134
|
catch (e) {
|
|
72
|
-
|
|
135
|
+
logger.checkpoint('require.resolve failed, using fallback', { error: e.message });
|
|
73
136
|
const setupPath = (0, path_1.join)(__dirname, '../../transpilers/esm/vue-jsdom-setup.mjs');
|
|
137
|
+
logger.checkpoint('JSDOM setup fallback path', { setupPath });
|
|
74
138
|
original.require.unshift(setupPath);
|
|
75
139
|
}
|
|
76
140
|
};
|
|
141
|
+
// Configure transpiler
|
|
77
142
|
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
|
-
|
|
143
|
+
logger.checkpoint('Configuring transpiler', { transpiler: original.transpiler });
|
|
144
|
+
try {
|
|
145
|
+
switch (original.transpiler) {
|
|
146
|
+
case 'es-vue':
|
|
147
|
+
logger.checkpoint('Adding es-vue requireModule');
|
|
148
|
+
original.requireModule.push('@lynxwall/cucumber-tsflow/lib/transpilers/esvue');
|
|
149
|
+
break;
|
|
150
|
+
case 'ts-vue': {
|
|
151
|
+
const module = experimentalDecorators ? 'tsvue-exp' : 'tsvue';
|
|
152
|
+
logger.checkpoint('Adding ts-vue requireModule', { module });
|
|
153
|
+
original.requireModule.push(`@lynxwall/cucumber-tsflow/lib/transpilers/${module}`);
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
case 'es-node':
|
|
157
|
+
logger.checkpoint('Adding es-node requireModule');
|
|
158
|
+
original.requireModule.push('@lynxwall/cucumber-tsflow/lib/transpilers/esnode');
|
|
159
|
+
break;
|
|
160
|
+
case 'ts-node': {
|
|
161
|
+
const module = experimentalDecorators ? 'tsnode-exp' : 'tsnode';
|
|
162
|
+
logger.checkpoint('Adding ts-node requireModule', { module });
|
|
163
|
+
original.requireModule.push(`@lynxwall/cucumber-tsflow/lib/transpilers/${module}`);
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
case 'ts-node-esm':
|
|
167
|
+
logger.checkpoint('Adding ts-node-esm loader');
|
|
168
|
+
original.loader.push('@lynxwall/cucumber-tsflow/lib/transpilers/esm/tsnode-loader');
|
|
169
|
+
break;
|
|
170
|
+
case 'es-node-esm':
|
|
171
|
+
logger.checkpoint('Adding es-node-esm loader');
|
|
172
|
+
original.loader.push('@lynxwall/cucumber-tsflow/lib/transpilers/esm/esnode-loader');
|
|
173
|
+
break;
|
|
174
|
+
case 'ts-vue-esm':
|
|
175
|
+
logger.checkpoint('Adding ts-vue-esm loader + JSDOM');
|
|
176
|
+
original.loader.push('@lynxwall/cucumber-tsflow/lib/transpilers/esm/vue-loader');
|
|
177
|
+
initJsDom();
|
|
178
|
+
break;
|
|
179
|
+
case 'es-vue-esm':
|
|
180
|
+
logger.checkpoint('Adding es-vue-esm loader + JSDOM');
|
|
181
|
+
original.loader.push('@lynxwall/cucumber-tsflow/lib/transpilers/esm/esvue-loader');
|
|
182
|
+
initJsDom();
|
|
183
|
+
break;
|
|
184
|
+
default:
|
|
185
|
+
logger.checkpoint('No built-in transpiler (user-provided expected)', {
|
|
186
|
+
transpiler: original.transpiler
|
|
187
|
+
});
|
|
188
|
+
break;
|
|
113
189
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
190
|
+
logger.checkpoint('Transpiler configured', {
|
|
191
|
+
loaders: original.loader,
|
|
192
|
+
requireModules: original.requireModule,
|
|
193
|
+
requires: original.require
|
|
194
|
+
});
|
|
117
195
|
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
logger.error('Failed to configure transpiler', error, { transpiler: original.transpiler });
|
|
198
|
+
throw new Error(`Failed to configure transpiler "${original.transpiler}": ${error.message}`, { cause: error });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
logger.checkpoint('No transpiler specified');
|
|
118
203
|
}
|
|
119
|
-
//
|
|
204
|
+
// Set snippet syntax
|
|
120
205
|
if (!original.formatOptions.snippetSyntax) {
|
|
121
206
|
original.formatOptions.snippetSyntax = '@lynxwall/cucumber-tsflow/snippet';
|
|
122
207
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
208
|
+
logger.checkpoint('Snippet syntax configured', { snippetSyntax: original.formatOptions.snippetSyntax });
|
|
209
|
+
// Process format options
|
|
210
|
+
logger.checkpoint('Processing format options', { formatCount: original.format?.length });
|
|
211
|
+
try {
|
|
212
|
+
for (let idx = 0; idx < original.format.length; idx++) {
|
|
213
|
+
if (typeof original.format[idx] === 'string') {
|
|
214
|
+
const formatItem = original.format[idx];
|
|
215
|
+
if (formatItem.startsWith('behave:')) {
|
|
216
|
+
original.format[idx] = formatItem.replace('behave', '@lynxwall/cucumber-tsflow/behave');
|
|
217
|
+
logger.checkpoint('Replaced behave format', { index: idx });
|
|
218
|
+
}
|
|
129
219
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
220
|
+
else if (original.format[idx].length > 0) {
|
|
221
|
+
const formatItem = original.format[idx][0];
|
|
222
|
+
if (formatItem.startsWith('behave')) {
|
|
223
|
+
const newVal = formatItem.replace('behave', '@lynxwall/cucumber-tsflow/behave');
|
|
224
|
+
original.format[idx] = original.format[idx].length > 1 ? [newVal, original.format[idx][1]] : [newVal];
|
|
225
|
+
logger.checkpoint('Replaced behave format (array)', { index: idx });
|
|
226
|
+
}
|
|
136
227
|
}
|
|
137
228
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
229
|
+
for (let idx = 0; idx < original.format.length; idx++) {
|
|
230
|
+
if (typeof original.format[idx] === 'string') {
|
|
231
|
+
const formatItem = original.format[idx];
|
|
232
|
+
if (formatItem.startsWith('junitbamboo:')) {
|
|
233
|
+
original.format[idx] = formatItem.replace('junitbamboo', '@lynxwall/cucumber-tsflow/junitbamboo');
|
|
234
|
+
logger.checkpoint('Replaced junitbamboo format', { index: idx });
|
|
235
|
+
}
|
|
145
236
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
237
|
+
else if (original.format[idx].length > 0) {
|
|
238
|
+
const formatItem = original.format[idx][0];
|
|
239
|
+
if (formatItem.startsWith('junitbamboo')) {
|
|
240
|
+
const newVal = formatItem.replace('junitbamboo', '@lynxwall/cucumber-tsflow/junitbamboo');
|
|
241
|
+
original.format[idx] = original.format[idx].length > 1 ? [newVal, original.format[idx][1]] : [newVal];
|
|
242
|
+
logger.checkpoint('Replaced junitbamboo format (array)', { index: idx });
|
|
243
|
+
}
|
|
152
244
|
}
|
|
153
245
|
}
|
|
246
|
+
logger.checkpoint('Format options processed');
|
|
154
247
|
}
|
|
155
|
-
|
|
248
|
+
catch (error) {
|
|
249
|
+
logger.error('Failed to process format options', error);
|
|
250
|
+
throw new Error(`Failed to process format options: ${error.message}`, { cause: error });
|
|
251
|
+
}
|
|
252
|
+
// Process debugFile
|
|
156
253
|
if ((0, helpers_1.hasStringValue)(original.debugFile)) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
254
|
+
logger.checkpoint('Processing debugFile', { debugFile: original.debugFile });
|
|
255
|
+
try {
|
|
256
|
+
const gherkin = new gherkin_manager_1.default();
|
|
257
|
+
await gherkin.loadFeatures(original.paths);
|
|
258
|
+
const features = gherkin.findFeaturesByStepFile(original.debugFile);
|
|
259
|
+
if (features.length > 0) {
|
|
260
|
+
original.paths = [];
|
|
261
|
+
features.forEach(x => original.paths.push(x.featureFile));
|
|
262
|
+
logger.checkpoint('Debug features found', { featureCount: features.length });
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
cucumberLogger.warn(ansis_1.default.yellow(`\nUnable to find feature for debugFile: ${original.debugFile}`));
|
|
266
|
+
cucumberLogger.warn(ansis_1.default.yellow('All tests will be executed\n'));
|
|
267
|
+
logger.checkpoint('No features found for debugFile');
|
|
268
|
+
}
|
|
164
269
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
logger.warn(ansis_1.default.yellow('All tests will be executed\n'));
|
|
270
|
+
catch (error) {
|
|
271
|
+
logger.error('Failed to process debugFile', error, { debugFile: original.debugFile });
|
|
272
|
+
throw new Error(`Failed to process debugFile "${original.debugFile}": ${error.message}`, { cause: error });
|
|
169
273
|
}
|
|
170
274
|
}
|
|
171
|
-
//
|
|
172
|
-
// if not, default it to false
|
|
275
|
+
// Configure Vue style
|
|
173
276
|
if (original.enableVueStyle === null || original.enableVueStyle === undefined) {
|
|
174
277
|
original.enableVueStyle = false;
|
|
175
278
|
}
|
|
176
|
-
// set our global parameter used by the Vue transpiler
|
|
177
|
-
// to determine if Vue Style Blocks should be enabled
|
|
178
279
|
global.enableVueStyle = original.enableVueStyle;
|
|
179
|
-
(
|
|
180
|
-
|
|
280
|
+
logger.checkpoint('Vue style configured', { enableVueStyle: original.enableVueStyle });
|
|
281
|
+
// Validate configuration
|
|
282
|
+
try {
|
|
283
|
+
logger.checkpoint('Validating configuration');
|
|
284
|
+
(0, validate_configuration_1.validateConfiguration)(original, cucumberLogger);
|
|
285
|
+
logger.checkpoint('Configuration validated');
|
|
286
|
+
}
|
|
287
|
+
catch (error) {
|
|
288
|
+
logger.error('Configuration validation failed', error);
|
|
289
|
+
throw new Error(`Configuration validation failed: ${error.message}`, { cause: error });
|
|
290
|
+
}
|
|
291
|
+
// Convert configuration
|
|
292
|
+
let runnable;
|
|
293
|
+
try {
|
|
294
|
+
logger.checkpoint('Converting configuration');
|
|
295
|
+
runnable = await (0, convert_configuration_1.convertConfiguration)(cucumberLogger, original, env);
|
|
296
|
+
logger.checkpoint('Configuration converted', {
|
|
297
|
+
importPaths: runnable.support?.importPaths,
|
|
298
|
+
loaders: runnable.support?.loaders
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
catch (error) {
|
|
302
|
+
logger.error('Failed to convert configuration', error);
|
|
303
|
+
throw new Error(`Failed to convert configuration: ${error.message}`, { cause: error });
|
|
304
|
+
}
|
|
305
|
+
logger.checkpoint('loadConfiguration() completed');
|
|
181
306
|
return {
|
|
182
307
|
useConfiguration: original,
|
|
183
308
|
runConfiguration: runnable
|