Browse Source

Merge pull request #354 from sindresorhus/fix-error-stacks

Show full stack trace for non-assert errors
babel-plugin-for-integration-tests
Sindre Sorhus 9 years ago
parent
commit
945dbea40a
  1. 6
      api.js
  2. 7
      lib/test.js
  3. 3
      test/promise.js

6
api.js

@ -83,8 +83,14 @@ Api.prototype._handleTest = function (test) {
if (test.error.originalMessage) {
message = test.error.originalMessage + ' ' + message;
}
test.error.message = message;
}
if (test.error.name !== 'AssertionError') {
test.error.message = 'failed with "' + test.error.message + '"';
}
this.errors.push(test);
} else {
test.error = null;

7
lib/test.js

@ -125,12 +125,7 @@ Test.prototype.run = function () {
self.exit();
})
.catch(function (err) {
self._setAssertError(new assert.AssertionError({
actual: err,
message: 'Promise rejected → ' + err,
operator: 'promise'
}));
self._setAssertError(err);
self.exit();
});
} else if (!this.metadata.callback) {

3
test/promise.js

@ -245,7 +245,8 @@ test('reject', function (t) {
});
}).run().catch(function (err) {
t.ok(err);
t.is(err.name, 'AssertionError');
t.is(err.name, 'Error');
t.is(err.message, 'unicorn');
t.end();
});
});

Loading…
Cancel
Save