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.

afterAll hide errors

See original GitHub issue

🐛 Bug Report

https://repl.it/@evandrocoan/EnviousMagnificentApplicationpackage

const sum = require('./sum');

describe("Test question and answer audios", () => {
  beforeAll(async () => {
    console.log("beforeAll");
  });

  afterAll(async () => {
    console.supererror();
    console.log("afterAll");
  });

  test('Timeout on the wrong place...', async () => {
    expect(sum(1, 2)).toBe(3);
  });
});

Actual behavior

 jest
 PASS  ./sum.test.js
  Test question and answer audios
    ✓ Timeout on the wrong place... (5ms)

  console.log sum.test.js:5
    beforeAll

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        6.199s
Ran all test suites.

Expected behavior

 jest
 FAIL  ./sum.test.js
  Test question and answer audios
    ✕ Timeout on the wrong place... (3ms)

  ● Test question and answer audios › Timeout on the wrong place...

    TypeError: console.supererror is not a function

       7 | 
       8 |   afterAll(async () => {
    >  9 |     console.supererror();
         |             ^
      10 |     console.log("afterAll");
      11 |   });
      12 | 

      at Object.<anonymous> (sum.test.js:9:13)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        6.657s
Ran all test suites.
exit status 1

envinfo

 npx envinfo --preset jest
npx: installed 1 in 4.22s

  System:
    OS: Linux 4.15 Debian GNU/Linux 9 (stretch) 9 (stretch)
    CPU: (4) x64 Intel(R) Xeon(R) CPU @ 2.30GHz
  Binaries:
    Node: 12.16.2 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
  npmPackages:
    jest: ^24.9.0 => 24.9.0 

Related:

  1. afterAll hook hides errors. #3266
  2. afterAll inside a describe hides errors #6692
  3. beforeAll() executed in parallel with test case in case of timeout #9527
  4. A timeout in a beforeEach continues executing the dependant test cases #8442
  5. beforeAll async hook hides errors #8688

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
chasen-bettingercommented, May 28, 2020

@jayarjo

Follow the Installation and Configuration steps here: https://www.npmjs.com/package/jest-circus

0reactions
SimenBcommented, Nov 6, 2020

feel free to send a PR. Or use jest-cricus - it will be default in 27: #10686

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jasmine Karma afterall hides property error - Stack Overflow
An error was thrown in afterAll TypeError: Cannot read properties of undefined (reading 'hide') at SafeSubscriber.
Read more >
API Reference | Vitest
A blazing fast unit test framework powered by Vite.
Read more >
JUnit 5 User Guide
Similarly, @AfterAll methods declared in an interface are inherited as long as they are not hidden or overridden, and @AfterAll methods from an ......
Read more >
PowerShell errors are easy to suppress — but should you?
After all, it's important to know when something isn't working right. If you need to suppress an error, you can use the ErrorAction...
Read more >
Error Messages | Cypress Documentation
Test File Errors No tests found This message means that Cypress was unable to find ... You can globally disable animation error checking,...
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