Skip to content

Commit 5a4f130

Browse files
committed
Merge remote-tracking branch 'origin/main' into release-3.9
2 parents f541cc0 + 7ec27c4 commit 5a4f130

File tree

4 files changed

+30
-33
lines changed

4 files changed

+30
-33
lines changed

src/testing/internal/profile/Render.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ export interface BaseRender {
3030
type Screen = typeof screen;
3131
/** @internal */
3232
export type SyncScreen = {
33-
[K in keyof Screen]: K extends `find${string}`
34-
? {
35-
/** @deprecated A snapshot is static, so avoid async queries! */
36-
(...args: Parameters<Screen[K]>): ReturnType<Screen[K]>;
37-
}
38-
: Screen[K];
33+
[K in keyof Screen]: K extends `find${string}` ?
34+
{
35+
/** @deprecated A snapshot is static, so avoid async queries! */
36+
(...args: Parameters<Screen[K]>): ReturnType<Screen[K]>;
37+
}
38+
: Screen[K];
3939
};
4040

4141
/** @internal */

src/testing/internal/profile/profile.tsx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ export function createProfiler<Snapshot extends ValidSnapshot = void>({
163163
);
164164
}
165165
snapshotRef.current = snap(
166-
typeof snapshotRef.current === "object"
167-
? // "cheap best effort" to prevent accidental mutation of the last snapshot
168-
{ ...snapshotRef.current! }
169-
: snapshotRef.current!
166+
typeof snapshotRef.current === "object" ?
167+
// "cheap best effort" to prevent accidental mutation of the last snapshot
168+
{ ...snapshotRef.current! }
169+
: snapshotRef.current!
170170
);
171171
} else {
172172
snapshotRef.current = snap;
@@ -176,9 +176,9 @@ export function createProfiler<Snapshot extends ValidSnapshot = void>({
176176
const mergeSnapshot: MergeSnapshot<Snapshot> = (partialSnapshot) => {
177177
replaceSnapshot((snapshot) => ({
178178
...snapshot,
179-
...(typeof partialSnapshot === "function"
180-
? partialSnapshot(snapshot)
181-
: partialSnapshot),
179+
...(typeof partialSnapshot === "function" ?
180+
partialSnapshot(snapshot)
181+
: partialSnapshot),
182182
}));
183183
};
184184

@@ -366,12 +366,11 @@ export class WaitForRenderTimeoutError extends Error {
366366
type StringReplaceRenderWithSnapshot<T extends string> =
367367
T extends `${infer Pre}Render${infer Post}` ? `${Pre}Snapshot${Post}` : T;
368368

369-
type ResultReplaceRenderWithSnapshot<T> = T extends (
370-
...args: infer Args
371-
) => Render<infer Snapshot>
372-
? (...args: Args) => Snapshot
373-
: T extends (...args: infer Args) => Promise<Render<infer Snapshot>>
374-
? (...args: Args) => Promise<Snapshot>
369+
type ResultReplaceRenderWithSnapshot<T> =
370+
T extends (...args: infer Args) => Render<infer Snapshot> ?
371+
(...args: Args) => Snapshot
372+
: T extends (...args: infer Args) => Promise<Render<infer Snapshot>> ?
373+
(...args: Args) => Promise<Snapshot>
375374
: T;
376375

377376
type ProfiledHookFields<ReturnValue> =

src/testing/internal/profile/traces.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ export function captureStackTrace(callingFunction?: string | (() => {})) {
1111
}
1212

1313
const callerName =
14-
typeof callingFunction === "string"
15-
? callingFunction
16-
: callingFunction
17-
? callingFunction.name
18-
: undefined;
14+
typeof callingFunction === "string" ? callingFunction
15+
: callingFunction ? callingFunction.name
16+
: undefined;
1917

2018
if (callerName && stack.includes(callerName)) {
2119
const lines = stack.split("\n");

src/testing/matchers/index.d.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ interface ApolloCustomMatchers<R = void, T = {}> {
2020
/**
2121
* Used to determine if the Suspense cache has a cache entry.
2222
*/
23-
toHaveSuspenseCacheEntryUsing: T extends ApolloClient<any>
24-
? (
25-
query: DocumentNode,
26-
options?: {
27-
variables?: OperationVariables;
28-
queryKey?: string | number | any[];
29-
}
30-
) => R
31-
: { error: "matcher needs to be called on an ApolloClient instance" };
23+
toHaveSuspenseCacheEntryUsing: T extends ApolloClient<any> ?
24+
(
25+
query: DocumentNode,
26+
options?: {
27+
variables?: OperationVariables;
28+
queryKey?: string | number | any[];
29+
}
30+
) => R
31+
: { error: "matcher needs to be called on an ApolloClient instance" };
3232

3333
toRerender: T extends
3434
| Profiler<any, any>

0 commit comments

Comments
 (0)