-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cakefile
61 lines (51 loc) · 1.89 KB
/
Cakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
fs = require 'fs'
# Grab test files
walk = (dir, fileList) ->
list = fs.readdirSync(dir)
if list
for file in list
if file
filename = dir + '/' + file
stat = fs.statSync(filename)
if stat and stat.isDirectory()
walk(filename, fileList)
else if filename.substr(-6) == "coffee"
fileList.push(filename)
fileList
{exec} = require 'child_process'
testFiles = walk("test", [])
uiTestFiles = walk("client/test", [])
task 'tests', 'run tests through mocha', ->
runTests testFiles
task 'tests:client', 'run tests through mocha', ->
runTests uiTestFiles
runTests = (fileList) ->
console.log "Run tests with Mocha for " + fileList.join(" ")
command = "mocha " + fileList.join(" ") + " --reporter spec "
command += "--require should --compilers coffee:coffee-script --colors"
exec command, (err, stdout, stderr) ->
if err
console.log "Running mocha caught exception: \n" + err
console.log stdout
option '-f', '--file [FILE]', 'test file to run'
task 'tests:file', 'run test through mocha for a given file', (options) ->
file = options.file
console.log "Run tests with Mocha for " + file
command = "mocha " + file + " --reporter spec "
command += "--require should --compilers coffee:coffee-script --colors"
exec command, (err, stdout, stderr) ->
if err
console.log "Running mocha caught exception: \n" + err
console.log stdout
task "xunit", "", ->
process.env.TZ = "Europe/Paris"
command = "mocha "
command += " --require should --compilers coffee:coffee-script -R xunit > xunit.xml"
exec command, (err, stdout, stderr) ->
console.log stdout
task "xunit:client", "", ->
process.env.TZ = "Europe/Paris"
command = "mocha client/test/*"
command += " --require should --compilers coffee:coffee-script -R xunit > xunitclient.xml"
exec command, (err, stdout, stderr) ->
console.log stdout