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

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

Open
pierpo opened this issue Nov 26, 2024 · 1 comment
Open

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

pierpo opened this issue Nov 26, 2024 · 1 comment

Comments

@pierpo
Copy link

pierpo commented Nov 26, 2024

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...

@pierpo
Copy link
Author

pierpo commented Nov 26, 2024

I guess the solution would probably be inside this:

options.testNamePattern = shellQuote(

But I never managed to build the extension myself and run it locally so I can't manage to contribute 🙈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant