summaryrefslogtreecommitdiff
path: root/js/test.js
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-01-10 17:27:26 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-01-10 17:27:26 -0800
commit145424ab245350a4a6eec1adab8d57402677530e (patch)
treee7e71aad949ef8890b051e9f894de0602061b331 /js/test.js
parent2fe4743a1303ca5dcba4018519a044e9de8e11db (diff)
Removed ansi from js source tree.
Test suite will now use ansi if the package is installed, otherwise skip it.
Diffstat (limited to 'js/test.js')
-rwxr-xr-xjs/test.js22
1 files changed, 20 insertions, 2 deletions
diff --git a/js/test.js b/js/test.js
index 6cb7c98..a6184b3 100755
--- a/js/test.js
+++ b/js/test.js
@@ -3,8 +3,26 @@
var fs = require('fs');
var commonmark = require('./lib/index.js');
-var ansi = require('./ansi/ansi');
-var cursor = ansi(process.stdout);
+var ansi;
+var cursor;
+
+try {
+ ansi = require('ansi');
+ cursor = ansi(process.stdout);
+}
+catch(err) {
+ var noOp = function() { return this; };
+ cursor = {
+ write: function (s) {
+ process.stdout.write(s);
+ return this;
+ },
+ green: noOp,
+ red: noOp,
+ cyan: noOp,
+ reset: noOp,
+ };
+}
var writer = new commonmark.HtmlRenderer();
var reader = new commonmark.DocParser();