ava 0.16.0 → 0.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api.js +297 -265
- package/cli.js +15 -179
- package/index.js +5 -98
- package/index.js.flow +201 -0
- package/lib/assert.js +87 -53
- package/lib/ava-error.js +4 -8
- package/lib/ava-files.js +282 -0
- package/lib/babel-config.js +35 -73
- package/lib/beautify-stack.js +17 -16
- package/lib/caching-precompiler.js +72 -87
- package/lib/cli.js +181 -0
- package/lib/code-excerpt.js +57 -0
- package/lib/colors.js +6 -2
- package/lib/concurrent.js +62 -75
- package/lib/enhance-assert.js +57 -49
- package/lib/extract-stack.js +10 -0
- package/lib/fork.js +67 -68
- package/lib/format-assert-error.js +72 -0
- package/lib/globals.js +3 -8
- package/lib/hook.js +15 -20
- package/lib/logger.js +59 -82
- package/lib/main.js +90 -0
- package/lib/prefix-title.js +21 -0
- package/lib/process-adapter.js +108 -0
- package/lib/reporters/mini.js +260 -257
- package/lib/reporters/tap.js +80 -85
- package/lib/reporters/verbose.js +142 -115
- package/lib/run-status.js +110 -152
- package/lib/runner.js +125 -137
- package/lib/sequence.js +68 -84
- package/lib/serialize-error.js +68 -4
- package/lib/snapshot-state.js +30 -0
- package/lib/test-collection.js +144 -156
- package/lib/test-worker.js +45 -95
- package/lib/test.js +289 -318
- package/lib/throws-helper.js +9 -9
- package/lib/validate-test.js +48 -0
- package/lib/watcher.js +258 -297
- package/package.json +63 -53
- package/profile.js +68 -55
- package/readme.md +215 -101
- package/types/generated.d.ts +848 -228
- package/types/make.js +54 -23
- package/lib/send.js +0 -16
package/cli.js
CHANGED
|
@@ -1,191 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var debug = require('debug')('ava');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const debug = require('debug')('ava');
|
|
6
5
|
|
|
7
6
|
// Prefer the local installation of AVA.
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const resolveCwd = require('resolve-cwd');
|
|
8
|
+
const localCLI = resolveCwd('ava/cli');
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
// Use `path.relative()` to detect local AVA installation,
|
|
11
|
+
// because __filename's case is inconsistent on Windows
|
|
12
|
+
// see https://github.com/nodejs/node/issues/6624
|
|
13
|
+
if (localCLI && path.relative(localCLI, __filename) !== '') {
|
|
12
14
|
debug('Using local install of AVA');
|
|
13
|
-
require(localCLI);
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (debug.enabled) {
|
|
18
|
-
require('time-require');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
var updateNotifier = require('update-notifier');
|
|
22
|
-
var figures = require('figures');
|
|
23
|
-
var arrify = require('arrify');
|
|
24
|
-
var meow = require('meow');
|
|
25
|
-
var Promise = require('bluebird');
|
|
26
|
-
var pkgConf = require('pkg-conf');
|
|
27
|
-
var isCi = require('is-ci');
|
|
28
|
-
var hasFlag = require('has-flag');
|
|
29
|
-
var colors = require('./lib/colors');
|
|
30
|
-
var verboseReporter = require('./lib/reporters/verbose');
|
|
31
|
-
var miniReporter = require('./lib/reporters/mini');
|
|
32
|
-
var tapReporter = require('./lib/reporters/tap');
|
|
33
|
-
var Logger = require('./lib/logger');
|
|
34
|
-
var Watcher = require('./lib/watcher');
|
|
35
|
-
var babelConfig = require('./lib/babel-config');
|
|
36
|
-
var Api = require('./api');
|
|
37
|
-
|
|
38
|
-
// Bluebird specific
|
|
39
|
-
Promise.longStackTraces();
|
|
40
|
-
|
|
41
|
-
var conf = pkgConf.sync('ava');
|
|
42
|
-
|
|
43
|
-
var pkgDir = path.dirname(pkgConf.filepath(conf));
|
|
44
|
-
|
|
45
|
-
try {
|
|
46
|
-
conf.babel = babelConfig.validate(conf.babel);
|
|
47
|
-
} catch (err) {
|
|
48
|
-
console.log('\n ' + err.message);
|
|
49
|
-
process.exit(1);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
var cli = meow([
|
|
53
|
-
'Usage',
|
|
54
|
-
' ava [<file|directory|glob> ...]',
|
|
55
|
-
'',
|
|
56
|
-
'Options',
|
|
57
|
-
' --init Add AVA to your project',
|
|
58
|
-
' --fail-fast Stop after first test failure',
|
|
59
|
-
' --serial, -s Run tests serially',
|
|
60
|
-
' --require, -r Module to preload (Can be repeated)',
|
|
61
|
-
' --tap, -t Generate TAP output',
|
|
62
|
-
' --verbose, -v Enable verbose output',
|
|
63
|
-
' --no-cache Disable the transpiler cache',
|
|
64
|
-
' --match, -m Only run tests with matching title (Can be repeated)',
|
|
65
|
-
' --watch, -w Re-run tests when tests and source files change',
|
|
66
|
-
' --source, -S Pattern to match source files so tests can be re-run (Can be repeated)',
|
|
67
|
-
' --timeout, -T Set global timeout',
|
|
68
|
-
' --concurrency, -c Maximum number of test files running at the same time (EXPERIMENTAL)',
|
|
69
|
-
'',
|
|
70
|
-
'Examples',
|
|
71
|
-
' ava',
|
|
72
|
-
' ava test.js test2.js',
|
|
73
|
-
' ava test-*.js',
|
|
74
|
-
' ava test',
|
|
75
|
-
' ava --init',
|
|
76
|
-
' ava --init foo.js',
|
|
77
|
-
'',
|
|
78
|
-
'Default patterns when no arguments:',
|
|
79
|
-
'test.js test-*.js test/**/*.js **/__tests__/**/*.js **/*.test.js'
|
|
80
|
-
], {
|
|
81
|
-
string: [
|
|
82
|
-
'_',
|
|
83
|
-
'require',
|
|
84
|
-
'timeout',
|
|
85
|
-
'source',
|
|
86
|
-
'match',
|
|
87
|
-
'concurrency'
|
|
88
|
-
],
|
|
89
|
-
boolean: [
|
|
90
|
-
'fail-fast',
|
|
91
|
-
'verbose',
|
|
92
|
-
'serial',
|
|
93
|
-
'tap',
|
|
94
|
-
'watch'
|
|
95
|
-
],
|
|
96
|
-
default: conf,
|
|
97
|
-
alias: {
|
|
98
|
-
t: 'tap',
|
|
99
|
-
v: 'verbose',
|
|
100
|
-
r: 'require',
|
|
101
|
-
s: 'serial',
|
|
102
|
-
m: 'match',
|
|
103
|
-
w: 'watch',
|
|
104
|
-
S: 'source',
|
|
105
|
-
T: 'timeout',
|
|
106
|
-
c: 'concurrency'
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
updateNotifier({pkg: cli.pkg}).notify();
|
|
111
|
-
|
|
112
|
-
if (cli.flags.init) {
|
|
113
|
-
require('ava-init')();
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (
|
|
118
|
-
((hasFlag('--watch') || hasFlag('-w')) && (hasFlag('--tap') || hasFlag('-t'))) ||
|
|
119
|
-
(conf.watch && conf.tap)
|
|
120
|
-
) {
|
|
121
|
-
console.error(' ' + colors.error(figures.cross) + ' The TAP reporter is not available when using watch mode.');
|
|
122
|
-
process.exit(1);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
var api = new Api({
|
|
126
|
-
failFast: cli.flags.failFast,
|
|
127
|
-
serial: cli.flags.serial,
|
|
128
|
-
require: arrify(cli.flags.require),
|
|
129
|
-
cacheEnabled: cli.flags.cache !== false,
|
|
130
|
-
explicitTitles: cli.flags.watch,
|
|
131
|
-
match: arrify(cli.flags.match),
|
|
132
|
-
babelConfig: conf.babel,
|
|
133
|
-
resolveTestsFrom: cli.input.length === 0 ? pkgDir : process.cwd(),
|
|
134
|
-
timeout: cli.flags.timeout,
|
|
135
|
-
concurrency: cli.flags.concurrency ? parseInt(cli.flags.concurrency, 10) : 0
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
var reporter;
|
|
139
|
-
|
|
140
|
-
if (cli.flags.tap && !cli.flags.watch) {
|
|
141
|
-
reporter = tapReporter();
|
|
142
|
-
} else if (cli.flags.verbose || isCi) {
|
|
143
|
-
reporter = verboseReporter();
|
|
15
|
+
require(localCLI); // eslint-disable-line import/no-dynamic-require
|
|
144
16
|
} else {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
reporter.api = api;
|
|
149
|
-
var logger = new Logger(reporter);
|
|
150
|
-
|
|
151
|
-
logger.start();
|
|
152
|
-
|
|
153
|
-
api.on('test-run', function (runStatus) {
|
|
154
|
-
reporter.api = runStatus;
|
|
155
|
-
runStatus.on('test', logger.test);
|
|
156
|
-
runStatus.on('error', logger.unhandledError);
|
|
157
|
-
|
|
158
|
-
runStatus.on('stdout', logger.stdout);
|
|
159
|
-
runStatus.on('stderr', logger.stderr);
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
var files = cli.input.length ? cli.input : arrify(conf.files);
|
|
17
|
+
if (debug.enabled) {
|
|
18
|
+
require('time-require'); // eslint-disable-line import/no-unassigned-import
|
|
19
|
+
}
|
|
163
20
|
|
|
164
|
-
if (cli.flags.watch) {
|
|
165
21
|
try {
|
|
166
|
-
|
|
167
|
-
watcher.observeStdin(process.stdin);
|
|
22
|
+
require('./lib/cli').run();
|
|
168
23
|
} catch (err) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
console.error(' ' + colors.error(figures.cross) + ' ' + err.message);
|
|
172
|
-
logger.exit(1);
|
|
173
|
-
} else {
|
|
174
|
-
// Rethrow so it becomes an uncaught exception.
|
|
175
|
-
throw err;
|
|
176
|
-
}
|
|
24
|
+
console.error(`\n ${err.message}`);
|
|
25
|
+
process.exit(1);
|
|
177
26
|
}
|
|
178
|
-
} else {
|
|
179
|
-
api.run(files)
|
|
180
|
-
.then(function (runStatus) {
|
|
181
|
-
logger.finish(runStatus);
|
|
182
|
-
logger.exit(runStatus.failCount > 0 || runStatus.rejectionCount > 0 || runStatus.exceptionCount > 0 ? 1 : 0);
|
|
183
|
-
})
|
|
184
|
-
.catch(function (err) {
|
|
185
|
-
// Don't swallow exceptions. Note that any expected error should already
|
|
186
|
-
// have been logged.
|
|
187
|
-
setImmediate(function () {
|
|
188
|
-
throw err;
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
27
|
}
|
package/index.js
CHANGED
|
@@ -1,101 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
var path = require('path');
|
|
3
|
-
var chalk = require('chalk');
|
|
4
|
-
var serializeError = require('./lib/serialize-error');
|
|
5
|
-
var globals = require('./lib/globals');
|
|
6
|
-
var Runner = require('./lib/runner');
|
|
7
|
-
var send = require('./lib/send');
|
|
8
2
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
// check if the test is being run without AVA cli
|
|
17
|
-
var isForked = typeof process.send === 'function';
|
|
18
|
-
|
|
19
|
-
if (!isForked) {
|
|
20
|
-
var fp = path.relative('.', process.argv[1]);
|
|
21
|
-
|
|
22
|
-
console.log();
|
|
23
|
-
console.error('Test files must be run with the AVA CLI:\n\n ' + chalk.grey.dim('$') + ' ' + chalk.cyan('ava ' + fp) + '\n');
|
|
24
|
-
|
|
25
|
-
process.exit(1); // eslint-disable-line xo/no-process-exit
|
|
3
|
+
// Ensure the same AVA install is loaded by the test file as by the test worker
|
|
4
|
+
if (process.env.AVA_PATH && process.env.AVA_PATH !== __dirname) {
|
|
5
|
+
module.exports = require(process.env.AVA_PATH); // eslint-disable-line import/no-dynamic-require
|
|
6
|
+
} else {
|
|
7
|
+
module.exports = require('./lib/main');
|
|
26
8
|
}
|
|
27
|
-
|
|
28
|
-
// note that test files have require('ava')
|
|
29
|
-
require('./lib/test-worker').avaRequired = true;
|
|
30
|
-
|
|
31
|
-
// if fail-fast is enabled, use this variable to detect
|
|
32
|
-
// that no more tests should be logged
|
|
33
|
-
var isFailed = false;
|
|
34
|
-
|
|
35
|
-
Error.stackTraceLimit = Infinity;
|
|
36
|
-
|
|
37
|
-
function test(props) {
|
|
38
|
-
if (isFailed) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
var hasError = typeof props.error !== 'undefined';
|
|
43
|
-
|
|
44
|
-
// don't display anything if it's a passed hook
|
|
45
|
-
if (!hasError && props.type !== 'test') {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (hasError) {
|
|
50
|
-
props.error = serializeError(props.error);
|
|
51
|
-
} else {
|
|
52
|
-
props.error = null;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
send('test', props);
|
|
56
|
-
|
|
57
|
-
if (hasError && opts.failFast) {
|
|
58
|
-
isFailed = true;
|
|
59
|
-
exit();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function exit() {
|
|
64
|
-
var stats = runner._buildStats();
|
|
65
|
-
|
|
66
|
-
send('results', {
|
|
67
|
-
stats: stats
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
globals.setImmediate(function () {
|
|
72
|
-
var hasExclusive = runner.tests.hasExclusive;
|
|
73
|
-
var numberOfTests = runner.tests.tests.concurrent.length + runner.tests.tests.serial.length;
|
|
74
|
-
|
|
75
|
-
if (numberOfTests === 0) {
|
|
76
|
-
send('no-tests', {avaRequired: true});
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
send('stats', {
|
|
81
|
-
testCount: numberOfTests,
|
|
82
|
-
hasExclusive: hasExclusive
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
runner.on('test', test);
|
|
86
|
-
|
|
87
|
-
process.on('ava-run', function (options) {
|
|
88
|
-
runner.run(options).then(exit);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
process.on('ava-init-exit', function () {
|
|
92
|
-
exit();
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
module.exports = runner.test;
|
|
97
|
-
|
|
98
|
-
// TypeScript imports the `default` property for
|
|
99
|
-
// an ES2015 default import (`import test from 'ava'`)
|
|
100
|
-
// See: https://github.com/Microsoft/TypeScript/issues/2242#issuecomment-83694181
|
|
101
|
-
module.exports.default = runner.test;
|
package/index.js.flow
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/* @flow */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Misc Setup Types
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
type PromiseLike<R> = {
|
|
8
|
+
then<U>(
|
|
9
|
+
onFulfill?: (value: R) => Promise<U> | U,
|
|
10
|
+
onReject?: (error: any) => Promise<U> | U
|
|
11
|
+
): Promise<U>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type ObservableLike = {
|
|
15
|
+
subscribe(observer: (value: {}) => void): void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type SpecialReturnTypes =
|
|
19
|
+
| PromiseLike<any>
|
|
20
|
+
| Iterator<any>
|
|
21
|
+
| ObservableLike;
|
|
22
|
+
|
|
23
|
+
type Constructor = Class<{
|
|
24
|
+
constructor(...args: Array<any>): any
|
|
25
|
+
}>;
|
|
26
|
+
|
|
27
|
+
type ErrorValidator =
|
|
28
|
+
| Constructor
|
|
29
|
+
| RegExp
|
|
30
|
+
| string
|
|
31
|
+
| ((error: any) => boolean);
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Assertion Types
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
type AssertContext = {
|
|
38
|
+
// Passing assertion.
|
|
39
|
+
pass(message?: string): void;
|
|
40
|
+
// Failing assertion.
|
|
41
|
+
fail(message?: string): void;
|
|
42
|
+
// Assert that value is truthy.
|
|
43
|
+
truthy(value: mixed, message?: string): void;
|
|
44
|
+
// Assert that value is falsy.
|
|
45
|
+
falsy(value: mixed, message?: string): void;
|
|
46
|
+
// Assert that value is true.
|
|
47
|
+
true(value: mixed, message?: string): void;
|
|
48
|
+
// Assert that value is false.
|
|
49
|
+
false(value: mixed, message?: string): void;
|
|
50
|
+
// Assert that value is equal to expected.
|
|
51
|
+
is<U>(value: U, expected: U, message?: string): void;
|
|
52
|
+
// Assert that value is not equal to expected.
|
|
53
|
+
not<U>(value: U, expected: U, message?: string): void;
|
|
54
|
+
// Assert that value is deep equal to expected.
|
|
55
|
+
deepEqual<U>(value: U, expected: U, message?: string): void;
|
|
56
|
+
// Assert that value is not deep equal to expected.
|
|
57
|
+
notDeepEqual<U>(value: U, expected: U, message?: string): void;
|
|
58
|
+
// Assert that function throws an error or promise rejects.
|
|
59
|
+
// @param error Can be a constructor, regex, error message or validation function.
|
|
60
|
+
throws: {
|
|
61
|
+
(value: PromiseLike<mixed>, error?: ErrorValidator, message?: string): Promise<Error>;
|
|
62
|
+
(value: () => mixed, error?: ErrorValidator, message?: string): Error;
|
|
63
|
+
};
|
|
64
|
+
// Assert that function doesn't throw an error or promise resolves.
|
|
65
|
+
notThrows: {
|
|
66
|
+
<U>(value: PromiseLike<U>, message?: string): Promise<U>;
|
|
67
|
+
(value: () => mixed, message?: string): void;
|
|
68
|
+
};
|
|
69
|
+
// Assert that contents matches regex.
|
|
70
|
+
regex(contents: string, regex: RegExp, message?: string): void;
|
|
71
|
+
// Assert that contents matches a snapshot.
|
|
72
|
+
snapshot(contents: any, message?: string): void;
|
|
73
|
+
// Assert that contents does not match regex.
|
|
74
|
+
notRegex(contents: string, regex: RegExp, message?: string): void;
|
|
75
|
+
// Assert that error is falsy.
|
|
76
|
+
ifError(error: any, message?: string): void;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Context Types
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
type TestContext = AssertContext & {
|
|
84
|
+
plan(count: number): void;
|
|
85
|
+
skip: AssertContext;
|
|
86
|
+
};
|
|
87
|
+
type CallbackTestContext = TestContext & { end(): void; };
|
|
88
|
+
type ContextualTestContext = TestContext & { context: any; };
|
|
89
|
+
type ContextualCallbackTestContext = CallbackTestContext & { context: any; };
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Test Implementations
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
type TestFunction<T, R> = {
|
|
96
|
+
(t: T, ...args: Array<any>): R;
|
|
97
|
+
title?: (providedTitle: string, ...args: Array<any>) => string;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
type TestImplementation<T, R> =
|
|
101
|
+
| TestFunction<T, R>
|
|
102
|
+
| Array<TestFunction<T, R>>;
|
|
103
|
+
|
|
104
|
+
type Test = TestImplementation<TestContext, SpecialReturnTypes | void>;
|
|
105
|
+
type CallbackTest = TestImplementation<CallbackTestContext, void>;
|
|
106
|
+
type ContextualTest = TestImplementation<ContextualTestContext, SpecialReturnTypes | void>;
|
|
107
|
+
type ContextualCallbackTest = TestImplementation<ContextualCallbackTestContext, void>;
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Method Types
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
type TestMethod = {
|
|
115
|
+
( implementation: Test): void;
|
|
116
|
+
(name: string, implementation: Test): void;
|
|
117
|
+
|
|
118
|
+
serial : TestMethod;
|
|
119
|
+
before : TestMethod;
|
|
120
|
+
after : TestMethod;
|
|
121
|
+
skip : TestMethod;
|
|
122
|
+
todo : TestMethod;
|
|
123
|
+
failing : TestMethod;
|
|
124
|
+
only : TestMethod;
|
|
125
|
+
beforeEach : TestMethod;
|
|
126
|
+
afterEach : TestMethod;
|
|
127
|
+
cb : CallbackTestMethod;
|
|
128
|
+
always : TestMethod;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
type CallbackTestMethod = {
|
|
132
|
+
( implementation: CallbackTest): void;
|
|
133
|
+
(name: string, implementation: CallbackTest): void;
|
|
134
|
+
|
|
135
|
+
serial : CallbackTestMethod;
|
|
136
|
+
before : CallbackTestMethod;
|
|
137
|
+
after : CallbackTestMethod;
|
|
138
|
+
skip : CallbackTestMethod;
|
|
139
|
+
todo : CallbackTestMethod;
|
|
140
|
+
failing : CallbackTestMethod;
|
|
141
|
+
only : CallbackTestMethod;
|
|
142
|
+
beforeEach : CallbackTestMethod;
|
|
143
|
+
afterEach : CallbackTestMethod;
|
|
144
|
+
cb : CallbackTestMethod;
|
|
145
|
+
always : CallbackTestMethod;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
type ContextualTestMethod = {
|
|
149
|
+
( implementation: ContextualTest): void;
|
|
150
|
+
(name: string, implementation: ContextualTest): void;
|
|
151
|
+
|
|
152
|
+
serial : ContextualTestMethod;
|
|
153
|
+
before : ContextualTestMethod;
|
|
154
|
+
after : ContextualTestMethod;
|
|
155
|
+
skip : ContextualTestMethod;
|
|
156
|
+
todo : ContextualTestMethod;
|
|
157
|
+
failing : ContextualTestMethod;
|
|
158
|
+
only : ContextualTestMethod;
|
|
159
|
+
beforeEach : ContextualTestMethod;
|
|
160
|
+
afterEach : ContextualTestMethod;
|
|
161
|
+
cb : ContextualCallbackTestMethod;
|
|
162
|
+
always : ContextualTestMethod;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
type ContextualCallbackTestMethod = {
|
|
166
|
+
( implementation: ContextualCallbackTest): void;
|
|
167
|
+
(name: string, implementation: ContextualCallbackTest): void;
|
|
168
|
+
|
|
169
|
+
serial : ContextualCallbackTestMethod;
|
|
170
|
+
before : ContextualCallbackTestMethod;
|
|
171
|
+
after : ContextualCallbackTestMethod;
|
|
172
|
+
skip : ContextualCallbackTestMethod;
|
|
173
|
+
todo : ContextualCallbackTestMethod;
|
|
174
|
+
failing : ContextualCallbackTestMethod;
|
|
175
|
+
only : ContextualCallbackTestMethod;
|
|
176
|
+
beforeEach : ContextualCallbackTestMethod;
|
|
177
|
+
afterEach : ContextualCallbackTestMethod;
|
|
178
|
+
cb : ContextualCallbackTestMethod;
|
|
179
|
+
always : ContextualCallbackTestMethod;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Public API
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
declare module.exports: {
|
|
187
|
+
( run: ContextualTest): void;
|
|
188
|
+
(name: string, run: ContextualTest): void;
|
|
189
|
+
|
|
190
|
+
beforeEach : TestMethod;
|
|
191
|
+
afterEach : TestMethod;
|
|
192
|
+
serial : ContextualTestMethod;
|
|
193
|
+
before : ContextualTestMethod;
|
|
194
|
+
after : ContextualTestMethod;
|
|
195
|
+
skip : ContextualTestMethod;
|
|
196
|
+
todo : ContextualTestMethod;
|
|
197
|
+
failing : ContextualTestMethod;
|
|
198
|
+
only : ContextualTestMethod;
|
|
199
|
+
cb : ContextualCallbackTestMethod;
|
|
200
|
+
always : ContextualTestMethod;
|
|
201
|
+
};
|