-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Labels
Description
π Bug Report
%%
consume an argument.- When there is a character used in a format specifier such as
d
ors
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