1 | path = require "path"
|
2 | wrench = require "wrench"
|
3 | Mocha = require "mocha"
|
4 | tests = __dirname
|
5 |
|
6 | by_js_extension = (filepath) -> /\.js$/.test filepath
|
7 |
|
8 | into_abs_path = (specs) -> (relpath) -> path.join specs, relpath
|
9 |
|
10 | run = (type) ->
|
11 | runner = new Mocha
|
12 | ui: "bdd"
|
13 | reporter: "dot"
|
14 |
|
15 | specs = path.join tests, type
|
16 |
|
17 | runner.files = wrench.readdirSyncRecursive specs
|
18 | .filter by_js_extension
|
19 | .map into_abs_path specs
|
20 |
|
21 | runner.run process.exit
|
22 |
|
23 | module.exports =
|
24 | run: run
|