From 00af9e978c3554234271d953eee3fd75752bdcbb Mon Sep 17 00:00:00 2001 From: Tyler Akins Date: Wed, 2 Aug 2017 10:34:09 -0500 Subject: [PATCH] Making the specs run again in an easier way --- README.md | 6 +----- package.json | 10 ++++++++++ run-spec.js | 5 +++-- 3 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 package.json mode change 100755 => 100644 run-spec.js diff --git a/README.md b/README.md index 41a92fc..3dc6981 100644 --- a/README.md +++ b/README.md @@ -144,11 +144,7 @@ Developing Check out the code and hack away. Please add tests to show off bugs before fixing them. New functionality should also be covered by a test. -First you need to get the official tests. This command will pull them down and put those tests into a "spec" folder. - - git clone https://github.com/mustache/spec.git spec - -After that you need to install node.js and run `npm install async` (no, I didn't make a package.json to just list one dependency). Finally, `./run-spec.js spec/specs/*.json` will run against the official tests - there's over 100 of them. +First, make sure you install Node.js. After that, run `npm run install-tests` to get the dependencies and the repository of YAML tests. Run `npm run test` to run the JavaScript tests. There's over 100 of them, which is great. Not all of them will pass, but that's discussed later. When submitting patches, make sure to run them past [ShellCheck] and ensure no problems are found. Also please use Bash 3 syntax if you are manipulating arrays. diff --git a/package.json b/package.json new file mode 100644 index 0000000..dd8e1ef --- /dev/null +++ b/package.json @@ -0,0 +1,10 @@ +{ + "dependencies": { + "async": "*" + }, + "scripts": { + "clean": "rm -rf package-lock.json node_modules/ spec/", + "install-tests": "npm install; git clone https://github.com/mustache/spec.git spec", + "test": "node run-spec.js spec/specs/*.json" + } +} diff --git a/run-spec.js b/run-spec.js old mode 100755 new mode 100644 index 6c334a5..891432a --- a/run-spec.js +++ b/run-spec.js @@ -1,6 +1,6 @@ #!/usr/bin/env node -var async, exec, fs, summary, specFiles; +var async, exec, fs, summary; function makeShellString(value) { if (typeof value === 'string') { @@ -71,7 +71,8 @@ function runTest(test, done) { Object.keys(test.data).forEach(function (name) { script.push(addToEnvironment(name, test.data[name])); }); - script.push('. mo spec-runner/spec-template'); + script.push('. mo'); + script.push('mo spec-runner/spec-template'); test.script = script.join('\n'); async.series([ function (taskDone) {