Upgrade Ava to v4
This commit is contained in:
parent
9a40cc5274
commit
ce89f1b611
1153 changed files with 27264 additions and 95308 deletions
52
node_modules/ava/lib/run-status.js
generated
vendored
52
node_modules/ava/lib/run-status.js
generated
vendored
|
|
@ -1,17 +1,21 @@
|
|||
'use strict';
|
||||
const Emittery = require('emittery');
|
||||
const cloneDeep = require('lodash/cloneDeep');
|
||||
import v8 from 'node:v8';
|
||||
|
||||
class RunStatus extends Emittery {
|
||||
constructor(files, parallelRuns) {
|
||||
import Emittery from 'emittery';
|
||||
|
||||
const copyStats = stats => v8.deserialize(v8.serialize(stats));
|
||||
|
||||
export default class RunStatus extends Emittery {
|
||||
constructor(files, parallelRuns, selectionInsights) {
|
||||
super();
|
||||
|
||||
this.pendingTests = new Map();
|
||||
|
||||
this.emptyParallelRun = parallelRuns &&
|
||||
parallelRuns.currentFileCount === 0 &&
|
||||
parallelRuns.totalRuns > 1 &&
|
||||
files > 0;
|
||||
this.emptyParallelRun = parallelRuns
|
||||
&& parallelRuns.currentFileCount === 0
|
||||
&& parallelRuns.totalRuns > 1
|
||||
&& files > 0;
|
||||
|
||||
this.selectionInsights = selectionInsights;
|
||||
|
||||
this.stats = {
|
||||
byFile: new Map(),
|
||||
|
|
@ -32,7 +36,7 @@ class RunStatus extends Emittery {
|
|||
timeouts: 0,
|
||||
todoTests: 0,
|
||||
uncaughtExceptions: 0,
|
||||
unhandledRejections: 0
|
||||
unhandledRejections: 0,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -51,7 +55,7 @@ class RunStatus extends Emittery {
|
|||
todoTests: 0,
|
||||
uncaughtExceptions: 0,
|
||||
unhandledRejections: 0,
|
||||
...stats
|
||||
...stats,
|
||||
});
|
||||
|
||||
this.pendingTests.set(testFile, new Set());
|
||||
|
|
@ -147,7 +151,7 @@ class RunStatus extends Emittery {
|
|||
}
|
||||
|
||||
if (changedStats) {
|
||||
this.emit('stateChange', {type: 'stats', stats: cloneDeep(stats)});
|
||||
this.emit('stateChange', {type: 'stats', stats: copyStats(stats)});
|
||||
}
|
||||
|
||||
this.emit('stateChange', event);
|
||||
|
|
@ -163,15 +167,15 @@ class RunStatus extends Emittery {
|
|||
}
|
||||
|
||||
if (
|
||||
this.stats.declaredTests === 0 ||
|
||||
this.stats.internalErrors > 0 ||
|
||||
this.stats.failedHooks > 0 ||
|
||||
this.stats.failedTests > 0 ||
|
||||
this.stats.failedWorkers > 0 ||
|
||||
this.stats.sharedWorkerErrors > 0 ||
|
||||
this.stats.timeouts > 0 ||
|
||||
this.stats.uncaughtExceptions > 0 ||
|
||||
this.stats.unhandledRejections > 0
|
||||
this.stats.declaredTests === 0
|
||||
|| this.stats.internalErrors > 0
|
||||
|| this.stats.failedHooks > 0
|
||||
|| this.stats.failedTests > 0
|
||||
|| this.stats.failedWorkers > 0
|
||||
|| this.stats.sharedWorkerErrors > 0
|
||||
|| this.stats.timeouts > 0
|
||||
|| this.stats.uncaughtExceptions > 0
|
||||
|| this.stats.unhandledRejections > 0
|
||||
) {
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -194,6 +198,8 @@ class RunStatus extends Emittery {
|
|||
this.pendingTests.get(event.testFile).delete(event.title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = RunStatus;
|
||||
getFailedTestFiles() {
|
||||
return [...this.stats.byFile].filter(statByFile => statByFile[1].failedTests).map(statByFile => statByFile[0]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue