From 0fee7a395ec2e8aa93e9050e7f185276c7c7964f Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Fri, 20 Mar 2015 17:35:51 +0100 Subject: [PATCH] Fix the way 'npm test' loads the library --- test/driver.js | 3 ++- test/run.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/driver.js b/test/driver.js index 46e29e547c..ed48ace821 100644 --- a/test/driver.js +++ b/test/driver.js @@ -69,7 +69,8 @@ var misMatch = exports.misMatch = function(exp, act) { if (!exp || !act || (typeof exp != "object") || (typeof act != "object")) { - if (exp !== act) return ppJSON(exp) + " !== " + ppJSON(act); + if (exp !== act && typeof exp != "function") + return ppJSON(exp) + " !== " + ppJSON(act); } else if (exp instanceof RegExp || act instanceof RegExp) { var left = ppJSON(exp), right = ppJSON(act); if (left !== right) return left + " !== " + right; diff --git a/test/run.js b/test/run.js index 865eed5cd3..43dc21d76a 100644 --- a/test/run.js +++ b/test/run.js @@ -51,12 +51,12 @@ var stats, modes = { Normal: { config: { - parse: (typeof require === "undefined" ? window.acorn : require("../dist/acorn")).parse + parse: acorn.parse } }, Loose: { config: { - parse: (typeof require === "undefined" ? window.acorn : require("../dist/acorn_loose")).parse_dammit, + parse: acorn.parse_dammit, loose: true, filter: function (test) { var opts = test.options || {};