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

fix: --spec now allows () in filename #29279

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
3 changes: 3 additions & 0 deletions cli/CHANGELOG.md
Expand Up @@ -7,6 +7,9 @@ _Released 4/16/2024 (PENDING)_

- Updated the Chrome flags to not show the "Enhanced Ad Privacy" dialog. Addresses [#29199](https://github.com/cypress-io/cypress/issues/29199).

**Bugfixes**
jennifer-shehane marked this conversation as resolved.
Show resolved Hide resolved
- Specs with () in the filename will no longer fail to load and now behave as any other spec. Fixes [#28509](https://github.com/cypress-io/cypress/issues/28509)
jennifer-shehane marked this conversation as resolved.
Show resolved Hide resolved
jennifer-shehane marked this conversation as resolved.
Show resolved Hide resolved

## 13.7.2

_Released 4/2/2024_
Expand Down
3 changes: 3 additions & 0 deletions packages/server/lib/util/args.js
Expand Up @@ -234,6 +234,9 @@ const parseSpecArgv = (pattern) => {
]
}

// Escape parentheses.
pattern = pattern.replace(/[()]/g, '\\$&')

/**
* Sanitizes a path's leftover commas.
*
Expand Down
7 changes: 7 additions & 0 deletions packages/server/test/unit/util/args_spec.js
Expand Up @@ -216,6 +216,13 @@ describe('lib/util/args', () => {
expect(options.spec[2]).to.eq(`${getCwd()}/cypress/integration/foo2/bar/baz/test.ts`)
expect(options.spec[3]).to.eq(`${getCwd()}/cypress/integration/foo3/bar/baz/foo4.ts`)
})

// https://github.com/cypress-io/cypress/issues/28509
it('correctly escapes parentheses in filename', function () {
const options = this.setup('--spec', 'cypress/integration/foo/bar/test().ts')

expect(options.spec[0]).to.eq(`${getCwd()}/cypress/integration/foo/bar/test\\(\\).ts`)
})
})

context('--tag', () => {
Expand Down