Skip to content

Instantly share code, notes, and snippets.

@trentm
Created February 23, 2016 19:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trentm/4b0becd0ecffe8f0ad08 to your computer and use it in GitHub Desktop.
Save trentm/4b0becd0ecffe8f0ad08 to your computer and use it in GitHub Desktop.
hack to node-tape to get timestamps on TAP test results
ok 41 [2016-02-23T19:45:28.419Z] createMachine
ok 42 [2016-02-23T19:45:28.419Z] createMachine 201 statusCode
ok 43 [2016-02-23T19:45:28.419Z] createMachine Location header
ok 44 [2016-02-23T19:45:28.419Z] createMachine body: 7d609b77-7821-459d-894f-637f9d5a3e05
ok 45 [2016-02-23T19:45:28.420Z] headers ok
ok 46 [2016-02-23T19:45:28.420Z] headers allow-origin
ok 47 [2016-02-23T19:45:28.420Z] headers allow-methods
ok 48 [2016-02-23T19:45:28.421Z] headers date
ok 49 [2016-02-23T19:45:28.421Z] headers request-id
ok 50 [2016-02-23T19:45:28.422Z] headers response time
ok 51 [2016-02-23T19:45:28.422Z] headers server
ok 52 [2016-02-23T19:45:28.422Z] headers connection
ok 53 [2016-02-23T19:45:28.422Z] headers api-version OK
$ diff -u node_modules/tape/lib/results.js.orig node_modules/tape/lib/results.js
--- node_modules/tape/lib/results.js.orig 2016-02-23 11:46:31.000000000 -0800
+++ node_modules/tape/lib/results.js 2016-02-23 11:41:16.000000000 -0800
@@ -128,6 +128,9 @@
function encodeResult (res, count) {
var output = '';
output += (res.ok ? 'ok ' : 'not ok ') + count;
+ if (true) { // XXX
+ output += ' [' + (new Date()).toISOString() + ']';
+ }
output += res.name ? ' ' + res.name.toString().replace(/\s+/g, ' ') : '';
if (res.skip) output += ' # SKIP';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment