Upgrade Ava to v4
This commit is contained in:
parent
9a40cc5274
commit
ce89f1b611
1153 changed files with 27264 additions and 95308 deletions
41
node_modules/ava/lib/worker/dependency-tracker.js
generated
vendored
41
node_modules/ava/lib/worker/dependency-tracker.js
generated
vendored
|
|
@ -1,20 +1,19 @@
|
|||
/* eslint-disable node/no-deprecated-api */
|
||||
'use strict';
|
||||
const ipc = require('./ipc');
|
||||
import process from 'node:process';
|
||||
|
||||
import channel from './channel.cjs';
|
||||
|
||||
const seenDependencies = new Set();
|
||||
let newDependencies = [];
|
||||
|
||||
function flush() {
|
||||
if (newDependencies.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ipc.send({type: 'dependencies', dependencies: newDependencies});
|
||||
channel.send({type: 'dependencies', dependencies: newDependencies});
|
||||
newDependencies = [];
|
||||
}
|
||||
|
||||
exports.flush = flush;
|
||||
|
||||
function track(filename) {
|
||||
if (seenDependencies.has(filename)) {
|
||||
return;
|
||||
|
|
@ -28,20 +27,22 @@ function track(filename) {
|
|||
newDependencies.push(filename);
|
||||
}
|
||||
|
||||
exports.track = track;
|
||||
const tracker = {
|
||||
flush,
|
||||
track,
|
||||
install(extensions, testPath) {
|
||||
for (const ext of Object.keys(extensions)) {
|
||||
const wrappedHandler = extensions[ext];
|
||||
|
||||
function install(testPath) {
|
||||
for (const ext of Object.keys(require.extensions)) {
|
||||
const wrappedHandler = require.extensions[ext];
|
||||
extensions[ext] = (module, filename) => {
|
||||
if (filename !== testPath) {
|
||||
track(filename);
|
||||
}
|
||||
|
||||
require.extensions[ext] = (module, filename) => {
|
||||
if (filename !== testPath) {
|
||||
track(filename);
|
||||
}
|
||||
wrappedHandler(module, filename);
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
wrappedHandler(module, filename);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
exports.install = install;
|
||||
export default tracker;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue