-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathglobals.ts
More file actions
31 lines (25 loc) · 747 Bytes
/
globals.ts
File metadata and controls
31 lines (25 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import type { ImageSnapshotOptions } from '@react-native-harness/bridge';
export type HarnessGlobal = {
appRegistryComponentName: string;
webSocketPort?: number;
disableViewFlattening?: boolean;
};
declare global {
var RN_HARNESS: HarnessGlobal | undefined;
}
declare module '@vitest/expect' {
interface Matchers {
/**
* Match the received screenshot against a stored snapshot.
* Creates a new snapshot if one doesn't exist.
*/
toMatchImageSnapshot(options: ImageSnapshotOptions): Promise<void>;
}
}
export const getHarnessGlobal = (): HarnessGlobal => {
const harnessGlobal = global.RN_HARNESS;
if (!harnessGlobal) {
throw new Error('RN_HARNESS global is not set');
}
return harnessGlobal;
};