Skip to content

Unhandled rejection warnings when expecting a rejection #173

@laggingreflex

Description

@laggingreflex

I'm not using Bluebird but similarly to this thread I'm getting the same warning errors of unhanded rejection when actually expecting a rejection.

Here's a repo to reproduce: https://github.com/laggingreflex/chai-as-promised-reject-test

It was mentioned chai-as-promised is indeed handling the errors (here) but I think they're not being handled soon enough. Putting a console.log there shows that it reaches that code only after the warning has been displayed:

(node:5580) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: rejected
  promise
(node:5580) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)
>>> assertIfNegated about to be called... <<<
    √ should be rejected


  1 passing (48ms)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions