@react-native-harness/runtime 1.0.0-canary.1766225407244 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/harness-module-system.js +73 -0
- package/dist/NativeHarness.d.ts +41 -0
- package/dist/NativeHarness.d.ts.map +1 -0
- package/dist/NativeHarness.js +2 -0
- package/dist/bundler/errors.d.ts.map +1 -1
- package/dist/bundler/errors.js +2 -1
- package/dist/bundler/evaluate.js +1 -1
- package/dist/client/factory.d.ts.map +1 -1
- package/dist/client/factory.js +8 -2
- package/dist/client/getDeviceDescriptor.d.ts +1 -1
- package/dist/client/getDeviceDescriptor.d.ts.map +1 -1
- package/dist/client/getDeviceDescriptor.js +8 -0
- package/dist/client/getWSServer.d.ts.map +1 -1
- package/dist/client/getWSServer.js +2 -1
- package/dist/client/store.d.ts +4 -0
- package/dist/client/store.d.ts.map +1 -0
- package/dist/client/store.js +10 -0
- package/dist/disableHMRWhenReady.d.ts +2 -0
- package/dist/disableHMRWhenReady.d.ts.map +1 -0
- package/dist/disableHMRWhenReady.js +26 -0
- package/dist/entry-point.js +8 -2
- package/dist/expect/expect.d.ts +9 -0
- package/dist/expect/expect.d.ts.map +1 -0
- package/dist/expect/expect.js +77 -0
- package/dist/expect/index.d.ts +1 -8
- package/dist/expect/index.d.ts.map +1 -1
- package/dist/expect/index.js +1 -73
- package/dist/expect/matchers/toMatchImageSnapshot.d.ts +13 -0
- package/dist/expect/matchers/toMatchImageSnapshot.d.ts.map +1 -0
- package/dist/expect/matchers/toMatchImageSnapshot.js +23 -0
- package/dist/globals.d.ts +12 -0
- package/dist/globals.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/initialize.js +2 -3
- package/dist/jsx/jsx-dev-runtime.d.ts +3 -0
- package/dist/jsx/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/jsx/jsx-dev-runtime.js +11 -0
- package/dist/jsx/jsx-runtime.d.ts +4 -0
- package/dist/jsx/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx/jsx-runtime.js +19 -0
- package/dist/mocker/index.d.ts +1 -1
- package/dist/mocker/index.d.ts.map +1 -1
- package/dist/mocker/index.js +1 -1
- package/dist/mocker/registry.d.ts +0 -1
- package/dist/mocker/registry.d.ts.map +1 -1
- package/dist/mocker/registry.js +19 -16
- package/dist/polyfills.d.ts +11 -0
- package/dist/polyfills.d.ts.map +1 -0
- package/dist/polyfills.js +13 -0
- package/dist/render/TestComponentOverlay.d.ts.map +1 -1
- package/dist/render/TestComponentOverlay.js +21 -2
- package/dist/render/index.d.ts.map +1 -1
- package/dist/render/index.js +8 -6
- package/dist/render/queries.d.ts +7 -0
- package/dist/render/queries.d.ts.map +1 -0
- package/dist/render/queries.js +99 -0
- package/dist/runHarnessTestsInModule.d.ts +9 -0
- package/dist/runHarnessTestsInModule.d.ts.map +1 -0
- package/dist/runHarnessTestsInModule.js +57 -0
- package/dist/runner/context.d.ts +10 -0
- package/dist/runner/context.d.ts.map +1 -0
- package/dist/runner/context.js +6 -0
- package/dist/runner/factory.d.ts.map +1 -1
- package/dist/runner/factory.js +6 -1
- package/dist/runner/index.d.ts +1 -0
- package/dist/runner/index.d.ts.map +1 -1
- package/dist/runner/index.js +1 -0
- package/dist/runner/runSuite.d.ts +3 -0
- package/dist/runner/runSuite.d.ts.map +1 -1
- package/dist/runner/types.d.ts +6 -1
- package/dist/runner/types.d.ts.map +1 -1
- package/dist/screen/index.d.ts +50 -0
- package/dist/screen/index.d.ts.map +1 -0
- package/dist/screen/index.js +46 -0
- package/dist/symbolicate.d.ts +14 -0
- package/dist/symbolicate.d.ts.map +1 -1
- package/dist/symbolicate.js +12 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/ui/ReadyScreen.d.ts.map +1 -1
- package/dist/ui/ReadyScreen.js +1 -1
- package/dist/userEvent/index.d.ts +16 -0
- package/dist/userEvent/index.d.ts.map +1 -0
- package/dist/userEvent/index.js +31 -0
- package/dist/utils/dev-server.d.ts.map +1 -1
- package/dist/utils/dev-server.js +5 -0
- package/dist/utils/hmr.d.ts +2 -0
- package/dist/utils/hmr.d.ts.map +1 -0
- package/dist/utils/hmr.js +3 -0
- package/dist/utils/parse-error-stack.d.ts +9 -0
- package/dist/utils/parse-error-stack.d.ts.map +1 -0
- package/dist/utils/parse-error-stack.js +56 -0
- package/out-tsc/vitest/src/__tests__/collector.test.d.ts +2 -0
- package/out-tsc/vitest/src/__tests__/collector.test.d.ts.map +1 -0
- package/out-tsc/vitest/src/__tests__/error-handling.test.d.ts +2 -0
- package/out-tsc/vitest/src/__tests__/error-handling.test.d.ts.map +1 -0
- package/out-tsc/vitest/src/__tests__/expect.test.d.ts +2 -0
- package/out-tsc/vitest/src/__tests__/expect.test.d.ts.map +1 -0
- package/out-tsc/vitest/src/__tests__/initialize.test.d.ts +2 -0
- package/out-tsc/vitest/src/__tests__/initialize.test.d.ts.map +1 -0
- package/out-tsc/vitest/src/__tests__/spy.test.d.ts +2 -0
- package/out-tsc/vitest/src/__tests__/spy.test.d.ts.map +1 -0
- package/out-tsc/vitest/src/bundler/bundle.d.ts +2 -0
- package/out-tsc/vitest/src/bundler/bundle.d.ts.map +1 -0
- package/out-tsc/vitest/src/bundler/errors.d.ts +15 -0
- package/out-tsc/vitest/src/bundler/errors.d.ts.map +1 -0
- package/out-tsc/vitest/src/bundler/evaluate.d.ts +2 -0
- package/out-tsc/vitest/src/bundler/evaluate.d.ts.map +1 -0
- package/out-tsc/vitest/src/bundler/factory.d.ts +3 -0
- package/out-tsc/vitest/src/bundler/factory.d.ts.map +1 -0
- package/out-tsc/vitest/src/bundler/index.d.ts +4 -0
- package/out-tsc/vitest/src/bundler/index.d.ts.map +1 -0
- package/out-tsc/vitest/src/bundler/types.d.ts +7 -0
- package/out-tsc/vitest/src/bundler/types.d.ts.map +1 -0
- package/{dist/runtime.d.ts → out-tsc/vitest/src/client/factory.d.ts} +1 -1
- package/out-tsc/vitest/src/client/factory.d.ts.map +1 -0
- package/out-tsc/vitest/src/client/getDeviceDescriptor.d.ts +8 -0
- package/out-tsc/vitest/src/client/getDeviceDescriptor.d.ts.map +1 -0
- package/out-tsc/vitest/src/client/getWSServer.d.ts +2 -0
- package/out-tsc/vitest/src/client/getWSServer.d.ts.map +1 -0
- package/out-tsc/vitest/src/client/index.d.ts +2 -0
- package/out-tsc/vitest/src/client/index.d.ts.map +1 -0
- package/out-tsc/vitest/src/client/setup-files.d.ts +12 -0
- package/out-tsc/vitest/src/client/setup-files.d.ts.map +1 -0
- package/out-tsc/vitest/src/client/store.d.ts +4 -0
- package/out-tsc/vitest/src/client/store.d.ts.map +1 -0
- package/out-tsc/vitest/src/collector/errors.d.ts +8 -0
- package/out-tsc/vitest/src/collector/errors.d.ts.map +1 -0
- package/out-tsc/vitest/src/collector/factory.d.ts +3 -0
- package/out-tsc/vitest/src/collector/factory.d.ts.map +1 -0
- package/{dist/rntl/describe.d.ts → out-tsc/vitest/src/collector/functions.d.ts} +4 -21
- package/out-tsc/vitest/src/collector/functions.d.ts.map +1 -0
- package/out-tsc/vitest/src/collector/index.d.ts +5 -0
- package/out-tsc/vitest/src/collector/index.d.ts.map +1 -0
- package/out-tsc/vitest/src/collector/types.d.ts +10 -0
- package/out-tsc/vitest/src/collector/types.d.ts.map +1 -0
- package/out-tsc/vitest/src/collector/validation.d.ts +4 -0
- package/out-tsc/vitest/src/collector/validation.d.ts.map +1 -0
- package/out-tsc/vitest/src/constants.d.ts +2 -0
- package/out-tsc/vitest/src/constants.d.ts.map +1 -0
- package/out-tsc/vitest/src/disableHMRWhenReady.d.ts +2 -0
- package/out-tsc/vitest/src/disableHMRWhenReady.d.ts.map +1 -0
- package/out-tsc/vitest/src/entry-point.d.ts +2 -0
- package/out-tsc/vitest/src/entry-point.d.ts.map +1 -0
- package/out-tsc/vitest/src/errors.d.ts +6 -0
- package/out-tsc/vitest/src/errors.d.ts.map +1 -0
- package/out-tsc/vitest/src/expect/expect.d.ts +9 -0
- package/out-tsc/vitest/src/expect/expect.d.ts.map +1 -0
- package/out-tsc/vitest/src/expect/index.d.ts +2 -0
- package/out-tsc/vitest/src/expect/index.d.ts.map +1 -0
- package/out-tsc/vitest/src/expect/matchers/toMatchImageSnapshot.d.ts +13 -0
- package/out-tsc/vitest/src/expect/matchers/toMatchImageSnapshot.d.ts.map +1 -0
- package/out-tsc/vitest/src/expect/setup.d.ts +2 -0
- package/out-tsc/vitest/src/expect/setup.d.ts.map +1 -0
- package/out-tsc/vitest/src/filtering/index.d.ts +2 -0
- package/out-tsc/vitest/src/filtering/index.d.ts.map +1 -0
- package/out-tsc/vitest/src/filtering/testNameFilter.d.ts +12 -0
- package/out-tsc/vitest/src/filtering/testNameFilter.d.ts.map +1 -0
- package/out-tsc/vitest/src/globals.d.ts +20 -0
- package/out-tsc/vitest/src/globals.d.ts.map +1 -0
- package/out-tsc/vitest/src/index.d.ts +11 -0
- package/out-tsc/vitest/src/index.d.ts.map +1 -0
- package/out-tsc/vitest/src/initialize.d.ts +2 -0
- package/out-tsc/vitest/src/initialize.d.ts.map +1 -0
- package/out-tsc/vitest/src/jest-mock.d.ts +2 -0
- package/out-tsc/vitest/src/jest-mock.d.ts.map +1 -0
- package/out-tsc/vitest/src/jsx/jsx-dev-runtime.d.ts +3 -0
- package/out-tsc/vitest/src/jsx/jsx-dev-runtime.d.ts.map +1 -0
- package/out-tsc/vitest/src/jsx/jsx-runtime.d.ts +4 -0
- package/out-tsc/vitest/src/jsx/jsx-runtime.d.ts.map +1 -0
- package/out-tsc/vitest/src/mocker/index.d.ts +2 -0
- package/out-tsc/vitest/src/mocker/index.d.ts.map +1 -0
- package/out-tsc/vitest/src/mocker/registry.d.ts +6 -0
- package/out-tsc/vitest/src/mocker/registry.d.ts.map +1 -0
- package/out-tsc/vitest/src/mocker/types.d.ts +6 -0
- package/out-tsc/vitest/src/mocker/types.d.ts.map +1 -0
- package/out-tsc/vitest/src/namespace.d.ts +18 -0
- package/out-tsc/vitest/src/namespace.d.ts.map +1 -0
- package/out-tsc/vitest/src/polyfills.d.ts +11 -0
- package/out-tsc/vitest/src/polyfills.d.ts.map +1 -0
- package/out-tsc/vitest/src/render/ErrorBoundary.d.ts +17 -0
- package/out-tsc/vitest/src/render/ErrorBoundary.d.ts.map +1 -0
- package/out-tsc/vitest/src/render/TestComponentOverlay.d.ts +3 -0
- package/out-tsc/vitest/src/render/TestComponentOverlay.d.ts.map +1 -0
- package/out-tsc/vitest/src/render/cleanup.d.ts +2 -0
- package/out-tsc/vitest/src/render/cleanup.d.ts.map +1 -0
- package/out-tsc/vitest/src/render/index.d.ts +6 -0
- package/out-tsc/vitest/src/render/index.d.ts.map +1 -0
- package/out-tsc/vitest/src/render/setup.d.ts +2 -0
- package/out-tsc/vitest/src/render/setup.d.ts.map +1 -0
- package/out-tsc/vitest/src/render/types.d.ts +12 -0
- package/out-tsc/vitest/src/render/types.d.ts.map +1 -0
- package/out-tsc/vitest/src/runner/context.d.ts +10 -0
- package/out-tsc/vitest/src/runner/context.d.ts.map +1 -0
- package/out-tsc/vitest/src/runner/errors.d.ts +11 -0
- package/out-tsc/vitest/src/runner/errors.d.ts.map +1 -0
- package/out-tsc/vitest/src/runner/factory.d.ts +3 -0
- package/out-tsc/vitest/src/runner/factory.d.ts.map +1 -0
- package/out-tsc/vitest/src/runner/hooks.d.ts +4 -0
- package/out-tsc/vitest/src/runner/hooks.d.ts.map +1 -0
- package/out-tsc/vitest/src/runner/index.d.ts +5 -0
- package/out-tsc/vitest/src/runner/index.d.ts.map +1 -0
- package/out-tsc/vitest/src/runner/runSuite.d.ts +7 -0
- package/out-tsc/vitest/src/runner/runSuite.d.ts.map +1 -0
- package/out-tsc/vitest/src/runner/types.d.ts +18 -0
- package/out-tsc/vitest/src/runner/types.d.ts.map +1 -0
- package/out-tsc/vitest/src/screen/index.d.ts +8 -0
- package/out-tsc/vitest/src/screen/index.d.ts.map +1 -0
- package/out-tsc/vitest/src/spy/index.d.ts +2 -0
- package/out-tsc/vitest/src/spy/index.d.ts.map +1 -0
- package/out-tsc/vitest/src/symbolicate.d.ts +17 -0
- package/out-tsc/vitest/src/symbolicate.d.ts.map +1 -0
- package/out-tsc/vitest/src/ui/ReadyScreen.d.ts +2 -0
- package/out-tsc/vitest/src/ui/ReadyScreen.d.ts.map +1 -0
- package/out-tsc/vitest/src/ui/WrongEnvironmentScreen.d.ts +2 -0
- package/out-tsc/vitest/src/ui/WrongEnvironmentScreen.d.ts.map +1 -0
- package/out-tsc/vitest/src/ui/index.d.ts +2 -0
- package/out-tsc/vitest/src/ui/index.d.ts.map +1 -0
- package/out-tsc/vitest/src/ui/state.d.ts +20 -0
- package/out-tsc/vitest/src/ui/state.d.ts.map +1 -0
- package/out-tsc/vitest/src/userEvent/index.d.ts +6 -0
- package/out-tsc/vitest/src/userEvent/index.d.ts.map +1 -0
- package/out-tsc/vitest/src/utils/dev-server.d.ts +2 -0
- package/out-tsc/vitest/src/utils/dev-server.d.ts.map +1 -0
- package/out-tsc/vitest/src/utils/emitter.d.ts +16 -0
- package/out-tsc/vitest/src/utils/emitter.d.ts.map +1 -0
- package/out-tsc/vitest/src/waitFor.d.ts +21 -0
- package/out-tsc/vitest/src/waitFor.d.ts.map +1 -0
- package/out-tsc/vitest/tsconfig.spec.tsbuildinfo +1 -0
- package/out-tsc/vitest/vite.config.d.ts +3 -0
- package/out-tsc/vitest/vite.config.d.ts.map +1 -0
- package/package.json +30 -9
- package/src/bundler/errors.ts +2 -1
- package/src/bundler/evaluate.ts +1 -1
- package/src/client/factory.ts +9 -2
- package/src/client/getDeviceDescriptor.ts +10 -1
- package/src/client/getWSServer.ts +2 -1
- package/src/client/store.ts +16 -0
- package/src/disableHMRWhenReady.ts +35 -0
- package/src/entry-point.ts +10 -5
- package/src/expect/expect.ts +127 -0
- package/src/expect/index.ts +1 -123
- package/src/expect/matchers/toMatchImageSnapshot.ts +50 -0
- package/src/globals.ts +14 -0
- package/src/index.ts +2 -1
- package/src/initialize.ts +5 -5
- package/src/jsx/jsx-dev-runtime.ts +29 -0
- package/src/jsx/jsx-runtime.ts +38 -0
- package/src/mocker/index.ts +0 -1
- package/src/mocker/metro-require.d.ts +1 -1
- package/src/mocker/registry.ts +21 -18
- package/src/polyfills.ts +14 -0
- package/src/react-native.d.ts +0 -27
- package/src/render/TestComponentOverlay.tsx +22 -2
- package/src/render/index.ts +8 -6
- package/src/runner/context.ts +16 -0
- package/src/runner/factory.ts +7 -1
- package/src/runner/index.ts +5 -0
- package/src/runner/runSuite.ts +4 -0
- package/src/runner/types.ts +7 -1
- package/src/symbolicate.ts +35 -4
- package/src/ui/ReadyScreen.tsx +1 -0
- package/src/utils/dev-server.ts +7 -0
- package/tsconfig.lib.json +2 -1
- package/assets/moduleSystem.flow.js +0 -1082
- package/dist/collection.d.ts +0 -39
- package/dist/collection.d.ts.map +0 -1
- package/dist/collection.js +0 -224
- package/dist/getEntryComponent.d.ts +0 -6
- package/dist/getEntryComponent.d.ts.map +0 -1
- package/dist/getEntryComponent.js +0 -6
- package/dist/module.d.ts +0 -3
- package/dist/module.d.ts.map +0 -1
- package/dist/module.js +0 -26
- package/dist/module.web.d.ts +0 -2
- package/dist/module.web.d.ts.map +0 -1
- package/dist/module.web.js +0 -12
- package/dist/package.json +0 -37
- package/dist/rntl/client.d.ts +0 -3
- package/dist/rntl/client.d.ts.map +0 -1
- package/dist/rntl/client.js +0 -8
- package/dist/rntl/describe.d.ts.map +0 -1
- package/dist/rntl/describe.js +0 -216
- package/dist/rntl/expect.d.ts +0 -11
- package/dist/rntl/expect.d.ts.map +0 -1
- package/dist/rntl/expect.js +0 -19
- package/dist/rntl/fn.d.ts +0 -2
- package/dist/rntl/fn.d.ts.map +0 -1
- package/dist/rntl/fn.js +0 -1
- package/dist/rntl/render.d.ts +0 -4
- package/dist/rntl/render.d.ts.map +0 -1
- package/dist/rntl/render.js +0 -11
- package/dist/rntl/screen.d.ts +0 -45
- package/dist/rntl/screen.d.ts.map +0 -1
- package/dist/rntl/screen.js +0 -31
- package/dist/rntl/userEvent.d.ts +0 -22
- package/dist/rntl/userEvent.d.ts.map +0 -1
- package/dist/rntl/userEvent.js +0 -19
- package/dist/runner.d.ts +0 -4
- package/dist/runner.d.ts.map +0 -1
- package/dist/runner.js +0 -115
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js +0 -39
- package/dist/state.d.ts +0 -25
- package/dist/state.d.ts.map +0 -1
- package/dist/state.js +0 -37
- package/dist/ui/UI.d.ts +0 -13
- package/dist/ui/UI.d.ts.map +0 -1
- package/dist/ui/UI.js +0 -121
- package/src/__tests__/expect.test.ts +0 -627
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
// This file is a polyfill that monkey-patches the Metro module system
|
|
5
|
+
// to allow capturing nested require calls.
|
|
6
|
+
|
|
7
|
+
(function (globalObject) {
|
|
8
|
+
const myRequire = function (id) {
|
|
9
|
+
return globalObject.__r(id);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const myImportDefault = function (id) {
|
|
13
|
+
return globalObject.__r.importDefault(id);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const myImportAll = function (id) {
|
|
17
|
+
return globalObject.__r.importAll(id);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// Monkey-patch define
|
|
21
|
+
const originalDefine = globalObject.__d;
|
|
22
|
+
globalObject.__d = function (factory, moduleId, dependencyMap) {
|
|
23
|
+
const wrappedFactory = function (...args) {
|
|
24
|
+
// Standard Metro with import support (7 arguments)
|
|
25
|
+
// args: global, require, importDefault, importAll, module, exports, dependencyMap
|
|
26
|
+
const global = args[0];
|
|
27
|
+
const moduleObject = args[4];
|
|
28
|
+
const exports = args[5];
|
|
29
|
+
const depMap = args[6];
|
|
30
|
+
|
|
31
|
+
return factory(
|
|
32
|
+
global,
|
|
33
|
+
myRequire,
|
|
34
|
+
myImportDefault,
|
|
35
|
+
myImportAll,
|
|
36
|
+
moduleObject,
|
|
37
|
+
exports,
|
|
38
|
+
depMap
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Call the original define with the wrapped factory
|
|
43
|
+
return originalDefine.call(this, wrappedFactory, moduleId, dependencyMap);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
globalObject.__resetModule = function (moduleId) {
|
|
47
|
+
const module = globalObject.__r.getModules().get(moduleId);
|
|
48
|
+
|
|
49
|
+
if (!module) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module.hasError = false;
|
|
54
|
+
module.error = undefined;
|
|
55
|
+
module.isInitialized = false;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
globalObject.__resetModules = function () {
|
|
59
|
+
const modules = globalObject.__r.getModules();
|
|
60
|
+
|
|
61
|
+
modules.forEach(function (mod, moduleId) {
|
|
62
|
+
globalObject.__resetModule(moduleId);
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
})(
|
|
66
|
+
typeof globalThis !== 'undefined'
|
|
67
|
+
? globalThis
|
|
68
|
+
: typeof global !== 'undefined'
|
|
69
|
+
? global
|
|
70
|
+
: typeof window !== 'undefined'
|
|
71
|
+
? window
|
|
72
|
+
: this
|
|
73
|
+
);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type TurboModule } from 'react-native';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the position and dimensions of a view in screen coordinates (points/dp).
|
|
4
|
+
*/
|
|
5
|
+
export interface ViewInfo {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}
|
|
11
|
+
interface Spec extends TurboModule {
|
|
12
|
+
/**
|
|
13
|
+
* Simulates a native tap at the specified screen coordinates.
|
|
14
|
+
* Returns a promise that resolves when the tap action is complete.
|
|
15
|
+
*/
|
|
16
|
+
simulateTap(x: number, y: number): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Finds a view by its testID (accessibilityIdentifier on iOS, tag on Android).
|
|
19
|
+
* Returns null if no view is found.
|
|
20
|
+
*/
|
|
21
|
+
queryByTestId(testId: string): ViewInfo | null;
|
|
22
|
+
/**
|
|
23
|
+
* Finds all views by testID (accessibilityIdentifier on iOS, tag on Android).
|
|
24
|
+
* Returns an empty array if no views are found.
|
|
25
|
+
*/
|
|
26
|
+
queryAllByTestId(testId: string): ViewInfo[];
|
|
27
|
+
/**
|
|
28
|
+
* Finds a view by its accessibility label.
|
|
29
|
+
* Returns null if no view is found.
|
|
30
|
+
*/
|
|
31
|
+
queryByAccessibilityLabel(label: string): ViewInfo | null;
|
|
32
|
+
/**
|
|
33
|
+
* Finds all views by accessibility label.
|
|
34
|
+
* Returns an empty array if no views are found.
|
|
35
|
+
*/
|
|
36
|
+
queryAllByAccessibilityLabel(label: string): ViewInfo[];
|
|
37
|
+
}
|
|
38
|
+
export type HarnessModule = Spec;
|
|
39
|
+
declare const _default: Spec;
|
|
40
|
+
export default _default;
|
|
41
|
+
//# sourceMappingURL=NativeHarness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeHarness.d.ts","sourceRoot":"","sources":["../src/NativeHarness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,IAAK,SAAQ,WAAW;IAChC;;;OAGG;IACH,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjD;;;OAGG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;IAE/C;;;OAGG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAE,CAAC;IAE7C;;;OAGG;IACH,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;IAE1D;;;OAGG;IACH,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,EAAE,CAAC;CACzD;AAED,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC;;AAEjC,wBAAiE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/bundler/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,mBAAoB,SAAQ,KAAK;aAChB,UAAU,EAAE,MAAM;gBAAlB,UAAU,EAAE,MAAM;CAI/C;AAED,qBAAa,oBAAqB,SAAQ,KAAK;aAE3B,UAAU,EAAE,MAAM;aAClB,MAAM,EAAE,MAAM;gBADd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM;CAKjC;AAED,qBAAa,mBAAoB,SAAQ,KAAK;aAE1B,UAAU,EAAE,MAAM;aAClB,MAAM,EAAE,MAAM;gBADd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/bundler/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,mBAAoB,SAAQ,KAAK;aAChB,UAAU,EAAE,MAAM;gBAAlB,UAAU,EAAE,MAAM;CAI/C;AAED,qBAAa,oBAAqB,SAAQ,KAAK;aAE3B,UAAU,EAAE,MAAM;aAClB,MAAM,EAAE,MAAM;gBADd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM;CAKjC;AAED,qBAAa,mBAAoB,SAAQ,KAAK;aAE1B,UAAU,EAAE,MAAM;aAClB,MAAM,EAAE,MAAM;gBADd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM;CAMjC"}
|
package/dist/bundler/errors.js
CHANGED
|
@@ -20,7 +20,8 @@ export class BundlingFailedError extends Error {
|
|
|
20
20
|
modulePath;
|
|
21
21
|
reason;
|
|
22
22
|
constructor(modulePath, reason) {
|
|
23
|
-
|
|
23
|
+
const reasonMessage = JSON.parse(reason).message ?? reason;
|
|
24
|
+
super(`Bundling of ${modulePath} failed with error:\n\n${reasonMessage}\n`);
|
|
24
25
|
this.modulePath = modulePath;
|
|
25
26
|
this.reason = reason;
|
|
26
27
|
this.name = 'BundlingFailedError';
|
package/dist/bundler/evaluate.js
CHANGED
|
@@ -12,7 +12,7 @@ export const evaluateModule = (moduleJs, modulePath) => {
|
|
|
12
12
|
}
|
|
13
13
|
const moduleId = Number(__rParam);
|
|
14
14
|
// This is important as if module was already initialized, it would not be re-initialized
|
|
15
|
-
global.
|
|
15
|
+
global.__resetModule(moduleId);
|
|
16
16
|
// eslint-disable-next-line no-eval
|
|
17
17
|
eval(moduleJs);
|
|
18
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/client/factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/client/factory.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,SAAS,2EAsFrB,CAAC"}
|
package/dist/client/factory.js
CHANGED
|
@@ -8,13 +8,15 @@ import { getBundler, evaluateModule } from '../bundler/index.js';
|
|
|
8
8
|
import { markTestsAsSkippedByName } from '../filtering/index.js';
|
|
9
9
|
import { setup } from '../render/setup.js';
|
|
10
10
|
import { runSetupFiles } from './setup-files.js';
|
|
11
|
+
import { setClient } from './store.js';
|
|
11
12
|
export const getClient = async () => {
|
|
12
13
|
const client = await getBridgeClient(getWSServer(), {
|
|
13
14
|
runTests: async () => {
|
|
14
15
|
throw new Error('Not implemented');
|
|
15
16
|
},
|
|
16
17
|
});
|
|
17
|
-
client
|
|
18
|
+
setClient(client);
|
|
19
|
+
client.rpc.$functions.runTests = async (path, options) => {
|
|
18
20
|
if (store.getState().status === 'running') {
|
|
19
21
|
throw new Error('Already running tests');
|
|
20
22
|
}
|
|
@@ -55,7 +57,11 @@ export const getClient = async () => {
|
|
|
55
57
|
const processedTestSuite = options.testNamePattern
|
|
56
58
|
? markTestsAsSkippedByName(collectionResult.testSuite, options.testNamePattern)
|
|
57
59
|
: collectionResult.testSuite;
|
|
58
|
-
const result = await runner.run(
|
|
60
|
+
const result = await runner.run({
|
|
61
|
+
testSuite: processedTestSuite,
|
|
62
|
+
testFilePath: path,
|
|
63
|
+
runner: options.runner,
|
|
64
|
+
});
|
|
59
65
|
return result;
|
|
60
66
|
}
|
|
61
67
|
finally {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDeviceDescriptor.d.ts","sourceRoot":"","sources":["../../src/client/getDeviceDescriptor.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"getDeviceDescriptor.d.ts","sourceRoot":"","sources":["../../src/client/getDeviceDescriptor.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC;IAC7C,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAO,gBAwCtC,CAAC"}
|
|
@@ -4,6 +4,14 @@ const getPlatform = () => {
|
|
|
4
4
|
};
|
|
5
5
|
export const getDeviceDescriptor = () => {
|
|
6
6
|
const platform = getPlatform();
|
|
7
|
+
if (platform.OS === 'web') {
|
|
8
|
+
return {
|
|
9
|
+
platform: 'web',
|
|
10
|
+
manufacturer: '',
|
|
11
|
+
model: '',
|
|
12
|
+
osVersion: '',
|
|
13
|
+
};
|
|
14
|
+
}
|
|
7
15
|
if (platform.OS === 'ios') {
|
|
8
16
|
return {
|
|
9
17
|
platform: 'ios',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWSServer.d.ts","sourceRoot":"","sources":["../../src/client/getWSServer.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,QAAO,
|
|
1
|
+
{"version":3,"file":"getWSServer.d.ts","sourceRoot":"","sources":["../../src/client/getWSServer.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,QAAO,MAM9B,CAAC"}
|
|
@@ -3,5 +3,6 @@ import { WS_SERVER_PORT } from '../constants.js';
|
|
|
3
3
|
export const getWSServer = () => {
|
|
4
4
|
const devServerUrl = getDevServerUrl();
|
|
5
5
|
const hostname = devServerUrl.split('://')[1].split(':')[0];
|
|
6
|
-
|
|
6
|
+
const port = global.RN_HARNESS?.webSocketPort || WS_SERVER_PORT;
|
|
7
|
+
return `ws://${hostname}:${port}`;
|
|
7
8
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/client/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAIxE,eAAO,MAAM,SAAS,GAAI,QAAQ,YAAY,KAAG,IAEhD,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAO,YAOpC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
let clientInstance = null;
|
|
2
|
+
export const setClient = (client) => {
|
|
3
|
+
clientInstance = client;
|
|
4
|
+
};
|
|
5
|
+
export const getClientInstance = () => {
|
|
6
|
+
if (!clientInstance) {
|
|
7
|
+
throw new Error('Bridge client not initialized. This should not happen in normal operation.');
|
|
8
|
+
}
|
|
9
|
+
return clientInstance;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disableHMRWhenReady.d.ts","sourceRoot":"","sources":["../src/disableHMRWhenReady.ts"],"names":[],"mappings":"AAEA,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,IAAI,EACnB,WAAW,EAAE,MAAM,EACnB,UAAU,SAAK,iBA6BhB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Platform } from "react-native";
|
|
2
|
+
export function disableHMRWhenReady(disable, retriesLeft, retryDelay = 10) {
|
|
3
|
+
return new Promise((resolve, reject) => {
|
|
4
|
+
if (Platform.OS === 'web') {
|
|
5
|
+
// No HMR on web
|
|
6
|
+
resolve();
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
function attempt(remaining) {
|
|
10
|
+
try {
|
|
11
|
+
disable();
|
|
12
|
+
resolve();
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
if (remaining > 0 &&
|
|
16
|
+
error instanceof Error &&
|
|
17
|
+
error.message.includes('Expected HMRClient.setup() call at startup.')) {
|
|
18
|
+
setTimeout(() => attempt(remaining - 1), retryDelay);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
reject(error);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
attempt(retriesLeft);
|
|
25
|
+
});
|
|
26
|
+
}
|
package/dist/entry-point.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import { AppRegistry } from 'react-native';
|
|
1
|
+
import { AppRegistry, Platform } from 'react-native';
|
|
2
2
|
import { getHarnessGlobal } from './globals.js';
|
|
3
3
|
import { UI } from './ui/index.js';
|
|
4
|
-
|
|
4
|
+
const componentName = getHarnessGlobal().appRegistryComponentName;
|
|
5
|
+
AppRegistry.registerComponent(componentName, () => UI);
|
|
6
|
+
if (Platform.OS === 'web') {
|
|
7
|
+
AppRegistry.runApplication(componentName, {
|
|
8
|
+
rootTag: document.getElementById('root'),
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ExpectStatic } from '@vitest/expect';
|
|
2
|
+
import * as chai from 'chai';
|
|
3
|
+
import './setup.js';
|
|
4
|
+
export declare function createExpect(): ExpectStatic;
|
|
5
|
+
declare const globalExpect: ExpectStatic;
|
|
6
|
+
export { assert, should } from 'chai';
|
|
7
|
+
export { chai, globalExpect as expect };
|
|
8
|
+
export type { Assertion, AsymmetricMatchersContaining, DeeplyAllowMatchers, ExpectStatic, JestAssertion, Matchers, } from '@vitest/expect';
|
|
9
|
+
//# sourceMappingURL=expect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../src/expect/expect.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAa,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAS5E,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,OAAO,YAAY,CAAC;AAGpB,wBAAgB,YAAY,IAAI,YAAY,CAwF3C;AAED,QAAA,MAAM,YAAY,EAAE,YAA6B,CAAC;AAQlD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,YAAY,IAAI,MAAM,EAAE,CAAC;AAExC,YAAY,EACV,SAAS,EACT,4BAA4B,EAC5B,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,QAAQ,GACT,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// This is adapted version of https://github.com/vitest-dev/vitest/blob/main/packages/vitest/src/integrations/chai/index.ts
|
|
2
|
+
// Credits to Vitest team for the original implementation.
|
|
3
|
+
import { addCustomEqualityTesters, ASYMMETRIC_MATCHERS_OBJECT, customMatchers, getState, GLOBAL_EXPECT, setState, } from '@vitest/expect';
|
|
4
|
+
import * as chai from 'chai';
|
|
5
|
+
// Setup additional matchers
|
|
6
|
+
import './setup.js';
|
|
7
|
+
import { toMatchImageSnapshot } from './matchers/toMatchImageSnapshot.js';
|
|
8
|
+
export function createExpect() {
|
|
9
|
+
const expect = ((value, message) => {
|
|
10
|
+
const { assertionCalls } = getState(expect);
|
|
11
|
+
setState({ assertionCalls: assertionCalls + 1 }, expect);
|
|
12
|
+
return chai.expect(value, message);
|
|
13
|
+
});
|
|
14
|
+
Object.assign(expect, chai.expect);
|
|
15
|
+
Object.assign(expect, globalThis[ASYMMETRIC_MATCHERS_OBJECT]);
|
|
16
|
+
expect.getState = () => getState(expect);
|
|
17
|
+
expect.setState = (state) => setState(state, expect);
|
|
18
|
+
// @ts-expect-error global is not typed
|
|
19
|
+
const globalState = getState(globalThis[GLOBAL_EXPECT]) || {};
|
|
20
|
+
setState({
|
|
21
|
+
// this should also add "snapshotState" that is added conditionally
|
|
22
|
+
...globalState,
|
|
23
|
+
assertionCalls: 0,
|
|
24
|
+
isExpectingAssertions: false,
|
|
25
|
+
isExpectingAssertionsError: null,
|
|
26
|
+
expectedAssertionsNumber: null,
|
|
27
|
+
expectedAssertionsNumberErrorGen: null,
|
|
28
|
+
}, expect);
|
|
29
|
+
// @ts-expect-error untyped
|
|
30
|
+
expect.extend = (matchers) => chai.expect.extend(expect, matchers);
|
|
31
|
+
// @ts-expect-error untyped
|
|
32
|
+
expect.addEqualityTesters = (customTesters) => addCustomEqualityTesters(customTesters);
|
|
33
|
+
// @ts-expect-error untyped
|
|
34
|
+
expect.soft = (...args) => {
|
|
35
|
+
// @ts-expect-error private soft access
|
|
36
|
+
return expect(...args).withContext({ soft: true });
|
|
37
|
+
};
|
|
38
|
+
// @ts-expect-error untyped
|
|
39
|
+
expect.unreachable = (message) => {
|
|
40
|
+
chai.assert.fail(`expected${message ? ` "${message}" ` : ' '}not to be reached`);
|
|
41
|
+
};
|
|
42
|
+
function assertions(expected) {
|
|
43
|
+
const errorGen = () => new Error(`expected number of assertions to be ${expected}, but got ${expect.getState().assertionCalls}`);
|
|
44
|
+
if (Error.captureStackTrace) {
|
|
45
|
+
Error.captureStackTrace(errorGen(), assertions);
|
|
46
|
+
}
|
|
47
|
+
expect.setState({
|
|
48
|
+
expectedAssertionsNumber: expected,
|
|
49
|
+
expectedAssertionsNumberErrorGen: errorGen,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function hasAssertions() {
|
|
53
|
+
const error = new Error('expected any number of assertion, but got none');
|
|
54
|
+
if (Error.captureStackTrace) {
|
|
55
|
+
Error.captureStackTrace(error, hasAssertions);
|
|
56
|
+
}
|
|
57
|
+
expect.setState({
|
|
58
|
+
isExpectingAssertions: true,
|
|
59
|
+
isExpectingAssertionsError: error,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
chai.util.addMethod(expect, 'assertions', assertions);
|
|
63
|
+
chai.util.addMethod(expect, 'hasAssertions', hasAssertions);
|
|
64
|
+
expect.extend(customMatchers);
|
|
65
|
+
expect.extend({
|
|
66
|
+
toMatchImageSnapshot,
|
|
67
|
+
});
|
|
68
|
+
return expect;
|
|
69
|
+
}
|
|
70
|
+
const globalExpect = createExpect();
|
|
71
|
+
Object.defineProperty(globalThis, GLOBAL_EXPECT, {
|
|
72
|
+
value: globalExpect,
|
|
73
|
+
writable: true,
|
|
74
|
+
configurable: true,
|
|
75
|
+
});
|
|
76
|
+
export { assert, should } from 'chai';
|
|
77
|
+
export { chai, globalExpect as expect };
|
package/dist/expect/index.d.ts
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import * as chai from 'chai';
|
|
3
|
-
import './setup.js';
|
|
4
|
-
export declare function createExpect(): ExpectStatic;
|
|
5
|
-
declare const globalExpect: ExpectStatic;
|
|
6
|
-
export { assert, should } from 'chai';
|
|
7
|
-
export { chai, globalExpect as expect };
|
|
8
|
-
export type { Assertion, AsymmetricMatchersContaining, DeeplyAllowMatchers, ExpectStatic, JestAssertion, Matchers, } from '@vitest/expect';
|
|
1
|
+
export * from './expect.js';
|
|
9
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/expect/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/expect/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
package/dist/expect/index.js
CHANGED
|
@@ -1,73 +1 @@
|
|
|
1
|
-
|
|
2
|
-
// Credits to Vitest team for the original implementation.
|
|
3
|
-
import { addCustomEqualityTesters, ASYMMETRIC_MATCHERS_OBJECT, customMatchers, getState, GLOBAL_EXPECT, setState, } from '@vitest/expect';
|
|
4
|
-
import * as chai from 'chai';
|
|
5
|
-
// Setup additional matchers
|
|
6
|
-
import './setup.js';
|
|
7
|
-
export function createExpect() {
|
|
8
|
-
const expect = ((value, message) => {
|
|
9
|
-
const { assertionCalls } = getState(expect);
|
|
10
|
-
setState({ assertionCalls: assertionCalls + 1 }, expect);
|
|
11
|
-
return chai.expect(value, message);
|
|
12
|
-
});
|
|
13
|
-
Object.assign(expect, chai.expect);
|
|
14
|
-
Object.assign(expect, globalThis[ASYMMETRIC_MATCHERS_OBJECT]);
|
|
15
|
-
expect.getState = () => getState(expect);
|
|
16
|
-
expect.setState = (state) => setState(state, expect);
|
|
17
|
-
// @ts-expect-error global is not typed
|
|
18
|
-
const globalState = getState(globalThis[GLOBAL_EXPECT]) || {};
|
|
19
|
-
setState({
|
|
20
|
-
// this should also add "snapshotState" that is added conditionally
|
|
21
|
-
...globalState,
|
|
22
|
-
assertionCalls: 0,
|
|
23
|
-
isExpectingAssertions: false,
|
|
24
|
-
isExpectingAssertionsError: null,
|
|
25
|
-
expectedAssertionsNumber: null,
|
|
26
|
-
expectedAssertionsNumberErrorGen: null,
|
|
27
|
-
}, expect);
|
|
28
|
-
// @ts-expect-error untyped
|
|
29
|
-
expect.extend = (matchers) => chai.expect.extend(expect, matchers);
|
|
30
|
-
// @ts-expect-error untyped
|
|
31
|
-
expect.addEqualityTesters = (customTesters) => addCustomEqualityTesters(customTesters);
|
|
32
|
-
// @ts-expect-error untyped
|
|
33
|
-
expect.soft = (...args) => {
|
|
34
|
-
// @ts-expect-error private soft access
|
|
35
|
-
return expect(...args).withContext({ soft: true });
|
|
36
|
-
};
|
|
37
|
-
// @ts-expect-error untyped
|
|
38
|
-
expect.unreachable = (message) => {
|
|
39
|
-
chai.assert.fail(`expected${message ? ` "${message}" ` : ' '}not to be reached`);
|
|
40
|
-
};
|
|
41
|
-
function assertions(expected) {
|
|
42
|
-
const errorGen = () => new Error(`expected number of assertions to be ${expected}, but got ${expect.getState().assertionCalls}`);
|
|
43
|
-
if (Error.captureStackTrace) {
|
|
44
|
-
Error.captureStackTrace(errorGen(), assertions);
|
|
45
|
-
}
|
|
46
|
-
expect.setState({
|
|
47
|
-
expectedAssertionsNumber: expected,
|
|
48
|
-
expectedAssertionsNumberErrorGen: errorGen,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
function hasAssertions() {
|
|
52
|
-
const error = new Error('expected any number of assertion, but got none');
|
|
53
|
-
if (Error.captureStackTrace) {
|
|
54
|
-
Error.captureStackTrace(error, hasAssertions);
|
|
55
|
-
}
|
|
56
|
-
expect.setState({
|
|
57
|
-
isExpectingAssertions: true,
|
|
58
|
-
isExpectingAssertionsError: error,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
chai.util.addMethod(expect, 'assertions', assertions);
|
|
62
|
-
chai.util.addMethod(expect, 'hasAssertions', hasAssertions);
|
|
63
|
-
expect.extend(customMatchers);
|
|
64
|
-
return expect;
|
|
65
|
-
}
|
|
66
|
-
const globalExpect = createExpect();
|
|
67
|
-
Object.defineProperty(globalThis, GLOBAL_EXPECT, {
|
|
68
|
-
value: globalExpect,
|
|
69
|
-
writable: true,
|
|
70
|
-
configurable: true,
|
|
71
|
-
});
|
|
72
|
-
export { assert, should } from 'chai';
|
|
73
|
-
export { chai, globalExpect as expect };
|
|
1
|
+
export * from './expect.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MatcherState } from '@vitest/expect';
|
|
2
|
+
import { type ImageSnapshotOptions } from '@react-native-harness/bridge';
|
|
3
|
+
type ScreenshotResult = {
|
|
4
|
+
data: Uint8Array;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
};
|
|
8
|
+
export declare function toMatchImageSnapshot(this: MatcherState, received: ScreenshotResult, options: ImageSnapshotOptions): Promise<{
|
|
9
|
+
pass: boolean;
|
|
10
|
+
message: () => string;
|
|
11
|
+
}>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=toMatchImageSnapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toMatchImageSnapshot.d.ts","sourceRoot":"","sources":["../../../src/expect/matchers/toMatchImageSnapshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,8BAA8B,CAAC;AAGtC,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,MAAM,CAAA;CAAE,CAAC,CA+BnD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getClientInstance } from '../../client/store.js';
|
|
2
|
+
import { generateTransferId, } from '@react-native-harness/bridge';
|
|
3
|
+
import { getHarnessContext } from '../../runner/index.js';
|
|
4
|
+
export async function toMatchImageSnapshot(received, options) {
|
|
5
|
+
const client = getClientInstance();
|
|
6
|
+
const context = getHarnessContext();
|
|
7
|
+
const transferId = generateTransferId();
|
|
8
|
+
client.sendBinary(transferId, received.data);
|
|
9
|
+
const screenshotFile = await client.rpc['device.screenshot.receive']({
|
|
10
|
+
type: 'binary',
|
|
11
|
+
transferId,
|
|
12
|
+
size: received.data.length,
|
|
13
|
+
mimeType: 'image/png',
|
|
14
|
+
}, {
|
|
15
|
+
width: received.width,
|
|
16
|
+
height: received.height,
|
|
17
|
+
});
|
|
18
|
+
const result = await client.rpc['test.matchImageSnapshot'](screenshotFile, context.testFilePath, options, context.runner);
|
|
19
|
+
return {
|
|
20
|
+
pass: result.pass,
|
|
21
|
+
message: () => result.message,
|
|
22
|
+
};
|
|
23
|
+
}
|
package/dist/globals.d.ts
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
|
+
import type { ImageSnapshotOptions } from '@react-native-harness/bridge';
|
|
1
2
|
export type HarnessGlobal = {
|
|
2
3
|
appRegistryComponentName: string;
|
|
4
|
+
webSocketPort?: number;
|
|
5
|
+
disableViewFlattening?: boolean;
|
|
3
6
|
};
|
|
4
7
|
declare global {
|
|
5
8
|
var RN_HARNESS: HarnessGlobal | undefined;
|
|
6
9
|
}
|
|
10
|
+
declare module '@vitest/expect' {
|
|
11
|
+
interface Matchers {
|
|
12
|
+
/**
|
|
13
|
+
* Match the received screenshot against a stored snapshot.
|
|
14
|
+
* Creates a new snapshot if one doesn't exist.
|
|
15
|
+
*/
|
|
16
|
+
toMatchImageSnapshot(options: ImageSnapshotOptions): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
7
19
|
export declare const getHarnessGlobal: () => HarnessGlobal;
|
|
8
20
|
//# sourceMappingURL=globals.d.ts.map
|
package/dist/globals.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../src/globals.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,wBAAwB,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../src/globals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,MAAM,MAAM,aAAa,GAAG;IAC1B,wBAAwB,EAAE,MAAM,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,UAAU,EAAE,aAAa,GAAG,SAAS,CAAC;CAC3C;AAED,OAAO,QAAQ,gBAAgB,CAAC;IAC9B,UAAU,QAAQ;QAChB;;;WAGG;QACH,oBAAoB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;KACpE;CACF;AAED,eAAO,MAAM,gBAAgB,QAAO,aAQnC,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AACxB,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,EAAE,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACzD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/initialize.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getDeviceDescriptor } from './client/getDeviceDescriptor.js';
|
|
2
2
|
import { getClient } from './client/index.js';
|
|
3
|
+
import { disableHMRWhenReady } from './disableHMRWhenReady.js';
|
|
3
4
|
import { setupJestMock } from './jest-mock.js';
|
|
4
5
|
// Polyfill for EventTarget
|
|
5
6
|
const Shim = require('event-target-shim');
|
|
@@ -15,9 +16,7 @@ const HMRClientModule = require('react-native/Libraries/Utilities/HMRClient');
|
|
|
15
16
|
const HMRClient = 'default' in HMRClientModule ? HMRClientModule.default : HMRClientModule;
|
|
16
17
|
// Wait for HMRClient to be initialized
|
|
17
18
|
setTimeout(() => {
|
|
18
|
-
HMRClient.disable();
|
|
19
|
-
// Initialize the React Native Harness
|
|
20
|
-
void getClient().then((client) => client.rpc.reportReady(getDeviceDescriptor()));
|
|
19
|
+
void disableHMRWhenReady(() => HMRClient.disable(), 50).then(() => getClient().then((client) => client.rpc.reportReady(getDeviceDescriptor())));
|
|
21
20
|
});
|
|
22
21
|
// Re-throw fatal errors
|
|
23
22
|
ErrorUtils.setGlobalHandler((error) => {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const Fragment: import("react").ExoticComponent<import("react").FragmentProps>;
|
|
2
|
+
export declare function jsxDEV(type: any, props: any, key: any, isStaticChildren: any, source: any, self: any): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
3
|
+
//# sourceMappingURL=jsx-dev-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.d.ts","sourceRoot":"","sources":["../../src/jsx/jsx-dev-runtime.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,gEAA8B,CAAC;AAEpD,wBAAgB,MAAM,CACpB,IAAI,EAAE,GAAG,EACT,KAAK,EAAE,GAAG,EACV,GAAG,EAAE,GAAG,EACR,gBAAgB,EAAE,GAAG,EACrB,MAAM,EAAE,GAAG,EACX,IAAI,EAAE,GAAG,8FAkBV"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as ReactJSXRuntimeDev from 'react/jsx-dev-runtime';
|
|
2
|
+
export const Fragment = ReactJSXRuntimeDev.Fragment;
|
|
3
|
+
export function jsxDEV(type, props, key, isStaticChildren, source, self) {
|
|
4
|
+
if (type &&
|
|
5
|
+
(type.displayName === 'View' || type.name === 'View') &&
|
|
6
|
+
props &&
|
|
7
|
+
props.collapsable === undefined) {
|
|
8
|
+
props = { ...props, collapsable: true };
|
|
9
|
+
}
|
|
10
|
+
return ReactJSXRuntimeDev.jsxDEV(type, props, key, isStaticChildren, source, self);
|
|
11
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const Fragment: import("react").ExoticComponent<import("react").FragmentProps>;
|
|
2
|
+
export declare function jsx(type: React.ElementType, props: unknown, key?: React.Key): React.ReactElement;
|
|
3
|
+
export declare function jsxs(type: React.ElementType, props: unknown, key?: React.Key): React.ReactElement;
|
|
4
|
+
//# sourceMappingURL=jsx-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../../src/jsx/jsx-runtime.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,gEAA2B,CAAC;AAmBjD,wBAAgB,GAAG,CACjB,IAAI,EAAE,KAAK,CAAC,WAAW,EACvB,KAAK,EAAE,OAAO,EACd,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,GACd,KAAK,CAAC,YAAY,CAEpB;AAED,wBAAgB,IAAI,CAClB,IAAI,EAAE,KAAK,CAAC,WAAW,EACvB,KAAK,EAAE,OAAO,EACd,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,GACd,KAAK,CAAC,YAAY,CAEpB"}
|