-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AVA t.throws results in failing test #1389
Comments
I don't think the error is Wallaby specific, this is the way TypeScript compilation works (and the way AVA checks error types). You should get the same error when running AVA without wallaby. As the error message says:
AVA thinks that the error type is You may easily see what I mean by running an example: class NetworkError extends Error {
}
test('simple test', async t => {
console.log((new NetworkError('an error') instanceof NetworkError)); // <-- prints false
t.throws(() => {
throw new NetworkError('an error')
}, NetworkError);
}); A workaround would be to check the error message (you may also use a RegExp in AVA AFAIK): t.throws(() => {
throw new NetworkError('an error')
}, 'an error'); Hope it makes sense and answers your question. |
I was using Thanks for the help towards resolving my issue, the error message was very confusing (though I'm guessing that's ava rather than wallaby). |
Awesome, thanks for the update! |
Issue description or question
Wallaby reports error when error is expected to actually pass the test using ava's
t.throws
, i.e.:results in error (and test not passing):
Wallaby.js configuration file
Code editor or IDE name and version
WebStorm 2017.3 EAP
Build #WS-173.3622.29, built on November 9, 2017
WebStorm EAP User
Expiration date: December 9, 2017
JRE: 1.8.0_152-release-1024-b6 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
OS name and version
Mac OS X 10.13.1
The text was updated successfully, but these errors were encountered: