Bump packages to fix linter

This commit is contained in:
Henry Mercer 2023-01-18 20:50:03 +00:00
parent ed9506bbaf
commit 0a11e3fdd9
6063 changed files with 378752 additions and 306784 deletions

63
node_modules/ava/lib/worker/base.js generated vendored
View file

@ -19,6 +19,41 @@ import {flags, refs, sharedWorkerTeardowns} from './state.cjs';
import {isRunningInThread, isRunningInChildProcess} from './utils.cjs';
const currentlyUnhandled = setUpCurrentlyUnhandled();
let runner;
// Override process.exit with an undetectable replacement
// to report when it is called from a test (which it should never be).
const {apply} = Reflect;
const realExit = process.exit;
async function exit(code, forceSync = false) {
dependencyTracking.flush();
const flushing = channel.flush();
if (!forceSync) {
await flushing;
}
apply(realExit, process, [code]);
}
const handleProcessExit = (fn, receiver, args) => {
const error = new Error('Unexpected process.exit()');
Error.captureStackTrace(error, handleProcessExit);
const {stack} = serializeError('', true, error);
channel.send({type: 'process-exit', stack});
// Make sure to extract the code only from `args` rather than e.g. `Array.prototype`.
// This level of paranoia is usually unwarranted, but we're dealing with test code
// that has already colored outside the lines.
const code = args.length > 0 ? args[0] : undefined;
// Force a synchronous exit as guaranteed by the real process.exit().
exit(code, true);
};
process.exit = new Proxy(realExit, {
apply: handleProcessExit,
});
const run = async options => {
setOptions(options);
@ -29,16 +64,6 @@ const run = async options => {
global.console = Object.assign(global.console, new console.Console({stdout, stderr, colorMode: true}));
}
async function exit(code) {
if (!process.exitCode) {
process.exitCode = code;
}
dependencyTracking.flush();
await channel.flush();
process.exit(); // eslint-disable-line unicorn/no-process-exit
}
let checkSelectedByLineNumbers;
try {
checkSelectedByLineNumbers = lineNumberSelection({
@ -50,7 +75,7 @@ const run = async options => {
checkSelectedByLineNumbers = () => false;
}
const runner = new Runner({
runner = new Runner({
checkSelectedByLineNumbers,
experiments: options.experiments,
failFast: options.failFast,
@ -141,7 +166,7 @@ const run = async options => {
for (const extension of extensionsToLoadAsModules) {
if (ref.endsWith(`.${extension}`)) {
return import(pathToFileURL(ref)); // eslint-disable-line node/no-unsupported-features/es-syntax
return import(pathToFileURL(ref));
}
}
@ -161,7 +186,7 @@ const run = async options => {
if (options.debug && options.debug.port !== undefined && options.debug.host !== undefined) {
// If an inspector was active when the main process started, and is
// already active for the worker process, do not open a new one.
const {default: inspector} = await import('node:inspector'); // eslint-disable-line node/no-unsupported-features/es-syntax
const {default: inspector} = await import('node:inspector');
if (!options.debug.active || inspector.url() === undefined) {
inspector.open(options.debug.port, options.debug.host, true);
}
@ -197,12 +222,18 @@ const onError = error => {
});
};
let options;
if (isRunningInThread) {
channel.send({type: 'starting'}); // AVA won't terminate the worker thread until it's seen this message.
const {options} = workerData;
({options} = workerData);
delete workerData.options; // Don't allow user code access.
run(options).catch(onError);
} else if (isRunningInChildProcess) {
channel.send({type: 'ready-for-options'});
channel.options.then(run).catch(onError);
options = await channel.options;
}
try {
await run(options);
} catch (error) {
onError(error);
}

View file

@ -1,7 +1,7 @@
'use strict';
const events = require('events');
const process = require('process');
const {MessageChannel, threadId} = require('worker_threads');
const events = require('node:events');
const process = require('node:process');
const {MessageChannel, threadId} = require('node:worker_threads');
const timers = require('../now-and-timers.cjs');
@ -15,7 +15,7 @@ let pEvent = async (emitter, event, options) => {
emitter.on(event, addToBuffer);
try {
({pEvent} = await import('p-event')); // eslint-disable-line node/no-unsupported-features/es-syntax
({pEvent} = await import('p-event'));
} finally {
emitter.off(event, addToBuffer);
}
@ -125,7 +125,7 @@ if (isRunningInChildProcess) {
const {controlFlow} = require('../ipc-flow-control.cjs');
handle = new IpcHandle(controlFlow(process));
} else if (isRunningInThread) {
const {parentPort} = require('worker_threads');
const {parentPort} = require('node:worker_threads');
handle = new MessagePortHandle(parentPort);
}
@ -133,7 +133,7 @@ if (isRunningInChildProcess) {
// Node.js. In order to keep track, explicitly reference before attaching.
handle.ref();
exports.options = pEvent(handle.channel, 'message', selectAvaMessage('options')).then(message => message.ava.options);
exports.options = pEvent(handle.channel, 'message', selectAvaMessage('options')).then(message => message.ava.options); // eslint-disable-line unicorn/prefer-top-level-await
exports.peerFailed = pEvent(handle.channel, 'message', selectAvaMessage('peer-failed'));
exports.send = handle.send.bind(handle);
exports.unref = handle.unref.bind(handle);

View file

@ -1,6 +1,6 @@
'use strict';
const path = require('path');
const process = require('process');
const path = require('node:path');
const process = require('node:process');
const {isRunningInThread, isRunningInChildProcess} = require('./utils.cjs');

View file

@ -12,7 +12,7 @@ function parse(file) {
const walk = require('acorn-walk');
const ast = acorn.parse(fs.readFileSync(file, 'utf8'), {
ecmaVersion: 11,
ecmaVersion: 'latest',
locations: true,
sourceType: 'module',
});

View file

@ -1,7 +1,7 @@
'use strict';
require('./guard-environment.cjs'); // eslint-disable-line import/no-unassigned-import
const assert = require('assert');
const assert = require('node:assert');
const {flags, refs} = require('./state.cjs');

View file

@ -1,6 +1,6 @@
'use strict';
const process = require('process');
const {isMainThread} = require('worker_threads');
const process = require('node:process');
const {isMainThread} = require('node:worker_threads');
exports.isRunningInThread = isMainThread === false;
exports.isRunningInChildProcess = typeof process.send === 'function';