Skip to content

[BUG] Multiline test names don't work properly #1204

@pierpo

Description

@pierpo

Describe the bug

My test names look like this:

    it(`
      Given a user requesting another user's personal info
      When they call the endpoint
      Then it returns a status 403
    `, async () => {

To Reproduce
Steps to reproduce the behavior:

  1. Name a test with a multiline template string
  2. Click on the button to run the single test
  3. See that the \n are not properly escaped when sent to the jest command line

Expected behavior

It should escape the \n of the test name to a string \n Given a user requesting another user's personal info\n When they call the endpoint in shell

Screenshots

Environment (please complete the following information):

  • vscode-jest version: v6.4.0
  • node -v: 20.18
  • npm -v or yarn --version: [e.g., npm 10.1.0]
  • jest or react-scripts (if you haven’t ejected) version: [e.g., jest 29.7.0]
  • your vscode-jest settings:
{
  "jest.enable": true,
  "jest.runMode": "on-demand",
  "jest.virtualFolders": [
    {
      "name": "unit",
      "runMode": "on-save",
      "jestCommandLine": "yarn test"
    },
    {
      "name": "e2e",
      "runMode": "on-demand",
      "jestCommandLine": "yarn test:e2e"
    }
  ]
}
  • Operating system: MacOS 14.4.1

Prerequisite

  • are you able to run jest from the command line? yes
  • where do you run jest CLI from? root directory
  • how do you run your tests from the command line? yarn test

Additional context
Add any other context about the problem here.


The fastest (and the most fun) way to resolve the issue is to submit a pull request yourself. If you are interested, please check out the contribution guide, we look forward to seeing your PR...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions