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

%% is not replaced correctly in name of test.each #11356

Closed
frozenbonito opened this issue Apr 29, 2021 · 1 comment · Fixed by #11364
Closed

%% is not replaced correctly in name of test.each #11356

frozenbonito opened this issue Apr 29, 2021 · 1 comment · Fixed by #11364

Comments

@frozenbonito
Copy link
Contributor

🐛 Bug Report

  1. %% consume an argument.
  2. When there is a character used in a format specifier such as d or s immediately after %% (e.g. %%d), % replaced from %% is considered as a prefix of format specifier.

To Reproduce

Steps to reproduce the behavior:

index.test.js

describe("test name should to be %", () => {
  test.each([[1, 2, 3]])("%%", (a, b, expected) => {
    expect(a + b).toBe(expected);
  });
});

describe("test name should to be %d", () => {
  test.each([[1, 2, 3]])("%%d", (a, b, expected) => {
    expect(a + b).toBe(expected);
  });
});

Run npx jest, then you can see the following:

$ npx jest
 PASS  ./index.test.js
  test name should to be %
    ✓ % 1 (1 ms)
  test name should to be %d
    ✓ 2 1

Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        0.244 s, estimated 1 s
Ran all test suites.

Expected behavior

$ npx jest
 PASS  ./index.test.js
  test name should to be %
    ✓ % (1 ms)
  test name should to be %d
    ✓ %d

Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        0.244 s, estimated 1 s
Ran all test suites.

Link to repl or repo (highly encouraged)

envinfo

  System:
    OS: Linux 4.19 Debian GNU/Linux 10 (buster) 10 (buster)
    CPU: (8) x64 Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
  Binaries:
    Node: 14.16.1 - ~/.nvm/versions/node/v14.16.1/bin/node
    npm: 7.11.1 - ~/.nvm/versions/node/v14.16.1/bin/npm
  npmPackages:
    jest: ^26.6.3 => 26.6.3 
@github-actions
Copy link

github-actions bot commented Jun 1, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 1, 2021
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.

1 participant