You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some cases, test arguments are skipped during title parameter injection.
To Reproduce
Consider the following Jest test:
classMyClass{constructor(value){this.value=value}}describe("Test arguments are skipped during title parameter injection",()=>{test.each([["%d",newObject("My object")]])("given \"%s\", returns %p",()=>{})})
Running it produces:
PASS test/unit/TestArgsSkipped.test.js
Test arguments are skipped during title parameter injection
✓ given "NaN", returns %p
The title parameters have not been substituted as expected. The first one, %s, has been substituted by the (non-)number NaN, suggesting some confusion with the actual injected value of %d, and the second one, %p has not subtituted at all.
From what I observed, two conditions must be met at the same time for this to happen:
Having test arguments looking like parameter placeholder themselves: %d in my example
Having certain object arguments - does seem to happen with all prototypes, perhaps the presence of a toString function matters
Expected behavior
PASS test/unit/TestArgsSkipped.test.js
Test arguments are skipped during title parameter injection
✓ given "%d", returns {"value": "My object"} (1ms)
Link to repl or repo (highly encouraged)
Cannot provide this, since test.each seems to have been introduced in Jest 23, whereas repl.it is currently using Jest 22.
Run npx envinfo --preset jest
Paste the results here:
npx: installed 1 in 0.737s
System:
OS: Linux 5.0 Arch Linux
CPU: (8) x64 Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
Binaries:
Node: 11.13.0 - /usr/bin/node
npm: 6.9.0 - /usr/bin/npm
npmPackages:
jest: ^24.7.1 => 24.7.1
The text was updated successfully, but these errors were encountered:
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.
🐛 Bug Report
In some cases, test arguments are skipped during title parameter injection.
To Reproduce
Consider the following Jest test:
Running it produces:
The title parameters have not been substituted as expected. The first one,
%s
, has been substituted by the (non-)numberNaN
, suggesting some confusion with the actual injected value of%d
, and the second one,%p
has not subtituted at all.From what I observed, two conditions must be met at the same time for this to happen:
%d
in my exampletoString
function mattersExpected behavior
Link to repl or repo (highly encouraged)
Cannot provide this, since
test.each
seems to have been introduced in Jest 23, whereas repl.it is currently using Jest 22.Run
npx envinfo --preset jest
Paste the results here:
The text was updated successfully, but these errors were encountered: