Skip to content

Commit

Permalink
use serialize-error module
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Oct 27, 2015
1 parent 46d15ab commit c887a8e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
16 changes: 2 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';
var setImmediate = require('set-immediate-shim');
var hasFlag = require('has-flag');
var serializeError = require('serialize-error');
var Runner = require('./lib/runner');
var runner = new Runner();

Expand All @@ -10,28 +11,15 @@ var isFailed = false;

Error.stackTraceLimit = Infinity;

function serializeError(err) {
err = {
message: err.message,
stack: err.stack
};

return err;
}

function test(err, title, duration) {
if (isFailed) {
return;
}

if (err) {
err = serializeError(err);
}

process.send({
name: 'test',
data: {
err: err || {},
err: err ? serializeError(err) : {},
title: title,
duration: duration
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"power-assert-renderers": "^0.1.0",
"pretty-ms": "^2.0.0",
"resolve-from": "^1.0.0",
"serialize-error": "^1.0.0",
"set-immediate-shim": "^1.0.1",
"squeak": "^1.2.0",
"update-notifier": "^0.5.0"
Expand Down

0 comments on commit c887a8e

Please sign in to comment.