busterjs/buster — Issue #63: assert.exception() failure gets max call stack for nested test objects
Author: rvagg
Created: 2012-01-27 07:56:13+00:00
State: open

Perhaps related to #61, perhaps not:

```js
buster.testCase('assert.exception() with additional level test container fails on max call stack', {
'tests in here': {
'assert.exception': function () {
buster.assert.exception(function () {})
}
}
})

buster.testCase('assert.exception() with empty additional level test container fails on max call stack', {
'assert.exception': function () {
buster.assert.exception(function () {})
},
'nothing in here': { }
})
```

```
$ buster-test
assert.exception() with additional level test container fails on max call stack: E
assert.exception() with empty additional level test container fails on max call stack: E
Error: assert.exception() with additional level test container fails on max call stack tests in here assert.exception
RangeError: Maximum call stack size exceeded

Error: assert.exception() with empty additional level test container fails on max call stack assert.exception
RangeError: Maximum call stack size exceeded
```

Take out the additional levels in the test object fed to `testCase()` and it's fine. Note that the second test simply has an empty additional level to get this failure. Providing an exception name/type argument doesn't change anything. Only a pass condition makes the problem go away so it's something to do with error message generation would be my guess.