我正在try 为Jasmine Test Framework编写一个测试,它预期会出现错误.现在我用的是Jasmine Node.js integration from GitHub.
在我的 node 中.js模块我有以下代码:
throw new Error("Parsing is not possible");
现在,我try 编写一个测试,该测试预计会出现以下错误:
describe('my suite...', function() {
[..]
it('should not parse foo', function() {
[..]
expect(parser.parse(raw)).toThrow(new Error("Parsing is not possible"));
});
});
我也try 了Error()
和其他一些变体,但就是不知道如何让它工作.