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.

Tests nested within describe unable to run

See original GitHub issue

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Using this test code,

image

Test nested within a describe block, whether using it or test does not run, I get this error:

image

If I add a simple non-nested test to the file, the output changes and that simple test is recognized, but not the nested test in the same file.

image

image

If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can yarn install and yarn test.

What is the expected behavior?

Should allow me to nest test or it within describe

Please provide your exact Jest configuration

Version: ^22.4.3

Config:

image

Run npx envinfo --preset jest in your project directory and paste the results here

image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

10reactions
SimenBcommented, Apr 29, 2018

describe cannot be async. Put the asynchronous work you’re doing into the test, or in a beforeEach/beforeAll

1reaction
chaselalcommented, Jun 21, 2019

@alaboudi Use test inside describe:

describe('booleans', () => {
  test('true is itself', () => {
    expect(true).toBe(true);
  });
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why can't nested describe() blocks see vars defined in outer ...
Within the nested describe() scope, the orchard object is undefined, even though it's defined within the it() blocks within it. Is this ...
Read more >
Avoid Nesting when you're Testing - Kent C. Dodds
I want to show you something. What I'm going to show is a general testing principle, applied to a React component test.
Read more >
JUnit 5 Nested Tests: Grouping Related Tests Together
Learn how to write JUnit 5 nested tests. Learn how to provide a hierarchical structure to describe relationships between the tests.
Read more >
JUnit Task - Apache Ant
Tests are defined by nested test or batchtest tags (see nested elements). ... When running multiple tests inside the same JVM (see forkMode...
Read more >
3 RackUnit API - Racket Documentation
There are three basic concepts in RackUnit: A check is the basic unit of a test. As the name suggests, it checks whether...
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