Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2023-07-17 20:17:37 +00:00
parent 99c9f6a498
commit e266801e21
242 changed files with 2638 additions and 9296 deletions

View file

@ -8,9 +8,9 @@ This package contains type definitions for Sinon (https://sinonjs.org).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sinon.
### Additional Details
* Last updated: Wed, 02 Jun 2021 06:01:28 GMT
* Last updated: Sun, 14 May 2023 04:32:51 GMT
* Dependencies: [@types/sinonjs__fake-timers](https://npmjs.com/package/@types/sinonjs__fake-timers)
* Global values: `sinon`
# Credits
These definitions were written by [William Sears](https://github.com/mrbigdog2u), [Lukas Spieß](https://github.com/lumaxis), [Nico Jansen](https://github.com/nicojs), [James Garbutt](https://github.com/43081j), [Josh Goldberg](https://github.com/joshuakgoldberg), [Greg Jednaszewski](https://github.com/gjednaszewski), [John Wood](https://github.com/johnjesse), [Alec Flett](https://github.com/alecf), and [Simon Schick](https://github.com/SimonSchick).
These definitions were written by [William Sears](https://github.com/mrbigdog2u), [Nico Jansen](https://github.com/nicojs), [James Garbutt](https://github.com/43081j), [Greg Jednaszewski](https://github.com/gjednaszewski), [John Wood](https://github.com/johnjesse), [Alec Flett](https://github.com/alecf), [Simon Schick](https://github.com/SimonSchick), and [Mathias Schreck](https://github.com/lo1tuma).

150
node_modules/@types/sinon/index.d.ts generated vendored
View file

@ -1,17 +1,16 @@
// Type definitions for Sinon 10.0
// Project: https://sinonjs.org
// Definitions by: William Sears <https://github.com/mrbigdog2u>
// Lukas Spieß <https://github.com/lumaxis>
// Nico Jansen <https://github.com/nicojs>
// James Garbutt <https://github.com/43081j>
// Josh Goldberg <https://github.com/joshuakgoldberg>
// Greg Jednaszewski <https://github.com/gjednaszewski>
// John Wood <https://github.com/johnjesse>
// Alec Flett <https://github.com/alecf>
// Simon Schick <https://github.com/SimonSchick>
// Mathias Schreck <https://github.com/lo1tuma>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as FakeTimers from "@sinonjs/fake-timers";
import * as FakeTimers from '@sinonjs/fake-timers';
// sinon uses DOM dependencies which are absent in browser-less environment like node.js
// to avoid compiler errors this monkey patch is used
@ -20,11 +19,19 @@ interface Event {} // tslint:disable-line no-empty-interface
interface Document {} // tslint:disable-line no-empty-interface
declare namespace Sinon {
type MatchArguments<T> = {
[K in keyof T]: SinonMatcher | (T[K] extends object ? MatchArguments<T[K]> : never) | T[K];
type MatchPartialArguments<T> = {
[K in keyof T]?: SinonMatcher | (T[K] extends object ? MatchPartialArguments<T[K]> : T[K]);
};
// TODO: Alias for backward compatibility, remove on next major release
type DeepPartialOrMatcher<T> = MatchPartialArguments<T>;
interface SinonSpyCallApi<TArgs extends any[] = any[], TReturnValue = any> {
type MatchExactArguments<T> = {
[K in keyof T]: SinonMatcher | (T[K] extends object ? MatchExactArguments<T[K]> : T[K]);
};
// TODO: Alias for backward compatibility, remove on next major release
type MatchArguments<T> = MatchExactArguments<T>;
interface SinonSpyCallApi<TArgs extends readonly any[] = any[], TReturnValue = any> {
// Properties
/**
* Array of received arguments.
@ -44,11 +51,11 @@ declare namespace Sinon {
* so a call that received the provided arguments (in the same spots) and possibly others as well will return true.
* @param args
*/
calledWith(...args: Partial<MatchArguments<TArgs>>): boolean;
calledWith(...args: MatchPartialArguments<TArgs>): boolean;
/**
* Returns true if spy was called at least once with the provided arguments and no others.
*/
calledWithExactly(...args: MatchArguments<TArgs>): boolean;
calledWithExactly(...args: MatchExactArguments<TArgs>): boolean;
/**
* Returns true if spy/stub was called the new operator.
* Beware that this is inferred based on the value of the this object and the spy functions prototype,
@ -59,25 +66,25 @@ declare namespace Sinon {
* Returns true if spy was called at exactly once with the provided arguments.
* @param args
*/
calledOnceWith(...args: MatchArguments<TArgs>): boolean;
calledOnceWithExactly(...args: MatchArguments<TArgs>): boolean;
calledOnceWith(...args: MatchPartialArguments<TArgs>): boolean;
calledOnceWithExactly(...args: MatchExactArguments<TArgs>): boolean;
/**
* Returns true if spy was called with matching arguments (and possibly others).
* This behaves the same as spy.calledWith(sinon.match(arg1), sinon.match(arg2), ...).
* @param args
*/
calledWithMatch(...args: TArgs): boolean;
calledWithMatch(...args: MatchPartialArguments<TArgs>): boolean;
/**
* Returns true if call did not receive provided arguments.
* @param args
*/
notCalledWith(...args: MatchArguments<TArgs>): boolean;
notCalledWith(...args: MatchExactArguments<TArgs>): boolean;
/**
* Returns true if call did not receive matching arguments.
* This behaves the same as spyCall.notCalledWith(sinon.match(arg1), sinon.match(arg2), ...).
* @param args
*/
notCalledWithMatch(...args: TArgs): boolean;
notCalledWithMatch(...args: MatchPartialArguments<TArgs>): boolean;
/**
* Returns true if spy returned the provided value at least once.
* Uses deep comparison for objects and arrays. Use spy.returned(sinon.match.same(obj)) for strict comparison (see matchers).
@ -101,30 +108,30 @@ declare namespace Sinon {
* Useful if a function is called with more than one callback, and simply calling the first callback is not desired.
* @param pos
*/
callArg(pos: number): void;
callArgOn(pos: number, obj: any, ...args: any[]): void;
callArg(pos: number): unknown[];
callArgOn(pos: number, obj: any, ...args: any[]): unknown[];
/**
* Like callArg, but with arguments.
*/
callArgWith(pos: number, ...args: any[]): void;
callArgOnWith(pos: number, obj: any, ...args: any[]): void;
callArgWith(pos: number, ...args: any[]): unknown[];
callArgOnWith(pos: number, obj: any, ...args: any[]): unknown[];
/**
* Invoke callbacks passed to the stub with the given arguments.
* If the stub was never called with a function argument, yield throws an error.
* Returns an Array with all callbacks return values in the order they were called, if no error is thrown.
* Also aliased as invokeCallback.
*/
yield(...args: any[]): void;
yieldOn(obj: any, ...args: any[]): void;
yield(...args: any[]): unknown[];
yieldOn(obj: any, ...args: any[]): unknown[];
/**
* Invokes callbacks passed as a property of an object to the stub.
* Like yield, yieldTo grabs the first matching argument, finds the callback and calls it with the (optional) arguments.
*/
yieldTo(property: string, ...args: any[]): void;
yieldToOn(property: string, obj: any, ...args: any[]): void;
yieldTo(property: string, ...args: any[]): unknown[];
yieldToOn(property: string, obj: any, ...args: any[]): unknown[];
}
interface SinonSpyCall<TArgs extends any[] = any[], TReturnValue = any>
interface SinonSpyCall<TArgs extends readonly any[] = any[], TReturnValue = any>
extends SinonSpyCallApi<TArgs, TReturnValue> {
/**
* The calls this value.
@ -167,10 +174,10 @@ declare namespace Sinon {
calledAfter(call: SinonSpyCall<any>): boolean;
}
interface SinonSpy<TArgs extends any[] = any[], TReturnValue = any>
interface SinonSpy<TArgs extends readonly any[] = any[], TReturnValue = any>
extends Pick<
SinonSpyCallApi<TArgs, TReturnValue>,
Exclude<keyof SinonSpyCallApi<TArgs, TReturnValue>, "args">
Exclude<keyof SinonSpyCallApi<TArgs, TReturnValue>, 'args'>
> {
// Properties
/**
@ -266,7 +273,7 @@ declare namespace Sinon {
* This is useful to be more expressive in your assertions, where you can access the spy with the same call.
* @param args Expected args
*/
withArgs(...args: MatchArguments<TArgs>): SinonSpy<TArgs, TReturnValue>;
withArgs(...args: MatchPartialArguments<TArgs>): SinonSpy<TArgs, TReturnValue>;
/**
* Returns true if the spy was always called with @param obj as this.
* @param obj
@ -275,12 +282,12 @@ declare namespace Sinon {
/**
* Returns true if spy was always called with the provided arguments (and possibly others).
*/
alwaysCalledWith(...args: MatchArguments<TArgs>): boolean;
alwaysCalledWith(...args: MatchExactArguments<TArgs>): boolean;
/**
* Returns true if spy was always called with the exact provided arguments.
* @param args
*/
alwaysCalledWithExactly(...args: MatchArguments<TArgs>): boolean;
alwaysCalledWithExactly(...args: MatchExactArguments<TArgs>): boolean;
/**
* Returns true if spy was always called with matching arguments (and possibly others).
* This behaves the same as spy.alwaysCalledWith(sinon.match(arg1), sinon.match(arg2), ...).
@ -291,7 +298,7 @@ declare namespace Sinon {
* Returns true if the spy/stub was never called with the provided arguments.
* @param args
*/
neverCalledWith(...args: MatchArguments<TArgs>): boolean;
neverCalledWith(...args: MatchExactArguments<TArgs>): boolean;
/**
* Returns true if the spy/stub was never called with matching arguments.
* This behaves the same as spy.neverCalledWith(sinon.match(arg1), sinon.match(arg2), ...).
@ -329,7 +336,7 @@ declare namespace Sinon {
/**
* Returns the nth call.
* Accessing individual calls helps with more detailed behavior verification when the spy is called more than once.
* @param n Zero based index of the spy call.
* @param n Zero-based index of the spy call.
*/
getCall(n: number): SinonSpyCall<TArgs, TReturnValue>;
/**
@ -383,7 +390,7 @@ declare namespace Sinon {
? SinonSpy<TArgs, TReturnValue>
: SinonSpy;
<T, K extends keyof T>(obj: T, method: K, types: Array<"get" | "set">): PropertyDescriptor & {
<T, K extends keyof T>(obj: T, method: K, types: Array<'get' | 'set'>): PropertyDescriptor & {
get: SinonSpy<[], T[K]>;
set: SinonSpy<[T[K]], void>;
};
@ -397,7 +404,8 @@ declare namespace Sinon {
? SinonSpy<TArgs, TReturnValue>
: T;
interface SinonStub<TArgs extends any[] = any[], TReturnValue = any> extends SinonSpy<TArgs, TReturnValue> {
interface SinonStub<TArgs extends readonly any[] = any[], TReturnValue = any>
extends SinonSpy<TArgs, TReturnValue> {
/**
* Resets the stubs behaviour to the default behaviour
* You can reset behaviour of all stubs using sinon.resetBehavior()
@ -566,7 +574,7 @@ declare namespace Sinon {
* Defines the behavior of the stub on the @param n call. Useful for testing sequential interactions.
* There are methods onFirstCall, onSecondCall,onThirdCall to make stub definitions read more naturally.
* onCall can be combined with all of the behavior defining methods in this section. In particular, it can be used together with withArgs.
* @param n
* @param n Zero-based index of the spy call.
*/
onCall(n: number): SinonStub<TArgs, TReturnValue>;
/**
@ -651,7 +659,7 @@ declare namespace Sinon {
* It is also useful to create a stub that can act differently in response to different arguments.
* @param args
*/
withArgs(...args: MatchArguments<TArgs>): SinonStub<TArgs, TReturnValue>;
withArgs(...args: MatchPartialArguments<TArgs>): SinonStub<TArgs, TReturnValue>;
}
interface SinonStubStatic {
@ -660,7 +668,7 @@ declare namespace Sinon {
/**
* Creates an anonymous stub function
*/
<TArgs extends any[] = any[], R = any>(): SinonStub<TArgs, R>;
<TArgs extends readonly any[] = any[], R = any>(): SinonStub<TArgs, R>;
/* tslint:enable:no-unnecessary-generics */
@ -783,12 +791,6 @@ declare namespace Sinon {
restore(): void;
};
interface SinonFakeTimersConfig {
now: number | Date;
toFake: string[];
shouldAdvanceTime: boolean;
}
interface SinonFakeUploadProgress {
eventListeners: {
progress: any[];
@ -1117,20 +1119,20 @@ declare namespace Sinon {
*/
calledWith<TArgs extends any[]>(
spyOrSpyCall: SinonSpy<TArgs> | SinonSpyCall<TArgs>,
...args: Partial<MatchArguments<TArgs>>
...args: MatchPartialArguments<TArgs>
): void;
/**
* Passes if spy was always called with the provided arguments.
* @param spy
* @param args
*/
alwaysCalledWith<TArgs extends any[]>(spy: SinonSpy<TArgs>, ...args: Partial<MatchArguments<TArgs>>): void;
alwaysCalledWith<TArgs extends any[]>(spy: SinonSpy<TArgs>, ...args: MatchPartialArguments<TArgs>): void;
/**
* Passes if spy was never called with the provided arguments.
* @param spy
* @param args
*/
neverCalledWith<TArgs extends any[]>(spy: SinonSpy<TArgs>, ...args: Partial<MatchArguments<TArgs>>): void;
neverCalledWith<TArgs extends any[]>(spy: SinonSpy<TArgs>, ...args: MatchPartialArguments<TArgs>): void;
/**
* Passes if spy was called with the provided arguments and no others.
* Its possible to assert on a dedicated spy call: sinon.assert.calledWithExactly(spy.getCall(1), arg1, arg2, ...);.
@ -1139,7 +1141,7 @@ declare namespace Sinon {
*/
calledWithExactly<TArgs extends any[]>(
spyOrSpyCall: SinonSpy<TArgs> | SinonSpyCall<TArgs>,
...args: MatchArguments<TArgs>
...args: MatchExactArguments<TArgs>
): void;
/**
* Passes if spy was called at exactly once with the provided arguments and no others.
@ -1148,18 +1150,21 @@ declare namespace Sinon {
*/
calledOnceWithExactly<TArgs extends any[]>(
spyOrSpyCall: SinonSpy<TArgs> | SinonSpyCall<TArgs>,
...args: MatchArguments<TArgs>
...args: MatchExactArguments<TArgs>
): void;
/**
* Passes if spy was always called with the provided arguments and no others.
*/
alwaysCalledWithExactly<TArgs extends any[]>(spy: SinonSpy<TArgs>, ...args: MatchArguments<TArgs>): void;
alwaysCalledWithExactly<TArgs extends any[]>(spy: SinonSpy<TArgs>, ...args: MatchExactArguments<TArgs>): void;
/**
* Passes if spy was called with matching arguments.
* This behaves the same way as sinon.assert.calledWith(spy, sinon.match(arg1), sinon.match(arg2), ...).
* It's possible to assert on a dedicated spy call: sinon.assert.calledWithMatch(spy.secondCall, arg1, arg2, ...);.
*/
calledWithMatch<TArgs extends any[]>(spyOrSpyCall: SinonSpy<TArgs> | SinonSpyCall<TArgs>, ...args: TArgs): void;
calledWithMatch<TArgs extends any[]>(
spyOrSpyCall: SinonSpy<TArgs> | SinonSpyCall<TArgs>,
...args: MatchPartialArguments<TArgs>
): void;
/**
* Passes if spy was called once with matching arguments.
* This behaves the same way as calling both sinon.assert.calledOnce(spy) and
@ -1173,14 +1178,14 @@ declare namespace Sinon {
* Passes if spy was always called with matching arguments.
* This behaves the same way as sinon.assert.alwaysCalledWith(spy, sinon.match(arg1), sinon.match(arg2), ...).
*/
alwaysCalledWithMatch<TArgs extends any[]>(spy: SinonSpy<TArgs>, ...args: TArgs): void;
alwaysCalledWithMatch<TArgs extends any[]>(spy: SinonSpy<TArgs>, ...args: MatchPartialArguments<TArgs>): void;
/**
* Passes if spy was never called with matching arguments.
* This behaves the same way as sinon.assert.neverCalledWith(spy, sinon.match(arg1), sinon.match(arg2), ...).
* @param spy
* @param args
*/
neverCalledWithMatch<TArgs extends any[]>(spy: SinonSpy<TArgs>, ...args: TArgs): void;
neverCalledWithMatch<TArgs extends any[]>(spy: SinonSpy<TArgs>, ...args: MatchPartialArguments<TArgs>): void;
/**
* Passes if spy was called with the new operator.
* Its possible to assert on a dedicated spy call: sinon.assert.calledWithNew(spy.secondCall, arg1, arg2, ...);.
@ -1444,7 +1449,7 @@ declare namespace Sinon {
* If set to true, the sandbox will have a clock property.
* You can optionally pass in a configuration object that follows the specification for fake timers, such as { toFake: ["setTimeout", "setInterval"] }.
*/
useFakeTimers: boolean | Partial<SinonFakeTimersConfig>;
useFakeTimers: boolean | Partial<FakeTimers.FakeTimerInstallOpts>;
/**
* If true, server and requests properties are added to the sandbox. Can also be an object to use for fake server.
* The default one is sinon.fakeServer, but if youre using jQuery 1.3.x or some other library that does not set the XHRs onreadystatechange handler,
@ -1465,7 +1470,7 @@ declare namespace Sinon {
*
* @template TType Object type being stubbed.
*/
type SinonStubbedInstance<TType> = {
type SinonStubbedInstance<TType> = TType & {
[P in keyof TType]: SinonStubbedMember<TType[P]>;
};
@ -1480,43 +1485,54 @@ declare namespace Sinon {
/**
* Creates a basic fake, with no behavior
*/
(): SinonSpy;
<TArgs extends readonly any[] = any[], TReturnValue = any>(): SinonSpy<TArgs, TReturnValue>;
/**
* Wraps an existing Function to record all interactions, while leaving it up to the func to provide the behavior.
* This is useful when complex behavior not covered by the sinon.fake.* methods is required or when wrapping an existing function or method.
*/
(fn: Function): SinonSpy;
<TArgs extends readonly any[] = any[], TReturnValue = any>(fn: (...args: TArgs) => TReturnValue): SinonSpy<
TArgs,
TReturnValue
>;
/**
* Creates a fake that returns the val argument
* @param val Returned value
*/
returns(val: any): SinonSpy;
returns<TArgs extends readonly any[] = any[], TReturnValue = any>(
val: TReturnValue,
): SinonSpy<TArgs, TReturnValue>;
/**
* Creates a fake that throws an Error with the provided value as the message property.
* If an Error is passed as the val argument, then that will be the thrown value. If any other value is passed, then that will be used for the message property of the thrown Error.
* @param val Returned value or throw value if an Error
*/
throws(val: Error | string): SinonSpy;
throws<TArgs extends readonly any[] = any[], TReturnValue = any>(
val: Error | string,
): SinonSpy<TArgs, TReturnValue>;
/**
* Creates a fake that returns a resolved Promise for the passed value.
* @param val Resolved promise
*/
resolves(val: any): SinonSpy;
resolves<TArgs extends readonly any[] = any[], TReturnValue = any>(
val: TReturnValue extends PromiseLike<infer TResolveValue> ? TResolveValue : any,
): SinonSpy<TArgs, TReturnValue>;
/**
* Creates a fake that returns a rejected Promise for the passed value.
* If an Error is passed as the value argument, then that will be the value of the promise.
* If any other value is passed, then that will be used for the message property of the Error returned by the promise.
* @param val Rejected promise
*/
rejects(val: any): SinonSpy;
rejects<TArgs extends readonly any[] = any[], TReturnValue = any>(val: any): SinonSpy<TArgs, TReturnValue>;
/**
* fake expects the last argument to be a callback and will invoke it with the given arguments.
*/
yields(...args: any[]): SinonSpy;
yields<TArgs extends readonly any[] = any[], TReturnValue = any>(...args: any[]): SinonSpy<TArgs, TReturnValue>;
/**
* fake expects the last argument to be a callback and will invoke it asynchronously with the given arguments.
*/
yieldsAsync(...args: any[]): SinonSpy;
yieldsAsync<TArgs extends readonly any[] = any[], TReturnValue = any>(
...args: any[]
): SinonSpy<TArgs, TReturnValue>;
}
interface SinonSandbox {
@ -1561,7 +1577,7 @@ declare namespace Sinon {
* You would have to call either clock.next(), clock.tick(), clock.runAll() or clock.runToLast() (see example below). Please refer to the lolex documentation for more information.
* @param config
*/
useFakeTimers(config?: number | Date | Partial<SinonFakeTimersConfig>): SinonFakeTimers;
useFakeTimers(config?: number | Date | Partial<FakeTimers.FakeTimerInstallOpts>): SinonFakeTimers;
/**
* Causes Sinon to replace the native XMLHttpRequest object in browsers that support it with a custom implementation which does not send actual requests.
* In browsers that support ActiveXObject, this constructor is replaced, and fake objects are returned for XMLHTTP progIds.
@ -1612,7 +1628,7 @@ declare namespace Sinon {
* replacement can be any value, including spies, stubs and fakes.
* This method only works on non-accessor properties, for replacing accessors, use sandbox.replaceGetter() and sandbox.replaceSetter().
*/
replace<T, TKey extends keyof T>(obj: T, prop: TKey, replacement: T[TKey]): T[TKey];
replace<T, TKey extends keyof T, R extends T[TKey] = T[TKey]>(obj: T, prop: TKey, replacement: R): R;
/**
* Replaces getter for property on object with replacement argument. Attempts to replace an already replaced getter cause an exception.
* replacement must be a Function, and can be instances of spies, stubs and fakes.
@ -1653,6 +1669,14 @@ declare namespace Sinon {
): SinonStubbedInstance<TType>;
}
type SinonPromise<T> = Promise<T> & {
status: 'pending' | 'resolved' | 'rejected';
resolve(val: unknown): Promise<T>;
reject(reason: unknown): Promise<void>;
resolvedValue?: T;
rejectedValue?: unknown;
};
interface SinonApi {
expectation: SinonExpectationStatic;
@ -1687,6 +1711,10 @@ declare namespace Sinon {
* on a format of your choosing, such as "{ id: 42 }"
*/
setFormatter: (customFormatter: (...args: any[]) => string) => void;
promise<T = unknown>(
executor?: (resolve: (value: T) => void, reject: (reason?: unknown) => void) => void,
): SinonPromise<T>;
}
type SinonStatic = SinonSandbox & SinonApi;

View file

@ -1,6 +1,6 @@
{
"name": "@types/sinon",
"version": "10.0.2",
"version": "10.0.15",
"description": "TypeScript definitions for Sinon",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sinon",
"license": "MIT",
@ -10,11 +10,6 @@
"url": "https://github.com/mrbigdog2u",
"githubUsername": "mrbigdog2u"
},
{
"name": "Lukas Spieß",
"url": "https://github.com/lumaxis",
"githubUsername": "lumaxis"
},
{
"name": "Nico Jansen",
"url": "https://github.com/nicojs",
@ -25,11 +20,6 @@
"url": "https://github.com/43081j",
"githubUsername": "43081j"
},
{
"name": "Josh Goldberg",
"url": "https://github.com/joshuakgoldberg",
"githubUsername": "joshuakgoldberg"
},
{
"name": "Greg Jednaszewski",
"url": "https://github.com/gjednaszewski",
@ -49,6 +39,11 @@
"name": "Simon Schick",
"url": "https://github.com/SimonSchick",
"githubUsername": "SimonSchick"
},
{
"name": "Mathias Schreck",
"url": "https://github.com/lo1tuma",
"githubUsername": "lo1tuma"
}
],
"main": "",
@ -60,8 +55,8 @@
},
"scripts": {},
"dependencies": {
"@sinonjs/fake-timers": "^7.1.0"
"@types/sinonjs__fake-timers": "*"
},
"typesPublisherContentHash": "d9f02a4574f6f32057808563b4551e558075d0c93c5739b604521c743c4bb712",
"typeScriptVersion": "3.6"
"typesPublisherContentHash": "c87e5ef382887bbdb8c25d070fd87c515977fd4e28b3d8cf4293c673f5e33f2e",
"typeScriptVersion": "4.3"
}

21
node_modules/@types/sinonjs__fake-timers/LICENSE generated vendored Executable file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) Microsoft Corporation.
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

16
node_modules/@types/sinonjs__fake-timers/README.md generated vendored Executable file
View file

@ -0,0 +1,16 @@
# Installation
> `npm install --save @types/sinonjs__fake-timers`
# Summary
This package contains type definitions for @sinonjs/fake-timers (https://github.com/sinonjs/fake-timers).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sinonjs__fake-timers.
### Additional Details
* Last updated: Wed, 23 Mar 2022 18:01:46 GMT
* Dependencies: none
* Global values: none
# Credits
These definitions were written by [Wim Looman](https://github.com/Nemo157), [Rogier Schouten](https://github.com/rogierschouten), [Yishai Zehavi](https://github.com/zyishai), [Remco Haszing](https://github.com/remcohaszing), and [Jaden Simon](https://github.com/JadenSimon).

392
node_modules/@types/sinonjs__fake-timers/index.d.ts generated vendored Executable file
View file

@ -0,0 +1,392 @@
// Type definitions for @sinonjs/fake-timers 8.1
// Project: https://github.com/sinonjs/fake-timers
// Definitions by: Wim Looman <https://github.com/Nemo157>
// Rogier Schouten <https://github.com/rogierschouten>
// Yishai Zehavi <https://github.com/zyishai>
// Remco Haszing <https://github.com/remcohaszing>
// Jaden Simon <https://github.com/JadenSimon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/**
* Names of clock methods that may be faked by install.
*/
export type FakeMethod =
| 'setTimeout'
| 'clearTimeout'
| 'setImmediate'
| 'clearImmediate'
| 'setInterval'
| 'clearInterval'
| 'Date'
| 'nextTick'
| 'hrtime'
| 'requestAnimationFrame'
| 'cancelAnimationFrame'
| 'requestIdleCallback'
| 'cancelIdleCallback'
| 'performance'
| 'queueMicrotask';
/**
* Global methods available to every clock and also as standalone methods (inside `timers` global object).
*/
export interface GlobalTimers<TTimerId extends TimerId> {
/**
* Schedules a callback to be fired once timeout milliseconds have ticked by.
*
* @param callback Callback to be fired.
* @param timeout How many ticks to wait to run the callback.
* @param args Any extra arguments to pass to the callback.
* @returns Time identifier for cancellation.
*/
setTimeout: (callback: (...args: any[]) => void, timeout: number, ...args: any[]) => TTimerId;
/**
* Clears a timer, as long as it was created using setTimeout.
*
* @param id Timer ID or object.
*/
clearTimeout: (id: TTimerId) => void;
/**
* Schedules a callback to be fired every time timeout milliseconds have ticked by.
*
* @param callback Callback to be fired.
* @param timeout How many ticks to wait between callbacks.
* @param args Any extra arguments to pass to the callback.
* @returns Time identifier for cancellation.
*/
setInterval: (callback: (...args: any[]) => void, timeout: number, ...args: any[]) => TTimerId;
/**
* Clears a timer, as long as it was created using setInterval.
*
* @param id Timer ID or object.
*/
clearInterval: (id: TTimerId) => void;
/**
* Schedules the callback to be fired once 0 milliseconds have ticked by.
*
* @param callback Callback to be fired.
* @param args Any extra arguments to pass to the callback.
* @remarks You'll still have to call clock.tick() for the callback to fire.
* @remarks If called during a tick the callback won't fire until 1 millisecond has ticked by.
*/
setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => TTimerId;
/**
* Clears a timer, as long as it was created using setImmediate.
*
* @param id Timer ID or object.
*/
clearImmediate: (id: TTimerId) => void;
/**
* Implements the Date object but using this clock to provide the correct time.
*/
Date: typeof Date;
}
/**
* Timer object used in node.
*/
export interface NodeTimer {
/**
* Stub method call. Does nothing.
*/
ref(): NodeTimer;
/**
* Stub method call. Does nothing.
*/
unref(): NodeTimer;
/**
* Refreshes the timer.
*/
refresh(): NodeTimer;
}
/**
* Timer identifier for clock scheduling.
*/
export type TimerId = number | NodeTimer;
/**
* Controls the flow of time.
*/
export interface FakeClock<TTimerId extends TimerId> extends GlobalTimers<TTimerId> {
/**
* Current clock time.
*/
now: number;
/**
* Mimics performance.now().
*/
performance: {
now: () => number;
};
/**
* Don't know what this prop is for, but it was included in the clocks that `createClock` or
* `install` return (it is never used in the code, for now).
*/
timeouts: {};
/**
* Maximum number of timers that will be run when calling runAll().
*/
loopLimit: number;
/**
* Schedule callback to run in the next animation frame.
*
* @param callback Callback to be fired.
* @returns Request id.
*/
requestAnimationFrame: (callback: (time: number) => void) => TTimerId;
/**
* Cancel animation frame request.
*
* @param id The id returned from requestAnimationFrame method.
*/
cancelAnimationFrame: (id: TTimerId) => void;
/**
* Queues the callback to be fired during idle periods to perform background and low priority work on the main event loop.
*
* @param callback Callback to be fired.
* @param timeout The maximum number of ticks before the callback must be fired.
* @remarks Callbacks which have a timeout option will be fired no later than time in milliseconds.
*/
requestIdleCallback: (callback: () => void, timeout?: number) => TTimerId;
/**
* Clears a timer, as long as it was created using requestIdleCallback.
*
* @param id Timer ID or object.
*/
cancelIdleCallback: (id: TTimerId) => void;
/**
* Get the number of waiting timers.
*
* @returns number of waiting timers.
*/
countTimers: () => number;
/**
* Advances the clock to the the moment of the first scheduled timer, firing it.
* @returns Fake milliseconds since the unix epoch.
*/
next: () => number;
/**
* Advances the clock to the the moment of the first scheduled timer, firing it.
*
* Also breaks the event loop, allowing any scheduled promise callbacks to execute _before_ running the timers.
* @returns Fake milliseconds since the unix epoch.
*/
nextAsync: () => Promise<number>;
/**
* Advance the clock, firing callbacks if necessary.
*
* @param time How many ticks to advance by.
* @returns Fake milliseconds since the unix epoch.
*/
tick: (time: number | string) => number;
/**
* Advance the clock, firing callbacks if necessary.
*
* Also breaks the event loop, allowing any scheduled promise callbacks to execute _before_ running the timers.
*
* @param time How many ticks to advance by.
* @returns Fake milliseconds since the unix epoch.
*/
tickAsync: (time: number | string) => Promise<number>;
/**
* Removes all timers and tick without firing them and restore now to its original value.
*/
reset: () => void;
/**
* Runs all pending timers until there are none remaining.
*
* @remarks If new timers are added while it is executing they will be run as well.
* @returns Fake milliseconds since the unix epoch.
*/
runAll: () => number;
/**
* Runs all pending timers until there are none remaining.
*
* Also breaks the event loop, allowing any scheduled promise callbacks to execute _before_ running the timers.
*
* @remarks If new timers are added while it is executing they will be run as well.
* @returns Fake milliseconds since the unix epoch.
*/
runAllAsync: () => Promise<number>;
/**
* Advanced the clock to the next animation frame while firing all scheduled callbacks.
* @returns Fake milliseconds since the unix epoch.
*/
runToFrame: () => number;
/**
* Takes note of the last scheduled timer when it is run, and advances the clock to
* that time firing callbacks as necessary.
* @returns Fake milliseconds since the unix epoch.
*/
runToLast: () => number;
/**
* Takes note of the last scheduled timer when it is run, and advances the clock to
* that time firing callbacks as necessary.
*
* Also breaks the event loop, allowing any scheduled promise callbacks to execute _before_ running the timers.
* @returns Fake milliseconds since the unix epoch.
*/
runToLastAsync: () => Promise<number>;
/**
* Simulates a user changing the system clock.
*
* @param now New system time.
* @remarks This affects the current time but it does not in itself cause timers to fire.
*/
setSystemTime: (now?: number | Date) => void;
}
/**
* Fake clock for a browser environment.
*/
export type BrowserClock = FakeClock<number>;
/**
* Fake clock for a Node environment.
*/
export type NodeClock = FakeClock<NodeTimer> & {
/**
* Mimics process.hrtime().
*
* @param prevTime Previous system time to calculate time elapsed.
* @returns High resolution real time as [seconds, nanoseconds].
*/
hrtime(prevTime?: [number, number]): [number, number];
/**
* Mimics process.nextTick() explicitly dropping additional arguments.
*/
queueMicrotask: (callback: () => void) => void;
/**
* Simulates process.nextTick().
*/
nextTick: (callback: (...args: any[]) => void, ...args: any[]) => void;
/**
* Run all pending microtasks scheduled with nextTick.
*/
runMicrotasks: () => void;
};
/**
* Clock object created by @sinonjs/fake-timers.
*/
export type Clock = BrowserClock | NodeClock;
/**
* Additional methods that installed clock have.
*/
export interface InstalledMethods {
/**
* Restores the original methods on the context that was passed to FakeTimers.install,
* or the native timers if no context was given.
*/
uninstall: () => void;
methods: FakeMethod[];
}
/**
* Clock object created by calling `install();`.
*/
export type InstalledClock = Clock & InstalledMethods;
/**
* Creates a clock.
*
* @param now Current time for the clock.
* @param loopLimit Maximum number of timers that will be run when calling runAll()
* before assuming that we have an infinite loop and throwing an error
* (by default, 1000).
* @remarks The default epoch is 0.
*/
export function createClock(now?: number | Date, loopLimit?: number): Clock;
export interface FakeTimerInstallOpts {
/**
* Installs fake timers with the specified unix epoch (default: 0)
*/
now?: number | Date | undefined;
/**
* An array with names of global methods and APIs to fake. By default, `@sinonjs/fake-timers` does not replace `nextTick()` and `queueMicrotask()`.
* For instance, `FakeTimers.install({ toFake: ['setTimeout', 'nextTick'] })` will fake only `setTimeout()` and `nextTick()`
*/
toFake?: FakeMethod[] | undefined;
/**
* The maximum number of timers that will be run when calling runAll() (default: 1000)
*/
loopLimit?: number | undefined;
/**
* Tells @sinonjs/fake-timers to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by
* 20ms for every 20ms change in the real system time) (default: false)
*/
shouldAdvanceTime?: boolean | undefined;
/**
* Relevant only when using with shouldAdvanceTime: true. increment mocked time by advanceTimeDelta ms every advanceTimeDelta ms change
* in the real system time (default: 20)
*/
advanceTimeDelta?: number | undefined;
/**
* Tells FakeTimers to clear 'native' (i.e. not fake) timers by delegating to their respective handlers. These are not cleared by
* default, leading to potentially unexpected behavior if timers existed prior to installing FakeTimers. (default: false)
*/
shouldClearNativeTimers?: boolean | undefined;
}
/**
* Creates a clock and installs it globally.
*
* @param [opts] Options for the fake timer.
*/
export function install(opts?: FakeTimerInstallOpts): InstalledClock;
export interface FakeTimerWithContext {
timers: GlobalTimers<TimerId>;
createClock: (now?: number | Date, loopLimit?: number) => Clock;
install: (opts?: FakeTimerInstallOpts) => InstalledClock;
withGlobal: (global: object) => FakeTimerWithContext;
}
/**
* Apply new context to fake timers.
*
* @param global New context to apply like `window` (in browsers) or `global` (in node).
*/
export function withGlobal(global: object): FakeTimerWithContext;
export const timers: GlobalTimers<TimerId>;

45
node_modules/@types/sinonjs__fake-timers/package.json generated vendored Executable file
View file

@ -0,0 +1,45 @@
{
"name": "@types/sinonjs__fake-timers",
"version": "8.1.2",
"description": "TypeScript definitions for @sinonjs/fake-timers",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sinonjs__fake-timers",
"license": "MIT",
"contributors": [
{
"name": "Wim Looman",
"url": "https://github.com/Nemo157",
"githubUsername": "Nemo157"
},
{
"name": "Rogier Schouten",
"url": "https://github.com/rogierschouten",
"githubUsername": "rogierschouten"
},
{
"name": "Yishai Zehavi",
"url": "https://github.com/zyishai",
"githubUsername": "zyishai"
},
{
"name": "Remco Haszing",
"url": "https://github.com/remcohaszing",
"githubUsername": "remcohaszing"
},
{
"name": "Jaden Simon",
"url": "https://github.com/JadenSimon",
"githubUsername": "JadenSimon"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/sinonjs__fake-timers"
},
"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "452fe64e05b9936a8b0868109cdd45c3e241020b1658d8cf534cb04b6cae7c4e",
"typeScriptVersion": "3.9"
}