Skip to content

Commit

Permalink
fix(cucumber): bypass Cucumber OptionSplitter issue cucumber/cucumber…
Browse files Browse the repository at this point in the history
…-js#2326

Cucumber OptionSplitter seems to be having problems parsing Windows paths. Instead of relying on
OptionSplitter, Serenity/JS will now provide its formatter configuration as an array.

Related tickets: #2060
  • Loading branch information
jan-molak committed Nov 12, 2023
1 parent 9384181 commit a8ad995
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions packages/cucumber/src/adapter/CucumberCLIAdapter.ts
Expand Up @@ -128,14 +128,11 @@ export class CucumberCLIAdapter implements TestRunnerAdapter {
const output = this.output.get();

// https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md#ambiguous-colons-in-formats
const formatter = [
`"${ pathToSerenityListener }"`,
output.value() && `"${ output.value() }"`,
].filter(Boolean).join(':');

console.log('>> DEBUG formatter', formatter);

return await this.runWithCucumberApi(formatter, pathsToScenarios, output);
// https://github.com/cucumber/cucumber-js/issues/2326#issuecomment-1711701382
return await this.runWithCucumberApi([
pathToSerenityListener,
output.value() ?? undefined,
], pathsToScenarios, output);
}

// https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md
Expand All @@ -144,7 +141,7 @@ export class CucumberCLIAdapter implements TestRunnerAdapter {
return await this.runWithCucumberApi(`${ pathToSerenityListener }:${ output.value() }`, pathsToScenarios, output);
}

private async runWithCucumberApi(serenityFormatter: string, pathsToScenarios: string[], output: OutputDescriptor): Promise<void> {
private async runWithCucumberApi(serenityFormatter: string | [string, string?], pathsToScenarios: string[], output: OutputDescriptor): Promise<void> {
const configuration = this.options.asCucumberApiConfiguration();
const { loadConfiguration, loadSupport, runCucumber } = this.loader.require('@cucumber/cucumber/api');

Expand Down

0 comments on commit a8ad995

Please sign in to comment.