In the Ky tests, we have a simple assertion that a Node.js DOMException is thrown when a request is aborted. In AVA v5, this assertion works as expected. However, beginning with AVA v6, DOMException seems to no longer be detected as an error, even though error instanceOf Error is true for it.
Minimal reproduction with default config:
import test from 'ava';
test('DOMException should be considered an error', async t => {
await t.throwsAsync(Promise.reject(new DOMException('an error')));
});
The above test passes on AVA v5 but fails on v6. This applies to both t.throws() and t.throwsAsync().
As an aside, the docs are not very clear on what is considered "an error". I always assumed it meant the object had to be an instanceof Error, but at least in AVA v6, this seems to not be the case. Is it because error.constructor.name doesn't include "Error"? Would be nice to have some clarification.
In the Ky tests, we have a simple assertion that a Node.js
DOMExceptionis thrown when a request is aborted. In AVA v5, this assertion works as expected. However, beginning with AVA v6,DOMExceptionseems to no longer be detected as an error, even thougherror instanceOf Erroristruefor it.Minimal reproduction with default config:
The above test passes on AVA v5 but fails on v6. This applies to both
t.throws()andt.throwsAsync().As an aside, the docs are not very clear on what is considered "an error". I always assumed it meant the object had to be an
instanceof Error, but at least in AVA v6, this seems to not be the case. Is it becauseerror.constructor.namedoesn't include "Error"? Would be nice to have some clarification.