Quantcast
Channel: Chutzpah - A JavaScript Test Runner
Viewing all articles
Browse latest Browse all 1864

Created Unassigned: Incorrect error when JS is wrong in mocha before() [283]

$
0
0
I'm using the mocha test setup and I've noticed that when you have an error in your before() method you get a strange error.

example:

```
describe("When an error is in the before", function () {
before(function() {
var a = 2 / 3 + f;
});

it("returns a strange error", function () {
expect(1).to.equal(1);
});
});
```

what I expect to see you see this if you run the html page):

```
ReferenceError: 'f' is undefined
at Anonymous function
<snipped>
```

what you actually get from chutzpah 'Run JS Test'

```
------ Test started: File: C:\example\exampleTest.js ------
Error: TypeError: 'null' is not an object (evaluating 'activeTestCase.testResults')
in phantomjs://webpage.evaluate() (line 96)
```

Viewing all articles
Browse latest Browse all 1864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>