我有这个代码:
class root.Goal
constructor: (@name, @size) ->
if @size <= 0 then throw new Error "Goal must be larger than 0 size"
由这个 Jasmine-CoffeeScript 测试测试:
it "cannot be of size 0", ->
expect(new p.Goal("Goal 3", 0)).toThrow "Goal must be larger than 0 size"
似乎异常被抛出,但没有被测试处理:
cannot be of size 0
Failures:
1) cannot be of size 0
Message:
Error: Goal must be larger than 0 size
Stacktrace:
Error: Goal must be larger than 0 size
at new Goal (/var/lib/stickshift/1d4f33cd01e442eaa154aed2e7697ca7/app-root/data/235917/prioritization/process.coffee:14:15)
有任何想法吗?