ava 3.4.0 → 3.6.0
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/eslint-plugin-helper.js +1 -1
- package/index.d.ts +27 -24
- package/lib/api.js +2 -2
- package/lib/assert.js +14 -14
- package/lib/cli.js +14 -8
- package/lib/concordance-options.js +1 -1
- package/lib/create-chain.js +10 -10
- package/lib/environment-variables.js +1 -1
- package/lib/extensions.js +1 -1
- package/lib/fork.js +7 -7
- package/lib/globs.js +2 -2
- package/lib/is-ci.js +5 -0
- package/lib/load-config.js +2 -2
- package/lib/reporters/improper-usage-messages.js +1 -1
- package/lib/reporters/mini.js +21 -21
- package/lib/reporters/tap.js +10 -10
- package/lib/reporters/verbose.js +5 -5
- package/lib/runner.js +21 -16
- package/lib/snapshot-manager.js +11 -11
- package/lib/test.js +8 -3
- package/lib/worker/ensure-forked.js +1 -1
- package/lib/worker/subprocess.js +3 -3
- package/package.json +47 -50
- package/readme.md +0 -1
package/eslint-plugin-helper.js
CHANGED
|
@@ -49,7 +49,7 @@ function load(projectDir, overrides) {
|
|
|
49
49
|
let helperPatterns = [];
|
|
50
50
|
if (overrides && overrides.helpers !== undefined) {
|
|
51
51
|
if (!Array.isArray(overrides.helpers) || overrides.helpers.length === 0) {
|
|
52
|
-
throw new Error('The
|
|
52
|
+
throw new Error('The ’helpers’ override must be an array containing glob patterns.');
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
helperPatterns = normalizePatterns(overrides.helpers);
|
package/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export interface Subscribable {
|
|
2
2
|
subscribe(observer: {
|
|
3
|
-
error(err: any): void
|
|
4
|
-
complete(): void
|
|
5
|
-
}): void
|
|
3
|
+
error(err: any): void;
|
|
4
|
+
complete(): void;
|
|
5
|
+
}): void;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export type Constructor = (new (...args:
|
|
8
|
+
export type Constructor = (new (...args: any[]) => any);
|
|
9
9
|
|
|
10
10
|
/** Specify one or more expectations the thrown error must satisfy. */
|
|
11
11
|
export type ThrowsExpectation = {
|
|
@@ -29,8 +29,8 @@ export type CommitDiscardOptions = {
|
|
|
29
29
|
/**
|
|
30
30
|
* Whether the logs should be included in those of the parent test.
|
|
31
31
|
*/
|
|
32
|
-
retainLogs?: boolean
|
|
33
|
-
}
|
|
32
|
+
retainLogs?: boolean;
|
|
33
|
+
};
|
|
34
34
|
|
|
35
35
|
/** Options that can be passed to the `t.snapshot()` assertion. */
|
|
36
36
|
export type SnapshotOptions = {
|
|
@@ -308,6 +308,9 @@ export interface ExecutionContext<Context = unknown> extends Assertions {
|
|
|
308
308
|
/** Title of the test or hook. */
|
|
309
309
|
readonly title: string;
|
|
310
310
|
|
|
311
|
+
/** Whether the test has passed. Only accurate in afterEach hooks. */
|
|
312
|
+
readonly passed: boolean;
|
|
313
|
+
|
|
311
314
|
log: LogFn;
|
|
312
315
|
plan: PlanFn;
|
|
313
316
|
timeout: TimeoutFn;
|
|
@@ -316,10 +319,10 @@ export interface ExecutionContext<Context = unknown> extends Assertions {
|
|
|
316
319
|
|
|
317
320
|
export interface LogFn {
|
|
318
321
|
/** Log one or more values. */
|
|
319
|
-
(...values:
|
|
322
|
+
(...values: any[]): void;
|
|
320
323
|
|
|
321
324
|
/** Skip logging. */
|
|
322
|
-
skip(...values:
|
|
325
|
+
skip(...values: any[]): void;
|
|
323
326
|
}
|
|
324
327
|
|
|
325
328
|
export interface PlanFn {
|
|
@@ -343,30 +346,30 @@ export interface TimeoutFn {
|
|
|
343
346
|
|
|
344
347
|
export interface TryFn<Context = unknown> {
|
|
345
348
|
/**
|
|
346
|
-
*
|
|
349
|
+
* Attempt to run some assertions. The result must be explicitly committed or discarded or else
|
|
347
350
|
* the test will fail. A macro may be provided. The title may help distinguish attempts from
|
|
348
351
|
* one another.
|
|
349
352
|
*/
|
|
350
353
|
<Args extends any[]>(title: string, fn: EitherMacro<Args, Context>, ...args: Args): Promise<TryResult>;
|
|
351
354
|
|
|
352
355
|
/**
|
|
353
|
-
|
|
356
|
+
* Attempt to run some assertions. The result must be explicitly committed or discarded or else
|
|
354
357
|
* the test will fail. A macro may be provided. The title may help distinguish attempts from
|
|
355
358
|
* one another.
|
|
356
359
|
*/
|
|
357
|
-
<Args extends any[]>(title: string, fn: [EitherMacro<Args, Context>, ...EitherMacro<Args, Context
|
|
360
|
+
<Args extends any[]>(title: string, fn: [EitherMacro<Args, Context>, ...Array<EitherMacro<Args, Context>>], ...args: Args): Promise<TryResult[]>;
|
|
358
361
|
|
|
359
362
|
/**
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
+
* Attempt to run some assertions. The result must be explicitly committed or discarded or else
|
|
364
|
+
* the test will fail. A macro may be provided.
|
|
365
|
+
*/
|
|
363
366
|
<Args extends any[]>(fn: EitherMacro<Args, Context>, ...args: Args): Promise<TryResult>;
|
|
364
367
|
|
|
365
368
|
/**
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
<Args extends any[]>(fn: [EitherMacro<Args, Context>, ...EitherMacro<Args, Context
|
|
369
|
+
* Attempt to run some assertions. The result must be explicitly committed or discarded or else
|
|
370
|
+
* the test will fail. A macro may be provided.
|
|
371
|
+
*/
|
|
372
|
+
<Args extends any[]>(fn: [EitherMacro<Args, Context>, ...Array<EitherMacro<Args, Context>>], ...args: Args): Promise<TryResult[]>;
|
|
370
373
|
}
|
|
371
374
|
|
|
372
375
|
export interface AssertionError extends Error {}
|
|
@@ -427,32 +430,32 @@ export type Macro<Args extends any[], Context = unknown> = UntitledMacro<Args, C
|
|
|
427
430
|
* the title provided when the test or hook was declared. Also receives the remaining test arguments.
|
|
428
431
|
*/
|
|
429
432
|
title?: (providedTitle: string | undefined, ...args: Args) => string;
|
|
430
|
-
}
|
|
433
|
+
};
|
|
431
434
|
|
|
432
435
|
export type EitherMacro<Args extends any[], Context> = Macro<Args, Context> | UntitledMacro<Args, Context>;
|
|
433
436
|
|
|
434
437
|
/** Alias for a single macro, or an array of macros. */
|
|
435
|
-
export type OneOrMoreMacros<Args extends any[], Context> = EitherMacro<Args, Context> | [EitherMacro<Args, Context>, ...EitherMacro<Args, Context
|
|
438
|
+
export type OneOrMoreMacros<Args extends any[], Context> = EitherMacro<Args, Context> | [EitherMacro<Args, Context>, ...Array<EitherMacro<Args, Context>>];
|
|
436
439
|
|
|
437
440
|
/** A reusable test or hook implementation, for tests & hooks declared with the `.cb` modifier. */
|
|
438
|
-
export type UntitledCbMacro<Args extends any[], Context = unknown> = (t: CbExecutionContext<Context>, ...args: Args) => ImplementationResult
|
|
441
|
+
export type UntitledCbMacro<Args extends any[], Context = unknown> = (t: CbExecutionContext<Context>, ...args: Args) => ImplementationResult;
|
|
439
442
|
|
|
440
443
|
/** A reusable test or hook implementation, for tests & hooks declared with the `.cb` modifier. */
|
|
441
444
|
export type CbMacro<Args extends any[], Context = unknown> = UntitledCbMacro<Args, Context> & {
|
|
442
445
|
title?: (providedTitle: string | undefined, ...args: Args) => string;
|
|
443
|
-
}
|
|
446
|
+
};
|
|
444
447
|
|
|
445
448
|
export type EitherCbMacro<Args extends any[], Context> = CbMacro<Args, Context> | UntitledCbMacro<Args, Context>;
|
|
446
449
|
|
|
447
450
|
/** Alias for a single macro, or an array of macros, used for tests & hooks declared with the `.cb` modifier. */
|
|
448
|
-
export type OneOrMoreCbMacros<Args extends any[], Context> = EitherCbMacro<Args, Context> | [EitherCbMacro<Args, Context>, ...EitherCbMacro<Args, Context
|
|
451
|
+
export type OneOrMoreCbMacros<Args extends any[], Context> = EitherCbMacro<Args, Context> | [EitherCbMacro<Args, Context>, ...Array<EitherCbMacro<Args, Context>>];
|
|
449
452
|
|
|
450
453
|
export interface TestInterface<Context = unknown> {
|
|
451
454
|
/** Declare a concurrent test. */
|
|
452
455
|
(title: string, implementation: Implementation<Context>): void;
|
|
453
456
|
|
|
454
457
|
/** Declare a concurrent test that uses one or more macros. Additional arguments are passed to the macro. */
|
|
455
|
-
<T extends any[]>(title: string, macros: OneOrMoreMacros<T, Context>, ...rest: T): void
|
|
458
|
+
<T extends any[]>(title: string, macros: OneOrMoreMacros<T, Context>, ...rest: T): void;
|
|
456
459
|
|
|
457
460
|
/** Declare a concurrent test that uses one or more macros. The macro is responsible for generating a unique test title. */
|
|
458
461
|
<T extends any[]>(macros: OneOrMoreMacros<T, Context>, ...rest: T): void;
|
package/lib/api.js
CHANGED
|
@@ -3,7 +3,6 @@ const fs = require('fs');
|
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const os = require('os');
|
|
5
5
|
const commonPathPrefix = require('common-path-prefix');
|
|
6
|
-
const isCi = require('is-ci');
|
|
7
6
|
const resolveCwd = require('resolve-cwd');
|
|
8
7
|
const debounce = require('lodash/debounce');
|
|
9
8
|
const arrify = require('arrify');
|
|
@@ -13,6 +12,7 @@ const Emittery = require('emittery');
|
|
|
13
12
|
const pMap = require('p-map');
|
|
14
13
|
const tempDir = require('temp-dir');
|
|
15
14
|
const globs = require('./globs');
|
|
15
|
+
const isCi = require('./is-ci');
|
|
16
16
|
const RunStatus = require('./run-status');
|
|
17
17
|
const fork = require('./fork');
|
|
18
18
|
const serializeError = require('./serialize-error');
|
|
@@ -22,7 +22,7 @@ function resolveModules(modules) {
|
|
|
22
22
|
const modulePath = resolveCwd.silent(name);
|
|
23
23
|
|
|
24
24
|
if (modulePath === undefined) {
|
|
25
|
-
throw new Error(`Could not resolve required module
|
|
25
|
+
throw new Error(`Could not resolve required module ’${name}’`);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
return modulePath;
|
package/lib/assert.js
CHANGED
|
@@ -29,34 +29,34 @@ function formatPowerAssertValue(value) {
|
|
|
29
29
|
return concordance.format(value, concordanceOptions);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const hasOwnProperty = (
|
|
32
|
+
const hasOwnProperty = (object, prop) => Object.prototype.hasOwnProperty.call(object, prop);
|
|
33
33
|
const noop = () => {};
|
|
34
34
|
const notImplemented = () => {
|
|
35
35
|
throw new Error('not implemented');
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
class AssertionError extends Error {
|
|
39
|
-
constructor(
|
|
40
|
-
super(
|
|
39
|
+
constructor(options) {
|
|
40
|
+
super(options.message || '');
|
|
41
41
|
this.name = 'AssertionError';
|
|
42
42
|
|
|
43
|
-
this.assertion =
|
|
44
|
-
this.fixedSource =
|
|
45
|
-
this.improperUsage =
|
|
46
|
-
this.actualStack =
|
|
47
|
-
this.operator =
|
|
48
|
-
this.values =
|
|
43
|
+
this.assertion = options.assertion;
|
|
44
|
+
this.fixedSource = options.fixedSource;
|
|
45
|
+
this.improperUsage = options.improperUsage || false;
|
|
46
|
+
this.actualStack = options.actualStack;
|
|
47
|
+
this.operator = options.operator;
|
|
48
|
+
this.values = options.values || [];
|
|
49
49
|
|
|
50
50
|
// Raw expected and actual objects are stored for custom reporters
|
|
51
51
|
// (such as wallaby.js), that manage worker processes directly and
|
|
52
52
|
// use the values for custom diff views
|
|
53
|
-
this.raw =
|
|
53
|
+
this.raw = options.raw;
|
|
54
54
|
|
|
55
55
|
// Reserved for power-assert statements
|
|
56
56
|
this.statements = [];
|
|
57
57
|
|
|
58
|
-
if (
|
|
59
|
-
this.savedError =
|
|
58
|
+
if (options.savedError) {
|
|
59
|
+
this.savedError = options.savedError;
|
|
60
60
|
} else {
|
|
61
61
|
this.savedError = getErrorWithLongStackTrace();
|
|
62
62
|
}
|
|
@@ -72,8 +72,8 @@ function getErrorWithLongStackTrace() {
|
|
|
72
72
|
return err;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
function validateExpectations(assertion, expectations,
|
|
76
|
-
if (
|
|
75
|
+
function validateExpectations(assertion, expectations, numberArgs) { // eslint-disable-line complexity
|
|
76
|
+
if (numberArgs === 1 || expectations === null || expectations === undefined) {
|
|
77
77
|
expectations = {};
|
|
78
78
|
} else if (
|
|
79
79
|
typeof expectations === 'function' ||
|
package/lib/cli.js
CHANGED
|
@@ -5,8 +5,8 @@ const updateNotifier = require('update-notifier');
|
|
|
5
5
|
const figures = require('figures');
|
|
6
6
|
const arrify = require('arrify');
|
|
7
7
|
const yargs = require('yargs');
|
|
8
|
-
const isCi = require('is-ci');
|
|
9
8
|
const readPkg = require('read-pkg');
|
|
9
|
+
const isCi = require('./is-ci');
|
|
10
10
|
const loadConfig = require('./load-config');
|
|
11
11
|
|
|
12
12
|
function exit(message) {
|
|
@@ -106,8 +106,8 @@ exports.run = async () => { // eslint-disable-line complexity
|
|
|
106
106
|
'strip-aliased': true,
|
|
107
107
|
'unknown-options-as-args': false
|
|
108
108
|
})
|
|
109
|
-
.usage('$0 [<pattern>...]')
|
|
110
|
-
.usage('$0 debug [<pattern>...]')
|
|
109
|
+
.usage('$0 [<pattern>...]') // eslint-disable-line unicorn/string-content
|
|
110
|
+
.usage('$0 debug [<pattern>...]') // eslint-disable-line unicorn/string-content
|
|
111
111
|
.usage('$0 reset-cache')
|
|
112
112
|
.options({
|
|
113
113
|
color: {
|
|
@@ -118,19 +118,24 @@ exports.run = async () => { // eslint-disable-line complexity
|
|
|
118
118
|
description: 'Specific JavaScript file for AVA to read its config from, instead of using package.json or ava.config.* files'
|
|
119
119
|
}
|
|
120
120
|
})
|
|
121
|
-
.command('* [<pattern>...]', 'Run tests', yargs => yargs.options(FLAGS).positional('pattern', {
|
|
121
|
+
.command('* [<pattern>...]', 'Run tests', yargs => yargs.options(FLAGS).positional('pattern', { // eslint-disable-line unicorn/string-content
|
|
122
122
|
array: true,
|
|
123
123
|
describe: 'Glob patterns to select what test files to run. Leave empty if you want AVA to run all test files instead',
|
|
124
124
|
type: 'string'
|
|
125
125
|
}))
|
|
126
126
|
.command(
|
|
127
|
-
'debug [<pattern>...]',
|
|
127
|
+
'debug [<pattern>...]', // eslint-disable-line unicorn/string-content
|
|
128
128
|
'Activate Node.js inspector and run a single test file',
|
|
129
129
|
yargs => yargs.options(FLAGS).options({
|
|
130
130
|
break: {
|
|
131
131
|
description: 'Break before the test file is loaded',
|
|
132
132
|
type: 'boolean'
|
|
133
133
|
},
|
|
134
|
+
host: {
|
|
135
|
+
default: '127.0.0.1',
|
|
136
|
+
description: 'Address or hostname through which you can connect to the inspector',
|
|
137
|
+
type: 'string'
|
|
138
|
+
},
|
|
134
139
|
port: {
|
|
135
140
|
default: 9229,
|
|
136
141
|
description: 'Port on which you can connect to the inspector',
|
|
@@ -145,12 +150,13 @@ exports.run = async () => { // eslint-disable-line complexity
|
|
|
145
150
|
debug = {
|
|
146
151
|
break: argv.break === true,
|
|
147
152
|
files: argv.pattern,
|
|
153
|
+
host: argv.host,
|
|
148
154
|
port: argv.port
|
|
149
155
|
};
|
|
150
156
|
})
|
|
151
157
|
.command(
|
|
152
158
|
'reset-cache',
|
|
153
|
-
'Reset AVA
|
|
159
|
+
'Reset AVA’s compilation cache and exit',
|
|
154
160
|
yargs => yargs,
|
|
155
161
|
() => {
|
|
156
162
|
resetCache = true;
|
|
@@ -243,11 +249,11 @@ exports.run = async () => { // eslint-disable-line complexity
|
|
|
243
249
|
}
|
|
244
250
|
|
|
245
251
|
if (Reflect.has(conf, 'helpers')) {
|
|
246
|
-
exit('AVA no longer compiles helpers. Add exclusion patterns to the
|
|
252
|
+
exit('AVA no longer compiles helpers. Add exclusion patterns to the ’files’ configuration and specify ’compileAsTests’ in the Babel options instead.');
|
|
247
253
|
}
|
|
248
254
|
|
|
249
255
|
if (Reflect.has(conf, 'sources')) {
|
|
250
|
-
exit('
|
|
256
|
+
exit('’sources’ has been removed. Use ’ignoredByWatcher’ to provide glob patterns of files that the watcher should ignore.');
|
|
251
257
|
}
|
|
252
258
|
|
|
253
259
|
const ciParallelVars = require('ci-parallel-vars');
|
|
@@ -88,7 +88,7 @@ const colorTheme = {
|
|
|
88
88
|
string: {
|
|
89
89
|
open: ansiStyles.blue.open,
|
|
90
90
|
close: ansiStyles.blue.close,
|
|
91
|
-
line: {open: forceColor.blue('\''), close: forceColor.blue('\'')},
|
|
91
|
+
line: {open: forceColor.blue('\''), close: forceColor.blue('\'')}, // eslint-disable-line unicorn/string-content
|
|
92
92
|
multiline: {start: forceColor.blue('`'), end: forceColor.blue('`')},
|
|
93
93
|
controlPicture: ansiStyles.grey,
|
|
94
94
|
diff: {
|
package/lib/create-chain.js
CHANGED
|
@@ -11,35 +11,35 @@ function startChain(name, call, defaults) {
|
|
|
11
11
|
return fn;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
function extendChain(
|
|
14
|
+
function extendChain(previous, name, flag) {
|
|
15
15
|
if (!flag) {
|
|
16
16
|
flag = name;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
const fn = (...args) => {
|
|
20
|
-
callWithFlag(
|
|
20
|
+
callWithFlag(previous, flag, args);
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
const fullName = `${chainRegistry.get(
|
|
23
|
+
const fullName = `${chainRegistry.get(previous).fullName}.${name}`;
|
|
24
24
|
Object.defineProperty(fn, 'name', {value: fullName});
|
|
25
|
-
|
|
25
|
+
previous[name] = fn;
|
|
26
26
|
|
|
27
|
-
chainRegistry.set(fn, {flag, fullName, prev});
|
|
27
|
+
chainRegistry.set(fn, {flag, fullName, prev: previous});
|
|
28
28
|
return fn;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
function callWithFlag(
|
|
31
|
+
function callWithFlag(previous, flag, args) {
|
|
32
32
|
const combinedFlags = {[flag]: true};
|
|
33
33
|
do {
|
|
34
|
-
const step = chainRegistry.get(
|
|
34
|
+
const step = chainRegistry.get(previous);
|
|
35
35
|
if (step.call) {
|
|
36
36
|
step.call({...step.defaults, ...combinedFlags}, args);
|
|
37
|
-
|
|
37
|
+
previous = null;
|
|
38
38
|
} else {
|
|
39
39
|
combinedFlags[step.flag] = true;
|
|
40
|
-
|
|
40
|
+
previous = step.prev;
|
|
41
41
|
}
|
|
42
|
-
} while (
|
|
42
|
+
} while (previous);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
function createHookChain(hook, isAfterHook) {
|
|
@@ -6,7 +6,7 @@ function validateEnvironmentVariables(environmentVariables) {
|
|
|
6
6
|
|
|
7
7
|
for (const value of Object.values(environmentVariables)) {
|
|
8
8
|
if (typeof value !== 'string') {
|
|
9
|
-
throw new TypeError('The
|
|
9
|
+
throw new TypeError('The ’environmentVariables’ configuration must be an object containing string values.');
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
package/lib/extensions.js
CHANGED
|
@@ -21,7 +21,7 @@ module.exports = (configuredExtensions, providers = []) => {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
if (duplicates.size > 0) {
|
|
24
|
-
throw new Error(`Unexpected duplicate extensions in options:
|
|
24
|
+
throw new Error(`Unexpected duplicate extensions in options: ’${[...duplicates].join('’, ’')}’.`);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// Unless the default was used by providers, as long as the extensions aren't explicitly set, set the default.
|
package/lib/fork.js
CHANGED
|
@@ -14,7 +14,7 @@ const AVA_PATH = path.resolve(__dirname, '..');
|
|
|
14
14
|
|
|
15
15
|
const workerPath = require.resolve('./worker/subprocess');
|
|
16
16
|
|
|
17
|
-
module.exports = (file,
|
|
17
|
+
module.exports = (file, options, execArgv = process.execArgv) => {
|
|
18
18
|
let finished = false;
|
|
19
19
|
|
|
20
20
|
const emitter = new Emittery();
|
|
@@ -24,16 +24,16 @@ module.exports = (file, opts, execArgv = process.execArgv) => {
|
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
options = {
|
|
28
28
|
file,
|
|
29
29
|
baseDir: process.cwd(),
|
|
30
|
-
...
|
|
30
|
+
...options
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
const subprocess = childProcess.fork(workerPath,
|
|
34
|
-
cwd:
|
|
33
|
+
const subprocess = childProcess.fork(workerPath, options.workerArgv, {
|
|
34
|
+
cwd: options.projectDir,
|
|
35
35
|
silent: true,
|
|
36
|
-
env: {NODE_ENV: 'test', ...process.env, ...
|
|
36
|
+
env: {NODE_ENV: 'test', ...process.env, ...options.environmentVariables, AVA_PATH},
|
|
37
37
|
execArgv
|
|
38
38
|
});
|
|
39
39
|
|
|
@@ -64,7 +64,7 @@ module.exports = (file, opts, execArgv = process.execArgv) => {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
if (message.ava.type === 'ready-for-options') {
|
|
67
|
-
send({type: 'options', options
|
|
67
|
+
send({type: 'options', options});
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
|
package/lib/globs.js
CHANGED
|
@@ -46,11 +46,11 @@ exports.normalizePatterns = normalizePatterns;
|
|
|
46
46
|
|
|
47
47
|
function normalizeGlobs({extensions, files: filePatterns, ignoredByWatcher: ignoredByWatcherPatterns, providers}) {
|
|
48
48
|
if (filePatterns !== undefined && (!Array.isArray(filePatterns) || filePatterns.length === 0)) {
|
|
49
|
-
throw new Error('The
|
|
49
|
+
throw new Error('The ’files’ configuration must be an array containing glob patterns.');
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
if (ignoredByWatcherPatterns !== undefined && (!Array.isArray(ignoredByWatcherPatterns) || ignoredByWatcherPatterns.length === 0)) {
|
|
53
|
-
throw new Error('The
|
|
53
|
+
throw new Error('The ’ignoredByWatcher’ configuration must be an array containing glob patterns.');
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
const extensionPattern = buildExtensionPattern(extensions);
|
package/lib/is-ci.js
ADDED
package/lib/load-config.js
CHANGED
|
@@ -12,7 +12,7 @@ const EXPERIMENTS = new Set();
|
|
|
12
12
|
// *Very* rudimentary support for loading ava.config.js files containing an `export default` statement.
|
|
13
13
|
const evaluateJsConfig = configFile => {
|
|
14
14
|
const contents = fs.readFileSync(configFile, 'utf8');
|
|
15
|
-
const script = new vm.Script(`'use strict';(()=>{let __export__;\n${contents.replace(/export default/g, '__export__ =')};return __export__;})()`, {
|
|
15
|
+
const script = new vm.Script(`'use strict';(()=>{let __export__;\n${contents.replace(/export default/g, '__export__ =')};return __export__;})()`, { // eslint-disable-line unicorn/string-content
|
|
16
16
|
filename: configFile,
|
|
17
17
|
lineOffset: -1
|
|
18
18
|
});
|
|
@@ -137,7 +137,7 @@ function loadConfig({configFile, resolveFrom = process.cwd(), defaults = {}} = {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
if ('ava' in fileConf) {
|
|
140
|
-
throw new Error(`Encountered
|
|
140
|
+
throw new Error(`Encountered ’ava’ property in ${fileForErrorMessage}; avoid wrapping the configuration`);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
|
|
@@ -30,7 +30,7 @@ Please run AVA again with the ${chalk.cyan('--update-snapshots')} flag to recrea
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
if (name === 'LegacyError') {
|
|
33
|
-
return `The snapshot file was created with AVA 0.19. It
|
|
33
|
+
return `The snapshot file was created with AVA 0.19. It’s not supported by this AVA version.
|
|
34
34
|
|
|
35
35
|
File path: ${chalk.yellow(snapPath)}
|
|
36
36
|
|
package/lib/reporters/mini.js
CHANGED
|
@@ -51,23 +51,23 @@ class LineWriter extends stream.Writable {
|
|
|
51
51
|
callback();
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
_writeWithSpinner(
|
|
54
|
+
_writeWithSpinner(string) {
|
|
55
55
|
if (!this.spinner.id) {
|
|
56
|
-
this.dest.write(
|
|
56
|
+
this.dest.write(string);
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
this.lastSpinnerText =
|
|
60
|
+
this.lastSpinnerText = string;
|
|
61
61
|
// Ignore whitespace at the end of the chunk. We're continiously rewriting
|
|
62
62
|
// the last line through the spinner. Also be careful to remove the indent
|
|
63
63
|
// as the spinner adds its own.
|
|
64
|
-
this.spinner.text =
|
|
64
|
+
this.spinner.text = string.trimEnd().slice(2);
|
|
65
65
|
this.spinner.render();
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
writeLine(
|
|
69
|
-
if (
|
|
70
|
-
this.write(indentString(
|
|
68
|
+
writeLine(string) {
|
|
69
|
+
if (string) {
|
|
70
|
+
this.write(indentString(string, 2) + os.EOL);
|
|
71
71
|
} else {
|
|
72
72
|
this.write(os.EOL);
|
|
73
73
|
}
|
|
@@ -237,14 +237,14 @@ class MiniReporter {
|
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
writeWithCounts(
|
|
240
|
+
writeWithCounts(string) {
|
|
241
241
|
if (!this.stats) {
|
|
242
|
-
return this.lineWriter.writeLine(
|
|
242
|
+
return this.lineWriter.writeLine(string);
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
|
|
246
|
-
if (
|
|
247
|
-
|
|
245
|
+
string = string || '';
|
|
246
|
+
if (string !== '') {
|
|
247
|
+
string += os.EOL;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
let firstLinePostfix = this.watching ?
|
|
@@ -252,33 +252,33 @@ class MiniReporter {
|
|
|
252
252
|
'';
|
|
253
253
|
|
|
254
254
|
if (this.stats.passedTests > 0) {
|
|
255
|
-
|
|
255
|
+
string += os.EOL + colors.pass(`${this.stats.passedTests} passed`) + firstLinePostfix;
|
|
256
256
|
firstLinePostfix = '';
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
if (this.stats.passedKnownFailingTests > 0) {
|
|
260
|
-
|
|
260
|
+
string += os.EOL + colors.error(`${this.stats.passedKnownFailingTests} ${plur('known failure', this.stats.passedKnownFailingTests)}`);
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
if (this.stats.failedHooks > 0) {
|
|
264
|
-
|
|
264
|
+
string += os.EOL + colors.error(`${this.stats.failedHooks} ${plur('hook', this.stats.failedHooks)} failed`) + firstLinePostfix;
|
|
265
265
|
firstLinePostfix = '';
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
if (this.stats.failedTests > 0) {
|
|
269
|
-
|
|
269
|
+
string += os.EOL + colors.error(`${this.stats.failedTests} ${plur('test', this.stats.failedTests)} failed`) + firstLinePostfix;
|
|
270
270
|
firstLinePostfix = '';
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
if (this.stats.skippedTests > 0) {
|
|
274
|
-
|
|
274
|
+
string += os.EOL + colors.skip(`${this.stats.skippedTests} skipped`);
|
|
275
275
|
}
|
|
276
276
|
|
|
277
277
|
if (this.stats.todoTests > 0) {
|
|
278
|
-
|
|
278
|
+
string += os.EOL + colors.todo(`${this.stats.todoTests} todo`);
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
this.lineWriter.writeLine(
|
|
281
|
+
this.lineWriter.writeLine(string);
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
writeErr(evt) {
|
|
@@ -379,13 +379,13 @@ class MiniReporter {
|
|
|
379
379
|
cliCursor.show(this.reportStream);
|
|
380
380
|
|
|
381
381
|
if (!this.stats) {
|
|
382
|
-
this.lineWriter.writeLine(colors.error(`${figures.cross} Couldn
|
|
382
|
+
this.lineWriter.writeLine(colors.error(`${figures.cross} Couldn’t find any files to test`));
|
|
383
383
|
this.lineWriter.writeLine();
|
|
384
384
|
return;
|
|
385
385
|
}
|
|
386
386
|
|
|
387
387
|
if (this.matching && this.stats.selectedTests === 0) {
|
|
388
|
-
this.lineWriter.writeLine(colors.error(`${figures.cross} Couldn
|
|
388
|
+
this.lineWriter.writeLine(colors.error(`${figures.cross} Couldn’t find any matching tests`));
|
|
389
389
|
this.lineWriter.writeLine();
|
|
390
390
|
return;
|
|
391
391
|
}
|
package/lib/reporters/tap.js
CHANGED
|
@@ -10,26 +10,26 @@ const indentString = require('indent-string');
|
|
|
10
10
|
const prefixTitle = require('./prefix-title');
|
|
11
11
|
|
|
12
12
|
function dumpError(error) {
|
|
13
|
-
const
|
|
13
|
+
const object = {...error.object};
|
|
14
14
|
if (error.name) {
|
|
15
|
-
|
|
15
|
+
object.name = error.name;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
if (error.message) {
|
|
19
|
-
|
|
19
|
+
object.message = error.message;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
if (error.avaAssertionError) {
|
|
23
23
|
if (error.assertion) {
|
|
24
|
-
|
|
24
|
+
object.assertion = error.assertion;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
if (error.operator) {
|
|
28
|
-
|
|
28
|
+
object.operator = error.operator;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
if (error.values.length > 0) {
|
|
32
|
-
|
|
32
|
+
object.values = error.values.reduce((acc, value) => {
|
|
33
33
|
acc[value.label] = stripAnsi(value.formatted);
|
|
34
34
|
return acc;
|
|
35
35
|
}, {});
|
|
@@ -37,15 +37,15 @@ function dumpError(error) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
if (error.nonErrorObject) {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
object.message = 'Non-error object';
|
|
41
|
+
object.formatted = stripAnsi(error.formatted);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
if (error.stack) {
|
|
45
|
-
|
|
45
|
+
object.at = error.stack;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
return
|
|
48
|
+
return object;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
class TapReporter {
|
package/lib/reporters/verbose.js
CHANGED
|
@@ -31,9 +31,9 @@ class LineWriter extends stream.Writable {
|
|
|
31
31
|
callback();
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
writeLine(
|
|
35
|
-
if (
|
|
36
|
-
this.write(indentString(
|
|
34
|
+
writeLine(string) {
|
|
35
|
+
if (string) {
|
|
36
|
+
this.write(indentString(string, 2) + os.EOL);
|
|
37
37
|
this.lastLineIsEmpty = false;
|
|
38
38
|
} else {
|
|
39
39
|
this.write(os.EOL);
|
|
@@ -321,13 +321,13 @@ class VerboseReporter {
|
|
|
321
321
|
|
|
322
322
|
endRun() { // eslint-disable-line complexity
|
|
323
323
|
if (!this.stats) {
|
|
324
|
-
this.lineWriter.writeLine(colors.error(`${figures.cross} Couldn
|
|
324
|
+
this.lineWriter.writeLine(colors.error(`${figures.cross} Couldn’t find any files to test`));
|
|
325
325
|
this.lineWriter.writeLine();
|
|
326
326
|
return;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
329
|
if (this.matching && this.stats.selectedTests === 0) {
|
|
330
|
-
this.lineWriter.writeLine(colors.error(`${figures.cross} Couldn
|
|
330
|
+
this.lineWriter.writeLine(colors.error(`${figures.cross} Couldn’t find any matching tests`));
|
|
331
331
|
this.lineWriter.writeLine();
|
|
332
332
|
return;
|
|
333
333
|
}
|
package/lib/runner.js
CHANGED
|
@@ -232,9 +232,9 @@ class Runner extends Emittery {
|
|
|
232
232
|
};
|
|
233
233
|
|
|
234
234
|
let waitForSerial = Promise.resolve();
|
|
235
|
-
await runnables.reduce((
|
|
235
|
+
await runnables.reduce((previous, runnable) => {
|
|
236
236
|
if (runnable.metadata.serial || this.serial) {
|
|
237
|
-
waitForSerial =
|
|
237
|
+
waitForSerial = previous.then(() => {
|
|
238
238
|
// Serial runnables run as long as there was no previous failure, unless
|
|
239
239
|
// the runnable should always be run.
|
|
240
240
|
return (allPassed || runnable.metadata.always) && runAndStoreResult(runnable);
|
|
@@ -243,7 +243,7 @@ class Runner extends Emittery {
|
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
return Promise.all([
|
|
246
|
-
|
|
246
|
+
previous,
|
|
247
247
|
waitForSerial.then(() => {
|
|
248
248
|
// Concurrent runnables are kicked off after the previous serial
|
|
249
249
|
// runnables have completed, as long as there was no previous failure
|
|
@@ -266,7 +266,7 @@ class Runner extends Emittery {
|
|
|
266
266
|
return result;
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
async runHooks(tasks, contextRef, titleSuffix) {
|
|
269
|
+
async runHooks(tasks, contextRef, titleSuffix, testPassed) {
|
|
270
270
|
const hooks = tasks.map(task => new Runnable({
|
|
271
271
|
contextRef,
|
|
272
272
|
experiments: this.experiments,
|
|
@@ -278,7 +278,8 @@ class Runner extends Emittery {
|
|
|
278
278
|
updateSnapshots: this.updateSnapshots,
|
|
279
279
|
metadata: task.metadata,
|
|
280
280
|
powerAssert: this.powerAssert,
|
|
281
|
-
title: `${task.title}${titleSuffix || ''}
|
|
281
|
+
title: `${task.title}${titleSuffix || ''}`,
|
|
282
|
+
testPassed
|
|
282
283
|
}));
|
|
283
284
|
const outcome = await this.runMultiple(hooks, this.serial);
|
|
284
285
|
for (const result of outcome.storedResults) {
|
|
@@ -304,10 +305,11 @@ class Runner extends Emittery {
|
|
|
304
305
|
}
|
|
305
306
|
|
|
306
307
|
async runTest(task, contextRef) {
|
|
307
|
-
let hooksAndTestOk = false;
|
|
308
|
-
|
|
309
308
|
const hookSuffix = ` for ${task.title}`;
|
|
310
|
-
|
|
309
|
+
let hooksOk = await this.runHooks(this.tasks.beforeEach, contextRef, hookSuffix);
|
|
310
|
+
|
|
311
|
+
let testOk = false;
|
|
312
|
+
if (hooksOk) {
|
|
311
313
|
// Only run the test if all `beforeEach` hooks passed.
|
|
312
314
|
const test = new Runnable({
|
|
313
315
|
contextRef,
|
|
@@ -325,7 +327,9 @@ class Runner extends Emittery {
|
|
|
325
327
|
});
|
|
326
328
|
|
|
327
329
|
const result = await this.runSingle(test);
|
|
328
|
-
|
|
330
|
+
testOk = result.passed;
|
|
331
|
+
|
|
332
|
+
if (testOk) {
|
|
329
333
|
this.emit('stateChange', {
|
|
330
334
|
type: 'test-passed',
|
|
331
335
|
title: result.title,
|
|
@@ -333,7 +337,8 @@ class Runner extends Emittery {
|
|
|
333
337
|
knownFailing: result.metadata.failing,
|
|
334
338
|
logs: result.logs
|
|
335
339
|
});
|
|
336
|
-
|
|
340
|
+
|
|
341
|
+
hooksOk = await this.runHooks(this.tasks.afterEach, contextRef, hookSuffix, testOk);
|
|
337
342
|
} else {
|
|
338
343
|
this.emit('stateChange', {
|
|
339
344
|
type: 'test-failed',
|
|
@@ -347,8 +352,8 @@ class Runner extends Emittery {
|
|
|
347
352
|
}
|
|
348
353
|
}
|
|
349
354
|
|
|
350
|
-
const alwaysOk = await this.runHooks(this.tasks.afterEachAlways, contextRef, hookSuffix);
|
|
351
|
-
return
|
|
355
|
+
const alwaysOk = await this.runHooks(this.tasks.afterEachAlways, contextRef, hookSuffix, testOk);
|
|
356
|
+
return alwaysOk && hooksOk && testOk;
|
|
352
357
|
}
|
|
353
358
|
|
|
354
359
|
async start() {
|
|
@@ -424,16 +429,16 @@ class Runner extends Emittery {
|
|
|
424
429
|
return false;
|
|
425
430
|
}
|
|
426
431
|
|
|
427
|
-
return serialTests.reduce(async (
|
|
428
|
-
const
|
|
432
|
+
return serialTests.reduce(async (previous, task) => {
|
|
433
|
+
const previousOk = await previous;
|
|
429
434
|
// Don't start tests after an interrupt.
|
|
430
435
|
if (this.interrupted) {
|
|
431
|
-
return
|
|
436
|
+
return previousOk;
|
|
432
437
|
}
|
|
433
438
|
|
|
434
439
|
// Prevent subsequent tests from running if `failFast` is enabled and
|
|
435
440
|
// the previous test failed.
|
|
436
|
-
if (!
|
|
441
|
+
if (!previousOk && this.failFast) {
|
|
437
442
|
return false;
|
|
438
443
|
}
|
|
439
444
|
|
package/lib/snapshot-manager.js
CHANGED
|
@@ -169,9 +169,9 @@ function encodeSnapshots(buffersByHash) {
|
|
|
169
169
|
byteOffset += 4;
|
|
170
170
|
|
|
171
171
|
// Allows 65535 hashes (tests or identified snapshots) per file.
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
buffers.push(
|
|
172
|
+
const numberHashes = Buffer.alloc(2);
|
|
173
|
+
numberHashes.writeUInt16LE(buffersByHash.size);
|
|
174
|
+
buffers.push(numberHashes);
|
|
175
175
|
byteOffset += 2;
|
|
176
176
|
|
|
177
177
|
const entries = [];
|
|
@@ -183,9 +183,9 @@ function encodeSnapshots(buffersByHash) {
|
|
|
183
183
|
byteOffset += MD5_HASH_LENGTH;
|
|
184
184
|
|
|
185
185
|
// Allows 65535 snapshots per hash.
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
buffers.push(
|
|
186
|
+
const numberSnapshots = Buffer.alloc(2);
|
|
187
|
+
numberSnapshots.writeUInt16LE(snapshotBuffers.length, 0);
|
|
188
|
+
buffers.push(numberSnapshots);
|
|
189
189
|
byteOffset += 2;
|
|
190
190
|
|
|
191
191
|
for (const value of snapshotBuffers) {
|
|
@@ -255,18 +255,18 @@ function decodeSnapshots(buffer, snapPath) {
|
|
|
255
255
|
byteOffset += 4;
|
|
256
256
|
|
|
257
257
|
const snapshotsByHash = new Map();
|
|
258
|
-
const
|
|
258
|
+
const numberHashes = decompressed.readUInt16LE(byteOffset);
|
|
259
259
|
byteOffset += 2;
|
|
260
260
|
|
|
261
|
-
for (let count = 0; count <
|
|
261
|
+
for (let count = 0; count < numberHashes; count++) {
|
|
262
262
|
const hash = decompressed.toString('hex', byteOffset, byteOffset + MD5_HASH_LENGTH);
|
|
263
263
|
byteOffset += MD5_HASH_LENGTH;
|
|
264
264
|
|
|
265
|
-
const
|
|
265
|
+
const numberSnapshots = decompressed.readUInt16LE(byteOffset);
|
|
266
266
|
byteOffset += 2;
|
|
267
267
|
|
|
268
|
-
const snapshotsBuffers = new Array(
|
|
269
|
-
for (let index = 0; index <
|
|
268
|
+
const snapshotsBuffers = new Array(numberSnapshots);
|
|
269
|
+
for (let index = 0; index < numberSnapshots; index++) {
|
|
270
270
|
const start = decompressed.readUInt32LE(byteOffset) + headerLength;
|
|
271
271
|
byteOffset += 4;
|
|
272
272
|
const end = decompressed.readUInt32LE(byteOffset) + headerLength;
|
package/lib/test.js
CHANGED
|
@@ -108,7 +108,7 @@ class ExecutionContext extends assert.Assertions {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
if (discarded) {
|
|
111
|
-
test.saveFirstError(new Error('Can
|
|
111
|
+
test.saveFirstError(new Error('Can’t commit a result that was previously discarded'));
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -127,7 +127,7 @@ class ExecutionContext extends assert.Assertions {
|
|
|
127
127
|
},
|
|
128
128
|
discard: ({retainLogs = false} = {}) => {
|
|
129
129
|
if (committed) {
|
|
130
|
-
test.saveFirstError(new Error('Can
|
|
130
|
+
test.saveFirstError(new Error('Can’t discard a result that was previously committed'));
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -174,6 +174,10 @@ class ExecutionContext extends assert.Assertions {
|
|
|
174
174
|
testMap.get(this).contextRef.set(context);
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
get passed() {
|
|
178
|
+
return testMap.get(this).testPassed;
|
|
179
|
+
}
|
|
180
|
+
|
|
177
181
|
_throwsArgStart(assertion, file, line) {
|
|
178
182
|
testMap.get(this).trackThrows({assertion, file, line});
|
|
179
183
|
}
|
|
@@ -192,6 +196,7 @@ class Test {
|
|
|
192
196
|
this.metadata = options.metadata;
|
|
193
197
|
this.powerAssert = options.powerAssert;
|
|
194
198
|
this.title = options.title;
|
|
199
|
+
this.testPassed = options.testPassed;
|
|
195
200
|
this.registerUniqueTitle = options.registerUniqueTitle;
|
|
196
201
|
this.logs = [];
|
|
197
202
|
|
|
@@ -592,7 +597,7 @@ class Test {
|
|
|
592
597
|
if (this.metadata.callback) {
|
|
593
598
|
if (returnedObservable || returnedPromise) {
|
|
594
599
|
const asyncType = returnedObservable ? 'observables' : 'promises';
|
|
595
|
-
this.saveFirstError(new Error(`Do not return ${asyncType} from tests declared via \`test.cb(
|
|
600
|
+
this.saveFirstError(new Error(`Do not return ${asyncType} from tests declared via \`test.cb(…)\`. Use \`test.cb(…)\` for legacy callback APIs. When using promises, observables or async functions, use \`test(…)\`.`));
|
|
596
601
|
return this.finishPromised();
|
|
597
602
|
}
|
|
598
603
|
|
package/lib/worker/subprocess.js
CHANGED
|
@@ -8,7 +8,7 @@ const ipc = require('./ipc');
|
|
|
8
8
|
|
|
9
9
|
const supportsESM = async () => {
|
|
10
10
|
try {
|
|
11
|
-
await import('data:text/javascript,');
|
|
11
|
+
await import('data:text/javascript,'); // eslint-disable-line node/no-unsupported-features/es-syntax
|
|
12
12
|
return true;
|
|
13
13
|
} catch {}
|
|
14
14
|
|
|
@@ -155,7 +155,7 @@ ipc.options.then(async options => {
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
if (isESMSupported) {
|
|
158
|
-
return import(pathToFileURL(ref));
|
|
158
|
+
return import(pathToFileURL(ref)); // eslint-disable-line node/no-unsupported-features/es-syntax
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
ipc.send({type: 'internal-error', err: serializeError('Internal runner error', false, new Error('ECMAScript Modules are not supported in this Node.js version.'))});
|
|
@@ -189,7 +189,7 @@ ipc.options.then(async options => {
|
|
|
189
189
|
dependencyTracking.install(testPath);
|
|
190
190
|
|
|
191
191
|
if (options.debug) {
|
|
192
|
-
require('inspector').open(options.debug.port,
|
|
192
|
+
require('inspector').open(options.debug.port, options.debug.host, true); // eslint-disable-line node/no-unsupported-features/node-builtins
|
|
193
193
|
if (options.debug.break) {
|
|
194
194
|
debugger; // eslint-disable-line no-debugger
|
|
195
195
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ava",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "Testing can be a drag. AVA helps you get it done.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "avajs/ava",
|
|
@@ -10,14 +10,12 @@
|
|
|
10
10
|
"node": ">=10.18.0 <11 || >=12.14.0 <13 || >=13.5.0"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
|
-
"
|
|
14
|
-
"test:tap": "tap",
|
|
15
|
-
"test:typescript": "tsc --noEmit -p test/ts-types",
|
|
16
|
-
"test": "npm run lint && npm run test:typescript && npm run test:tap"
|
|
13
|
+
"test": "xo && tsd && nyc tap"
|
|
17
14
|
},
|
|
18
15
|
"files": [
|
|
19
16
|
"lib",
|
|
20
17
|
"*.js",
|
|
18
|
+
"!*.config.js",
|
|
21
19
|
"index.d.ts"
|
|
22
20
|
],
|
|
23
21
|
"keywords": [
|
|
@@ -61,9 +59,10 @@
|
|
|
61
59
|
"ansi-styles": "^4.2.1",
|
|
62
60
|
"arrgv": "^1.0.2",
|
|
63
61
|
"arrify": "^2.0.1",
|
|
64
|
-
"chalk": "^
|
|
62
|
+
"chalk": "^4.0.0",
|
|
65
63
|
"chokidar": "^3.3.1",
|
|
66
64
|
"chunkd": "^2.0.1",
|
|
65
|
+
"ci-info": "^2.0.0",
|
|
67
66
|
"ci-parallel-vars": "^1.0.0",
|
|
68
67
|
"clean-stack": "^2.2.0",
|
|
69
68
|
"clean-yaml-object": "^0.1.0",
|
|
@@ -76,14 +75,13 @@
|
|
|
76
75
|
"currently-unhandled": "^0.4.1",
|
|
77
76
|
"debug": "^4.1.1",
|
|
78
77
|
"del": "^5.1.0",
|
|
79
|
-
"emittery": "^0.
|
|
78
|
+
"emittery": "^0.6.0",
|
|
80
79
|
"equal-length": "^1.0.0",
|
|
81
|
-
"figures": "^3.
|
|
80
|
+
"figures": "^3.2.0",
|
|
82
81
|
"globby": "^11.0.0",
|
|
83
82
|
"ignore-by-default": "^1.0.0",
|
|
84
83
|
"import-local": "^3.0.2",
|
|
85
84
|
"indent-string": "^4.0.0",
|
|
86
|
-
"is-ci": "^2.0.0",
|
|
87
85
|
"is-error": "^2.2.2",
|
|
88
86
|
"is-plain-object": "^3.0.0",
|
|
89
87
|
"is-promise": "^2.1.0",
|
|
@@ -92,11 +90,11 @@
|
|
|
92
90
|
"md5-hex": "^3.0.1",
|
|
93
91
|
"ms": "^2.1.2",
|
|
94
92
|
"ora": "^4.0.3",
|
|
95
|
-
"p-map": "^
|
|
96
|
-
"picomatch": "^2.2.
|
|
93
|
+
"p-map": "^4.0.0",
|
|
94
|
+
"picomatch": "^2.2.2",
|
|
97
95
|
"pkg-conf": "^3.1.0",
|
|
98
96
|
"plur": "^4.0.0",
|
|
99
|
-
"pretty-ms": "^6.0.
|
|
97
|
+
"pretty-ms": "^6.0.1",
|
|
100
98
|
"read-pkg": "^5.2.0",
|
|
101
99
|
"resolve-cwd": "^3.0.0",
|
|
102
100
|
"slash": "^3.0.0",
|
|
@@ -107,77 +105,76 @@
|
|
|
107
105
|
"temp-dir": "^2.0.0",
|
|
108
106
|
"trim-off-newlines": "^1.0.1",
|
|
109
107
|
"update-notifier": "^4.1.0",
|
|
110
|
-
"write-file-atomic": "^3.0.
|
|
111
|
-
"yargs": "^15.1
|
|
108
|
+
"write-file-atomic": "^3.0.3",
|
|
109
|
+
"yargs": "^15.3.1"
|
|
112
110
|
},
|
|
113
111
|
"devDependencies": {
|
|
114
112
|
"@ava/babel": "^1.0.1",
|
|
115
|
-
"@sinonjs/fake-timers": "^6.0.
|
|
116
|
-
"ansi-escapes": "^4.3.
|
|
113
|
+
"@sinonjs/fake-timers": "^6.0.1",
|
|
114
|
+
"ansi-escapes": "^4.3.1",
|
|
117
115
|
"delay": "^4.3.0",
|
|
118
116
|
"esm": "^3.2.25",
|
|
119
117
|
"execa": "^4.0.0",
|
|
120
118
|
"get-stream": "^5.1.0",
|
|
119
|
+
"nyc": "^15.0.1",
|
|
121
120
|
"p-event": "^4.1.0",
|
|
122
121
|
"proxyquire": "^2.1.3",
|
|
123
|
-
"react": "^16.
|
|
124
|
-
"react-test-renderer": "^16.
|
|
122
|
+
"react": "^16.13.1",
|
|
123
|
+
"react-test-renderer": "^16.13.1",
|
|
125
124
|
"replace-string": "^3.0.0",
|
|
126
|
-
"sinon": "^
|
|
125
|
+
"sinon": "^9.0.1",
|
|
127
126
|
"source-map-fixtures": "^2.1.0",
|
|
128
|
-
"tap": "^14.10.
|
|
127
|
+
"tap": "^14.10.7",
|
|
129
128
|
"temp-write": "^4.0.0",
|
|
130
|
-
"tempy": "^0.
|
|
129
|
+
"tempy": "^0.5.0",
|
|
131
130
|
"touch": "^3.1.0",
|
|
132
|
-
"
|
|
131
|
+
"tsd": "^0.11.0",
|
|
133
132
|
"typescript": "^3.7.5",
|
|
134
|
-
"xo": "^0.
|
|
133
|
+
"xo": "^0.28.2",
|
|
135
134
|
"zen-observable": "^0.8.15"
|
|
136
135
|
},
|
|
137
136
|
"xo": {
|
|
138
137
|
"ignores": [
|
|
139
138
|
"media/**",
|
|
140
|
-
"test/fixture/ava-paths/target/test.js",
|
|
141
|
-
"test/fixture/{source-map-initial,syntax-error}.js",
|
|
142
|
-
"test/fixture/snapshots/test-sourcemaps/build/**",
|
|
143
|
-
"test/fixture/power-assert.js"
|
|
144
|
-
"**/*.ts"
|
|
139
|
+
"test-tap/fixture/ava-paths/target/test.js",
|
|
140
|
+
"test-tap/fixture/{source-map-initial,syntax-error}.js",
|
|
141
|
+
"test-tap/fixture/snapshots/test-sourcemaps/build/**",
|
|
142
|
+
"test-tap/fixture/power-assert.js"
|
|
145
143
|
],
|
|
146
144
|
"rules": {
|
|
147
|
-
"no-use-extend-native/no-use-extend-native": "off"
|
|
145
|
+
"no-use-extend-native/no-use-extend-native": "off",
|
|
146
|
+
"@typescript-eslint/no-var-requires": "off"
|
|
148
147
|
},
|
|
149
148
|
"overrides": [
|
|
150
149
|
{
|
|
151
|
-
"files": "
|
|
150
|
+
"files": "*.d.ts",
|
|
151
|
+
"rules": {
|
|
152
|
+
"@typescript-eslint/member-ordering": "off",
|
|
153
|
+
"@typescript-eslint/prefer-function-type": "off",
|
|
154
|
+
"@typescript-eslint/unified-signatures": "off"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"files": "test-d/*.ts",
|
|
159
|
+
"rules": {
|
|
160
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
161
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
162
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
163
|
+
"no-unused-vars": "off"
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"files": "test-tap/**/*.js",
|
|
152
168
|
"rules": {
|
|
153
169
|
"promise/prefer-await-to-then": "off"
|
|
154
170
|
}
|
|
155
171
|
},
|
|
156
172
|
{
|
|
157
|
-
"files": "test/fixture/**/*.js",
|
|
173
|
+
"files": "test-tap/fixture/**/*.js",
|
|
158
174
|
"rules": {
|
|
159
175
|
"import/no-extraneous-dependencies": "off"
|
|
160
176
|
}
|
|
161
177
|
}
|
|
162
178
|
]
|
|
163
|
-
},
|
|
164
|
-
"tap": {
|
|
165
|
-
"browser": false,
|
|
166
|
-
"coverage-report": [
|
|
167
|
-
"html",
|
|
168
|
-
"lcov",
|
|
169
|
-
"text"
|
|
170
|
-
],
|
|
171
|
-
"esm": false,
|
|
172
|
-
"files": [
|
|
173
|
-
"test/*.js",
|
|
174
|
-
"test/reporters/*.js",
|
|
175
|
-
"test/integration/*.js"
|
|
176
|
-
],
|
|
177
|
-
"flow": false,
|
|
178
|
-
"jobs": 2,
|
|
179
|
-
"jsx": false,
|
|
180
|
-
"timeout": 300,
|
|
181
|
-
"ts": false
|
|
182
179
|
}
|
|
183
180
|
}
|
package/readme.md
CHANGED
|
@@ -156,7 +156,6 @@ We have a growing list of [common pitfalls](docs/08-common-pitfalls.md) you may
|
|
|
156
156
|
- [Passing arguments to your test files](docs/recipes/passing-arguments-to-your-test-files.md)
|
|
157
157
|
- [Testing React components](docs/recipes/react.md)
|
|
158
158
|
- [Testing Vue.js components](docs/recipes/vue.md)
|
|
159
|
-
- [JSPM and SystemJS](docs/recipes/jspm-systemjs.md)
|
|
160
159
|
- [Debugging tests with Chrome DevTools](docs/recipes/debugging-with-chrome-devtools.md)
|
|
161
160
|
- [Debugging tests with VSCode](docs/recipes/debugging-with-vscode.md)
|
|
162
161
|
- [Debugging tests with WebStorm](docs/recipes/debugging-with-webstorm.md)
|