@@ -66,25 +66,32 @@ export function buildArgs(runCfg: CucumberRunnerConfig, cucumberBin: string) {
66
66
}
67
67
68
68
/**
69
- * Normalizes a Cucumber format string by ensuring it is in the form of `"key":"value"` .
69
+ * Normalizes a Cucumber-js format string.
70
70
*
71
- * @param {string } format - The input format string, which can be in various forms:
71
+ * For structured inputs (`key:value` or `"key:value"`), returns a string in the
72
+ * form `"key":"value"`, with the asset directory prepended to relative paths.
73
+ * For simple inputs (e.g., `progress-bar`), returns the input as-is.
74
+ *
75
+ * @param {string } format - The input format string. Examples include:
72
76
* - `"key:value"`
73
77
* - `"key":"value"`
74
78
* - `key:value`
75
- * @param {string } assetDir - The asset directory.
76
- * @throws {Error } If the input format is invalid (e.g., missing a colon separator).
77
- * @returns {string } The normalized format string in the form of `"key":"value"`,
78
- * with the asset directory prepended to relative paths.
79
+ * - `progress-bar`
80
+ * @param {string } assetDir - The directory to prepend to the value for relative paths.
81
+ * @returns {string } The normalized format string. For structured inputs, it returns
82
+ * a string in the form `"key":"value"`. For simple inputs, it
83
+ * returns the input unchanged.
79
84
*
80
85
* Example:
81
- * Input: `"html:formatter/report.html"`, `"/project/assets"`
82
- * Output: `"html":"/project/assets/formatter/report.html"`
86
+ * - Input: `"html":"formatter/report.html"`, `"/project/assets"`
87
+ * Output: `"html":"/project/assets/formatter/report.html"`
88
+ * - Input: `"progress-bar"`, `"/project/assets"`
89
+ * Output: `"progress-bar"`
83
90
*/
84
91
export function normalizeFormat ( format : string , assetDir : string ) : string {
85
92
const match = format . match ( / ^ " ? ( [ ^ : ] + ) : " ? ( [ ^ " ] + ) " ? $ / ) ;
86
93
if ( ! match ) {
87
- throw new Error ( `Invalid format: ${ format } ` ) ;
94
+ return format ;
88
95
}
89
96
90
97
let [ , key , value ] = match ;
0 commit comments