diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee index 2b67337c8..f531be459 100644 --- a/src/Linkification/Linkify.coffee +++ b/src/Linkification/Linkify.coffee @@ -74,7 +74,7 @@ Linkify = if Linkify.regString.test word links.push Linkify.makeRange node, endNode, index, length - <%= assert('word is links[links.length-1].toString()') %> + <%= assert('.tests_enabled', 'word is links[links.length-1].toString()') %> break unless test.lastIndex and node is endNode diff --git a/tools/template.js b/tools/template.js index fdd439c28..49792f7d9 100644 --- a/tools/template.js +++ b/tools/template.js @@ -161,8 +161,8 @@ obj.html = function(template) { return `(innerHTML: ${output})`; }; -obj.assert = function(statement) { - if (!obj.tests_enabled) return ''; +obj.assert = function(flagFile, statement) { + if (!readJSON(flagFile)) return ''; return `throw new Error 'Assertion failed: ' + ${constExpression(statement)} unless ${statement}`; };