The following assertion will fail if Promises are not supported natively:
expect(result).to.be.a('promise');
Please consider adding support for using a Promise polyfill. Example:
chai.promise = PromisePolyfill;
The current workaround is to use an assertion like this:
expect(result).to.be.an.instanceof(PromisePolyfill);
Hey @natlibfi-arlehiko thanks for the issue.
I'll cut to the chase; I think we shouldn't do this, for a couple of reasons:
chai.object that can be reassigned? What about chai.array? chai.global?Symbol.toStringTag. If your engine supports it (modern browsers or modern Node), and your promise polyfill supports it, then you can already make this assertion.Because of these reasons, I'm going to close this issue. I would say that if you would like the behaviour you're requesting - you can raise an issue with the Promise polyfill you're using, for them to support Symbol.toStringTag.
Feel free to continue the discussion here too. Let me know your thoughts on the above, and if you have any other issues with chai please feel free to file them!
Most helpful comment
Hey @natlibfi-arlehiko thanks for the issue.
I'll cut to the chase; I think we shouldn't do this, for a couple of reasons:
chai.objectthat can be reassigned? What aboutchai.array?chai.global?Symbol.toStringTag. If your engine supports it (modern browsers or modern Node), and your promise polyfill supports it, then you can already make this assertion.Because of these reasons, I'm going to close this issue. I would say that if you would like the behaviour you're requesting - you can raise an issue with the Promise polyfill you're using, for them to support
Symbol.toStringTag.Feel free to continue the discussion here too. Let me know your thoughts on the above, and if you have any other issues with chai please feel free to file them!