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.

test list gets screwed up when multiple tests have the same name but are in different describe blocks

See original GitHub issue

Is this a bug report or a feature request?

bug

Version Info

  • Version of Majestic: v1.6.2
  • Version of Jest:
  • Version of Node:
  • Operating System:

Reproduction Repo

Create a unit test with two describe blocks and each describe block place the a test with the same name.

describe('block 1', () => {
  it('test name', () => {
    expect(true).toBeTruthy();
  })
}
describe('block 2', () => (
  it('test name', () => {
    expect(false).toBeTruthy();
  })
}

What you will see is the proper display of two describe blocks, each with one test in it, but both tests will show as passing, even though the second one fails.

I assume that you are using the test name as a unique key, which can’t be assumed.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
gregverescommented, May 15, 2020

@zeevrosental if you want a version that fixes this issue, you can build my fork. It is now up to date with the latest changes from the main fork and it includes few extra enhancements that I will do separate PRs for if this original code is accepted.

0reactions
zeevrosentalcommented, Mar 24, 2020

hi!, any reason why this wasn’t merged yet?

Read more comments on GitHub >

github_iconTop Results From Across the Web

having multiple describe in spec leads to weird behaviour
If they are related put them both nested inside an additional describe and add a string that describes what you're about to test...
Read more >
Is it OK to have multiple asserts in a single unit test?
The key is that you have only one action, and then you inspect the results of that action using asserts. But it is...
Read more >
Jest Testing like a Pro - Tips and tricks
When you run Jest, tests are run by file, within that file you can have groups of related tests, which you put under...
Read more >
Structuring Tests - Node Tap
There are two tools that you can use to organize your tests so that they help in this process: test files (aka suites)...
Read more >
Unit Tests, How to Write Testable Code, and Why It Matters
After finishing a test, the mad scientist cleans up all the dirt, sand and rocks that are now scattered in his lovely laboratory....
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