bitovi/testee

Error thrown when test titles are non-strings

phillipskevin opened this issue · 1 comments

An error is thrown when data.title is a non-string here: new mocha.Test(data.title, true).

(node:26651) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Test `title` should be a "string" but "number" was given instead.
(node:26651) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: No test information found for {"file":"http://localhost:3996/test/index.html","id":"3579e9fb15341a2bdf24b2bd7ee32d3b","title":5,"parent":"64b475e08b3b8c40f6040445dadc1695","status":"passed","state":"passed"}

This happens in situations like this:

QUnit.ok(m.l[0].id, 5, "correct props");

We should coerce these titles to strings.

We've discussed and this is not an issue with Testee itself, if we look at the erroneous line:

QUnit.ok(m.l[0].id, 5, "correct props");

We can see that this assertion is incorrect, it should be an .equal(). That is a QUnit error. The best thing we can do here in Testee is add a troubleshooting section for "UnhandledPromiseRejectionWarning" letting people know it is most likely because they are asserting incorrectly.