From c07a1367e07b1d45186f91125439af850722dc8f Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Wed, 16 Sep 2015 00:51:32 -0400 Subject: [PATCH] Better exception messages on phantomjs Exceptions on phantomjs have a `stack` property that does not contain the exception message itself. Which causes us to print only the stack without the actual error message. This change ensures that the error message must appear withinn our output. I'm not sure how to test this -- mocking out `ok` while also using `ok` seems very headsplody. --- lib/ember-qunit/test.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/ember-qunit/test.js b/lib/ember-qunit/test.js index dc326d8d..d6516052 100644 --- a/lib/ember-qunit/test.js +++ b/lib/ember-qunit/test.js @@ -12,6 +12,11 @@ export default function test(testName, callback) { var message; if (reason instanceof Error) { message = reason.stack; + if (reason.message && message.indexOf(reason.message) < 0) { + // PhantomJS has a `stack` that does not contain the actual + // exception message. + message = Ember.inspect(reason) + "\n" + message; + } } else { message = Ember.inspect(reason); }