/
karma.conf.coffee
86 lines (70 loc) · 2.13 KB
/
karma.conf.coffee
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
path = require 'path'
yargs = require 'yargs'
###
Exports a Karma configuration object
Details: http://karma-runner.github.io/0.13/config/configuration-file.html
###
getConfiguration = ->
# Base path that will be used to resolve all patterns (eg. files, exclude)
# basePath: __dirname
# Frameworks to use
# Available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: [
'mocha'
'mocha-debug'
'sinon-chai'
'chai-as-promised'
'chai'
]
preprocessors:
'**/*.js': ['sourcemap']
# List of files / patterns to load in the browser
files: getFileList()
# Test results reporter to use
# Available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['mocha']
# Web server port
port: 4000
# Enable / disable colors in the output (reporters and logs)
colors: true
# Level of logging
# logLevel: 'OFF'
# logLevel: 'ERROR'
# logLevel: 'DEBUG'
# logLevel: 'WARN'
# logLevel: 'INFO'
logLevel: 'INFO'
# Start these browsers
# Available browsers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS']
# Exit upon conclusion of test run(s)
singleRun: false
# Mocha (or other runner) options
client: getClientOptions()
# PhantomJS options
phantomjsLauncher:
# Have phantomjs exit if a ResourceError is encountered
# (useful if karma exits without killing phantom)
exitOnResourceError: false
###
Generates the options that are passed to the test client/runner (e.g. Mocha)
###
getClientOptions = ->
args = []
args.splice(2, 0, '--grep', yargs.argv.grep) if yargs.argv.grep?
args.splice(2, 0, '--timeout', yargs.argv.timeout) if yargs.argv.timeout?
return {args}
###
Generates a list of file paths that Karma should load. Order is important.
Details: http://karma-runner.github.io/0.13/config/files.html
###
getFileList = -> [
pattern: 'public/build/test.js'
nocache: true
]
###
Exports the configuration from this module
###
module.exports = (config) ->
config.set getConfiguration()
return