ava 5.0.1 → 5.1.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/lib/cli.js +2 -2
- package/lib/load-config.js +13 -7
- package/lib/reporters/default.js +3 -0
- package/lib/run-status.js +15 -0
- package/lib/runner.js +6 -0
- package/package.json +15 -15
package/lib/cli.js
CHANGED
|
@@ -250,8 +250,8 @@ export default async function loadCli() { // eslint-disable-line complexity
|
|
|
250
250
|
setChalk(chalkOptions);
|
|
251
251
|
|
|
252
252
|
if (confError) {
|
|
253
|
-
if (confError.
|
|
254
|
-
exit(`${confError.message}\n\n${chalk.gray(
|
|
253
|
+
if (confError.cause) {
|
|
254
|
+
exit(`${confError.message}\n\n${chalk.gray(confError.cause?.stack ?? confError.cause)}`);
|
|
255
255
|
} else {
|
|
256
256
|
exit(confError.message);
|
|
257
257
|
}
|
package/lib/load-config.js
CHANGED
|
@@ -29,17 +29,13 @@ const loadConfigFile = async ({projectDir, configFile}) => {
|
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
throw Object.assign(new Error(`Error loading ${fileForErrorMessage}: ${error.message}`), {
|
|
32
|
+
throw Object.assign(new Error(`Error loading ${fileForErrorMessage}: ${error.message}`), {cause: error});
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
function resolveConfigFile(configFile) {
|
|
37
37
|
if (configFile) {
|
|
38
38
|
configFile = path.resolve(configFile); // Relative to CWD
|
|
39
|
-
|
|
40
|
-
if (!configFile.endsWith('.js') && !configFile.endsWith('.cjs') && !configFile.endsWith('.mjs')) {
|
|
41
|
-
throw new Error('Config files must have .js, .cjs or .mjs extensions');
|
|
42
|
-
}
|
|
43
39
|
}
|
|
44
40
|
|
|
45
41
|
return configFile;
|
|
@@ -78,7 +74,7 @@ async function checkJsonFile(searchDir) {
|
|
|
78
74
|
}
|
|
79
75
|
}
|
|
80
76
|
|
|
81
|
-
export async function loadConfig({configFile, resolveFrom = process.cwd(), defaults = {}} = {}) {
|
|
77
|
+
export async function loadConfig({configFile, resolveFrom = process.cwd(), defaults = {}} = {}) { // eslint-disable-line complexity
|
|
82
78
|
let packageConf = await packageConfig('ava', {cwd: resolveFrom});
|
|
83
79
|
const filepath = packageJsonPath(packageConf);
|
|
84
80
|
const projectDir = filepath === undefined ? resolveFrom : path.dirname(filepath);
|
|
@@ -94,7 +90,17 @@ export async function loadConfig({configFile, resolveFrom = process.cwd(), defau
|
|
|
94
90
|
let fileForErrorMessage;
|
|
95
91
|
let conflicting = [];
|
|
96
92
|
if (configFile) {
|
|
97
|
-
|
|
93
|
+
let loaded;
|
|
94
|
+
try {
|
|
95
|
+
loaded = await loadConfigFile({projectDir, configFile});
|
|
96
|
+
} catch (error) {
|
|
97
|
+
if (!configFile.endsWith('.js') && !configFile.endsWith('.cjs') && !configFile.endsWith('.mjs')) {
|
|
98
|
+
throw Object.assign(new Error('Could not load config file; it should have .js, .cjs or .mjs extension'), {cause: error});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
103
|
+
|
|
98
104
|
if (loaded !== null) {
|
|
99
105
|
({config: fileConf, fileForErrorMessage} = loaded);
|
|
100
106
|
}
|
package/lib/reporters/default.js
CHANGED
|
@@ -370,8 +370,11 @@ export default class Reporter {
|
|
|
370
370
|
}
|
|
371
371
|
|
|
372
372
|
this.lineWriter.writeLine(`${testsInFile.size} tests were pending in ${this.relativeFile(file)}\n`);
|
|
373
|
+
const testTitleToLogs = evt.pendingTestsLogs.get(file);
|
|
373
374
|
for (const title of testsInFile) {
|
|
375
|
+
const logs = testTitleToLogs?.get(title);
|
|
374
376
|
this.lineWriter.writeLine(`${figures.circleDotted} ${this.prefixTitle(file, title)}`);
|
|
377
|
+
this.writeLogs({logs});
|
|
375
378
|
}
|
|
376
379
|
|
|
377
380
|
this.lineWriter.writeLine('');
|
package/lib/run-status.js
CHANGED
|
@@ -9,6 +9,7 @@ export default class RunStatus extends Emittery {
|
|
|
9
9
|
super();
|
|
10
10
|
|
|
11
11
|
this.pendingTests = new Map();
|
|
12
|
+
this.pendingTestsLogs = new Map();
|
|
12
13
|
|
|
13
14
|
this.emptyParallelRun = parallelRuns
|
|
14
15
|
&& parallelRuns.currentFileCount === 0
|
|
@@ -60,6 +61,7 @@ export default class RunStatus extends Emittery {
|
|
|
60
61
|
});
|
|
61
62
|
|
|
62
63
|
this.pendingTests.set(testFile, new Set());
|
|
64
|
+
this.pendingTestsLogs.set(testFile, new Map());
|
|
63
65
|
worker.onStateChange(data => this.emitStateChange(data));
|
|
64
66
|
}
|
|
65
67
|
|
|
@@ -124,10 +126,15 @@ export default class RunStatus extends Emittery {
|
|
|
124
126
|
fileStats.remainingTests--;
|
|
125
127
|
this.removePendingTest(event);
|
|
126
128
|
break;
|
|
129
|
+
case 'test-register-log-reference':
|
|
130
|
+
this.addPendingTestLogs(event);
|
|
131
|
+
break;
|
|
127
132
|
case 'timeout':
|
|
128
133
|
stats.timeouts++;
|
|
129
134
|
event.pendingTests = this.pendingTests;
|
|
135
|
+
event.pendingTestsLogs = this.pendingTestsLogs;
|
|
130
136
|
this.pendingTests = new Map();
|
|
137
|
+
this.pendingTestsLogs = new Map();
|
|
131
138
|
for (const testsInFile of event.pendingTests.values()) {
|
|
132
139
|
stats.timedOutTests += testsInFile.size;
|
|
133
140
|
}
|
|
@@ -135,11 +142,15 @@ export default class RunStatus extends Emittery {
|
|
|
135
142
|
break;
|
|
136
143
|
case 'interrupt':
|
|
137
144
|
event.pendingTests = this.pendingTests;
|
|
145
|
+
event.pendingTestsLogs = this.pendingTestsLogs;
|
|
138
146
|
this.pendingTests = new Map();
|
|
147
|
+
this.pendingTestsLogs = new Map();
|
|
139
148
|
break;
|
|
140
149
|
case 'process-exit':
|
|
141
150
|
event.pendingTests = this.pendingTests;
|
|
151
|
+
event.pendingTestsLogs = this.pendingTestsLogs;
|
|
142
152
|
this.pendingTests = new Map();
|
|
153
|
+
this.pendingTestsLogs = new Map();
|
|
143
154
|
break;
|
|
144
155
|
case 'uncaught-exception':
|
|
145
156
|
stats.uncaughtExceptions++;
|
|
@@ -198,6 +209,10 @@ export default class RunStatus extends Emittery {
|
|
|
198
209
|
return 0;
|
|
199
210
|
}
|
|
200
211
|
|
|
212
|
+
addPendingTestLogs(event) {
|
|
213
|
+
this.pendingTestsLogs.get(event.testFile)?.set(event.title, event.logs);
|
|
214
|
+
}
|
|
215
|
+
|
|
201
216
|
addPendingTest(event) {
|
|
202
217
|
if (this.pendingTests.has(event.testFile)) {
|
|
203
218
|
this.pendingTests.get(event.testFile).add(event.title);
|
package/lib/runner.js
CHANGED
|
@@ -358,6 +358,12 @@ export default class Runner extends Emittery {
|
|
|
358
358
|
notifyTimeoutUpdate: this.notifyTimeoutUpdate,
|
|
359
359
|
});
|
|
360
360
|
|
|
361
|
+
this.emit('stateChange', {
|
|
362
|
+
type: 'test-register-log-reference',
|
|
363
|
+
title: task.title,
|
|
364
|
+
logs: test.logs,
|
|
365
|
+
});
|
|
366
|
+
|
|
361
367
|
const result = await this.runSingle(test);
|
|
362
368
|
testOk = result.passed;
|
|
363
369
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ava",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Node.js test runner that lets you develop with confidence.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "avajs/ava",
|
|
@@ -81,17 +81,17 @@
|
|
|
81
81
|
"typescript"
|
|
82
82
|
],
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"acorn": "^8.8.
|
|
84
|
+
"acorn": "^8.8.1",
|
|
85
85
|
"acorn-walk": "^8.2.0",
|
|
86
|
-
"ansi-styles": "^6.
|
|
86
|
+
"ansi-styles": "^6.2.1",
|
|
87
87
|
"arrgv": "^1.0.2",
|
|
88
88
|
"arrify": "^3.0.0",
|
|
89
89
|
"callsites": "^4.0.0",
|
|
90
90
|
"cbor": "^8.1.0",
|
|
91
|
-
"chalk": "^5.
|
|
91
|
+
"chalk": "^5.1.2",
|
|
92
92
|
"chokidar": "^3.5.3",
|
|
93
93
|
"chunkd": "^2.0.1",
|
|
94
|
-
"ci-info": "^3.
|
|
94
|
+
"ci-info": "^3.6.1",
|
|
95
95
|
"ci-parallel-vars": "^1.0.1",
|
|
96
96
|
"clean-yaml-object": "^0.1.0",
|
|
97
97
|
"cli-truncate": "^3.1.0",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"currently-unhandled": "^0.4.1",
|
|
102
102
|
"debug": "^4.3.4",
|
|
103
103
|
"del": "^7.0.0",
|
|
104
|
-
"emittery": "^1.0.
|
|
104
|
+
"emittery": "^1.0.1",
|
|
105
105
|
"figures": "^5.0.0",
|
|
106
106
|
"globby": "^13.1.2",
|
|
107
107
|
"ignore-by-default": "^2.1.0",
|
|
@@ -120,18 +120,18 @@
|
|
|
120
120
|
"pretty-ms": "^8.0.0",
|
|
121
121
|
"resolve-cwd": "^3.0.0",
|
|
122
122
|
"slash": "^3.0.0",
|
|
123
|
-
"stack-utils": "^2.0.
|
|
123
|
+
"stack-utils": "^2.0.6",
|
|
124
124
|
"strip-ansi": "^7.0.1",
|
|
125
125
|
"supertap": "^3.0.1",
|
|
126
|
-
"temp-dir": "^
|
|
127
|
-
"write-file-atomic": "^
|
|
128
|
-
"yargs": "^17.
|
|
126
|
+
"temp-dir": "^3.0.0",
|
|
127
|
+
"write-file-atomic": "^5.0.0",
|
|
128
|
+
"yargs": "^17.6.2"
|
|
129
129
|
},
|
|
130
130
|
"devDependencies": {
|
|
131
131
|
"@ava/test": "github:avajs/test",
|
|
132
132
|
"@ava/typescript": "^3.0.1",
|
|
133
133
|
"@sindresorhus/tsconfig": "^3.0.1",
|
|
134
|
-
"@sinonjs/fake-timers": "^
|
|
134
|
+
"@sinonjs/fake-timers": "^10.0.0",
|
|
135
135
|
"ansi-escapes": "^6.0.0",
|
|
136
136
|
"c8": "^7.12.0",
|
|
137
137
|
"delay": "^5.0.0",
|
|
@@ -139,15 +139,15 @@
|
|
|
139
139
|
"fs-extra": "^10.1.0",
|
|
140
140
|
"get-stream": "^6.0.1",
|
|
141
141
|
"replace-string": "^4.0.0",
|
|
142
|
-
"sinon": "^14.0.
|
|
142
|
+
"sinon": "^14.0.2",
|
|
143
143
|
"tap": "^16.3.0",
|
|
144
144
|
"temp-write": "^5.0.0",
|
|
145
145
|
"tempy": "^3.0.0",
|
|
146
146
|
"touch": "^3.1.0",
|
|
147
147
|
"tsd": "^0.24.1",
|
|
148
|
-
"typescript": "^4.8.
|
|
149
|
-
"xo": "^0.52.
|
|
150
|
-
"zen-observable": "^0.
|
|
148
|
+
"typescript": "^4.8.4",
|
|
149
|
+
"xo": "^0.52.4",
|
|
150
|
+
"zen-observable": "^0.9.0"
|
|
151
151
|
},
|
|
152
152
|
"peerDependencies": {
|
|
153
153
|
"@ava/typescript": "*"
|