Skip to content

🐛 Bug: Pending constructor does not inherit from the Error constructor #2228

@mojwang

Description

@mojwang

I ran into the following annoying warning, thrown by Bluebird, when a test is skipped at runtime within a Bluebird promise chain.

Warning: a promise was rejected with a non-error: [object Object]

Some context on the warning thrown by Bluebird: http://bluebirdjs.com/docs/warning-explanations.html#warning-a-promise-was-rejected-with-a-non-error

Nevertheless, the root cause is that the Pending constructor in pending.js does not inherit from the Error constructor.

You can reproduce this by writing and running the following asynchronous test:

var Promise = require('bluebird');

Promise.config({
  warnings: true,
  longStackTraces: true
});

describe('Suite', function () { 
  it('Test', function () { 
    return Promise.bind(this).then(function () {
       this.skip();
    });
  });
});

Can this be fix?

Metadata

Metadata

Labels

status: accepting prsMocha can use your help with this one!type: buga defect, confirmed by a maintainer

Type

No type

Projects

Status

In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions