Update checked-in dependencies
This commit is contained in:
parent
4fad06f438
commit
40a500c743
4168 changed files with 298222 additions and 374905 deletions
4
node_modules/ava/lib/assert.js
generated
vendored
4
node_modules/ava/lib/assert.js
generated
vendored
|
|
@ -55,7 +55,7 @@ export class AssertionError extends Error {
|
|||
}
|
||||
|
||||
export function checkAssertionMessage(assertion, message) {
|
||||
if (typeof message === 'undefined' || typeof message === 'string') {
|
||||
if (message === undefined || typeof message === 'string') {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -253,7 +253,7 @@ function assertExpectations({assertion, actual, expectations, message, prefix, s
|
|||
});
|
||||
}
|
||||
|
||||
if (typeof expectations.code !== 'undefined' && actual.code !== expectations.code) {
|
||||
if (expectations.code !== undefined && actual.code !== expectations.code) {
|
||||
throw new AssertionError({
|
||||
assertion,
|
||||
message,
|
||||
|
|
|
|||
20
node_modules/ava/lib/cli.js
generated
vendored
20
node_modules/ava/lib/cli.js
generated
vendored
|
|
@ -5,7 +5,6 @@ import process from 'node:process';
|
|||
|
||||
import arrify from 'arrify';
|
||||
import ciParallelVars from 'ci-parallel-vars';
|
||||
import {deleteAsync} from 'del';
|
||||
import figures from 'figures';
|
||||
import yargs from 'yargs';
|
||||
import {hideBin} from 'yargs/helpers'; // eslint-disable-line n/file-extension-in-import
|
||||
|
|
@ -140,6 +139,7 @@ export default async function loadCli() { // eslint-disable-line complexity
|
|||
|
||||
let resetCache = false;
|
||||
const {argv} = yargs(hideBin(process.argv))
|
||||
.scriptName('ava')
|
||||
.version(pkg.version)
|
||||
.parserConfiguration({
|
||||
'boolean-negation': true,
|
||||
|
|
@ -260,11 +260,23 @@ export default async function loadCli() { // eslint-disable-line complexity
|
|||
const {nonSemVerExperiments: experiments, projectDir} = conf;
|
||||
if (resetCache) {
|
||||
const cacheDir = path.join(projectDir, 'node_modules', '.cache', 'ava');
|
||||
|
||||
try {
|
||||
const deletedFilePaths = await deleteAsync('*', {cwd: cacheDir});
|
||||
let entries;
|
||||
try {
|
||||
entries = fs.readdirSync(cacheDir);
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
entries = [];
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
if (deletedFilePaths.length === 0) {
|
||||
for (const entry of entries) {
|
||||
fs.rmSync(path.join(cacheDir, entry), {recursive: true, force: true});
|
||||
}
|
||||
|
||||
if (entries.length === 0) {
|
||||
console.log(`\n${chalk.green(figures.tick)} No cache files to remove`);
|
||||
} else {
|
||||
console.log(`\n${chalk.green(figures.tick)} Removed AVA cache files in ${cacheDir}`);
|
||||
|
|
|
|||
3
node_modules/ava/lib/glob-helpers.cjs
generated
vendored
3
node_modules/ava/lib/glob-helpers.cjs
generated
vendored
|
|
@ -4,7 +4,8 @@ const process = require('node:process');
|
|||
|
||||
const ignoreByDefault = require('ignore-by-default');
|
||||
const picomatch = require('picomatch');
|
||||
const slash = require('slash');
|
||||
|
||||
const slash = require('./slash.cjs');
|
||||
|
||||
const defaultIgnorePatterns = [...ignoreByDefault.directories(), '**/node_modules'];
|
||||
exports.defaultIgnorePatterns = defaultIgnorePatterns;
|
||||
|
|
|
|||
45
node_modules/ava/lib/like-selector.js
generated
vendored
45
node_modules/ava/lib/like-selector.js
generated
vendored
|
|
@ -1,29 +1,40 @@
|
|||
const isPrimitive = value => value === null || typeof value !== 'object';
|
||||
|
||||
export function isLikeSelector(selector) {
|
||||
return selector !== null
|
||||
&& typeof selector === 'object'
|
||||
&& Reflect.getPrototypeOf(selector) === Object.prototype
|
||||
&& Reflect.ownKeys(selector).length > 0;
|
||||
// Require selector to be an array or plain object.
|
||||
if (
|
||||
isPrimitive(selector)
|
||||
|| (!Array.isArray(selector) && Reflect.getPrototypeOf(selector) !== Object.prototype)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Also require at least one enumerable property.
|
||||
const descriptors = Object.getOwnPropertyDescriptors(selector);
|
||||
return Reflect.ownKeys(descriptors).some(key => descriptors[key].enumerable === true);
|
||||
}
|
||||
|
||||
export const CIRCULAR_SELECTOR = new Error('Encountered a circular selector');
|
||||
|
||||
export function selectComparable(lhs, selector, circular = new Set()) {
|
||||
if (circular.has(selector)) {
|
||||
throw CIRCULAR_SELECTOR;
|
||||
export function selectComparable(actual, selector, circular = [selector]) {
|
||||
if (isPrimitive(actual)) {
|
||||
return actual;
|
||||
}
|
||||
|
||||
circular.add(selector);
|
||||
const comparable = Array.isArray(selector) ? [] : {};
|
||||
const enumerableKeys = Reflect.ownKeys(selector).filter(key => Reflect.getOwnPropertyDescriptor(selector, key).enumerable);
|
||||
for (const key of enumerableKeys) {
|
||||
const subselector = Reflect.get(selector, key);
|
||||
if (isLikeSelector(subselector)) {
|
||||
if (circular.includes(subselector)) {
|
||||
throw CIRCULAR_SELECTOR;
|
||||
}
|
||||
|
||||
if (lhs === null || typeof lhs !== 'object') {
|
||||
return lhs;
|
||||
}
|
||||
|
||||
const comparable = {};
|
||||
for (const [key, rhs] of Object.entries(selector)) {
|
||||
if (isLikeSelector(rhs)) {
|
||||
comparable[key] = selectComparable(Reflect.get(lhs, key), rhs, circular);
|
||||
circular.push(subselector);
|
||||
comparable[key] = selectComparable(Reflect.get(actual, key), subselector, circular);
|
||||
circular.pop();
|
||||
} else {
|
||||
comparable[key] = Reflect.get(lhs, key);
|
||||
comparable[key] = Reflect.get(actual, key);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
36
node_modules/ava/lib/slash.cjs
generated
vendored
Normal file
36
node_modules/ava/lib/slash.cjs
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
Inlined from
|
||||
<https://github.com/sindresorhus/slash/blob/98b618f5a3bfcb5dd374b204868818845b87bb2f/index.js>,
|
||||
since we need a CJS version.
|
||||
|
||||
Copyright 2023 Sindre Sorhus
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the “Software”), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
function slash(path) {
|
||||
const isExtendedLengthPath = path.startsWith('\\\\?\\');
|
||||
|
||||
if (isExtendedLengthPath) {
|
||||
return path;
|
||||
}
|
||||
|
||||
return path.replace(/\\/g, '/');
|
||||
}
|
||||
|
||||
module.exports = slash;
|
||||
2
node_modules/ava/lib/snapshot-manager.js
generated
vendored
2
node_modules/ava/lib/snapshot-manager.js
generated
vendored
|
|
@ -10,10 +10,10 @@ import cbor from 'cbor';
|
|||
import concordance from 'concordance';
|
||||
import indentString from 'indent-string';
|
||||
import mem from 'mem';
|
||||
import slash from 'slash';
|
||||
import writeFileAtomic from 'write-file-atomic';
|
||||
|
||||
import {snapshotManager as concordanceOptions} from './concordance-options.js';
|
||||
import slash from './slash.cjs';
|
||||
|
||||
// Increment if encoding layout or Concordance serialization versions change. Previous AVA versions will not be able to
|
||||
// decode buffers generated by a newer version, so changing this value will require a major version bump of AVA itself.
|
||||
|
|
|
|||
52
node_modules/ava/lib/test.js
generated
vendored
52
node_modules/ava/lib/test.js
generated
vendored
|
|
@ -7,6 +7,22 @@ import concordanceOptions from './concordance-options.js';
|
|||
import nowAndTimers from './now-and-timers.cjs';
|
||||
import parseTestArgs from './parse-test-args.js';
|
||||
|
||||
const hasOwnProperty = (object, prop) => Object.prototype.hasOwnProperty.call(object, prop);
|
||||
|
||||
function isExternalAssertError(error) {
|
||||
if (typeof error !== 'object' || error === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Match errors thrown by <https://www.npmjs.com/package/expect>.
|
||||
if (hasOwnProperty(error, 'matcherResult')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Match errors thrown by <https://www.npmjs.com/package/chai> and <https://nodejs.org/api/assert.html>.
|
||||
return hasOwnProperty(error, 'actual') && hasOwnProperty(error, 'expected');
|
||||
}
|
||||
|
||||
function formatErrorValue(label, error) {
|
||||
const formatted = concordance.format(error, concordanceOptions);
|
||||
return {label, formatted};
|
||||
|
|
@ -519,11 +535,19 @@ export default class Test {
|
|||
|
||||
const result = this.callFn();
|
||||
if (!result.ok) {
|
||||
this.saveFirstError(new AssertionError({
|
||||
message: 'Error thrown in test',
|
||||
savedError: result.error instanceof Error && result.error,
|
||||
values: [formatErrorValue('Error thrown in test:', result.error)],
|
||||
}));
|
||||
if (isExternalAssertError(result.error)) {
|
||||
this.saveFirstError(new AssertionError({
|
||||
message: 'Assertion failed',
|
||||
savedError: result.error instanceof Error && result.error,
|
||||
values: [{label: 'Assertion failed: ', formatted: result.error.message}],
|
||||
}));
|
||||
} else {
|
||||
this.saveFirstError(new AssertionError({
|
||||
message: 'Error thrown in test',
|
||||
savedError: result.error instanceof Error && result.error,
|
||||
values: [formatErrorValue('Error thrown in test:', result.error)],
|
||||
}));
|
||||
}
|
||||
|
||||
return this.finish();
|
||||
}
|
||||
|
|
@ -564,11 +588,19 @@ export default class Test {
|
|||
|
||||
promise
|
||||
.catch(error => {
|
||||
this.saveFirstError(new AssertionError({
|
||||
message: 'Rejected promise returned by test',
|
||||
savedError: error instanceof Error && error,
|
||||
values: [formatErrorValue('Rejected promise returned by test. Reason:', error)],
|
||||
}));
|
||||
if (isExternalAssertError(error)) {
|
||||
this.saveFirstError(new AssertionError({
|
||||
message: 'Assertion failed',
|
||||
savedError: error instanceof Error && error,
|
||||
values: [{label: 'Assertion failed: ', formatted: error.message}],
|
||||
}));
|
||||
} else {
|
||||
this.saveFirstError(new AssertionError({
|
||||
message: 'Rejected promise returned by test',
|
||||
savedError: error instanceof Error && error,
|
||||
values: [formatErrorValue('Rejected promise returned by test. Reason:', error)],
|
||||
}));
|
||||
}
|
||||
})
|
||||
.then(() => resolve(this.finish()));
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue