1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | var sprintf = require('sprintf').sprintf;
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | var DEFAULT_TEST_TIMEOUT = 15 * 1000;
|
24 |
|
25 | var DEFAULT_CONCURRENCY = 1;
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | var DEFAULT_TEST_REPORTER = 'cli';
|
31 | var DEFAULT_COVERAGE_REPORTER = 'cli';
|
32 | var DEFAULT_SCOPE_LEAKS_REPORTER = 'cli';
|
33 |
|
34 |
|
35 |
|
36 |
|
37 | var VERSION = '0.7.1';
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | var COVERAGE_PATH = 'lib-cov';
|
43 |
|
44 |
|
45 |
|
46 |
|
47 | var DEFAULT_VERBOSITY = 2;
|
48 |
|
49 | var INIT_FUNCTION_NAME = 'init';
|
50 |
|
51 | var GLOBAL_TEARDOWN_FUNCTION_NAME = 'globalTearDown';
|
52 | var TEARDOWN_FUNCTION_NAME = 'tearDown';
|
53 | var GLOBAL_SETUP_FUNCTION_NAME = 'globalSetUp';
|
54 | var SETUP_FUNCTION_NAME = 'setUp';
|
55 |
|
56 | var DEFAULT_SOCKET_PATH = '/tmp/whiskey-parent.sock';
|
57 |
|
58 |
|
59 |
|
60 |
|
61 | var TEST_START_MARKER = '@-start-test-@';
|
62 | var DELIMITER = '@-delimiter-@';
|
63 | var TEST_END_MARKER = '@-end-test-@';
|
64 | var TEST_FILE_END_MARKER = '@-end-test-file-@';
|
65 | var COVERAGE_END_MARKER = '@-end-coverage-@';
|
66 |
|
67 |
|
68 |
|
69 |
|
70 | var DEFAULT_OPTIONS = [
|
71 | ['-h', '--help', 'Print this help'],
|
72 | ['-V', '--version', 'Print the version']
|
73 | ];
|
74 |
|
75 |
|
76 |
|
77 |
|
78 | var WHISKEY_OPTIONS = [
|
79 | ['-t', '--tests STRING', 'Whitespace separated list of test suites to run sequentially.'],
|
80 | ['-T', '--independent-tests STRING', 'Whitespace separated list of test suites capable of running independently and concurrently.'],
|
81 | ['-m', '--max-suites NUMBER', 'The number of concurrently executing test suites (defaults to 5)'],
|
82 | ['-ti', '--test-init-file STRING', 'An initialization file which is run before each test file'],
|
83 | ['-c', '--chdir STRING', 'Directory to which each test process chdirs before running the tests'],
|
84 | ['-v', '--verbosity [NUMBER]', 'Test runner verbosity'],
|
85 | ['-g', '--global-setup-teardown STRING', 'Specifies the file containing the globalSetUp and globalTearDown procedures.'],
|
86 | ['', '--failfast', 'Stop running the tests on the first failure'],
|
87 | ['', '--timeout [NUMBER]', 'How long to wait (ms) for a test file to complete before timing out'],
|
88 | ['', '--socket-path STRING', sprintf('A path to the unix socket used for communication. ' +
|
89 | 'Defaults to %s', DEFAULT_SOCKET_PATH)],
|
90 |
|
91 | ['', '--concurrency [NUMBER]', sprintf('Maximum number of tests in a file which will run in ' +
|
92 | 'parallel. Defaults to %s', DEFAULT_CONCURRENCY)],
|
93 | ['', '--sequential', 'Run test in a file in sequential mode. This is the same as using --concurrency 1'],
|
94 |
|
95 | ['', '--custom-assert-module STRING', 'Absolute path to a module with custom assert methods'],
|
96 |
|
97 | ['', '--no-styles', 'Don\'t use colors and styles'],
|
98 |
|
99 | ['', '--quiet', 'Don\'t print stdout and stderr'],
|
100 | ['', '--real-time', 'Print data which is sent to stdout / stderr as soon ' +
|
101 | 'as it comes in'],
|
102 |
|
103 | ['', '--test-reporter STRING', 'Rest reporter type (cli or tap)'],
|
104 |
|
105 | ['', '--coverage', 'Enable test coverage'],
|
106 | ['', '--coverage-file STRING', 'A file where the coverage result is stored. Only has an effect if json coverage reporter is used'],
|
107 | ['', '--coverage-files STRING', 'A comma-separated list of files containing coverage data'],
|
108 | ['', '--coverage-reporter STRING', 'Coverage reporter type (cli, html)'],
|
109 | ['', '--coverage-dir STRING', 'Directory where the HTML coverage report is saved'],
|
110 | ['', '--coverage-encoding STRING', 'Encoding which jscoverage will use when parsing files which are instrumented'],
|
111 | ['', '--coverage-exclude STRING', 'Paths which won\'t be instrumented'],
|
112 | ['', '--coverage-no-instrument STRING', 'Copy but don\'t instrument the path'],
|
113 | ['', '--coverage-no-regen', 'Don\'t generate coverage file if lib-cov directory already exists'],
|
114 |
|
115 | ['', '--scope-leaks', 'Records which variables were leaked into the global ' +
|
116 | 'scope.'],
|
117 | ['', '--scope-leaks-reporter STRING', 'Scope leaks reporter type (cli)'],
|
118 | ['-d', '--debug', 'Attach a debugger to a test process'],
|
119 | ['', '--gen-makefile', 'Genarate a Makefile'],
|
120 | ['', '--makefile-path STRING', 'Path where a generated Makefile is saved'],
|
121 | ['', '--report-timing', 'Report test timing'],
|
122 | ['', '--dependencies STRING', 'Path to the test dependencies configuration file'],
|
123 | ['', '--only-essential-dependencies', 'Only start dependencies required by the tests files which are ran']
|
124 | ];
|
125 |
|
126 |
|
127 |
|
128 |
|
129 | var PROCESS_RUNNER_OPTIONS = [
|
130 | ['-c', '--config STRING', 'Path to the dependencies.json file'],
|
131 | ['-v', '--verify', 'Verify the config'],
|
132 | ['-r', '--run', 'Run the processes'],
|
133 | ['-n', '--names STRING', 'Comma-delimited string of the processes to run. Only applicable' +
|
134 | ' if --run is used']
|
135 | ];
|
136 |
|
137 | exports.DEFAULT_TEST_TIMEOUT = DEFAULT_TEST_TIMEOUT;
|
138 | exports.DEFAULT_CONCURRENCY = DEFAULT_CONCURRENCY;
|
139 | exports.DEFAULT_TEST_REPORTER = DEFAULT_TEST_REPORTER;
|
140 | exports.DEFAULT_COVERAGE_REPORTER = DEFAULT_COVERAGE_REPORTER;
|
141 | exports.DEFAULT_SCOPE_LEAKS_REPORTER = DEFAULT_SCOPE_LEAKS_REPORTER;
|
142 |
|
143 | exports.VERSION = VERSION;
|
144 | exports.COVERAGE_PATH = COVERAGE_PATH;
|
145 | exports.DEFAULT_VERBOSITY = DEFAULT_VERBOSITY;
|
146 | exports.INIT_FUNCTION_NAME = INIT_FUNCTION_NAME;
|
147 | exports.SETUP_FUNCTION_NAME = SETUP_FUNCTION_NAME;
|
148 | exports.TEARDOWN_FUNCTION_NAME = TEARDOWN_FUNCTION_NAME;
|
149 | exports.GLOBAL_SETUP_FUNCTION_NAME = GLOBAL_SETUP_FUNCTION_NAME;
|
150 | exports.GLOBAL_TEARDOWN_FUNCTION_NAME = GLOBAL_TEARDOWN_FUNCTION_NAME;
|
151 | exports.DEFAULT_SOCKET_PATH = DEFAULT_SOCKET_PATH;
|
152 | exports.DEFAULT_OPTIONS = DEFAULT_OPTIONS;
|
153 | exports.WHISKEY_OPTIONS = WHISKEY_OPTIONS;
|
154 | exports.PROCESS_RUNNER_OPTIONS = PROCESS_RUNNER_OPTIONS;
|
155 |
|
156 | exports.TEST_START_MARKER = TEST_START_MARKER;
|
157 | exports.DELIMITER = DELIMITER;
|
158 | exports.TEST_END_MARKER = TEST_END_MARKER;
|
159 | exports.TEST_FILE_END_MARKER = TEST_FILE_END_MARKER;
|
160 | exports.COVERAGE_END_MARKER = COVERAGE_END_MARKER;
|