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

Double escaping code in arrays #2426

Closed
6 tasks done
cyberalien opened this issue Dec 4, 2022 · 0 comments · Fixed by #2430
Closed
6 tasks done

Double escaping code in arrays #2426

cyberalien opened this issue Dec 4, 2022 · 0 comments · Fixed by #2430

Comments

@cyberalien
Copy link

Describe the bug

When comparing arrays, \ is double escaped.

Example:

expect(['\\u123']).toEqual(['\\123'])

Results in:

    Array [
  -   "\\\\123",
  +   "\\\\u123",
    ]

Same bug doesn't happen when comparing strings:

expect('\\u123').toEqual('\\123');

Results in:

 - Expected   "\\123"
  + Received   "\\u123"

Reproduction

Test this:

expect(['\\u123']).toEqual(['\\123'])

StackBlitz demo: https://stackblitz.com/edit/vitest-dev-vitest-mym1aa?file=test/basic.test.ts

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 7.17.0 - /usr/local/bin/npm
  npmPackages:
    vite: latest => 3.2.4 
    vitest: latest => 0.25.3

Used Package Manager

npm

Validations

@github-actions github-actions bot locked and limited conversation to collaborators Jun 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants