I'm trying to write a test for the Jasmine Test Framework which expects an error. At the moment I'm using a Jasmine Node.js integration from GitHub.
In my Node.js module I have the following code:
throw new Error("Parsing is not possible");
Now I try to write a test which expects this error:
describe('my suite...', function() {
[..]
it('should not parse foo', function() {
[..]
expect(parser.parse(raw)).toThrow(new Error("Parsing is not possible"));
});
});
I tried also Error() and some other variants and just can't figure out how to make it work.
Watch video javascript - How can I write a test which expects an 'Error' to be thrown in Jasmine? online without registration, duration hours minute second in high quality. This video was added by user Code Samples 05 April 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 64 once and liked it 0 people.