Bump packages to fix linter
This commit is contained in:
parent
ed9506bbaf
commit
0a11e3fdd9
6063 changed files with 378752 additions and 306784 deletions
22
node_modules/ava/lib/load-config.js
generated
vendored
22
node_modules/ava/lib/load-config.js
generated
vendored
|
|
@ -11,7 +11,7 @@ const MISSING_DEFAULT_EXPORT = Symbol('missing default export');
|
|||
const EXPERIMENTS = new Set();
|
||||
|
||||
const importConfig = async ({configFile, fileForErrorMessage}) => {
|
||||
const {default: config = MISSING_DEFAULT_EXPORT} = await import(url.pathToFileURL(configFile)); // eslint-disable-line node/no-unsupported-features/es-syntax
|
||||
const {default: config = MISSING_DEFAULT_EXPORT} = await import(url.pathToFileURL(configFile));
|
||||
if (config === MISSING_DEFAULT_EXPORT) {
|
||||
throw new Error(`${fileForErrorMessage} must have a default export`);
|
||||
}
|
||||
|
|
@ -29,17 +29,13 @@ const loadConfigFile = async ({projectDir, configFile}) => {
|
|||
return null;
|
||||
}
|
||||
|
||||
throw Object.assign(new Error(`Error loading ${fileForErrorMessage}: ${error.message}`), {parent: error});
|
||||
throw Object.assign(new Error(`Error loading ${fileForErrorMessage}: ${error.message}`), {cause: error});
|
||||
}
|
||||
};
|
||||
|
||||
function resolveConfigFile(configFile) {
|
||||
if (configFile) {
|
||||
configFile = path.resolve(configFile); // Relative to CWD
|
||||
|
||||
if (!configFile.endsWith('.js') && !configFile.endsWith('.cjs') && !configFile.endsWith('.mjs')) {
|
||||
throw new Error('Config files must have .js, .cjs or .mjs extensions');
|
||||
}
|
||||
}
|
||||
|
||||
return configFile;
|
||||
|
|
@ -78,7 +74,7 @@ async function checkJsonFile(searchDir) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function loadConfig({configFile, resolveFrom = process.cwd(), defaults = {}} = {}) {
|
||||
export async function loadConfig({configFile, resolveFrom = process.cwd(), defaults = {}} = {}) { // eslint-disable-line complexity
|
||||
let packageConf = await packageConfig('ava', {cwd: resolveFrom});
|
||||
const filepath = packageJsonPath(packageConf);
|
||||
const projectDir = filepath === undefined ? resolveFrom : path.dirname(filepath);
|
||||
|
|
@ -94,7 +90,17 @@ export async function loadConfig({configFile, resolveFrom = process.cwd(), defau
|
|||
let fileForErrorMessage;
|
||||
let conflicting = [];
|
||||
if (configFile) {
|
||||
const loaded = await loadConfigFile({projectDir, configFile});
|
||||
let loaded;
|
||||
try {
|
||||
loaded = await loadConfigFile({projectDir, configFile});
|
||||
} catch (error) {
|
||||
if (!configFile.endsWith('.js') && !configFile.endsWith('.cjs') && !configFile.endsWith('.mjs')) {
|
||||
throw Object.assign(new Error('Could not load config file; it should have .js, .cjs or .mjs extension'), {cause: error});
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
if (loaded !== null) {
|
||||
({config: fileConf, fileForErrorMessage} = loaded);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue