Skip to content

Commit 4f00fae

Browse files
committed
fix: toMatchSnapshot missing
1 parent a34dae2 commit 4f00fae

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

apps/playground/tsconfig.app.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,7 @@
2525
"src/**/*.spec.jsx",
2626
"src/test-setup.ts"
2727
],
28-
"include": [
29-
"src/**/*.ts",
30-
"src/**/*.tsx",
31-
"src/**/*.js",
32-
"src/**/*.jsx",
33-
"react-native-harness.d.ts"
34-
],
28+
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.js", "src/**/*.jsx"],
3529
"references": [
3630
{
3731
"path": "../../packages/platform-vega/tsconfig.lib.json"

packages/jest/tsconfig.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
{
77
"path": "../cli"
88
},
9-
{
10-
"path": "../bundler-metro"
11-
},
129
{
1310
"path": "../tools"
1411
},
@@ -18,6 +15,9 @@
1815
{
1916
"path": "../config"
2017
},
18+
{
19+
"path": "../bundler-metro"
20+
},
2121
{
2222
"path": "../bridge"
2323
},

packages/runtime/src/expect/matchers/toMatchImageSnapshot.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ import {
66
} from '@react-native-harness/bridge';
77
import { getHarnessContext } from '../../runner/index.js';
88

9-
declare module '@vitest/expect' {
10-
interface Matchers {
11-
toMatchImageSnapshot(options: ImageSnapshotOptions): Promise<void>;
12-
}
13-
}
14-
159
type ScreenshotResult = {
1610
data: Uint8Array;
1711
width: number;

packages/runtime/src/globals.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { ImageSnapshotOptions } from '@react-native-harness/bridge';
2+
13
export type HarnessGlobal = {
24
appRegistryComponentName: string;
35
webSocketPort?: number;
@@ -7,6 +9,16 @@ declare global {
79
var RN_HARNESS: HarnessGlobal | undefined;
810
}
911

12+
declare module '@vitest/expect' {
13+
interface Matchers {
14+
/**
15+
* Match the received screenshot against a stored snapshot.
16+
* Creates a new snapshot if one doesn't exist.
17+
*/
18+
toMatchImageSnapshot(options: ImageSnapshotOptions): Promise<void>;
19+
}
20+
}
21+
1022
export const getHarnessGlobal = (): HarnessGlobal => {
1123
const harnessGlobal = global.RN_HARNESS;
1224

packages/runtime/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import './polyfills.js';
2-
import './globals.d.ts';
2+
import './globals.js';
33

44
export { UI as ReactNativeHarness } from './ui/index.js';
55
export * from './spy/index.js';

0 commit comments

Comments
 (0)