From 8c023ba271e3298abdb0cbe924fdb9fc7d266628 Mon Sep 17 00:00:00 2001 From: Ludwig Magnusson Date: Sun, 13 Jul 2014 12:27:04 +0200 Subject: [PATCH 1/2] Added programatic test runner. --- runtests.coffee | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 runtests.coffee diff --git a/runtests.coffee b/runtests.coffee new file mode 100644 index 0000000..91457ce --- /dev/null +++ b/runtests.coffee @@ -0,0 +1,19 @@ +Mocha = require 'mocha' +fs = require 'fs' +path = require 'path' + +require './lib/mocha-given' + +mocha = new Mocha + ui: 'mocha-given' + reporter: 'spec' + +testDir = 'test' +fs.readdirSync(testDir).filter((file) -> + file.match /\.(coffee|js)$/ +).forEach (file) -> + mocha.addFile path.join(testDir, file) + +mocha.run (failures) -> + process.on 'exit', -> + process.exit failures From f7b85c0e68b6c9d6c565093506e92da19a0b5610 Mon Sep 17 00:00:00 2001 From: Ludwig Magnusson Date: Sun, 13 Jul 2014 12:27:23 +0200 Subject: [PATCH 2/2] Updated package.json to use programatic test runner in "npm test" --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 7d025a2..1c28314 100644 --- a/package.json +++ b/package.json @@ -16,11 +16,12 @@ "mocha": "~1.20.1" }, "devDependencies": { - "expect.js": "~0.3.1" + "expect.js": "~0.3.1", + "mocha": "^1.20.1" }, "scripts": { - "prepublish": "./node_modules/.bin/coffee -cbo browser lib/mocha-given.coffee", - "test": "./node_modules/.bin/mocha -u mocha-given --compilers coffee:coffee-script -R spec" + "prepublish": "coffee -cbo browser lib/mocha-given.coffee", + "test": "coffee runtests.coffee" }, "keywords": [ "mocha",