Closed
Description
Consider:
Napi::Value Rwar(const Napi::CallbackInfo& info) {
Napi::Env env = info.Env();
Napi::TypeError::New(env, "Wrong number of arguments")
.ThrowAsJavaScriptException();
return env.Null();
}
test('throws wrong number of arguments', () => {
expect.assertions(1)
try {
addon.rwar()
} catch (err) {
expect(err).toBeInstanceOf(TypeError)
}
})
For whatever reason I am getting:
● throws wrong number of arguments
expect(received).toBeInstanceOf(expected)
Expected constructor: TypeError
Received constructor: TypeError
6 | addon.rwar()
7 | } catch (err) {
> 8 | expect(err).toBeInstanceOf(TypeError)
| ^
9 | }
10 | })
11 |
Whenever I check err instanceof Error
or err instanceof TypeError
both return false
. Is there something I am doing wrong, or is this a bug?
Metadata
Metadata
Assignees
Labels
No labels