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.

UnhandledPromiseRejectionWarning appears even though rejection is caught

See original GitHub issue

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

Bug about Manual Mock

What is the current behavior?

All tests that uses a function addNewPath (ie at least 20 of the 29 tests) succeed except 2 for strange reasons … This function relies on a mock implementation of two modules : fs and filehound

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.

My repo : https://github.com/jy95/mediaScan/tree/test-fix

What is the expected behavior?

It should work

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.

Jest version : 22.3.0 Node version : 8.9.3 NPM version : 5.6.0 OS : Windows 10 Version 1709

My jest.config.js :

// jest.config.js
module.exports = {
    verbose: true,
    "moduleFileExtensions": [
        "ts",
        "tsx",
        "js"
    ],
    "transform": {
        "^.+\\.(ts|tsx)$": "<rootDir>/__tests__/__helpers__/preprocessor.js"
    },
    "testMatch": [
        "<rootDir>/__tests__/**/*.(ts|tsx|js)"
    ],
    "testPathIgnorePatterns": ["<rootDir>/node_modules/", "<rootDir>/__tests__/__helpers__/"],
    "collectCoverage": true
};

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
goldel777commented, May 16, 2018

I just installed jest according to the instructions. And no matter how I run it I get…

node:7364) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): TypeError: Cannot read property ‘Symbol(Symbol.iterator)’ of undefined (node:7364) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

0reactions
github-actions[bot]commented, May 12, 2021

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

Getting UnhandledPromiseRejectionWarning even when ...
I know that making my calling function async and await ing doSomethingAsync inside of a try / catch makes the error go away,...
Read more >
Unhandled Promise Rejections in Node.js - The Code Barbarian
If you want to suppress the unhandled promise rejection warning, all you need to do is call .catch() on the promise with an...
Read more >
Fixing UnhandledPromiseRejectionWarning in Node.js
We still get the warning even though promise2 is wrapped in a try/catch. Wrapping a whole function with try/catch won't cover all Promises!...
Read more >
What is UnhandledPromiseRejectionWarning
UnhandledPromiseRejectionWarning originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not ...
Read more >
Window: unhandledrejection event - Web APIs | MDN
The unhandledrejection event is sent to the global scope of a script when a JavaScript Promise that has no rejection handler is rejected; ......
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