From e204e8b4d98ef7bd953240d141575a943834b0fc Mon Sep 17 00:00:00 2001 From: elliottcable Date: Tue, 28 May 2013 06:26:59 -0400 Subject: [PATCH] (- meta) Moving `cake test` into a script ... sort of --- Scripts/test.sh | 18 ++++++++++++++++++ package.json | 11 +++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) create mode 100755 Scripts/test.sh diff --git a/Scripts/test.sh b/Scripts/test.sh new file mode 100755 index 0000000..b988f59 --- /dev/null +++ b/Scripts/test.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env sh + +# Usage: +# ------ +# This simply invokes `mocha` with some sensible defaults. +# +# FLAGS="--reporter dot --watch" npm run-script test +# FLAGS="--grep API" npm run-script test +# +# Unfortunately, at the moment, there's no way to pass flags to `npm run-script`; so I roll in flags +# using an environment-variable (`$FLAGS`). See: https://github.com/isaacs/npm/issues/3494 + +env NODE_ENV="$npm_package_config_mocha_ENV" \ +./node_modules/.bin/mocha \ + --compilers coffee:coffee-script \ + --reporter "$npm_package_config_mocha_reporter" \ + --ui "$npm_package_config_mocha_ui" \ + $FLAGS "$npm_package_config_testFiles" diff --git a/package.json b/package.json index 8d1338b..cf3c13d 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ , "main" : "Library/Paws.js" , "scripts" :{ - "clean" : "./Scripts/clean.sh" + "test" : "./Scripts/test.sh" +, "clean" : "./Scripts/clean.sh" , "coverage" : "./Scripts/coverage.sh 3> Coverage.html" , "coveralls" : "./Scripts/coveralls.sh" } @@ -16,9 +17,11 @@ "testFiles" : "Test/*.coffee" , "dirs" :{"source" :"Source" , "instrumentation" - :"Source" - -}} + :"Source" } +, "mocha" :{"ui" : "bdd" + , "reporter" : "spec" + , "ENV" : "test" } + } , "engines" :{"node":"~0.10.7"} , "dependencies" :{"coffee-script" : "~1.6.2"