Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class DebuggerAgent {

export class DebuggerMock extends DebuggerAgent {
// Empty handlers
+handle: JestMockFn<[message: JSONSerializable], void> = jest.fn();
readonly handle: JestMockFn<[message: JSONSerializable], void> = jest.fn();

__handle(message: JSONSerializable): void {
this.handle(message);
Expand Down
12 changes: 7 additions & 5 deletions packages/dev-middleware/src/__tests__/InspectorDeviceUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,18 @@ export class DeviceAgent {

export class DeviceMock extends DeviceAgent {
// Empty handlers
+connect: JestMockFn<[message: ConnectRequest], void> = jest.fn();
+disconnect: JestMockFn<[message: DisconnectRequest], void> = jest.fn();
+getPages: JestMockFn<
readonly connect: JestMockFn<[message: ConnectRequest], void> = jest.fn();
readonly disconnect: JestMockFn<[message: DisconnectRequest], void> =
jest.fn();
readonly getPages: JestMockFn<
[message: GetPagesRequest],
| GetPagesResponse['payload']
| Promise<GetPagesResponse['payload'] | void>
| void,
> = jest.fn();
+wrappedEvent: JestMockFn<[message: WrappedEventToDevice], void> = jest.fn();
+wrappedEventParsed: JestMockFn<
readonly wrappedEvent: JestMockFn<[message: WrappedEventToDevice], void> =
jest.fn();
readonly wrappedEventParsed: JestMockFn<
[
payload: {
...WrappedEventToDevice['payload'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const PAGES_POLLING_DELAY = 2100;
jest.useFakeTimers();

async function setupDevice(
serverRef: {+serverBaseWsUrl: string, ...},
serverRef: {readonly serverBaseWsUrl: string, ...},
signal: AbortSignal,
) {
const device = await createDeviceMock(
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-middleware/src/inspector-proxy/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export default class Device {
// Logging reporting batches of cdp messages
#cdpDebugLogging: CdpDebugLogging;

+#experiments: Experiments;
readonly #experiments: Experiments;

constructor(deviceOptions: DeviceOptions) {
this.#experiments = deviceOptions.experiments;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default class InspectorProxy implements InspectorProxyQueries {

#eventReporter: ?EventReporter;

+#experiments: Experiments;
readonly #experiments: Experiments;

// custom message handler factory allowing implementers to handle unsupported CDP messages.
#customMessageHandler: ?CreateCustomMessageHandlerFn;
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-middleware/src/inspector-proxy/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export type JSONSerializable =
| string
| null
| ReadonlyArray<JSONSerializable>
| {+[string]: JSONSerializable};
| {readonly [string]: JSONSerializable};

export type DeepReadOnly<T> =
T extends ReadonlyArray<infer V>
Expand Down
9 changes: 6 additions & 3 deletions packages/dev-middleware/src/types/DevToolLauncher.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface DevToolLauncher {
* the host of dev-middleware. Implementations are responsible for rewriting
* this as necessary where the server is remote.
*/
+launchDebuggerAppWindow: (url: string) => Promise<void>;
readonly launchDebuggerAppWindow: (url: string) => Promise<void>;

/**
* Attempt to open a debugger frontend URL in a standalone shell window
Expand All @@ -47,7 +47,10 @@ export interface DevToolLauncher {
* the host of dev-middleware. Implementations are responsible for rewriting
* this as necessary where the server is remote.
*/
+launchDebuggerShell?: (url: string, windowKey: string) => Promise<void>;
readonly launchDebuggerShell?: (
url: string,
windowKey: string,
) => Promise<void>;

/**
* Attempt to prepare the debugger shell for use and returns a coded result
Expand All @@ -60,5 +63,5 @@ export interface DevToolLauncher {
* SHOULD NOT return a rejecting promise in any case, and instead SHOULD report
* errors via the returned result object.
*/
+prepareDebuggerShell?: () => Promise<DebuggerShellPreparationResult>;
readonly prepareDebuggerShell?: () => Promise<DebuggerShellPreparationResult>;
}
26 changes: 13 additions & 13 deletions packages/dev-middleware/src/types/ReadonlyURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface ReadonlyURLSearchParams {
get(name: string): string | null;
getAll(name: string): Array<string>;
has(name: string, value?: string): boolean;
+size: number;
readonly size: number;
entries(): Iterator<[string, string]>;
keys(): Iterator<string>;
values(): Iterator<string>;
Expand All @@ -37,18 +37,18 @@ export interface ReadonlyURLSearchParams {
* Used for URLs passed between module boundaries.
*/
export interface ReadonlyURL {
+hash: string;
+host: string;
+hostname: string;
+href: string;
+origin: string;
+password: string;
+pathname: string;
+port: string;
+protocol: string;
+search: string;
+searchParams: ReadonlyURLSearchParams;
+username: string;
readonly hash: string;
readonly host: string;
readonly hostname: string;
readonly href: string;
readonly origin: string;
readonly password: string;
readonly pathname: string;
readonly port: string;
readonly protocol: string;
readonly search: string;
readonly searchParams: ReadonlyURLSearchParams;
readonly username: string;
toString(): string;
toJSON(): string;
}
Loading