diff --git a/types/aws-lambda/common/api-gateway.d.ts b/types/aws-lambda/common/api-gateway.d.ts
index 2d1c1c255a3541..c63d60ae5a0b70 100644
--- a/types/aws-lambda/common/api-gateway.d.ts
+++ b/types/aws-lambda/common/api-gateway.d.ts
@@ -80,6 +80,6 @@ export interface APIGatewayEventIdentity {
user: string | null;
userAgent: string | null;
userArn: string | null;
- vpcId: string | null;
- vpceId: string | null;
+ vpcId?: string | undefined;
+ vpceId?: string | undefined;
}
diff --git a/types/aws-lambda/test/api-gateway-tests.ts b/types/aws-lambda/test/api-gateway-tests.ts
index 982f802209dcb2..6cb72826c6d1f6 100644
--- a/types/aws-lambda/test/api-gateway-tests.ts
+++ b/types/aws-lambda/test/api-gateway-tests.ts
@@ -152,8 +152,8 @@ let proxyHandler: APIGatewayProxyHandler = async (event, context, callback) => {
strOrNull = requestContext.identity.user;
strOrNull = requestContext.identity.userAgent;
strOrNull = requestContext.identity.userArn;
- strOrNull = requestContext.identity.vpcId;
- strOrNull = requestContext.identity.vpceId;
+ strOrUndefined = requestContext.identity.vpcId;
+ strOrUndefined = requestContext.identity.vpceId;
strOrUndefined = requestContext.messageDirection;
strOrUndefinedOrNull = requestContext.messageId;
str = requestContext.path;
diff --git a/types/react-dom/client.d.ts b/types/react-dom/client.d.ts
index 90f941ae5ac03a..2c7affa76c93f1 100644
--- a/types/react-dom/client.d.ts
+++ b/types/react-dom/client.d.ts
@@ -96,7 +96,7 @@ export function createRoot(container: Container, options?: RootOptions): Root;
* hydrateRoot(document.querySelector('#root'), )
* ```
*
- * @see https://reactjs.org/docs/react-dom-client.html#hydrateroot
+ * @see https://react.dev/reference/react-dom/client/hydrateRoot
*/
export function hydrateRoot(
container: Element | Document,
diff --git a/types/react-dom/server.d.ts b/types/react-dom/server.d.ts
index f07bd68f334f8b..84312f9d6f4175 100644
--- a/types/react-dom/server.d.ts
+++ b/types/react-dom/server.d.ts
@@ -94,7 +94,7 @@ export interface ServerOptions {
/**
* Only available in the environments with [Node.js Streams](https://nodejs.dev/learn/nodejs-streams).
*
- * @see [API](https://reactjs.org/docs/react-dom-server.html#rendertopipeablestream)
+ * @see [API](https://react.dev/reference/react-dom/server/renderToPipeableStream)
*
* @param children
* @param options
@@ -149,7 +149,7 @@ export interface ReactDOMServerReadableStream extends ReadableStream {
/**
* Only available in the environments with [Web Streams](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) (this includes browsers, Deno, and some modern edge runtimes).
*
- * @see [API](https://reactjs.org/docs/react-dom-server.html#rendertoreadablestream)
+ * @see [API](https://react.dev/reference/react-dom/server/renderToReadableStream)
*/
export function renderToReadableStream(
children: ReactNode,
diff --git a/types/react-dom/test/react-dom-tests.tsx b/types/react-dom/test/react-dom-tests.tsx
index 70dbdaff7e9500..b12c0080b1bc00 100644
--- a/types/react-dom/test/react-dom-tests.tsx
+++ b/types/react-dom/test/react-dom-tests.tsx
@@ -343,7 +343,7 @@ function pipeableStreamDocumentedStringExample() {
}
/**
- * source: https://reactjs.org/docs/react-dom-server.html#rendertoreadablestream
+ * source: https://react.dev/reference/react-dom/server/renderToReadableStream
*/
async function readableStreamDocumentedExample() {
const controller = new AbortController();
@@ -383,7 +383,7 @@ async function readableStreamDocumentedExample() {
}
/**
- * source: https://reactjs.org/docs/react-dom-server.html#rendertoreadablestream
+ * source: https://react.dev/reference/react-dom/server/renderToReadableStream
*/
async function readableStreamDocumentedStringExample() {
const controller = new AbortController();
diff --git a/types/sinon-test/index.d.ts b/types/sinon-test/index.d.ts
index d8b63fa191e390..9f3ccfa7e2dd2e 100644
--- a/types/sinon-test/index.d.ts
+++ b/types/sinon-test/index.d.ts
@@ -5,7 +5,6 @@ interface Configuration {
injectInto?: any;
properties?: Array<"spy" | "stub" | "mock" | "clock" | "server" | "requests"> | undefined;
useFakeTimers?: boolean | undefined;
- useFakeServer?: boolean | undefined;
}
declare function sinonTest(sinon: Sinon.SinonStatic, config?: Configuration): any;
diff --git a/types/sinon-test/sinon-test-tests.ts b/types/sinon-test/sinon-test-tests.ts
index 1b95e7743f60ce..1e8103d15aeb41 100644
--- a/types/sinon-test/sinon-test-tests.ts
+++ b/types/sinon-test/sinon-test-tests.ts
@@ -7,7 +7,6 @@ function testConfigure() {
injectInto: true,
properties: ["spy", "stub", "mock", "clock", "server", "requests"],
useFakeTimers: true,
- useFakeServer: true,
});
}
diff --git a/types/sinon/index.d.ts b/types/sinon/index.d.ts
index f9dfdfabd2dbec..53c9ec28c04d67 100644
--- a/types/sinon/index.d.ts
+++ b/types/sinon/index.d.ts
@@ -410,11 +410,6 @@ declare namespace Sinon {
* As a convenience, you can apply stub.reset() to all stubs using sinon.reset()
*/
reset(): void;
- /**
- * Causes the stub to return promises using a specific Promise library instead of the global one when using stub.rejects or stub.resolves.
- * Returns the stub to allow chaining.
- */
- usingPromise(promiseLibrary: any): SinonStub;
/**
* Makes the stub return the provided @param obj value.
@@ -438,7 +433,6 @@ declare namespace Sinon {
* Causes the stub to return a Promise which resolves to the provided value.
* When constructing the Promise, sinon uses the Promise.resolve method.
* You are responsible for providing a polyfill in environments which do not provide Promise.
- * The Promise library can be overwritten using the usingPromise method.
* Since sinon@2.0.0
*/
resolves(
@@ -477,7 +471,6 @@ declare namespace Sinon {
* Causes the stub to return a Promise which rejects with an exception (Error).
* When constructing the Promise, sinon uses the Promise.reject method.
* You are responsible for providing a polyfill in environments which do not provide Promise.
- * The Promise library can be overwritten using the usingPromise method.
* Since sinon@2.0.0
*/
rejects(): SinonStub;
@@ -793,247 +786,6 @@ declare namespace Sinon {
dispatchEvent(event: Event): void;
}
- interface SinonFakeXMLHttpRequest {
- // Properties
- /**
- * The URL set on the request object.
- */
- url: string;
- /**
- * The request method as a string.
- */
- method: string;
- /**
- * An object of all request headers, i.e.:
- */
- requestHeaders: any;
- /**
- * The request body
- */
- requestBody: string;
- /**
- * The request’s status code.
- * undefined if the request has not been handled (see respond below)
- */
- status: number;
- /**
- * Only populated if the respond method is called (see below).
- */
- statusText: string;
- /**
- * Whether or not the request is asynchronous.
- */
- async: boolean;
- /**
- * Username, if any.
- */
- username: string;
- /**
- * Password, if any.
- */
- password: string;
- withCredentials: boolean;
- upload: SinonFakeUploadProgress;
- /**
- * When using respond, this property is populated with a parsed document if response headers indicate as much (see the spec)
- */
- responseXML: Document;
- /**
- * The value of the given response header, if the request has been responded to (see respond).
- * @param header
- */
- getResponseHeader(header: string): string;
- /**
- * All response headers as an object.
- */
- getAllResponseHeaders(): any;
-
- // Methods
- /**
- * Sets response headers (e.g. { "Content-Type": "text/html", ... }, updates the readyState property and fires onreadystatechange.
- * @param headers
- */
- setResponseHeaders(headers: any): void;
- /**
- * Sets the respond body, updates the readyState property and fires onreadystatechange.
- * Additionally, populates responseXML with a parsed document if response headers indicate as much.
- */
- setResponseBody(body: string): void;
- /**
- * Calls the above three methods.
- */
- respond(status: number, headers: any, body: string): void;
- autoRespond(ms: number): void;
- /**
- * Simulates a network error on the request. The onerror handler will be called and the status will be 0.
- */
- error(): void;
- onerror(): void;
- }
-
- interface SinonFakeXMLHttpRequestStatic {
- new(): SinonFakeXMLHttpRequest;
- /**
- * Default false.
- * When set to true, Sinon will check added filters if certain requests should be “unfaked”
- */
- useFilters: boolean;
- /**
- * Add a filter that will decide whether or not to fake a request.
- * The filter will be called when xhr.open is called, with the exact same arguments (method, url, async, username, password).
- * If the filter returns true, the request will not be faked.
- * @param filter
- */
- addFilter(
- filter: (method: string, url: string, async: boolean, username: string, password: string) => boolean,
- ): void;
- /**
- * By assigning a function to the onCreate property of the returned object from useFakeXMLHttpRequest()
- * you can subscribe to newly created FakeXMLHttpRequest objects. See below for the fake xhr object API.
- * Using this observer means you can still reach objects created by e.g. jQuery.ajax (or other abstractions/frameworks).
- * @param xhr
- */
- onCreate(xhr: SinonFakeXMLHttpRequest): void;
- /**
- * Restore original function(s).
- */
- restore(): void;
- }
-
- interface SinonFakeServer extends SinonFakeServerOptions {
- // Properties
- /**
- * Used internally to determine the HTTP method used with the provided request.
- * By default this method simply returns request.method.
- * When server.fakeHTTPMethods is true, the method will return the value of the _method parameter if the method is “POST”.
- * This method can be overridden to provide custom behavior.
- * @param request
- */
- getHTTPMethod(request: SinonFakeXMLHttpRequest): string;
- /**
- * You can inspect the server.requests to verify request ordering, find unmatched requests or check that no requests has been done.
- * server.requests is an array of all the FakeXMLHttpRequest objects that have been created.
- */
- requests: SinonFakeXMLHttpRequest[];
-
- // Methods
- /**
- * Causes the server to respond to any request not matched by another response with the provided data. The default catch-all response is [404, {}, ""].
- * A String representing the response body
- * An Array with status, headers and response body, e.g. [200, { "Content-Type": "text/html", "Content-Length": 2 }, "OK"]
- * A Function.
- * Default status is 200 and default headers are none.
- * When the response is a Function, it will be passed the request object. You must manually call respond on it to complete the request.
- * @param body A String representing the response body
- */
- respondWith(body: string): void;
- /**
- * Causes the server to respond to any request not matched by another response with the provided data. The default catch-all response is [404, {}, ""].
- * Default status is 200 and default headers are none.
- * When the response is a Function, it will be passed the request object. You must manually call respond on it to complete the request.
- * @param response An Array with status, headers and response body, e.g. [200, { "Content-Type": "text/html", "Content-Length": 2 }, "OK"]
- */
- respondWith(response: any[]): void;
- /**
- * Causes the server to respond to any request not matched by another response with the provided data. The default catch-all response is [404, {}, ""].
- * Default status is 200 and default headers are none.
- * When the response is a Function, it will be passed the request object. You must manually call respond on it to complete the request.
- * @param fn A Function.
- */
- respondWith(fn: (xhr: SinonFakeXMLHttpRequest) => void): void;
- /**
- * Responds to all requests to given URL, e.g. /posts/1.
- */
- respondWith(url: string, body: string): void;
- /**
- * Responds to all requests to given URL, e.g. /posts/1.
- */
- respondWith(url: string, response: any[]): void;
- /**
- * Responds to all requests to given URL, e.g. /posts/1.
- */
- respondWith(url: string, fn: (xhr: SinonFakeXMLHttpRequest) => void): void;
- /**
- * Responds to all method requests to the given URL with the given response.
- * method is an HTTP verb.
- */
- respondWith(method: string, url: string, body: string): void;
- /**
- * Responds to all method requests to the given URL with the given response.
- * method is an HTTP verb.
- */
- respondWith(method: string, url: string, response: any[]): void;
- /**
- * Responds to all method requests to the given URL with the given response.
- * method is an HTTP verb.
- */
- respondWith(method: string, url: string, fn: (xhr: SinonFakeXMLHttpRequest) => void): void;
- /**
- * URL may be a regular expression, e.g. /\\/post\\//\\d+
- * If the response is a Function, it will be passed any capture groups from the regular expression along with the XMLHttpRequest object:
- */
- respondWith(url: RegExp, body: string): void;
- /**
- * URL may be a regular expression, e.g. /\\/post\\//\\d+
- * If the response is a Function, it will be passed any capture groups from the regular expression along with the XMLHttpRequest object:
- */
- respondWith(url: RegExp, response: any[]): void;
- /**
- * URL may be a regular expression, e.g. /\\/post\\//\\d+
- * If the response is a Function, it will be passed any capture groups from the regular expression along with the XMLHttpRequest object:
- */
- respondWith(url: RegExp, fn: (xhr: SinonFakeXMLHttpRequest) => void): void;
- /**
- * Responds to all method requests to URLs matching the regular expression.
- */
- respondWith(method: string, url: RegExp, body: string): void;
- /**
- * Responds to all method requests to URLs matching the regular expression.
- */
- respondWith(method: string, url: RegExp, response: any[]): void;
- /**
- * Responds to all method requests to URLs matching the regular expression.
- */
- respondWith(method: string, url: RegExp, fn: (xhr: SinonFakeXMLHttpRequest) => void): void;
- /**
- * Causes all queued asynchronous requests to receive a response.
- * If none of the responses added through respondWith match, the default response is [404, {}, ""].
- * Synchronous requests are responded to immediately, so make sure to call respondWith upfront.
- * If called with arguments, respondWith will be called with those arguments before responding to requests.
- */
- respond(): void;
- restore(): void;
- }
-
- interface SinonFakeServerOptions {
- /**
- * When set to true, causes the server to automatically respond to incoming requests after a timeout.
- * The default timeout is 10ms but you can control it through the autoRespondAfter property.
- * Note that this feature is intended to help during mockup development, and is not suitable for use in tests.
- */
- autoRespond: boolean;
- /**
- * When autoRespond is true, respond to requests after this number of milliseconds. Default is 10.
- */
- autoRespondAfter: number;
- /**
- * If set to true, server will find _method parameter in POST body and recognize that as the actual method.
- * Supports a pattern common to Ruby on Rails applications. For custom HTTP method faking, override server.getHTTPMethod(request).
- */
- fakeHTTPMethods: boolean;
- /**
- * If set, the server will respond to every request immediately and synchronously.
- * This is ideal for faking the server from within a test without having to call server.respond() after each request made in that test.
- * As this is synchronous and immediate, this is not suitable for simulating actual network latency in tests or mockups.
- * To simulate network latency with automatic responses, see server.autoRespond and server.autoRespondAfter.
- */
- respondImmediately: boolean;
- }
-
- interface SinonFakeServerStatic {
- create(options?: Partial): SinonFakeServer;
- }
-
interface SinonExposeOptions {
prefix: string;
includeFail: boolean;
@@ -1429,9 +1181,7 @@ declare namespace Sinon {
*/
injectInto: object | null;
/**
- * What properties to inject.
- * Note that simply naming “server” here is not sufficient to have a server property show up in the target object,
- * you also have to set useFakeServer to true.
+ * Which properties to inject into the facade object. By default empty!
*/
properties: string[];
/**
@@ -1439,12 +1189,6 @@ declare namespace Sinon {
* You can optionally pass in a configuration object that follows the specification for fake timers, such as { toFake: ["setTimeout", "setInterval"] }.
*/
useFakeTimers: boolean | Partial;
- /**
- * 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 you’re using jQuery 1.3.x or some other library that does not set the XHR’s onreadystatechange handler,
- * you might want to do:
- */
- useFakeServer: boolean | SinonFakeServer;
/**
* The assert options can help limit the amount of output produced by assert.fail
*/
@@ -1564,8 +1308,6 @@ declare namespace Sinon {
*/
assert: SinonAssert;
clock: SinonFakeTimers;
- requests: SinonFakeXMLHttpRequest[];
- server: SinonFakeServer;
match: SinonMatch;
/**
* Works exactly like sinon.spy
@@ -1590,28 +1332,13 @@ declare namespace Sinon {
* Since sinon@2.0.0
* You can also pass in a Date object, and its getTime() will be used for the starting timestamp.
* * Config : As above, but allows further configuration options, some of which are:
- * * config.now - Number/Date - installs lolex with the specified unix epoch (default: 0)
- * * config.toFake - String[ ] - an array with explicit function names to fake.
- * By default lolex will automatically fake all methods except process.nextTick. You could, however, still fake nextTick by providing it explicitly
- * * config.shouldAdvanceTime - Boolean - tells lolex to increment mocked time automatically based on the real system time shift (default: false)
- * * Please visit the lolex.install documentation for the full feature set.
- * * Important note: when faking nextTick, normal calls to process.nextTick() would not execute automatically as they would during normal event-loop phases.
- * 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.
+ * * config.now - Number/Date - installs 'fake-timers' with the specified unix epoch (default: 0)
+ * * config.toFake - String[ ] - an array with explicit function names to fake. By default `fake-timers` will automatically fake _all_ methods (changed in v19).
+ * * config.shouldAdvanceTime - Boolean - tells `fake-timers` to increment mocked time automatically based on the real system time shift (default: false). When used in conjunction with `config.toFake`, it will only work if `'setInterval'` is included in `config.toFake`.
+ * * Important note: when faking `nextTick`, normal calls to `process.nextTick()` will not execute automatically as they would during normal event-loop phases. You would have to call either `clock.next()`, `clock.tick()`, `clock.runAll()` or `clock.runToLast()` manually (see example below). You can easily work around this using the `config.toFake` option. Please refer to the [`fake-timers`](https://github.com/sinonjs/fake-timers) documentation for more information.
* @param config
*/
useFakeTimers(config?: number | Date | Partial): 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.
- * Other progIds, such as XMLDOM are left untouched.
- * The native XMLHttpRequest object will be available at sinon.xhr.XMLHttpRequest
- */
- useFakeXMLHttpRequest(): SinonFakeXMLHttpRequestStatic;
- /**
- * Fakes XHR and binds a server object to the sandbox such that it too is restored when calling sandbox.restore().
- * Access requests through sandbox.requests and server through sandbox.server
- */
- useFakeServer(): SinonFakeServer;
/**
* Restores all fakes created through sandbox.
*/
@@ -1630,12 +1357,6 @@ declare namespace Sinon {
* Since sinon@2.0.0
*/
resetBehavior(): void;
- /**
- * Causes all stubs created from the sandbox to return promises using a specific Promise library instead of the global one when using stub.rejects or stub.resolves.
- * Returns the stub to allow chaining.
- * Since sinon@2.0.0
- */
- usingPromise(promiseLibrary: any): SinonSandbox;
/**
* Verifies all mocks created through the sandbox.
*/
@@ -1713,11 +1434,6 @@ declare namespace Sinon {
create(now: number | Date): FakeTimers.Clock;
};
- FakeXMLHttpRequest: SinonFakeXMLHttpRequestStatic;
-
- fakeServer: SinonFakeServerStatic;
- fakeServerWithClock: SinonFakeServerStatic;
-
/**
* Creates a new sandbox object with spies, stubs, and mocks.
* @param config
diff --git a/types/sinon/package.json b/types/sinon/package.json
index ab04d58e23dd18..edfacc955f5444 100644
--- a/types/sinon/package.json
+++ b/types/sinon/package.json
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/sinon",
- "version": "17.0.9999",
+ "version": "20.0.9999",
"projects": [
"https://sinonjs.org"
],
diff --git a/types/sinon/sinon-tests.ts b/types/sinon/sinon-tests.ts
index 5cc65a3c8be527..100f4efe7b5fac 100644
--- a/types/sinon/sinon-tests.ts
+++ b/types/sinon/sinon-tests.ts
@@ -8,7 +8,6 @@ function testSandbox() {
injectInto: obj,
properties: ["spy", "stub"],
useFakeTimers: true,
- useFakeServer: true,
assertOptions: {
shouldLimitAssertionLogs: true,
assertionLogLimit: 10,
@@ -25,7 +24,6 @@ function testSandbox() {
now: 1000,
shouldAdvanceTime: false,
},
- useFakeServer: sinon.fakeServer.create(),
});
sinon.createSandbox(sinon.defaultConfig);
@@ -48,18 +46,10 @@ function testSandbox() {
shouldClearNativeTimers: true,
});
- const xhr = sb.useFakeXMLHttpRequest();
- xhr.useFilters = true;
- xhr.restore();
-
- const server = sb.useFakeServer();
- server.respondWith("foo");
-
sb.restore();
sb.reset();
sb.resetHistory();
sb.resetBehavior();
- sb.usingPromise(Promise);
sb.verify();
sb.verifyAndRestore();
@@ -155,39 +145,6 @@ function testSandbox() {
sb.define(objToDefine, {}, 123);
}
-function testFakeServer() {
- let s = sinon.fakeServer.create();
- s = sinon.fakeServerWithClock.create();
-
- sinon.fakeServer.create({
- autoRespond: true,
- autoRespondAfter: 3,
- fakeHTTPMethods: true,
- respondImmediately: false,
- });
-
- sinon.fakeServer.create({
- autoRespond: true,
- autoRespondAfter: 3,
- });
-}
-
-function testXHR() {
- const xhr = new sinon.FakeXMLHttpRequest();
- const headers = xhr.getAllResponseHeaders();
- const header = xhr.getResponseHeader("foo");
-
- xhr.setResponseHeaders({ "Content-Type": "text/html" });
- xhr.setResponseBody("foo");
- xhr.respond(200, { "Content-Type": "foo" }, "bar");
- xhr.error();
-
- sinon.FakeXMLHttpRequest.useFilters = true;
- sinon.FakeXMLHttpRequest.addFilter((method, url, async, user, pass) => true);
- sinon.FakeXMLHttpRequest.onCreate = xhr => {};
- sinon.FakeXMLHttpRequest.restore();
-}
-
function testClock() {
let clock = sinon.clock.create(1000) as fakeTimers.BrowserClock;
clock = sinon.clock.create(new Date()) as fakeTimers.BrowserClock;
@@ -793,7 +750,6 @@ function testStub() {
stub.reset();
stub.resetBehavior();
- stub.usingPromise(Promise);
stub.returns(true);
stub.returns(5);