question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: replacment string for index of the test case for `.each` is wrong in documentation

See original GitHub issue

Version

27.4.5

Steps to reproduce

According to the documentation:

%# - Index of the test case. This means, this should show the index of the test case as the test name:

test.each(['a', 'b', 'c'])('%#', () => { expect(true).toBe(true); })

But it isn’t working and the reason is, that the actual implementation expects $# instead of %#

Expected behavior

Either the documentation to be correct or %# to be working. Or both to preserve backwards comptability.

Actual behavior

%# is not replaced and remains as is, in the title string.

Additional context

No response

Environment

System:
    OS: macOS 12.2
    CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
  Binaries:
    Node: 15.14.0 - ~/.nvm/versions/node/v15.14.0/bin/node
    npm: 7.7.6 - ~/.nvm/versions/node/v15.14.0/bin/npm
  npmPackages:
    jest: ^27.1.0 => 27.4.5

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
F3n67ucommented, Feb 27, 2022

@essenmitsosse I cannot reproduce with your snippet, could you provide a reproduced github repo?

➜  jest git:(73f3a5743b) ✗ cat ./debug/test.js                                
test.each(['a', 'b', 'c'])('%#', () => {
  expect(true).toBe(true);
});
➜  jest git:(73f3a5743b) ✗ node  ./packages/jest-cli/bin/jest.js --version
27.4.5-dev
➜  jest git:(73f3a5743b) ✗ node  ./packages/jest-cli/bin/jest.js debug/test.js
 PASS  debug/test.js
  ✓ 0 (2 ms)
  ✓ 1
  ✓ 2

Test Suites: 1 passed, 1 total
Tests:       3 passed, 3 total
Snapshots:   0 total
Time:        0.416 s, estimated 1 s
Ran all test suites matching /debug\/test.js/i.

Environment

System:
    OS: macOS 11.2.3
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
  Binaries:
    Node: 14.17.4 - ~/.nvm/versions/node/v14.17.4/bin/node
    Yarn: 2.4.3 - ~/.nvm/versions/node/v14.17.4/bin/yarn
    npm: 8.1.3 - ~/.nvm/versions/node/v14.17.4/bin/npm
  npmPackages:
    jest: workspace:* => 27.4.5 
0reactions
github-actions[bot]commented, Apr 1, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

doctest — Test interactive Python examples — Python 3.11.1 ...
To check that a module's docstrings are up-to-date by verifying that all interactive examples still work as documented. To perform regression testing by ......
Read more >
Handling the 'Object Does Not Exist' Error - SmartBear Support
The “Object Does Not Exist” message indicates that the tested application differs from the state it had during test recording or test creation....
Read more >
String (Java Platform SE 8 ) - Oracle Help Center
Allocates a new String that contains characters from a subarray of the Unicode code point array argument. The offset argument is the index...
Read more >
Pattern Matching and Replacement - R
sub and gsub perform replacement of the first and all matches respectively. Usage. grep(pattern, x, ignore.case = FALSE, perl = FALSE, value =...
Read more >
Testing tools - Django documentation
Note that the test client is not intended to be a replacement for Selenium or ... This is incorrect: ... (The name is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found