Update ava to 4.3.3

The [release notes](https://github.com/avajs/ava/releases/tag/v4.3.3)
mention compatibility with Node 18.8.
This commit is contained in:
Henry Mercer 2022-09-02 18:02:07 +01:00
parent 21530f507f
commit bea5e4b220
160 changed files with 2647 additions and 2263 deletions

30
node_modules/ava/lib/cli.js generated vendored
View file

@ -21,6 +21,7 @@ import {splitPatternAndLineNumbers} from './line-numbers.js';
import {loadConfig} from './load-config.js';
import normalizeModuleTypes from './module-types.js';
import normalizeNodeArguments from './node-arguments.js';
import pkg from './pkg.cjs';
import providerManager from './provider-manager.js';
import DefaultReporter from './reporters/default.js';
import TapReporter from './reporters/tap.js';
@ -102,8 +103,15 @@ export default async function loadCli() { // eslint-disable-line complexity
let conf;
let confError;
try {
const {argv: {config: configFile}} = yargs(hideBin(process.argv)).help(false);
conf = await loadConfig({configFile});
const {argv: {config: configFile}} = yargs(hideBin(process.argv)).help(false).version(false);
const loaded = await loadConfig({configFile});
if (loaded.unsupportedFiles.length > 0) {
console.log(chalk.magenta(
` ${figures.warning} AVA does not support JSON config, ignoring:\n\n ${loaded.unsupportedFiles.join('\n ')}`,
));
}
conf = loaded.config;
if (conf.configFile && path.basename(conf.configFile) !== path.relative(conf.projectDir, conf.configFile)) {
console.log(chalk.magenta(` ${figures.warning} Using configuration from ${conf.configFile}`));
}
@ -132,6 +140,7 @@ export default async function loadCli() { // eslint-disable-line complexity
let resetCache = false;
const {argv} = yargs(hideBin(process.argv))
.version(pkg.version)
.parserConfiguration({
'boolean-negation': true,
'camel-case-expansion': false,
@ -161,7 +170,7 @@ export default async function loadCli() { // eslint-disable-line complexity
})
.command('* [<pattern>...]', 'Run tests', yargs => yargs.options(FLAGS).positional('pattern', {
array: true,
describe: 'Select which test files to run. Leave empty if you want AVA to run all test files as per your configuration. Accepts glob patterns, directories that (recursively) contain test files, and file paths. Add a colon and specify line numbers of specific tests to run',
describe: 'Select which test files to run. Leave empty if you want AVA to run all test files as per your configuration. Accepts glob patterns, directories that (recursively) contain test files, and file paths optionally suffixed with a colon and comma-separated numbers and/or ranges identifying the 1-based line(s) of specific tests to run',
type: 'string',
}), argv => {
if (activeInspector) {
@ -188,7 +197,7 @@ export default async function loadCli() { // eslint-disable-line complexity
},
}).positional('pattern', {
demand: true,
describe: 'Glob patterns to select a single test file to debug. Add a colon and specify line numbers of specific tests to run',
describe: 'Glob pattern to select a single test file to debug, optionally suffixed with a colon and comma-separated numbers and/or ranges identifying the 1-based line(s) of specific tests to run',
type: 'string',
}),
argv => {
@ -319,16 +328,20 @@ export default async function loadCli() { // eslint-disable-line complexity
exit('sources has been removed. Use ignoredByWatcher to provide glob patterns of files that the watcher should ignore.');
}
let pkg;
if (Reflect.has(conf, 'sortTestFiles') && typeof conf.sortTestFiles !== 'function') {
exit('sortTestFiles must be a comparator function.');
}
let projectPackageObject;
try {
pkg = JSON.parse(fs.readFileSync(path.resolve(projectDir, 'package.json')));
projectPackageObject = JSON.parse(fs.readFileSync(path.resolve(projectDir, 'package.json')));
} catch (error) {
if (error.code !== 'ENOENT') {
throw error;
}
}
const {type: defaultModuleType = 'commonjs'} = pkg || {};
const {type: defaultModuleType = 'commonjs'} = projectPackageObject || {};
const providers = [];
if (Reflect.has(conf, 'typescript')) {
@ -380,7 +393,7 @@ export default async function loadCli() { // eslint-disable-line complexity
}
let parallelRuns = null;
if (isCi && ciParallelVars) {
if (isCi && ciParallelVars && combined.utilizeParallelBuilds !== false) {
const {index: currentIndex, total: totalRuns} = ciParallelVars;
parallelRuns = {currentIndex, totalRuns};
}
@ -411,6 +424,7 @@ export default async function loadCli() { // eslint-disable-line complexity
moduleTypes,
nodeArguments,
parallelRuns,
sortTestFiles: conf.sortTestFiles,
projectDir,
providers,
ranFromCli: true,