Skip to content

Commit 7ec27c4

Browse files
chore(deps): update all devdependencies (#11321)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Lenz Weber-Tronic <[email protected]> Co-authored-by: phryneas <[email protected]>
1 parent 83661c3 commit 7ec27c4

File tree

5 files changed

+46
-52
lines changed

5 files changed

+46
-52
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: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ export function profile<
114114
);
115115
}
116116
snapshotRef.current = snap(
117-
typeof snapshotRef.current === "object"
118-
? // "cheap best effort" to prevent accidental mutation of the last snapshot
119-
{ ...snapshotRef.current! }
120-
: snapshotRef.current!
117+
typeof snapshotRef.current === "object" ?
118+
// "cheap best effort" to prevent accidental mutation of the last snapshot
119+
{ ...snapshotRef.current! }
120+
: snapshotRef.current!
121121
);
122122
} else {
123123
snapshotRef.current = snap;
@@ -127,9 +127,9 @@ export function profile<
127127
const mergeSnapshot: MergeSnapshot<Snapshot> = (partialSnapshot) => {
128128
replaceSnapshot((snapshot) => ({
129129
...snapshot,
130-
...(typeof partialSnapshot === "function"
131-
? partialSnapshot(snapshot)
132-
: partialSnapshot),
130+
...(typeof partialSnapshot === "function" ?
131+
partialSnapshot(snapshot)
132+
: partialSnapshot),
133133
}));
134134
};
135135

@@ -166,9 +166,8 @@ export function profile<
166166
});
167167

168168
const snapshot = snapshotRef.current as Snapshot;
169-
const domSnapshot = snapshotDOM
170-
? window.document.body.innerHTML
171-
: undefined;
169+
const domSnapshot =
170+
snapshotDOM ? window.document.body.innerHTML : undefined;
172171
const render = new RenderInstance(baseRender, snapshot, domSnapshot);
173172
Profiled.renders.push(render);
174173
resolveNextRender?.(render);
@@ -297,19 +296,16 @@ export class WaitForRenderTimeoutError extends Error {
297296
type StringReplaceRenderWithSnapshot<T extends string> =
298297
T extends `${infer Pre}Render${infer Post}` ? `${Pre}Snapshot${Post}` : T;
299298

300-
type ResultReplaceRenderWithSnapshot<T> = T extends (
301-
...args: infer Args
302-
) => Render<infer Snapshot>
303-
? (...args: Args) => Snapshot
304-
: T extends (...args: infer Args) => Promise<Render<infer Snapshot>>
305-
? (...args: Args) => Promise<Snapshot>
299+
type ResultReplaceRenderWithSnapshot<T> =
300+
T extends (...args: infer Args) => Render<infer Snapshot> ?
301+
(...args: Args) => Snapshot
302+
: T extends (...args: infer Args) => Promise<Render<infer Snapshot>> ?
303+
(...args: Args) => Promise<Snapshot>
306304
: T;
307305

308-
type ProfiledHookFields<Props, ReturnValue> = ProfiledComponentFields<
309-
Props,
310-
ReturnValue
311-
> extends infer PC
312-
? {
306+
type ProfiledHookFields<Props, ReturnValue> =
307+
ProfiledComponentFields<Props, ReturnValue> extends infer PC ?
308+
{
313309
[K in keyof PC as StringReplaceRenderWithSnapshot<
314310
K & string
315311
>]: ResultReplaceRenderWithSnapshot<PC[K]>;

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/ProfiledComponent.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ export const toRerender: MatcherFunction<[options?: NextRenderOptions]> =
1111
| ProfiledComponent<any, any>
1212
| ProfiledHook<any, any>;
1313
const profiled =
14-
"ProfiledComponent" in _profiled
15-
? _profiled.ProfiledComponent
16-
: _profiled;
14+
"ProfiledComponent" in _profiled ?
15+
_profiled.ProfiledComponent
16+
: _profiled;
1717
const hint = this.utils.matcherHint("toRerender");
1818
let pass = true;
1919
try {

src/testing/matchers/index.d.ts

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

32-
toRerender: T extends ProfiledComponent<any, any> | ProfiledHook<any, any>
33-
? (options?: NextRenderOptions) => Promise<R>
34-
: { error: "matcher needs to be called on a ProfiledComponent instance" };
32+
toRerender: T extends ProfiledComponent<any, any> | ProfiledHook<any, any> ?
33+
(options?: NextRenderOptions) => Promise<R>
34+
: { error: "matcher needs to be called on a ProfiledComponent instance" };
3535

36-
toRenderExactlyTimes: T extends
37-
| ProfiledComponent<any, any>
38-
| ProfiledHook<any, any>
39-
? (count: number, options?: NextRenderOptions) => Promise<R>
40-
: { error: "matcher needs to be called on a ProfiledComponent instance" };
36+
toRenderExactlyTimes: T extends (
37+
ProfiledComponent<any, any> | ProfiledHook<any, any>
38+
) ?
39+
(count: number, options?: NextRenderOptions) => Promise<R>
40+
: { error: "matcher needs to be called on a ProfiledComponent instance" };
4141
}
4242

4343
declare global {

0 commit comments

Comments
 (0)