Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle spaces in the absolute path (#1845) #1847

Merged
merged 11 commits into from
Dec 15, 2021
3 changes: 2 additions & 1 deletion features/formatter_paths.feature
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ Feature: Formatter Paths
<duration-stat>
"""

@wip
eoola marked this conversation as resolved.
Show resolved Hide resolved
Scenario: Absolute path
Given "{{{tmpDir}}}" is an absolute path
When I run cucumber-js with `-f summary:{{{tmpDir}}}/summary.txt`
When I run cucumber-js with `-f summary:"{{{tmpDir}}}/summary.txt"`
Then the file "{{{tmpDir}}}/summary.txt" has the text:
"""
1 scenario (1 passed)
Expand Down
2 changes: 2 additions & 0 deletions src/cli/option_splitter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const OptionSplitter = {
split(option: string): string[] {
option = option.replace(/"/g, '')

const parts = option.split(/([^A-Z]):(?!\\)/)

const result = parts.reduce((memo: string[], part: string, i: number) => {
Expand Down
5 changes: 5 additions & 0 deletions src/cli/option_splitter_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ describe('OptionSplitter', () => {
input: '/custom/formatter:/formatter/output.txt',
output: ['/custom/formatter', '/formatter/output.txt'],
},
{
description: 'splits paths with quotes around them',
input: '/custom/formatter:"/formatter directory/output.txt"',
output: ['/custom/formatter', '/formatter directory/output.txt'],
},
{
description: 'splits absolute windows paths',
input: 'C:\\custom\\formatter:C:\\formatter\\output.txt',
Expand Down