Javascript 茉莉花试验期望值';Tothrower&x27;自定义错误不起作用

Javascript 茉莉花试验期望值';Tothrower&x27;自定义错误不起作用,javascript,jasmine,karma-jasmine,Javascript,Jasmine,Karma Jasmine,jasmine测试在此代码上无法按预期工作的原因: it('toThrowError test case', () => { expect(() => { throw new ArgumentOutOfRangeException(); }).toThrowError(ArgumentOutOfRangeException); }); ArgumentOutOfRangeException是扩展错误类型: class ArgumentOutOfRangeException e

jasmine测试在此代码上无法按预期工作的原因:

it('toThrowError test case', () => {
   expect(() => { throw new ArgumentOutOfRangeException(); }).toThrowError(ArgumentOutOfRangeException);
});
ArgumentOutOfRangeException是扩展错误类型:

class ArgumentOutOfRangeException extends Error {}
测试结果不符合预期,测试失败:

Expected function to throw ArgumentOutOfRangeException, but it threw Error.

它对我有用。不能复制它<代码>“jasmine”:“^3.5.0”@slideshowp2我的jasmine版本是3.6.0