Options Flashcards

Review the Mocha command line options, in both long and short form.

1
Q

–colors

A

force enabling of colors (Long version of -c)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

–growl

A

(Long Form) enable growl notification support

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

–invert

A

inverts –grep matches (Long version of -i)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

–slow

A

“slow” test threshold in milliseconds [75]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

–timeout

A

set test-case timeout in milliseconds [2000]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

–bail

A

(Long Form) bail after first test failure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

–async-only

A

(Long form) force all tests to take a callback (async)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

–check-leaks

A

By default Mocha will not check for global variables leaked while running tests, to enable this pass –check-leaks, to specify globals that are acceptable use –globals, for example –globals jQuery,MyLib.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

–compilers :,…

A

use the given module(s) to compile files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

–debug

A

Enables node’s debugger support, this executes your script(s) with node debug <file …> allowing you to step through code and break with the debugger statement.</file>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

–debug-brk

A

enable node’s debugger breaking on the first line

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

–help

A

The long form version of the comand line option for getting help information.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

–globals <names></names>

A

Accepts a comma-delimited list of accepted global variable names. For example suppose your app deliberately exposes a global named app and YUI, you may want to add –globals app,YUI.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

–interfaces

A

display available interfaces

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

–no-colors

A

force disabling of colors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

–recursive

A

include sub directories

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

–reporter

A

specify the reporter to use

14
Q

–reporters

A

display available reporters

15
Q

–require

A

require the given module

17
Q

–verion

A

How do you get the version number, long form?

17
Q

–ui

A

The –ui option lets you specify the interface to use, defaulting to “bdd”.

19
Q

–watch

A

watch files for changes

20
Q

-b

A

(Short Form) bail after first test failure

20
Q

-A

A

(Short Term) force all tests to take a callback (async)

22
Q

-c

A

force enabling of colors

22
Q

-C

A

force disabling of colors

25
Q

-G

A

(Short Form) enable growl notification support

27
Q

-g

A

The –grep option when specified will trigger mocha to only run tests matching the given pattern which is internally compiled to a RegExp.

Suppose for example you have “api” related tests, as well as “app” related tests, as shown in the following snippet; One could use –grep api or –grep app to run one or the other. The same goes for any other part of a suite or test-case title, –grep users would be valid as well, or even –grep GET.

28
Q

-h

A

The short form comand line option for getting help information.

30
Q

-i

A

inverts –grep matches

31
Q

-R

A

specify the reporter to use

32
Q

-r

A

The –require option is useful for libraries such as should.js, so you may simply –require should instead of manually invoking require(‘should’) within each test file. Note that this works well for should as it augments Object.prototype, however if you wish to access a module’s exports you will have to require them, for example var should = require(‘should’).

33
Q

-s

A

“slow” test threshold in milliseconds [75]

34
Q

-d

A

(Short Form) Enables node’s debugger support, this executes your script(s) with node debug <file …> allowing you to step through code and break with the debugger statement.</file>

35
Q

-t

A

set test-case timeout in milliseconds [2000]

36
Q

-u

A

The –u option lets you specify the interface to use, defaulting to “bdd”.

37
Q

-V

A

How do you get the version number, short form?

38
Q

-w

A

watch files for changes

39
Q

What is the default timeout?

A

2000 ms (2 seconds)

40
Q

–grep

A

The –grep option when specified will trigger mocha to only run tests matching the given pattern which is internally compiled to a RegExp.

Suppose for example you have “api” related tests, as well as “app” related tests, as shown in the following snippet; One could use –grep api or –grep app to run one or the other. The same goes for any other part of a suite or test-case title, –grep users would be valid as well, or even –grep GET.