first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

21
node_modules/@jest/create-cache-key-function/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
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.

46
node_modules/@jest/create-cache-key-function/README.md generated vendored Normal file
View File

@@ -0,0 +1,46 @@
# jest-create-cache-key-function
This module creates a function which is used for generating cache keys used by code transformers in Jest.
## Install
```sh
$ npm install --save-dev @jest/create-cache-key-function
```
## API
### `createCacheKey(files?: Array<string>, values?: Array<String>, length?: number): GetCacheKeyFunction`
Returns a function that can be used to generate cache keys based on source code of provided files and provided values.
#### Parameters
- `files`: [Optional] Array of absolute paths to files whose code should be accounted for when generating cache key
- `values`: [Optional] Array of string values that should be accounted for when generating cache key
- `length`: [Optional] Length of the resulting key. The default is `32`, or `16` on Windows.
**Note:**
The source code for your test is already taken into account when generating the cache key. The `files` array should be used to provide files that are not directly related to your code such as external configuration files.
## Usage
Here is some sample usage code while creating a new transformer for Jest
```javascript
const createCacheKeyFunction =
require('@jest/create-cache-key-function').default;
const filesToAccountFor = [
__filename,
require.resolve('some-package-name/package.json'),
];
const valuesToAccountFor = [process.env.SOME_LOCAL_ENV, 'Some_Other_Value'];
module.exports = {
process(src, filename, config, options) {},
getCacheKey: createCacheKeyFunction(filesToAccountFor, valuesToAccountFor),
};
```

View File

@@ -0,0 +1,52 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import type {Config} from '@jest/types';
/**
* Returns a function that can be used to generate cache keys based on source code of provided files and provided values.
*
* @param files - Array of absolute paths to files whose code should be accounted for when generating cache key
* @param values - Array of string values that should be accounted for when generating cache key
* @param length - Length of the resulting key. The default is `32`, or `16` on Windows.
* @returns A function that can be used to generate cache keys.
*/
declare function createCacheKey(
files?: Array<string>,
values?: Array<string>,
length?: number,
): GetCacheKeyFunction;
export default createCacheKey;
declare type GetCacheKeyFunction =
| OldGetCacheKeyFunction
| NewGetCacheKeyFunction;
declare type NewCacheKeyOptions = {
config: Config.ProjectConfig;
configString: string;
instrument: boolean;
};
declare type NewGetCacheKeyFunction = (
sourceText: string,
sourcePath: string,
options: NewCacheKeyOptions,
) => string;
declare type OldCacheKeyOptions = {
config: Config.ProjectConfig;
instrument: boolean;
};
declare type OldGetCacheKeyFunction = (
fileData: string,
filePath: string,
configStr: string,
options: OldCacheKeyOptions,
) => string;
export {};

View File

@@ -0,0 +1,92 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = createCacheKey;
function _crypto() {
const data = require('crypto');
_crypto = function () {
return data;
};
return data;
}
function _fs() {
const data = require('fs');
_fs = function () {
return data;
};
return data;
}
function _path() {
const data = require('path');
_path = function () {
return data;
};
return data;
}
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// eslint-disable-next-line no-restricted-imports
// Should mirror `import('@jest/transform').TransformOptions`
// Should mirror `import('@jest/transform').Transformer['getCacheKey']`
const {NODE_ENV, BABEL_ENV} = process.env;
function getGlobalCacheKey(files, values, length) {
return [
NODE_ENV,
BABEL_ENV,
...values,
...files.map(file => (0, _fs().readFileSync)(file))
]
.reduce(
(hash, chunk) => hash.update('\0', 'utf8').update(chunk || ''),
(0, _crypto().createHash)('sha1')
)
.digest('hex')
.substring(0, length);
}
function getCacheKeyFunction(globalCacheKey, length) {
return (sourceText, sourcePath, configString, options) => {
// Jest 27 passes a single options bag which contains `configString` rather than as a separate argument.
// We can hide that API difference, though, so this module is usable for both jest@<27 and jest@>=27
const inferredOptions = options || configString;
const {config, instrument} = inferredOptions;
return (0, _crypto().createHash)('sha1')
.update(globalCacheKey)
.update('\0', 'utf8')
.update(sourceText)
.update('\0', 'utf8')
.update(
config.rootDir ? (0, _path().relative)(config.rootDir, sourcePath) : ''
)
.update('\0', 'utf8')
.update(instrument ? 'instrument' : '')
.digest('hex')
.substring(0, length);
};
}
/**
* Returns a function that can be used to generate cache keys based on source code of provided files and provided values.
*
* @param files - Array of absolute paths to files whose code should be accounted for when generating cache key
* @param values - Array of string values that should be accounted for when generating cache key
* @param length - Length of the resulting key. The default is `32`, or `16` on Windows.
* @returns A function that can be used to generate cache keys.
*/
function createCacheKey(
files = [],
values = [],
length = process.platform === 'win32' ? 16 : 32
) {
return getCacheKeyFunction(getGlobalCacheKey(files, values, length), length);
}

View File

@@ -0,0 +1,33 @@
{
"name": "@jest/create-cache-key-function",
"version": "29.7.0",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
"directory": "packages/jest-create-cache-key-function"
},
"dependencies": {
"@jest/types": "^29.6.3"
},
"devDependencies": {
"@types/node": "*",
"jest-util": "^29.7.0"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
},
"license": "MIT",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"default": "./build/index.js"
},
"./package.json": "./package.json"
},
"publishConfig": {
"access": "public"
},
"gitHead": "4e56991693da7cd4c3730dc3579a1dd1403ee630"
}

21
node_modules/@jest/environment/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
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.

418
node_modules/@jest/environment/build/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,418 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="node" />
import type {Circus} from '@jest/types';
import type {Config} from '@jest/types';
import type {Context} from 'vm';
import type {Global} from '@jest/types';
import type {LegacyFakeTimers} from '@jest/fake-timers';
import type {Mocked} from 'jest-mock';
import type {ModernFakeTimers} from '@jest/fake-timers';
import type {ModuleMocker} from 'jest-mock';
export declare type EnvironmentContext = {
console: Console;
docblockPragmas: Record<string, string | Array<string>>;
testPath: string;
};
export declare interface Jest {
/**
* Advances all timers by `msToRun` milliseconds. All pending "macro-tasks"
* that have been queued via `setTimeout()` or `setInterval()`, and would be
* executed within this time frame will be executed.
*/
advanceTimersByTime(msToRun: number): void;
/**
* Advances all timers by `msToRun` milliseconds, firing callbacks if necessary.
*
* @remarks
* Not available when using legacy fake timers implementation.
*/
advanceTimersByTimeAsync(msToRun: number): Promise<void>;
/**
* Advances all timers by the needed milliseconds so that only the next
* timeouts/intervals will run. Optionally, you can provide steps, so it will
* run steps amount of next timeouts/intervals.
*/
advanceTimersToNextTimer(steps?: number): void;
/**
* Advances the clock to the the moment of the first scheduled timer, firing it.
* Optionally, you can provide steps, so it will run steps amount of
* next timeouts/intervals.
*
* @remarks
* Not available when using legacy fake timers implementation.
*/
advanceTimersToNextTimerAsync(steps?: number): Promise<void>;
/**
* Disables automatic mocking in the module loader.
*/
autoMockOff(): Jest;
/**
* Enables automatic mocking in the module loader.
*/
autoMockOn(): Jest;
/**
* Clears the `mock.calls`, `mock.instances`, `mock.contexts` and `mock.results` properties of
* all mocks. Equivalent to calling `.mockClear()` on every mocked function.
*/
clearAllMocks(): Jest;
/**
* Removes any pending timers from the timer system. If any timers have been
* scheduled, they will be cleared and will never have the opportunity to
* execute in the future.
*/
clearAllTimers(): void;
/**
* Given the name of a module, use the automatic mocking system to generate a
* mocked version of the module for you.
*
* This is useful when you want to create a manual mock that extends the
* automatic mock's behavior.
*/
createMockFromModule<T = unknown>(moduleName: string): Mocked<T>;
/**
* Indicates that the module system should never return a mocked version of
* the specified module and its dependencies.
*/
deepUnmock(moduleName: string): Jest;
/**
* Disables automatic mocking in the module loader.
*
* After this method is called, all `require()`s will return the real
* versions of each module (rather than a mocked version).
*/
disableAutomock(): Jest;
/**
* When using `babel-jest`, calls to `jest.mock()` will automatically be hoisted
* to the top of the code block. Use this method if you want to explicitly
* avoid this behavior.
*/
doMock<T = unknown>(
moduleName: string,
moduleFactory?: () => T,
options?: {
virtual?: boolean;
},
): Jest;
/**
* When using `babel-jest`, calls to `jest.unmock()` will automatically be hoisted
* to the top of the code block. Use this method if you want to explicitly
* avoid this behavior.
*/
dontMock(moduleName: string): Jest;
/**
* Enables automatic mocking in the module loader.
*/
enableAutomock(): Jest;
/**
* Creates a mock function. Optionally takes a mock implementation.
*/
fn: ModuleMocker['fn'];
/**
* Given the name of a module, use the automatic mocking system to generate a
* mocked version of the module for you.
*
* This is useful when you want to create a manual mock that extends the
* automatic mock's behavior.
*
* @deprecated Use `jest.createMockFromModule()` instead
*/
genMockFromModule<T = unknown>(moduleName: string): Mocked<T>;
/**
* When mocking time, `Date.now()` will also be mocked. If you for some reason
* need access to the real current time, you can invoke this function.
*
* @remarks
* Not available when using legacy fake timers implementation.
*/
getRealSystemTime(): number;
/**
* Retrieves the seed value. It will be randomly generated for each test run
* or can be manually set via the `--seed` CLI argument.
*/
getSeed(): number;
/**
* Returns the number of fake timers still left to run.
*/
getTimerCount(): number;
/**
* Returns `true` if test environment has been torn down.
*
* @example
* ```js
* if (jest.isEnvironmentTornDown()) {
* // The Jest environment has been torn down, so stop doing work
* return;
* }
* ```
*/
isEnvironmentTornDown(): boolean;
/**
* Determines if the given function is a mocked function.
*/
isMockFunction: ModuleMocker['isMockFunction'];
/**
* `jest.isolateModules()` goes a step further than `jest.resetModules()` and
* creates a sandbox registry for the modules that are loaded inside the callback
* function. This is useful to isolate specific modules for every test so that
* local module state doesn't conflict between tests.
*/
isolateModules(fn: () => void): Jest;
/**
* `jest.isolateModulesAsync()` is the equivalent of `jest.isolateModules()`, but for
* async functions to be wrapped. The caller is expected to `await` the completion of
* `isolateModulesAsync`.
*/
isolateModulesAsync(fn: () => Promise<void>): Promise<void>;
/**
* Mocks a module with an auto-mocked version when it is being required.
*/
mock<T = unknown>(
moduleName: string,
moduleFactory?: () => T,
options?: {
virtual?: boolean;
},
): Jest;
/**
* Mocks a module with the provided module factory when it is being imported.
*/
unstable_mockModule<T = unknown>(
moduleName: string,
moduleFactory: () => T | Promise<T>,
options?: {
virtual?: boolean;
},
): Jest;
/**
* Wraps types of the `source` object and its deep members with type definitions
* of Jest mock function. Pass `{shallow: true}` option to disable the deeply
* mocked behavior.
*/
mocked: ModuleMocker['mocked'];
/**
* Returns the current time in ms of the fake timer clock.
*/
now(): number;
/**
* Replaces property on an object with another value.
*
* @remarks
* For mocking functions or 'get' or 'set' accessors, use `jest.spyOn()` instead.
*/
replaceProperty: ModuleMocker['replaceProperty'];
/**
* Returns the actual module instead of a mock, bypassing all checks on
* whether the module should receive a mock implementation or not.
*
* @example
* ```js
* jest.mock('../myModule', () => {
* // Require the original module to not be mocked...
* const originalModule = jest.requireActual('../myModule');
*
* return {
* __esModule: true, // Use it when dealing with esModules
* ...originalModule,
* getRandom: jest.fn().mockReturnValue(10),
* };
* });
*
* const getRandom = require('../myModule').getRandom;
*
* getRandom(); // Always returns 10
* ```
*/
requireActual<T = unknown>(moduleName: string): T;
/**
* Returns a mock module instead of the actual module, bypassing all checks
* on whether the module should be required normally or not.
*/
requireMock<T = unknown>(moduleName: string): T;
/**
* Resets the state of all mocks. Equivalent to calling `.mockReset()` on
* every mocked function.
*/
resetAllMocks(): Jest;
/**
* Resets the module registry - the cache of all required modules. This is
* useful to isolate modules where local state might conflict between tests.
*/
resetModules(): Jest;
/**
* Restores all mocks and replaced properties back to their original value.
* Equivalent to calling `.mockRestore()` on every mocked function
* and `.restore()` on every replaced property.
*
* Beware that `jest.restoreAllMocks()` only works when the mock was created
* with `jest.spyOn()`; other mocks will require you to manually restore them.
*/
restoreAllMocks(): Jest;
/**
* Runs failed tests n-times until they pass or until the max number of
* retries is exhausted.
*
* If `logErrorsBeforeRetry` is enabled, Jest will log the error(s) that caused
* the test to fail to the console, providing visibility on why a retry occurred.
* retries is exhausted.
*
* @remarks
* Only available with `jest-circus` runner.
*/
retryTimes(
numRetries: number,
options?: {
logErrorsBeforeRetry?: boolean;
},
): Jest;
/**
* Exhausts tasks queued by `setImmediate()`.
*
* @remarks
* Only available when using legacy fake timers implementation.
*/
runAllImmediates(): void;
/**
* Exhausts the micro-task queue (usually interfaced in node via
* `process.nextTick()`).
*/
runAllTicks(): void;
/**
* Exhausts the macro-task queue (i.e., all tasks queued by `setTimeout()`
* and `setInterval()`).
*/
runAllTimers(): void;
/**
* Exhausts the macro-task queue (i.e., all tasks queued by `setTimeout()`
* and `setInterval()`).
*
* @remarks
* If new timers are added while it is executing they will be run as well.
* @remarks
* Not available when using legacy fake timers implementation.
*/
runAllTimersAsync(): Promise<void>;
/**
* Executes only the macro-tasks that are currently pending (i.e., only the
* tasks that have been queued by `setTimeout()` or `setInterval()` up to this
* point). If any of the currently pending macro-tasks schedule new
* macro-tasks, those new tasks will not be executed by this call.
*/
runOnlyPendingTimers(): void;
/**
* Executes only the macro-tasks that are currently pending (i.e., only the
* tasks that have been queued by `setTimeout()` or `setInterval()` up to this
* point). If any of the currently pending macro-tasks schedule new
* macro-tasks, those new tasks will not be executed by this call.
*
* @remarks
* Not available when using legacy fake timers implementation.
*/
runOnlyPendingTimersAsync(): Promise<void>;
/**
* Explicitly supplies the mock object that the module system should return
* for the specified module.
*
* @remarks
* It is recommended to use `jest.mock()` instead. The `jest.mock()` API's second
* argument is a module factory instead of the expected exported module object.
*/
setMock(moduleName: string, moduleExports: unknown): Jest;
/**
* Set the current system time used by fake timers. Simulates a user changing
* the system clock while your program is running. It affects the current time,
* but it does not in itself cause e.g. timers to fire; they will fire exactly
* as they would have done without the call to `jest.setSystemTime()`.
*
* @remarks
* Not available when using legacy fake timers implementation.
*/
setSystemTime(now?: number | Date): void;
/**
* Set the default timeout interval for tests and before/after hooks in
* milliseconds.
*
* @remarks
* The default timeout interval is 5 seconds if this method is not called.
*/
setTimeout(timeout: number): Jest;
/**
* Creates a mock function similar to `jest.fn()` but also tracks calls to
* `object[methodName]`.
*
* Optional third argument of `accessType` can be either 'get' or 'set', which
* proves to be useful when you want to spy on a getter or a setter, respectively.
*
* @remarks
* By default, `jest.spyOn()` also calls the spied method. This is different
* behavior from most other test libraries.
*/
spyOn: ModuleMocker['spyOn'];
/**
* Indicates that the module system should never return a mocked version of
* the specified module from `require()` (e.g. that it should always return the
* real module).
*/
unmock(moduleName: string): Jest;
/**
* Instructs Jest to use fake versions of the global date, performance,
* time and timer APIs. Fake timers implementation is backed by
* [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers).
*
* @remarks
* Calling `jest.useFakeTimers()` once again in the same test file would reinstall
* fake timers using the provided options.
*/
useFakeTimers(
fakeTimersConfig?: Config.FakeTimersConfig | Config.LegacyFakeTimersConfig,
): Jest;
/**
* Instructs Jest to restore the original implementations of the global date,
* performance, time and timer APIs.
*/
useRealTimers(): Jest;
}
export declare class JestEnvironment<Timer = unknown> {
constructor(config: JestEnvironmentConfig, context: EnvironmentContext);
global: Global.Global;
fakeTimers: LegacyFakeTimers<Timer> | null;
fakeTimersModern: ModernFakeTimers | null;
moduleMocker: ModuleMocker | null;
getVmContext(): Context | null;
setup(): Promise<void>;
teardown(): Promise<void>;
handleTestEvent?: Circus.EventHandler;
exportConditions?: () => Array<string>;
}
export declare interface JestEnvironmentConfig {
projectConfig: Config.ProjectConfig;
globalConfig: Config.GlobalConfig;
}
export declare interface JestImportMeta extends ImportMeta {
jest: Jest;
}
export declare type Module = NodeModule;
export declare type ModuleWrapper = (
this: Module['exports'],
module: Module,
exports: Module['exports'],
require: Module['require'],
__dirname: string,
__filename: Module['filename'],
jest?: Jest,
...sandboxInjectedGlobals: Array<Global.Global[keyof Global.Global]>
) => unknown;
export {};

1
node_modules/@jest/environment/build/index.js generated vendored Normal file
View File

@@ -0,0 +1 @@
'use strict';

32
node_modules/@jest/environment/package.json generated vendored Normal file
View File

@@ -0,0 +1,32 @@
{
"name": "@jest/environment",
"version": "29.7.0",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
"directory": "packages/jest-environment"
},
"license": "MIT",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"default": "./build/index.js"
},
"./package.json": "./package.json"
},
"dependencies": {
"@jest/fake-timers": "^29.7.0",
"@jest/types": "^29.6.3",
"@types/node": "*",
"jest-mock": "^29.7.0"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
},
"publishConfig": {
"access": "public"
},
"gitHead": "4e56991693da7cd4c3730dc3579a1dd1403ee630"
}

21
node_modules/@jest/fake-timers/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
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.

110
node_modules/@jest/fake-timers/build/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,110 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import type {Config} from '@jest/types';
import type {ModuleMocker} from 'jest-mock';
import {StackTraceConfig} from 'jest-message-util';
declare type Callback = (...args: Array<unknown>) => void;
export declare class LegacyFakeTimers<TimerRef = unknown> {
private _cancelledTicks;
private readonly _config;
private _disposed;
private _fakeTimerAPIs;
private _fakingTime;
private _global;
private _immediates;
private readonly _maxLoops;
private readonly _moduleMocker;
private _now;
private _ticks;
private readonly _timerAPIs;
private _timers;
private _uuidCounter;
private readonly _timerConfig;
constructor({
global,
moduleMocker,
timerConfig,
config,
maxLoops,
}: {
global: typeof globalThis;
moduleMocker: ModuleMocker;
timerConfig: TimerConfig<TimerRef>;
config: StackTraceConfig;
maxLoops?: number;
});
clearAllTimers(): void;
dispose(): void;
reset(): void;
now(): number;
runAllTicks(): void;
runAllImmediates(): void;
private _runImmediate;
runAllTimers(): void;
runOnlyPendingTimers(): void;
advanceTimersToNextTimer(steps?: number): void;
advanceTimersByTime(msToRun: number): void;
runWithRealTimers(cb: Callback): void;
useRealTimers(): void;
useFakeTimers(): void;
getTimerCount(): number;
private _checkFakeTimers;
private _createMocks;
private _fakeClearTimer;
private _fakeClearImmediate;
private _fakeNextTick;
private _fakeRequestAnimationFrame;
private _fakeSetImmediate;
private _fakeSetInterval;
private _fakeSetTimeout;
private _getNextTimerHandleAndExpiry;
private _runTimerHandle;
}
export declare class ModernFakeTimers {
private _clock;
private readonly _config;
private _fakingTime;
private readonly _global;
private readonly _fakeTimers;
constructor({
global,
config,
}: {
global: typeof globalThis;
config: Config.ProjectConfig;
});
clearAllTimers(): void;
dispose(): void;
runAllTimers(): void;
runAllTimersAsync(): Promise<void>;
runOnlyPendingTimers(): void;
runOnlyPendingTimersAsync(): Promise<void>;
advanceTimersToNextTimer(steps?: number): void;
advanceTimersToNextTimerAsync(steps?: number): Promise<void>;
advanceTimersByTime(msToRun: number): void;
advanceTimersByTimeAsync(msToRun: number): Promise<void>;
runAllTicks(): void;
useRealTimers(): void;
useFakeTimers(fakeTimersConfig?: Config.FakeTimersConfig): void;
reset(): void;
setSystemTime(now?: number | Date): void;
getRealSystemTime(): number;
now(): number;
getTimerCount(): number;
private _checkFakeTimers;
private _toSinonFakeTimersConfig;
}
declare type TimerConfig<Ref> = {
idToRef: (id: number) => Ref;
refToId: (ref: Ref) => number | void;
};
export {};

22
node_modules/@jest/fake-timers/build/index.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
Object.defineProperty(exports, 'LegacyFakeTimers', {
enumerable: true,
get: function () {
return _legacyFakeTimers.default;
}
});
Object.defineProperty(exports, 'ModernFakeTimers', {
enumerable: true,
get: function () {
return _modernFakeTimers.default;
}
});
var _legacyFakeTimers = _interopRequireDefault(require('./legacyFakeTimers'));
var _modernFakeTimers = _interopRequireDefault(require('./modernFakeTimers'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}

View File

@@ -0,0 +1,545 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _util() {
const data = require('util');
_util = function () {
return data;
};
return data;
}
function _jestMessageUtil() {
const data = require('jest-message-util');
_jestMessageUtil = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable local/prefer-spread-eventually */
const MS_IN_A_YEAR = 31536000000;
class FakeTimers {
_cancelledTicks;
_config;
_disposed;
_fakeTimerAPIs;
_fakingTime = false;
_global;
_immediates;
_maxLoops;
_moduleMocker;
_now;
_ticks;
_timerAPIs;
_timers;
_uuidCounter;
_timerConfig;
constructor({global, moduleMocker, timerConfig, config, maxLoops}) {
this._global = global;
this._timerConfig = timerConfig;
this._config = config;
this._maxLoops = maxLoops || 100000;
this._uuidCounter = 1;
this._moduleMocker = moduleMocker;
// Store original timer APIs for future reference
this._timerAPIs = {
cancelAnimationFrame: global.cancelAnimationFrame,
clearImmediate: global.clearImmediate,
clearInterval: global.clearInterval,
clearTimeout: global.clearTimeout,
nextTick: global.process && global.process.nextTick,
requestAnimationFrame: global.requestAnimationFrame,
setImmediate: global.setImmediate,
setInterval: global.setInterval,
setTimeout: global.setTimeout
};
this._disposed = false;
this.reset();
}
clearAllTimers() {
this._immediates = [];
this._timers.clear();
}
dispose() {
this._disposed = true;
this.clearAllTimers();
}
reset() {
this._cancelledTicks = {};
this._now = 0;
this._ticks = [];
this._immediates = [];
this._timers = new Map();
}
now() {
if (this._fakingTime) {
return this._now;
}
return Date.now();
}
runAllTicks() {
this._checkFakeTimers();
// Only run a generous number of ticks and then bail.
// This is just to help avoid recursive loops
let i;
for (i = 0; i < this._maxLoops; i++) {
const tick = this._ticks.shift();
if (tick === undefined) {
break;
}
if (
!Object.prototype.hasOwnProperty.call(this._cancelledTicks, tick.uuid)
) {
// Callback may throw, so update the map prior calling.
this._cancelledTicks[tick.uuid] = true;
tick.callback();
}
}
if (i === this._maxLoops) {
throw new Error(
`Ran ${this._maxLoops} ticks, and there are still more! ` +
"Assuming we've hit an infinite recursion and bailing out..."
);
}
}
runAllImmediates() {
this._checkFakeTimers();
// Only run a generous number of immediates and then bail.
let i;
for (i = 0; i < this._maxLoops; i++) {
const immediate = this._immediates.shift();
if (immediate === undefined) {
break;
}
this._runImmediate(immediate);
}
if (i === this._maxLoops) {
throw new Error(
`Ran ${this._maxLoops} immediates, and there are still more! Assuming ` +
"we've hit an infinite recursion and bailing out..."
);
}
}
_runImmediate(immediate) {
try {
immediate.callback();
} finally {
this._fakeClearImmediate(immediate.uuid);
}
}
runAllTimers() {
this._checkFakeTimers();
this.runAllTicks();
this.runAllImmediates();
// Only run a generous number of timers and then bail.
// This is just to help avoid recursive loops
let i;
for (i = 0; i < this._maxLoops; i++) {
const nextTimerHandleAndExpiry = this._getNextTimerHandleAndExpiry();
// If there are no more timer handles, stop!
if (nextTimerHandleAndExpiry === null) {
break;
}
const [nextTimerHandle, expiry] = nextTimerHandleAndExpiry;
this._now = expiry;
this._runTimerHandle(nextTimerHandle);
// Some of the immediate calls could be enqueued
// during the previous handling of the timers, we should
// run them as well.
if (this._immediates.length) {
this.runAllImmediates();
}
if (this._ticks.length) {
this.runAllTicks();
}
}
if (i === this._maxLoops) {
throw new Error(
`Ran ${this._maxLoops} timers, and there are still more! ` +
"Assuming we've hit an infinite recursion and bailing out..."
);
}
}
runOnlyPendingTimers() {
// We need to hold the current shape of `this._timers` because existing
// timers can add new ones to the map and hence would run more than necessary.
// See https://github.com/jestjs/jest/pull/4608 for details
const timerEntries = Array.from(this._timers.entries());
this._checkFakeTimers();
this._immediates.forEach(this._runImmediate, this);
timerEntries
.sort(([, left], [, right]) => left.expiry - right.expiry)
.forEach(([timerHandle, timer]) => {
this._now = timer.expiry;
this._runTimerHandle(timerHandle);
});
}
advanceTimersToNextTimer(steps = 1) {
if (steps < 1) {
return;
}
const nextExpiry = Array.from(this._timers.values()).reduce(
(minExpiry, timer) => {
if (minExpiry === null || timer.expiry < minExpiry) return timer.expiry;
return minExpiry;
},
null
);
if (nextExpiry !== null) {
this.advanceTimersByTime(nextExpiry - this._now);
this.advanceTimersToNextTimer(steps - 1);
}
}
advanceTimersByTime(msToRun) {
this._checkFakeTimers();
// Only run a generous number of timers and then bail.
// This is just to help avoid recursive loops
let i;
for (i = 0; i < this._maxLoops; i++) {
const timerHandleAndExpiry = this._getNextTimerHandleAndExpiry();
// If there are no more timer handles, stop!
if (timerHandleAndExpiry === null) {
break;
}
const [timerHandle, nextTimerExpiry] = timerHandleAndExpiry;
if (this._now + msToRun < nextTimerExpiry) {
// There are no timers between now and the target we're running to
break;
} else {
msToRun -= nextTimerExpiry - this._now;
this._now = nextTimerExpiry;
this._runTimerHandle(timerHandle);
}
}
// Advance the clock by whatever time we still have left to run
this._now += msToRun;
if (i === this._maxLoops) {
throw new Error(
`Ran ${this._maxLoops} timers, and there are still more! ` +
"Assuming we've hit an infinite recursion and bailing out..."
);
}
}
runWithRealTimers(cb) {
const prevClearImmediate = this._global.clearImmediate;
const prevClearInterval = this._global.clearInterval;
const prevClearTimeout = this._global.clearTimeout;
const prevNextTick = this._global.process.nextTick;
const prevSetImmediate = this._global.setImmediate;
const prevSetInterval = this._global.setInterval;
const prevSetTimeout = this._global.setTimeout;
this.useRealTimers();
let cbErr = null;
let errThrown = false;
try {
cb();
} catch (e) {
errThrown = true;
cbErr = e;
}
this._global.clearImmediate = prevClearImmediate;
this._global.clearInterval = prevClearInterval;
this._global.clearTimeout = prevClearTimeout;
this._global.process.nextTick = prevNextTick;
this._global.setImmediate = prevSetImmediate;
this._global.setInterval = prevSetInterval;
this._global.setTimeout = prevSetTimeout;
if (errThrown) {
throw cbErr;
}
}
useRealTimers() {
const global = this._global;
if (typeof global.cancelAnimationFrame === 'function') {
(0, _jestUtil().setGlobal)(
global,
'cancelAnimationFrame',
this._timerAPIs.cancelAnimationFrame
);
}
if (typeof global.clearImmediate === 'function') {
(0, _jestUtil().setGlobal)(
global,
'clearImmediate',
this._timerAPIs.clearImmediate
);
}
(0, _jestUtil().setGlobal)(
global,
'clearInterval',
this._timerAPIs.clearInterval
);
(0, _jestUtil().setGlobal)(
global,
'clearTimeout',
this._timerAPIs.clearTimeout
);
if (typeof global.requestAnimationFrame === 'function') {
(0, _jestUtil().setGlobal)(
global,
'requestAnimationFrame',
this._timerAPIs.requestAnimationFrame
);
}
if (typeof global.setImmediate === 'function') {
(0, _jestUtil().setGlobal)(
global,
'setImmediate',
this._timerAPIs.setImmediate
);
}
(0, _jestUtil().setGlobal)(
global,
'setInterval',
this._timerAPIs.setInterval
);
(0, _jestUtil().setGlobal)(
global,
'setTimeout',
this._timerAPIs.setTimeout
);
global.process.nextTick = this._timerAPIs.nextTick;
this._fakingTime = false;
}
useFakeTimers() {
this._createMocks();
const global = this._global;
if (typeof global.cancelAnimationFrame === 'function') {
(0, _jestUtil().setGlobal)(
global,
'cancelAnimationFrame',
this._fakeTimerAPIs.cancelAnimationFrame
);
}
if (typeof global.clearImmediate === 'function') {
(0, _jestUtil().setGlobal)(
global,
'clearImmediate',
this._fakeTimerAPIs.clearImmediate
);
}
(0, _jestUtil().setGlobal)(
global,
'clearInterval',
this._fakeTimerAPIs.clearInterval
);
(0, _jestUtil().setGlobal)(
global,
'clearTimeout',
this._fakeTimerAPIs.clearTimeout
);
if (typeof global.requestAnimationFrame === 'function') {
(0, _jestUtil().setGlobal)(
global,
'requestAnimationFrame',
this._fakeTimerAPIs.requestAnimationFrame
);
}
if (typeof global.setImmediate === 'function') {
(0, _jestUtil().setGlobal)(
global,
'setImmediate',
this._fakeTimerAPIs.setImmediate
);
}
(0, _jestUtil().setGlobal)(
global,
'setInterval',
this._fakeTimerAPIs.setInterval
);
(0, _jestUtil().setGlobal)(
global,
'setTimeout',
this._fakeTimerAPIs.setTimeout
);
global.process.nextTick = this._fakeTimerAPIs.nextTick;
this._fakingTime = true;
}
getTimerCount() {
this._checkFakeTimers();
return this._timers.size + this._immediates.length + this._ticks.length;
}
_checkFakeTimers() {
if (!this._fakingTime) {
this._global.console.warn(
'A function to advance timers was called but the timers APIs are not mocked ' +
'with fake timers. Call `jest.useFakeTimers({legacyFakeTimers: true})` ' +
'in this test file or enable fake timers for all tests by setting ' +
"{'enableGlobally': true, 'legacyFakeTimers': true} in " +
`Jest configuration file.\nStack Trace:\n${(0,
_jestMessageUtil().formatStackTrace)(
new Error().stack,
this._config,
{
noStackTrace: false
}
)}`
);
}
}
_createMocks() {
const fn = implementation => this._moduleMocker.fn(implementation);
const promisifiableFakeSetTimeout = fn(this._fakeSetTimeout.bind(this));
// @ts-expect-error: no index
promisifiableFakeSetTimeout[_util().promisify.custom] = (delay, arg) =>
new Promise(resolve => promisifiableFakeSetTimeout(resolve, delay, arg));
this._fakeTimerAPIs = {
cancelAnimationFrame: fn(this._fakeClearTimer.bind(this)),
clearImmediate: fn(this._fakeClearImmediate.bind(this)),
clearInterval: fn(this._fakeClearTimer.bind(this)),
clearTimeout: fn(this._fakeClearTimer.bind(this)),
nextTick: fn(this._fakeNextTick.bind(this)),
requestAnimationFrame: fn(this._fakeRequestAnimationFrame.bind(this)),
setImmediate: fn(this._fakeSetImmediate.bind(this)),
setInterval: fn(this._fakeSetInterval.bind(this)),
setTimeout: promisifiableFakeSetTimeout
};
}
_fakeClearTimer(timerRef) {
const uuid = this._timerConfig.refToId(timerRef);
if (uuid) {
this._timers.delete(String(uuid));
}
}
_fakeClearImmediate(uuid) {
this._immediates = this._immediates.filter(
immediate => immediate.uuid !== uuid
);
}
_fakeNextTick(callback, ...args) {
if (this._disposed) {
return;
}
const uuid = String(this._uuidCounter++);
this._ticks.push({
callback: () => callback.apply(null, args),
uuid
});
const cancelledTicks = this._cancelledTicks;
this._timerAPIs.nextTick(() => {
if (!Object.prototype.hasOwnProperty.call(cancelledTicks, uuid)) {
// Callback may throw, so update the map prior calling.
cancelledTicks[uuid] = true;
callback.apply(null, args);
}
});
}
_fakeRequestAnimationFrame(callback) {
return this._fakeSetTimeout(() => {
// TODO: Use performance.now() once it's mocked
callback(this._now);
}, 1000 / 60);
}
_fakeSetImmediate(callback, ...args) {
if (this._disposed) {
return null;
}
const uuid = String(this._uuidCounter++);
this._immediates.push({
callback: () => callback.apply(null, args),
uuid
});
this._timerAPIs.setImmediate(() => {
if (!this._disposed) {
if (this._immediates.find(x => x.uuid === uuid)) {
try {
callback.apply(null, args);
} finally {
this._fakeClearImmediate(uuid);
}
}
}
});
return uuid;
}
_fakeSetInterval(callback, intervalDelay, ...args) {
if (this._disposed) {
return null;
}
if (intervalDelay == null) {
intervalDelay = 0;
}
const uuid = this._uuidCounter++;
this._timers.set(String(uuid), {
callback: () => callback.apply(null, args),
expiry: this._now + intervalDelay,
interval: intervalDelay,
type: 'interval'
});
return this._timerConfig.idToRef(uuid);
}
_fakeSetTimeout(callback, delay, ...args) {
if (this._disposed) {
return null;
}
// eslint-disable-next-line no-bitwise
delay = Number(delay) | 0;
const uuid = this._uuidCounter++;
this._timers.set(String(uuid), {
callback: () => callback.apply(null, args),
expiry: this._now + delay,
interval: undefined,
type: 'timeout'
});
return this._timerConfig.idToRef(uuid);
}
_getNextTimerHandleAndExpiry() {
let nextTimerHandle = null;
let soonestTime = MS_IN_A_YEAR;
this._timers.forEach((timer, uuid) => {
if (timer.expiry < soonestTime) {
soonestTime = timer.expiry;
nextTimerHandle = uuid;
}
});
if (nextTimerHandle === null) {
return null;
}
return [nextTimerHandle, soonestTime];
}
_runTimerHandle(timerHandle) {
const timer = this._timers.get(timerHandle);
if (!timer) {
// Timer has been cleared - we'll hit this when a timer is cleared within
// another timer in runOnlyPendingTimers
return;
}
switch (timer.type) {
case 'timeout':
this._timers.delete(timerHandle);
timer.callback();
break;
case 'interval':
timer.expiry = this._now + (timer.interval || 0);
timer.callback();
break;
default:
throw new Error(`Unexpected timer type: ${timer.type}`);
}
}
}
exports.default = FakeTimers;

View File

@@ -0,0 +1,191 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _fakeTimers() {
const data = require('@sinonjs/fake-timers');
_fakeTimers = function () {
return data;
};
return data;
}
function _jestMessageUtil() {
const data = require('jest-message-util');
_jestMessageUtil = function () {
return data;
};
return data;
}
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
class FakeTimers {
_clock;
_config;
_fakingTime;
_global;
_fakeTimers;
constructor({global, config}) {
this._global = global;
this._config = config;
this._fakingTime = false;
this._fakeTimers = (0, _fakeTimers().withGlobal)(global);
}
clearAllTimers() {
if (this._fakingTime) {
this._clock.reset();
}
}
dispose() {
this.useRealTimers();
}
runAllTimers() {
if (this._checkFakeTimers()) {
this._clock.runAll();
}
}
async runAllTimersAsync() {
if (this._checkFakeTimers()) {
await this._clock.runAllAsync();
}
}
runOnlyPendingTimers() {
if (this._checkFakeTimers()) {
this._clock.runToLast();
}
}
async runOnlyPendingTimersAsync() {
if (this._checkFakeTimers()) {
await this._clock.runToLastAsync();
}
}
advanceTimersToNextTimer(steps = 1) {
if (this._checkFakeTimers()) {
for (let i = steps; i > 0; i--) {
this._clock.next();
// Fire all timers at this point: https://github.com/sinonjs/fake-timers/issues/250
this._clock.tick(0);
if (this._clock.countTimers() === 0) {
break;
}
}
}
}
async advanceTimersToNextTimerAsync(steps = 1) {
if (this._checkFakeTimers()) {
for (let i = steps; i > 0; i--) {
await this._clock.nextAsync();
// Fire all timers at this point: https://github.com/sinonjs/fake-timers/issues/250
await this._clock.tickAsync(0);
if (this._clock.countTimers() === 0) {
break;
}
}
}
}
advanceTimersByTime(msToRun) {
if (this._checkFakeTimers()) {
this._clock.tick(msToRun);
}
}
async advanceTimersByTimeAsync(msToRun) {
if (this._checkFakeTimers()) {
await this._clock.tickAsync(msToRun);
}
}
runAllTicks() {
if (this._checkFakeTimers()) {
// @ts-expect-error - doesn't exist?
this._clock.runMicrotasks();
}
}
useRealTimers() {
if (this._fakingTime) {
this._clock.uninstall();
this._fakingTime = false;
}
}
useFakeTimers(fakeTimersConfig) {
if (this._fakingTime) {
this._clock.uninstall();
}
this._clock = this._fakeTimers.install(
this._toSinonFakeTimersConfig(fakeTimersConfig)
);
this._fakingTime = true;
}
reset() {
if (this._checkFakeTimers()) {
const {now} = this._clock;
this._clock.reset();
this._clock.setSystemTime(now);
}
}
setSystemTime(now) {
if (this._checkFakeTimers()) {
this._clock.setSystemTime(now);
}
}
getRealSystemTime() {
return Date.now();
}
now() {
if (this._fakingTime) {
return this._clock.now;
}
return Date.now();
}
getTimerCount() {
if (this._checkFakeTimers()) {
return this._clock.countTimers();
}
return 0;
}
_checkFakeTimers() {
if (!this._fakingTime) {
this._global.console.warn(
'A function to advance timers was called but the timers APIs are not replaced ' +
'with fake timers. Call `jest.useFakeTimers()` in this test file or enable ' +
"fake timers for all tests by setting 'fakeTimers': {'enableGlobally': true} " +
`in Jest configuration file.\nStack Trace:\n${(0,
_jestMessageUtil().formatStackTrace)(
new Error().stack,
this._config,
{
noStackTrace: false
}
)}`
);
}
return this._fakingTime;
}
_toSinonFakeTimersConfig(fakeTimersConfig = {}) {
fakeTimersConfig = {
...this._config.fakeTimers,
...fakeTimersConfig
};
const advanceTimeDelta =
typeof fakeTimersConfig.advanceTimers === 'number'
? fakeTimersConfig.advanceTimers
: undefined;
const toFake = new Set(Object.keys(this._fakeTimers.timers));
fakeTimersConfig.doNotFake?.forEach(nameOfFakeableAPI => {
toFake.delete(nameOfFakeableAPI);
});
return {
advanceTimeDelta,
loopLimit: fakeTimersConfig.timerLimit || 100_000,
now: fakeTimersConfig.now ?? Date.now(),
shouldAdvanceTime: Boolean(fakeTimersConfig.advanceTimers),
shouldClearNativeTimers: true,
toFake: Array.from(toFake)
};
}
}
exports.default = FakeTimers;

38
node_modules/@jest/fake-timers/package.json generated vendored Normal file
View File

@@ -0,0 +1,38 @@
{
"name": "@jest/fake-timers",
"version": "29.7.0",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
"directory": "packages/jest-fake-timers"
},
"license": "MIT",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"default": "./build/index.js"
},
"./package.json": "./package.json"
},
"dependencies": {
"@jest/types": "^29.6.3",
"@sinonjs/fake-timers": "^10.0.2",
"@types/node": "*",
"jest-message-util": "^29.7.0",
"jest-mock": "^29.7.0",
"jest-util": "^29.7.0"
},
"devDependencies": {
"@jest/test-utils": "^29.7.0",
"@types/sinonjs__fake-timers": "^8.1.2"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
},
"publishConfig": {
"access": "public"
},
"gitHead": "4e56991693da7cd4c3730dc3579a1dd1403ee630"
}

21
node_modules/@jest/schemas/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
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.

3
node_modules/@jest/schemas/README.md generated vendored Normal file
View File

@@ -0,0 +1,3 @@
# `@jest/schemas`
Experimental and currently incomplete module for JSON schemas for [Jest's](https://jestjs.io/) configuration.

63
node_modules/@jest/schemas/build/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,63 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {Static} from '@sinclair/typebox';
import {TBoolean} from '@sinclair/typebox';
import {TNull} from '@sinclair/typebox';
import {TNumber} from '@sinclair/typebox';
import {TObject} from '@sinclair/typebox';
import {TReadonlyOptional} from '@sinclair/typebox';
import {TString} from '@sinclair/typebox';
declare const RawSnapshotFormat: TObject<{
callToJSON: TReadonlyOptional<TBoolean>;
compareKeys: TReadonlyOptional<TNull>;
escapeRegex: TReadonlyOptional<TBoolean>;
escapeString: TReadonlyOptional<TBoolean>;
highlight: TReadonlyOptional<TBoolean>;
indent: TReadonlyOptional<TNumber>;
maxDepth: TReadonlyOptional<TNumber>;
maxWidth: TReadonlyOptional<TNumber>;
min: TReadonlyOptional<TBoolean>;
printBasicPrototype: TReadonlyOptional<TBoolean>;
printFunctionName: TReadonlyOptional<TBoolean>;
theme: TReadonlyOptional<
TObject<{
comment: TReadonlyOptional<TString<string>>;
content: TReadonlyOptional<TString<string>>;
prop: TReadonlyOptional<TString<string>>;
tag: TReadonlyOptional<TString<string>>;
value: TReadonlyOptional<TString<string>>;
}>
>;
}>;
export declare const SnapshotFormat: TObject<{
callToJSON: TReadonlyOptional<TBoolean>;
compareKeys: TReadonlyOptional<TNull>;
escapeRegex: TReadonlyOptional<TBoolean>;
escapeString: TReadonlyOptional<TBoolean>;
highlight: TReadonlyOptional<TBoolean>;
indent: TReadonlyOptional<TNumber>;
maxDepth: TReadonlyOptional<TNumber>;
maxWidth: TReadonlyOptional<TNumber>;
min: TReadonlyOptional<TBoolean>;
printBasicPrototype: TReadonlyOptional<TBoolean>;
printFunctionName: TReadonlyOptional<TBoolean>;
theme: TReadonlyOptional<
TObject<{
comment: TReadonlyOptional<TString<string>>;
content: TReadonlyOptional<TString<string>>;
prop: TReadonlyOptional<TString<string>>;
tag: TReadonlyOptional<TString<string>>;
value: TReadonlyOptional<TString<string>>;
}>
>;
}>;
export declare type SnapshotFormat = Static<typeof RawSnapshotFormat>;
export {};

60
node_modules/@jest/schemas/build/index.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.SnapshotFormat = void 0;
function _typebox() {
const data = require('@sinclair/typebox');
_typebox = function () {
return data;
};
return data;
}
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const RawSnapshotFormat = _typebox().Type.Partial(
_typebox().Type.Object({
callToJSON: _typebox().Type.Readonly(_typebox().Type.Boolean()),
compareKeys: _typebox().Type.Readonly(_typebox().Type.Null()),
escapeRegex: _typebox().Type.Readonly(_typebox().Type.Boolean()),
escapeString: _typebox().Type.Readonly(_typebox().Type.Boolean()),
highlight: _typebox().Type.Readonly(_typebox().Type.Boolean()),
indent: _typebox().Type.Readonly(
_typebox().Type.Number({
minimum: 0
})
),
maxDepth: _typebox().Type.Readonly(
_typebox().Type.Number({
minimum: 0
})
),
maxWidth: _typebox().Type.Readonly(
_typebox().Type.Number({
minimum: 0
})
),
min: _typebox().Type.Readonly(_typebox().Type.Boolean()),
printBasicPrototype: _typebox().Type.Readonly(_typebox().Type.Boolean()),
printFunctionName: _typebox().Type.Readonly(_typebox().Type.Boolean()),
theme: _typebox().Type.Readonly(
_typebox().Type.Partial(
_typebox().Type.Object({
comment: _typebox().Type.Readonly(_typebox().Type.String()),
content: _typebox().Type.Readonly(_typebox().Type.String()),
prop: _typebox().Type.Readonly(_typebox().Type.String()),
tag: _typebox().Type.Readonly(_typebox().Type.String()),
value: _typebox().Type.Readonly(_typebox().Type.String())
})
)
)
})
);
const SnapshotFormat = _typebox().Type.Strict(RawSnapshotFormat);
exports.SnapshotFormat = SnapshotFormat;

29
node_modules/@jest/schemas/package.json generated vendored Normal file
View File

@@ -0,0 +1,29 @@
{
"name": "@jest/schemas",
"version": "29.6.3",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
"directory": "packages/jest-schemas"
},
"license": "MIT",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"default": "./build/index.js"
},
"./package.json": "./package.json"
},
"dependencies": {
"@sinclair/typebox": "^0.27.8"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
},
"publishConfig": {
"access": "public"
},
"gitHead": "fb7d95c8af6e0d65a8b65348433d8a0ea0725b5b"
}

21
node_modules/@jest/transform/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
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.

1000
node_modules/@jest/transform/build/ScriptTransformer.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,76 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = handlePotentialSyntaxError;
exports.enhanceUnexpectedTokenMessage = enhanceUnexpectedTokenMessage;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const DOT = ' \u2022 ';
function handlePotentialSyntaxError(e) {
if (e.codeFrame != null) {
e.stack = `${e.message}\n${e.codeFrame}`;
}
if (
// `instanceof` might come from the wrong context
e.name === 'SyntaxError' &&
!e.message.includes(' expected')
) {
throw enhanceUnexpectedTokenMessage(e);
}
return e;
}
function enhanceUnexpectedTokenMessage(e) {
e.stack = `${_chalk().default.bold.red(
'Jest encountered an unexpected token'
)}
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
By default "node_modules" folder is ignored by transformers.
Here's what you can do:
${DOT}If you are trying to use ECMAScript Modules, see ${_chalk().default.underline(
'https://jestjs.io/docs/ecmascript-modules'
)} for how to enable it.
${DOT}If you are trying to use TypeScript, see ${_chalk().default.underline(
'https://jestjs.io/docs/getting-started#using-typescript'
)}
${DOT}To have some of your "node_modules" files transformed, you can specify a custom ${_chalk().default.bold(
'"transformIgnorePatterns"'
)} in your config.
${DOT}If you need a custom transformation specify a ${_chalk().default.bold(
'"transform"'
)} option in your config.
${DOT}If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the ${_chalk().default.bold(
'"moduleNameMapper"'
)} config option.
You'll find more details and examples of these config options in the docs:
${_chalk().default.cyan('https://jestjs.io/docs/configuration')}
For information about custom transformations, see:
${_chalk().default.cyan('https://jestjs.io/docs/code-transformation')}
${_chalk().default.bold.red('Details:')}
${e.stack ?? ''}`.trimRight();
return e;
}

240
node_modules/@jest/transform/build/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,240 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import type {Config} from '@jest/types';
import type {EncodedSourceMap} from '@jridgewell/trace-mapping';
import type {TransformTypes} from '@jest/types';
export declare interface AsyncTransformer<TransformerConfig = unknown> {
/**
* Indicates if the transformer is capable of instrumenting the code for code coverage.
*
* If V8 coverage is _not_ active, and this is `true`, Jest will assume the code is instrumented.
* If V8 coverage is _not_ active, and this is `false`. Jest will instrument the code returned by this transformer using Babel.
*/
canInstrument?: boolean;
getCacheKey?: (
sourceText: string,
sourcePath: string,
options: TransformOptions<TransformerConfig>,
) => string;
getCacheKeyAsync?: (
sourceText: string,
sourcePath: string,
options: TransformOptions<TransformerConfig>,
) => Promise<string>;
process?: (
sourceText: string,
sourcePath: string,
options: TransformOptions<TransformerConfig>,
) => TransformedSource;
processAsync: (
sourceText: string,
sourcePath: string,
options: TransformOptions<TransformerConfig>,
) => Promise<TransformedSource>;
}
export declare interface CallerTransformOptions {
supportsDynamicImport: boolean;
supportsExportNamespaceFrom: boolean;
supportsStaticESM: boolean;
supportsTopLevelAwait: boolean;
}
export declare function createScriptTransformer(
config: Config.ProjectConfig,
cacheFS?: StringMap,
): Promise<ScriptTransformer>;
export declare function createTranspilingRequire(
config: Config.ProjectConfig,
): Promise<
<TModuleType = unknown>(
resolverPath: string,
applyInteropRequireDefault?: boolean,
) => Promise<TModuleType>
>;
declare interface ErrorWithCodeFrame extends Error {
codeFrame?: string;
}
declare interface FixedRawSourceMap extends Omit<EncodedSourceMap, 'version'> {
version: number;
}
export declare function handlePotentialSyntaxError(
e: ErrorWithCodeFrame,
): ErrorWithCodeFrame;
declare interface ReducedTransformOptions extends CallerTransformOptions {
instrument: boolean;
}
declare interface RequireAndTranspileModuleOptions
extends ReducedTransformOptions {
applyInteropRequireDefault: boolean;
}
export declare type ScriptTransformer = ScriptTransformer_2;
declare class ScriptTransformer_2 {
private readonly _config;
private readonly _cacheFS;
private readonly _cache;
private readonly _transformCache;
private _transformsAreLoaded;
constructor(_config: Config.ProjectConfig, _cacheFS: StringMap);
private _buildCacheKeyFromFileInfo;
private _buildTransformCacheKey;
private _getCacheKey;
private _getCacheKeyAsync;
private _createCachedFilename;
private _getFileCachePath;
private _getFileCachePathAsync;
private _getTransformPatternAndPath;
private _getTransformPath;
loadTransformers(): Promise<void>;
private _getTransformer;
private _instrumentFile;
private _buildTransformResult;
transformSource(
filepath: string,
content: string,
options: ReducedTransformOptions,
): TransformResult;
transformSourceAsync(
filepath: string,
content: string,
options: ReducedTransformOptions,
): Promise<TransformResult>;
private _transformAndBuildScriptAsync;
private _transformAndBuildScript;
transformAsync(
filename: string,
options: TransformationOptions,
fileSource?: string,
): Promise<TransformResult>;
transform(
filename: string,
options: TransformationOptions,
fileSource?: string,
): TransformResult;
transformJson(
filename: string,
options: TransformationOptions,
fileSource: string,
): string;
requireAndTranspileModule<ModuleType = unknown>(
moduleName: string,
callback?: (module: ModuleType) => void | Promise<void>,
options?: RequireAndTranspileModuleOptions,
): Promise<ModuleType>;
shouldTransform(filename: string): boolean;
}
export declare function shouldInstrument(
filename: string,
options: ShouldInstrumentOptions,
config: Config.ProjectConfig,
loadedFilenames?: Array<string>,
): boolean;
export declare interface ShouldInstrumentOptions
extends Pick<
Config.GlobalConfig,
'collectCoverage' | 'collectCoverageFrom' | 'coverageProvider'
> {
changedFiles?: Set<string>;
sourcesRelatedToTestsInChangedFiles?: Set<string>;
}
declare type StringMap = Map<string, string>;
export declare interface SyncTransformer<TransformerConfig = unknown> {
/**
* Indicates if the transformer is capable of instrumenting the code for code coverage.
*
* If V8 coverage is _not_ active, and this is `true`, Jest will assume the code is instrumented.
* If V8 coverage is _not_ active, and this is `false`. Jest will instrument the code returned by this transformer using Babel.
*/
canInstrument?: boolean;
getCacheKey?: (
sourceText: string,
sourcePath: string,
options: TransformOptions<TransformerConfig>,
) => string;
getCacheKeyAsync?: (
sourceText: string,
sourcePath: string,
options: TransformOptions<TransformerConfig>,
) => Promise<string>;
process: (
sourceText: string,
sourcePath: string,
options: TransformOptions<TransformerConfig>,
) => TransformedSource;
processAsync?: (
sourceText: string,
sourcePath: string,
options: TransformOptions<TransformerConfig>,
) => Promise<TransformedSource>;
}
export declare interface TransformationOptions
extends ShouldInstrumentOptions,
CallerTransformOptions {
isInternalModule?: boolean;
}
export declare type TransformedSource = {
code: string;
map?: FixedRawSourceMap | string | null;
};
/**
* We have both sync (`process`) and async (`processAsync`) code transformation, which both can be provided.
* `require` will always use `process`, and `import` will use `processAsync` if it exists, otherwise fall back to `process`.
* Meaning, if you use `import` exclusively you do not need `process`, but in most cases supplying both makes sense:
* Jest transpiles on demand rather than ahead of time, so the sync one needs to exist.
*
* For more info on the sync vs async model, see https://jestjs.io/docs/code-transformation#writing-custom-transformers
*/
declare type Transformer_2<TransformerConfig = unknown> =
| SyncTransformer<TransformerConfig>
| AsyncTransformer<TransformerConfig>;
export {Transformer_2 as Transformer};
export declare type TransformerCreator<
X extends Transformer_2<TransformerConfig>,
TransformerConfig = unknown,
> = (transformerConfig?: TransformerConfig) => X | Promise<X>;
/**
* Instead of having your custom transformer implement the Transformer interface
* directly, you can choose to export a factory function to dynamically create
* transformers. This is to allow having a transformer config in your jest config.
*/
export declare type TransformerFactory<X extends Transformer_2> = {
createTransformer: TransformerCreator<X>;
};
export declare interface TransformOptions<TransformerConfig = unknown>
extends ReducedTransformOptions {
/** Cached file system which is used by `jest-runtime` to improve performance. */
cacheFS: StringMap;
/** Jest configuration of currently running project. */
config: Config.ProjectConfig;
/** Stringified version of the `config` - useful in cache busting. */
configString: string;
/** Transformer configuration passed through `transform` option by the user. */
transformerConfig: TransformerConfig;
}
export declare type TransformResult = TransformTypes.TransformResult;
export {};

37
node_modules/@jest/transform/build/index.js generated vendored Normal file
View File

@@ -0,0 +1,37 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
Object.defineProperty(exports, 'createScriptTransformer', {
enumerable: true,
get: function () {
return _ScriptTransformer.createScriptTransformer;
}
});
Object.defineProperty(exports, 'createTranspilingRequire', {
enumerable: true,
get: function () {
return _ScriptTransformer.createTranspilingRequire;
}
});
Object.defineProperty(exports, 'handlePotentialSyntaxError', {
enumerable: true,
get: function () {
return _enhanceUnexpectedTokenMessage.default;
}
});
Object.defineProperty(exports, 'shouldInstrument', {
enumerable: true,
get: function () {
return _shouldInstrument.default;
}
});
var _ScriptTransformer = require('./ScriptTransformer');
var _shouldInstrument = _interopRequireDefault(require('./shouldInstrument'));
var _enhanceUnexpectedTokenMessage = _interopRequireDefault(
require('./enhanceUnexpectedTokenMessage')
);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}

View File

@@ -0,0 +1,94 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.makeInvalidTransformerError =
exports.makeInvalidSyncTransformerError =
exports.makeInvalidSourceMapWarning =
exports.makeInvalidReturnValueError =
void 0;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _slash() {
const data = _interopRequireDefault(require('slash'));
_slash = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const BULLET = '\u25cf ';
const DOCUMENTATION_NOTE = ` ${_chalk().default.bold(
'Code Transformation Documentation:'
)}
https://jestjs.io/docs/code-transformation
`;
const UPGRADE_NOTE = ` ${_chalk().default.bold(
'This error may be caused by a breaking change in Jest 28:'
)}
https://jestjs.io/docs/28.x/upgrading-to-jest28#transformer
`;
const makeInvalidReturnValueError = transformPath =>
_chalk().default.red(
[
_chalk().default.bold(`${BULLET}Invalid return value:`),
' `process()` or/and `processAsync()` method of code transformer found at ',
` "${(0, _slash().default)(transformPath)}" `,
' should return an object or a Promise resolving to an object. The object ',
' must have `code` property with a string of processed code.',
''
].join('\n') +
UPGRADE_NOTE +
DOCUMENTATION_NOTE
);
exports.makeInvalidReturnValueError = makeInvalidReturnValueError;
const makeInvalidSourceMapWarning = (filename, transformPath) =>
_chalk().default.yellow(
[
_chalk().default.bold(`${BULLET}Invalid source map:`),
` The source map for "${(0, _slash().default)(
filename
)}" returned by "${(0, _slash().default)(transformPath)}" is invalid.`,
' Proceeding without source mapping for that file.'
].join('\n')
);
exports.makeInvalidSourceMapWarning = makeInvalidSourceMapWarning;
const makeInvalidSyncTransformerError = transformPath =>
_chalk().default.red(
[
_chalk().default.bold(`${BULLET}Invalid synchronous transformer module:`),
` "${(0, _slash().default)(
transformPath
)}" specified in the "transform" object of Jest configuration`,
' must export a `process` function.',
''
].join('\n') + DOCUMENTATION_NOTE
);
exports.makeInvalidSyncTransformerError = makeInvalidSyncTransformerError;
const makeInvalidTransformerError = transformPath =>
_chalk().default.red(
[
_chalk().default.bold(`${BULLET}Invalid transformer module:`),
` "${(0, _slash().default)(
transformPath
)}" specified in the "transform" object of Jest configuration`,
' must export a `process` or `processAsync` or `createTransformer` function.',
''
].join('\n') + DOCUMENTATION_NOTE
);
exports.makeInvalidTransformerError = makeInvalidTransformerError;

177
node_modules/@jest/transform/build/shouldInstrument.js generated vendored Normal file
View File

@@ -0,0 +1,177 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = shouldInstrument;
function path() {
const data = _interopRequireWildcard(require('path'));
path = function () {
return data;
};
return data;
}
function _micromatch() {
const data = _interopRequireDefault(require('micromatch'));
_micromatch = function () {
return data;
};
return data;
}
function _jestRegexUtil() {
const data = require('jest-regex-util');
_jestRegexUtil = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== 'function') return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function (nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interopRequireWildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
return {default: obj};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor =
Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor
? Object.getOwnPropertyDescriptor(obj, key)
: null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const MOCKS_PATTERN = new RegExp(
(0, _jestRegexUtil().escapePathForRegex)(
`${path().sep}__mocks__${path().sep}`
)
);
const cachedRegexes = new Map();
const getRegex = regexStr => {
if (!cachedRegexes.has(regexStr)) {
cachedRegexes.set(regexStr, new RegExp(regexStr));
}
const regex = cachedRegexes.get(regexStr);
// prevent stateful regexes from breaking, just in case
regex.lastIndex = 0;
return regex;
};
function shouldInstrument(filename, options, config, loadedFilenames) {
if (!options.collectCoverage) {
return false;
}
if (
config.forceCoverageMatch.length &&
_micromatch().default.any(filename, config.forceCoverageMatch)
) {
return true;
}
if (
!config.testPathIgnorePatterns.some(pattern =>
getRegex(pattern).test(filename)
)
) {
if (config.testRegex.some(regex => new RegExp(regex).test(filename))) {
return false;
}
if (
(0, _jestUtil().globsToMatcher)(config.testMatch)(
(0, _jestUtil().replacePathSepForGlob)(filename)
)
) {
return false;
}
}
if (
options.collectCoverageFrom.length === 0 &&
loadedFilenames != null &&
!loadedFilenames.includes(filename)
) {
return false;
}
if (
// still cover if `only` is specified
options.collectCoverageFrom.length &&
!(0, _jestUtil().globsToMatcher)(options.collectCoverageFrom)(
(0, _jestUtil().replacePathSepForGlob)(
path().relative(config.rootDir, filename)
)
)
) {
return false;
}
if (
config.coveragePathIgnorePatterns.some(pattern => !!filename.match(pattern))
) {
return false;
}
if (config.globalSetup === filename) {
return false;
}
if (config.globalTeardown === filename) {
return false;
}
if (config.setupFiles.includes(filename)) {
return false;
}
if (config.setupFilesAfterEnv.includes(filename)) {
return false;
}
if (MOCKS_PATTERN.test(filename)) {
return false;
}
if (options.changedFiles && !options.changedFiles.has(filename)) {
if (!options.sourcesRelatedToTestsInChangedFiles) {
return false;
}
if (!options.sourcesRelatedToTestsInChangedFiles.has(filename)) {
return false;
}
}
if (filename.endsWith('.json')) {
return false;
}
return true;
}

1
node_modules/@jest/transform/build/types.js generated vendored Normal file
View File

@@ -0,0 +1 @@
'use strict';

52
node_modules/@jest/transform/package.json generated vendored Normal file
View File

@@ -0,0 +1,52 @@
{
"name": "@jest/transform",
"version": "29.7.0",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
"directory": "packages/jest-transform"
},
"license": "MIT",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"default": "./build/index.js"
},
"./package.json": "./package.json"
},
"dependencies": {
"@babel/core": "^7.11.6",
"@jest/types": "^29.6.3",
"@jridgewell/trace-mapping": "^0.3.18",
"babel-plugin-istanbul": "^6.1.1",
"chalk": "^4.0.0",
"convert-source-map": "^2.0.0",
"fast-json-stable-stringify": "^2.1.0",
"graceful-fs": "^4.2.9",
"jest-haste-map": "^29.7.0",
"jest-regex-util": "^29.6.3",
"jest-util": "^29.7.0",
"micromatch": "^4.0.4",
"pirates": "^4.0.4",
"slash": "^3.0.0",
"write-file-atomic": "^4.0.2"
},
"devDependencies": {
"@jest/test-utils": "^29.7.0",
"@types/babel__core": "^7.1.14",
"@types/convert-source-map": "^2.0.0",
"@types/graceful-fs": "^4.1.3",
"@types/micromatch": "^4.0.1",
"@types/write-file-atomic": "^4.0.0",
"dedent": "^1.0.0"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
},
"publishConfig": {
"access": "public"
},
"gitHead": "4e56991693da7cd4c3730dc3579a1dd1403ee630"
}

21
node_modules/@jest/types/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
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.

30
node_modules/@jest/types/README.md generated vendored Normal file
View File

@@ -0,0 +1,30 @@
# @jest/types
This package contains shared types of Jest's packages.
If you are looking for types of [Jest globals](https://jestjs.io/docs/api), you can import them from `@jest/globals` package:
```ts
import {describe, expect, it} from '@jest/globals';
describe('my tests', () => {
it('works', () => {
expect(1).toBe(1);
});
});
```
If you prefer to omit imports, a similar result can be achieved installing the [@types/jest](https://npmjs.com/package/@types/jest) package. Note that this is a third party library maintained at [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest) and may not cover the latest Jest features.
Another use-case for `@types/jest` is a typed Jest config as those types are not provided by Jest out of the box:
```ts
// jest.config.ts
import {Config} from '@jest/types';
const config: Config.InitialOptions = {
// some typed config
};
export default config;
```

1
node_modules/@jest/types/build/Circus.js generated vendored Normal file
View File

@@ -0,0 +1 @@
'use strict';

1
node_modules/@jest/types/build/Config.js generated vendored Normal file
View File

@@ -0,0 +1 @@
'use strict';

1
node_modules/@jest/types/build/Global.js generated vendored Normal file
View File

@@ -0,0 +1 @@
'use strict';

1
node_modules/@jest/types/build/TestResult.js generated vendored Normal file
View File

@@ -0,0 +1 @@
'use strict';

1
node_modules/@jest/types/build/Transform.js generated vendored Normal file
View File

@@ -0,0 +1 @@
'use strict';

1204
node_modules/@jest/types/build/index.d.ts generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/@jest/types/build/index.js generated vendored Normal file
View File

@@ -0,0 +1 @@
'use strict';

38
node_modules/@jest/types/package.json generated vendored Normal file
View File

@@ -0,0 +1,38 @@
{
"name": "@jest/types",
"version": "29.6.3",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
"directory": "packages/jest-types"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
},
"license": "MIT",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"default": "./build/index.js"
},
"./package.json": "./package.json"
},
"dependencies": {
"@jest/schemas": "^29.6.3",
"@types/istanbul-lib-coverage": "^2.0.0",
"@types/istanbul-reports": "^3.0.0",
"@types/node": "*",
"@types/yargs": "^17.0.8",
"chalk": "^4.0.0"
},
"devDependencies": {
"@tsd/typescript": "^5.0.4",
"tsd-lite": "^0.7.0"
},
"publishConfig": {
"access": "public"
},
"gitHead": "fb7d95c8af6e0d65a8b65348433d8a0ea0725b5b"
}