Created
February 22, 2016 23:33
-
-
Save wolframkriesing/fa5bfd16e45af3cf5757 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import assert from 'assert'; | |
import {assertThat, instanceOf, throws} from 'hamjest'; | |
class MyError extends Error { | |
constructor(...args) { | |
super(...args); | |
} | |
} | |
function throwingFunction() { | |
throw new MyError(); | |
} | |
describe('catch my error', () => { | |
it('finds error', () => { | |
assertThat(throwingFunction, throws(instanceOf(MyError))); | |
}); | |
}); |
Interesting… your code seems correct.
Can you open a ticket with more details about your environment, please? We can investigate it there.
Must be the ES6 class syntax. Seems like new MyError() instanceOf MyError
is falsy — odd.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the output when running the tests
I would have expected the test to pass, because
throwingFunction
does throwMyError
, but the tests fails :(