diff --git a/package.json b/package.json index d4fa12bdc..a28002930 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ }, "devDependencies": { "chai": "~1.8.1", + "glob": "~3.2.8", "mocha": "~1.14.0", "node-inspector": "~0.6.1", "sinon": "~1.7.3" @@ -49,7 +50,7 @@ "test": "tests" }, "scripts": { - "test": "node_modules/.bin/mocha --compilers coffee:coffee-script" + "test": "node tests.js" }, "license": "AGPL3" } diff --git a/tests.js b/tests.js new file mode 100644 index 000000000..4a913dfec --- /dev/null +++ b/tests.js @@ -0,0 +1,38 @@ +var $mocha = require('mocha'); + +var $glob = require('glob'); + +require('coffee-script'); + +//==================================================================== + +var mocha = new $mocha({ + reporter: 'spec', +}); + +var argv = process.argv; +for (var i = 2, n = argv.length; i < n; ++i) { + mocha.grep(new RegExp(argv[i])); +} + +$glob('src/**/*.spec.coffee', function (error, files) { + if (error) { + console.error(error) ; + } + + files.forEach(function (file) { + mocha.addFile(file); + }); + + $glob('src/**/*.spec.js', function (error, files) { + if (error) { + console.error(error) ; + } + + files.forEach(function (file) { + mocha.addFile(file); + }); + + mocha.run(); + }); +});