Fix the way 'npm test' loads the library

This commit is contained in:
Marijn Haverbeke 2015-03-20 17:35:51 +01:00
parent 864268abb6
commit 0fee7a395e
2 changed files with 4 additions and 3 deletions

View File

@ -69,7 +69,8 @@
var misMatch = exports.misMatch = function(exp, act) { var misMatch = exports.misMatch = function(exp, act) {
if (!exp || !act || (typeof exp != "object") || (typeof act != "object")) { 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) { } else if (exp instanceof RegExp || act instanceof RegExp) {
var left = ppJSON(exp), right = ppJSON(act); var left = ppJSON(exp), right = ppJSON(act);
if (left !== right) return left + " !== " + right; if (left !== right) return left + " !== " + right;

View File

@ -51,12 +51,12 @@
var stats, modes = { var stats, modes = {
Normal: { Normal: {
config: { config: {
parse: (typeof require === "undefined" ? window.acorn : require("../dist/acorn")).parse parse: acorn.parse
} }
}, },
Loose: { Loose: {
config: { config: {
parse: (typeof require === "undefined" ? window.acorn : require("../dist/acorn_loose")).parse_dammit, parse: acorn.parse_dammit,
loose: true, loose: true,
filter: function (test) { filter: function (test) {
var opts = test.options || {}; var opts = test.options || {};