Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- Fixed an issue where opening an unconfigured project from a git repository sub-directory (such as a monorepo package) skipped project setup. Additionally, the component testing setup wizard now reliably displays the auto-detected framework and bundler. Fixes [#27410](https://github.com/cypress-io/cypress/issues/27410) and [#29544](https://github.com/cypress-io/cypress/issues/29544). Fixed in [#34129](https://github.com/cypress-io/cypress/pull/34129) and [#34212](https://github.com/cypress-io/cypress/pull/34212).
- Fixed an issue where interacting with an element inside a horizontally-scrollable container could scroll the element to the container's right edge, placing it underneath a right-floating `position: sticky` or `position: fixed` element and causing the action to fail or land on the wrong element. Elements are now scrolled to their top, leftmost point as documented. Fixes [#33884](https://github.com/cypress-io/cypress/issues/33884). Fixed in [#34108](https://github.com/cypress-io/cypress/pull/34108).
- Fixed a regression in [15.17.0](#15-17-0) where `cypress run --spec` printed a spurious `The following --spec pattern did not match any spec files and will be ignored` warning for patterns that actually did match spec files, such as patterns using regex-style alternation groups (for example `cypress/e2e/(a|b)/*.js`). Fixes [#34160](https://github.com/cypress-io/cypress/issues/34160).
- Fixed an issue where a Cypress error message that interpolated a value containing a `$` sequence (such as `$&`, `` $` ``, `$'`, or `$$`, for example JSON-stringified data shown in a configuration validation error) could render with corrupted or duplicated text. Such values are now shown verbatim. Fixed in [#34220](https://github.com/cypress-io/cypress/pull/34220).

**Dependency Updates:**

Expand Down
5 changes: 4 additions & 1 deletion packages/errors/src/stripIndent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export const stripIndent = (strings: TemplateStringsArray, ...args: any[]): stri
let result = strippedLines.join('\n').trimLeft()

args.forEach((arg, i) => {
result = result.replace(`<<${i}>>`, `${arg}`)
// Use a replacer function so `$` sequences in the arg (`$&`, `$\``, `$'`,
// `$$`) are inserted literally rather than treated as special replacement
// patterns by String.prototype.replace.
result = result.replace(`<<${i}>>`, () => `${arg}`)
})

return result
Expand Down
8 changes: 8 additions & 0 deletions packages/errors/test/stripIndent.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,12 @@ Something went wrong.
- b
- c`.trimLeft())
})

it('inserts an argument containing $ replacement patterns verbatim', () => {
const arg = `a$&b$\`c$'d$$e$1f`

const str = stripIndent`You passed: ${arg}`

expect(str).toEqual(`You passed: ${arg}`)
})
})