From d1bb461caf944b5777fb84b691657bceb92350bc Mon Sep 17 00:00:00 2001 From: Phillip Johnsen Date: Mon, 2 Feb 2015 20:52:56 +0100 Subject: [PATCH] Run jshint before tests. - Documented required version of npm while developing - Use the latest npm client for node >= v0.8 on travis Special quirks to get node v0.6 supported: - npm client v1.3.26 on travis - jshint 2.4.4 as >= 2.5.x breaks --- .jshintrc | 3 ++- .travis.yml | 2 ++ README.md | 8 ++++++++ mustache.js | 2 +- package.json | 7 ++++++- 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.jshintrc b/.jshintrc index 28dff71..0e924ac 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,5 +1,6 @@ { "eqnull": true, - "evil": true + "evil": true, + "unused": true } diff --git a/.travis.yml b/.travis.yml index 089d620..2c8d525 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,8 @@ node_js: - 0.8 - '0.10' - 0.11 +before_install: + - "test $TRAVIS_NODE_VERSION = '0.6' && npm install -g npm@1.3.26 || npm install -g npm" matrix: allow_failures: - node_js: 0.11 \ No newline at end of file diff --git a/README.md b/README.md index bad0663..b6dfaeb 100644 --- a/README.md +++ b/README.md @@ -490,6 +490,14 @@ Then, you can run the test with: $ TEST=mytest npm run test-render +### Troubleshooting + +#### npm install fails + +Ensure to have a recent version of npm installed. While developing this project requires npm with support for `^` version ranges. + + $ npm install -g npm + ## Thanks mustache.js wouldn't kick ass if it weren't for these fine souls: diff --git a/mustache.js b/mustache.js index 1e4d3cd..47a396d 100644 --- a/mustache.js +++ b/mustache.js @@ -507,7 +507,7 @@ return this.renderTokens(token[4], context, partials, originalTemplate); }; - Writer.prototype._renderPartial = function(token, context, partials, originalTemplate) { + Writer.prototype._renderPartial = function(token, context, partials) { if (!partials) return; var value = isFunction(partials) ? partials(token[1]) : partials[token[1]]; diff --git a/package.json b/package.json index 8a3bf78..b56bfaf 100644 --- a/package.json +++ b/package.json @@ -17,12 +17,17 @@ "volo": { "url": "https://raw.github.com/janl/mustache.js/{version}/mustache.js" }, + "engines": { + "npm": ">=1.4.0" + }, "scripts": { + "pretest": "jshint mustache.js", "test": "mocha --reporter spec", "test-render": "mocha --reporter spec test/render-test" }, "devDependencies": { - "mocha": "2.0.1" + "jshint": "~2.4.4", + "mocha": "~2.1.0" }, "spm": { "main": "mustache.js",