-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathkarma.cli.txt
199 lines (186 loc) · 15.4 KB
/
karma.cli.txt
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
┏━━━━━━━━━━━┓
┃ KARMA ┃
┗━━━━━━━━━━━┛
VERSION => #0.12.35
GOAL ==> #Automating client-side unit testing (that require loading an HTML page)
#Actions:
# - starts a server at SERVER_URL:
# - CONFIGVAR hostname (def: localhost) and port (def: 9876) (or karma --port)
# - Is prefixed by CONFIGVAR urlRoot (def: "/")
# - clients are launched by karma run:
# - binaries ("browsers") are executed and connect to the server
# - they create a HTML page (in an <iframe>) that:
# - loads "frameworks" (e.g. testing frameworks) by including <script>
# - read "included" files (e.g. source+test files) by including <script>
# - redirect output/result to "reporters"
# - if binaries are already launched, just refresh the page
# - files can be:
# - watched (e.g. source, test files): changes triggers karma run
# - included (e.g. source, test files and libraries): see above.
# Usually JavaScript files: HTML runner files of testing are useless since Karma creates
# the HTML shell in the <iframe> for each specific framework.
# However, can also include HTML pages (use <link rel="import"> on modern browsers)
# - served (e.g. source, test, resource files): hosted on the server at SERVER_URL/base/
# so can also include resource files
#Browsers, frameworks and reporters are available as plugins:
# - must install them as devDependencies
# - by def, all karma-* are require()'d, but can use CONFIGVAR plugins MODULE_STR_ARR instead
karma COMMAND [FILE] #Command line from Node module:
[-- ARGS] # - Located at node_modules/karma/bin/
# - To have globally install npm package karma-cli globally.
#Uses FILE (def: karma.conf.js), which is a Node module with:
# module.exports = function(CONFIG){CONFIG.set({ CONFIGVAR: VAL })}:
# - can be generated with karma init
# - CONFIGVAR are listed below
# - GPATH use minimatch
#COMMAND:
# - start: launches server then (in order of priority):
# - if CONFIGVAR singleRun true (déf: false): karma run then exit code 1|0
# Can also use karma --[no-]single-run
# - if CONFIGVAR autoWatch true (déf): karma run then karma watch
# Can also use karma --[no-]auto-watch
# - otherwise hangs (waits for karma run|watch)
# - run: lanches "browsers", "frameworks", etc.
# ARGS are passed to CONFIG.args STR_ARR (can only be accessed by plugins)
# Can also be set with CONFIGVAR client.args STR_ARR
# - watch: use watch feature to do "run" when files change
# Waits CONFIGVAR autoWatchBatchDelay NUM (def: 250ms) to do it in batch.
files #OBJ_ARR of files to watch/include/serve:
# - pattern GPATH
# - watched BOOL (déf: true)
# - included BOOL: if true (def) include using <script>, otherwise doesn’t
# (should use RequireJS).
# - served BOOL (déf: true): whether to host under SERVER_URL/base/
#Can also be GPATH_ARR: same as { pattern GPATH }
#Each file is only counted once and in the order of the array (alphabetically for pattern
#matching files).
proxies #{ PATH: URL ...}, makes SERVER_URL/PATH/ point to URL instead (PATH must start with "/")
basePath #For relative path in files and exclude. Def: package.json __dirname
browsers #STR_ARR of "browsers" plugins, i.e. binaries to execute (usually browsers) and connect to
#SERVER_URL:
# - Configuration can be either:
# - CONFIGVAR
# - CUSTOMVAR:
# - CONFIGVAR customLaunchers.CUSTOMBROWSER { base BROWSER, CUSTOMVAR... }
# - browsers [ CUSTOMBROWSER ] instead of browsers [ BROWSER ]
# - CUSTOMVAR flags STR_ARR: command line options to binary
# - Binary is looked up by plugins in usual locations: to override it, use ENVVAR BROWSER_BIN,
# e.g. CHROME_BIN
#Can also use karma --browsers STR_ARR
#If several "browsers", "reporters" gets only the aggregated/summed results, with "browsers"
#name of failed results.
#Available:
## - "Safari" (module karma-safari-launcher 0.1.1)
## - "Opera" (module karma-opera-launcher 0.1.0)
## - "Firefox" (module karma-firefox-launcher 0.1.6):
## - CUSTOMVAR prefs OBJ
## - CUSTOMVAR extensions (path to ".xpi" Firefox extension)
## - "IE" (module karma-ie-launcher 0.1.5):
## - CUSTOMVAR "x-ua-compatible": "IE=EmulateIE8|9"
## - "Chrome" (module karma-chrome-launcher 0.1.12):
## - command line --disable-web-security if needed
## - "PhantomJS" (module karma-phantomjs-launcher 0.2.0):
## - CONFIGVAR phantomjsLauncher.exitOnResourceError BOOL
## - CUSTOMVAR options { windowName STR, settings OBJ }
## - CUSTOMVAR debug BOOL
## - "BrowserStack" (karma-browserstack-launcher 0.1.2): uses unit testing REST API through
## BROWSERSTACK Node module + BrowserStackTunnel:
## - CUSTOMVAR os|browser[_version], device, real_mobile
## - CONFIGVAR browserStack OBJ:
## - username|accessKey STR (def: ENVVAR BROWSER_STACK_USERNAME|ACCESS_KEY)
## - retryLimit NUM (def: 3): number of connections retries
## - captureTimeout (def: 120): browser idle timeout
## - timeout (def: 300): test idle timeout
## - build, name, project: like CAPAB_OBJ.
## "build" def: ENVVAR [TRAVIS_]BUILD_NUMBER, BUILD_TAG, CIRCLE_BUILD_NUM
## - startTunnel BOOL (déf: false), tunnelIdentifier (déf: "karma" + random number),
## jarFile (or ENVVAR BROWSER_STACK_TUNNEL_JAR)
## - "SauceLabs" (karma-sauce-launcher 0.2.11): uses wd.js WD.get() + SauceConnect:
## - CUSTOMVAR browserName STR, platform STR, version STR, deviceOrientation STR
## - CONFIGVAR sauceLabs OBJ:
## - username|accessKey STR (def: ENVVAR SAUCE_USERNAME|ACCESS_KEY)
## - testName STR
## - tags STR_ARR
## - startConnect BOOL (déf: true): starts it automatically
## - tunnelIdentifier STR (for SauceConnect) (déf: "karma" + timestamp)
## - build STR (def: ENVVAR [TRAVIS_]BUILD_NUMBER, BUILD_TAG|NUM
## - recordVideo|Screenshots BOOL (def: false|true)
## - options CAPAB_OBJ: except for the ones above
## - must use reporter "saucelabs" (module karma-sauce-launcher) in order to update job
## "passed" BOOL and "custom-data" (with test result)
## - should increase captureTimeout to 2 minutes
# - a PATH to a Bash script, which take SERVER_URL as argument (does not seem to work)
browserDisconnectTolerance #If browser disconnects from server because of bad connection, try NUM times more (def: 0) with
#a timeout of CONFIGVAR browserDisconnectTimeout NUM (def: 2000).
browserNoActivityTimeout #If browser stays idle for NUM (def: 10000), it will disconnect.
captureTimeout #If browser takes more than NUM to connect (def: 60000), it will disconnect.
#Can also use karma --capture-timeout NUM
proxyValidateSSL #If false, doesn’t validate SSL certificates.
client.useIframe #If false, disable running the actions in an <iframe> (use a new window instead)
frameworks #STR_ARR of plugins performing actions, usually testing or libraries.
#They add <script> in the beginning of the HTML page.
#Using frameworks plugins for libraries is similar to using CONFIGVAR files.
#Available:
## - "jasmine" (module karma-jasmine[@2_0] 0.3.5)
## - "qunit" (module karma-qunit 0.1.4)
## - "chai", "mocha" (module karma-chai 0.1.0 and karma-mocha 0.1.10):
## - CONFIGVAR client.mocha OBJ
reporters #STR_ARR of plugins redirecting the HTML page results ("frameworks" results)
#Can also use karma --reporters STR_ARR
#Reporters don't use logLevel.
#Available:
# - "dots": terminal output, simple dots
# - "progress": terminal output, progress bar (best short terminal output)
## - "spec" (module karma-spec-reporter 0.0.18): Jasmine-like terminal output
## - "mocha" (module karma-mocha-reporter 1.0.2): Mocha-like terminal output
## (best long terminal output). CONFIGVAR mochaReporter:
## - output STR: "full" (def), "autowatch" (next runs show less), "minimal", "noFailures"
## - ignoreSkipped BOOL (def: false): ignore skipped tests
## - "html" (module: karma-html-reporter 0.2.6) with CONFIGVAR htmlReporter:
## - outputDir DIR
## - pageTitle STR
## - reportName STR
## - templatePath FILE (when providing own template, based on jasmine_template.html)
## - focusOnFailure BOOL (def: true)
## - namedFiles BOOL (def: false): use files instead of dirs
## - urlFriendlyNames BOOL (def: false): replace " " by _
## - preserveDescribeNesting BOOL (def: false)
## - foldAll BOOL (def: false)
## - "html" (module: karma-htmlfile-reporter 0.2.1) with CONFIGVAR htmlReporter:
## - outputFile FILE
## - [sub]pageTitle STR
## HTML file showing passed|failed tests
## - "growl" (module karma-growl-reporter 0.1.1): Growl notifications (whether passes or fails)
## Must have GNTP server running first.
## - "junit" (module: karma-junit-reporter 0.2.2): XML Junit format with CONFIGVAR junitReporter:
## - outputFile FILE
## - suite STR
##Browser console.* is also redirected to terminal if CONFIGVAR client.captureConsole true (déf)
reportSlowerThan #Report "frameworks" performing on a file (typically a test file) for more than NUMms (def: 0)
#Can also use karma --report-slower-than NUM
loggers #For the Karma server logs (not reporters output). OBJ_ARR same as LOG4JS appenders OBJ3_ARR
#(déf: [{ type: "console", layout: { type: "coloredOutput" } }])
#Use CONFIGVAR logLevel CONFIG.LOG_DISABLE|ERROR|WARN|INFO|DEBUG (def: LOG_INFO)
#(or karma --log-level disable|error|etc.)
preprocessors #{ GPATH: "PLUGIN" }: process some files with plugins.
#Prefer using gulp to do this.
#Can use plugin-dependent CONFIGVAR
#Available:
## - "html2js" (module karma-html2js-preprocessor 0.1.0): transform HTML file into JavaScript
## file defining WINDOW.__html__.FILENAME = "HTML"
┌───────────┐
│ TOOLS │
└───────────┘
grunt-karma #Grunt plugin (0.11.0) that does karma ACTION
# - TASK "karma"
# - ACTION is first ARG (def: "start")
# - TARGET: src (optional, override Karma files, and can be along watched|included|served BOOL)
# - options:
# - configFile FILE
# - any CONFIGVAR (can also be in TARGET_OBJ) including singleRun|autoWatch
# - background BOOL: make async
GULP-KARMA(OBJ) #Gulp plugin that executes karma binary
#OBJ members:
# - configFile STR (no déf)
# - action STR (def: "run")
#Failed test emits an error event