expo-router 6.0.0-beta.1 → 6.0.0-beta.2
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.
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
import './expect';
|
|
2
2
|
import './mocks';
|
|
3
|
-
import
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import { MockContextConfig, getMockConfig, getMockContext } from './mock-config';
|
|
5
5
|
import { ExpoLinkingOptions } from '../getLinkingConfig';
|
|
6
6
|
import { ReactNavigationState } from '../global-state/router-store';
|
|
7
|
-
|
|
8
|
-
export type
|
|
7
|
+
declare const rnTestingLibrary: typeof import("@testing-library/react-native");
|
|
8
|
+
export type * from '@testing-library/react-native';
|
|
9
|
+
export declare const act: typeof React.act, cleanup: typeof import("@testing-library/react-native").cleanup, fireEvent: typeof import("@testing-library/react-native").fireEvent, waitFor: typeof import("@testing-library/react-native").waitFor, waitForElementToBeRemoved: typeof import("@testing-library/react-native").waitForElementToBeRemoved, within: typeof import("@testing-library/react-native").within, configure: typeof import("@testing-library/react-native").configure, resetToDefaults: typeof import("@testing-library/react-native").resetToDefaults, isHiddenFromAccessibility: typeof import("@testing-library/react-native").isHiddenFromAccessibility, isInaccessible: typeof import("@testing-library/react-native").isHiddenFromAccessibility, getDefaultNormalizer: typeof import("@testing-library/react-native").getDefaultNormalizer, renderHook: typeof import("@testing-library/react-native").renderHook, userEvent: {
|
|
10
|
+
setup: typeof import("@testing-library/react-native/build/user-event/setup").setup;
|
|
11
|
+
press: (element: import("react-test-renderer").ReactTestInstance) => Promise<void>;
|
|
12
|
+
longPress: (element: import("react-test-renderer").ReactTestInstance, options?: import("@testing-library/react-native/build/user-event/press").PressOptions) => Promise<void>;
|
|
13
|
+
type: (element: import("react-test-renderer").ReactTestInstance, text: string, options?: import("@testing-library/react-native/build/user-event/type").TypeOptions) => Promise<void>;
|
|
14
|
+
clear: (element: import("react-test-renderer").ReactTestInstance) => Promise<void>;
|
|
15
|
+
paste: (element: import("react-test-renderer").ReactTestInstance, text: string) => Promise<void>;
|
|
16
|
+
scrollTo: (element: import("react-test-renderer").ReactTestInstance, options: import("@testing-library/react-native/build/user-event/scroll").ScrollToOptions) => Promise<void>;
|
|
17
|
+
};
|
|
18
|
+
export declare let screen: typeof rnTestingLibrary.screen;
|
|
19
|
+
export type RenderRouterOptions = Parameters<typeof rnTestingLibrary.render>[1] & {
|
|
9
20
|
initialUrl?: any;
|
|
10
21
|
linking?: Partial<ExpoLinkingOptions>;
|
|
11
22
|
};
|
|
12
|
-
type Result = ReturnType<typeof render> & {
|
|
23
|
+
type Result = ReturnType<typeof rnTestingLibrary.render> & {
|
|
13
24
|
getPathname(): string;
|
|
14
25
|
getPathnameWithParams(): string;
|
|
15
26
|
getSegments(): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing-library/index.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,CAAC;AAClB,OAAO,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing-library/index.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,CAAC;AAClB,OAAO,SAAS,CAAC;AAGjB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAS,MAAM,8BAA8B,CAAC;AAG3E,QAAA,MAAM,gBAAgB,gDAclB,CAAC;AAEL,mBAAmB,+BAA+B,CAAC;AAGnD,MAAM,CAAC,OAAO,CAAC,MACb,GAAG,oBACH,OAAO,0DACP,SAAS,4DACT,OAAO,0DACP,yBAAyB,4EACzB,MAAM,yDACN,SAAS,4DACT,eAAe,kEACf,yBAAyB,4EACzB,cAAc,4EACd,oBAAoB,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{
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
4
|
};
|
|
@@ -21,7 +7,6 @@ exports.testRouter = exports.getMockContext = exports.getMockConfig = void 0;
|
|
|
21
7
|
exports.renderRouter = renderRouter;
|
|
22
8
|
require("./expect");
|
|
23
9
|
require("./mocks");
|
|
24
|
-
const react_native_1 = require("@testing-library/react-native");
|
|
25
10
|
const react_1 = __importDefault(require("react"));
|
|
26
11
|
const mock_config_1 = require("./mock-config");
|
|
27
12
|
Object.defineProperty(exports, "getMockConfig", { enumerable: true, get: function () { return mock_config_1.getMockConfig; } });
|
|
@@ -29,14 +14,32 @@ Object.defineProperty(exports, "getMockContext", { enumerable: true, get: functi
|
|
|
29
14
|
const ExpoRoot_1 = require("../ExpoRoot");
|
|
30
15
|
const router_store_1 = require("../global-state/router-store");
|
|
31
16
|
const imperative_api_1 = require("../imperative-api");
|
|
32
|
-
|
|
33
|
-
|
|
17
|
+
const rnTestingLibrary = (() => {
|
|
18
|
+
try {
|
|
19
|
+
return require('@testing-library/react-native');
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
if ('code' in error && error.code === 'MODULE_NOT_FOUND') {
|
|
23
|
+
const newError = new Error(`[expo-router/testing-library] "@testing-library/react-native" failed to import. You need to install it to use expo-router's testing library.`);
|
|
24
|
+
newError.stack = error.stack;
|
|
25
|
+
newError.cause = error;
|
|
26
|
+
throw newError;
|
|
27
|
+
}
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
})();
|
|
31
|
+
Object.assign(exports, rnTestingLibrary);
|
|
32
|
+
Object.defineProperty(exports, 'screen', {
|
|
33
|
+
get() {
|
|
34
|
+
return rnTestingLibrary.screen;
|
|
35
|
+
},
|
|
36
|
+
});
|
|
34
37
|
function renderRouter(context = './app', { initialUrl = '/', linking, ...options } = {}) {
|
|
35
38
|
jest.useFakeTimers();
|
|
36
39
|
const mockContext = (0, mock_config_1.getMockContext)(context);
|
|
37
40
|
// Force the render to be synchronous
|
|
38
41
|
process.env.EXPO_ROUTER_IMPORT_MODE = 'sync';
|
|
39
|
-
const result =
|
|
42
|
+
const result = rnTestingLibrary.render(<ExpoRoot_1.ExpoRoot context={mockContext} location={initialUrl} linking={linking}/>, options);
|
|
40
43
|
/**
|
|
41
44
|
* This is a hack to ensure that React Navigation's state updates are processed before we run assertions.
|
|
42
45
|
* Some updates are async and we need to wait for them to complete, otherwise will we get a false positive.
|
|
@@ -63,25 +66,25 @@ function renderRouter(context = './app', { initialUrl = '/', linking, ...options
|
|
|
63
66
|
exports.testRouter = {
|
|
64
67
|
/** Navigate to the provided pathname and the pathname */
|
|
65
68
|
navigate(path) {
|
|
66
|
-
|
|
67
|
-
expect(
|
|
69
|
+
rnTestingLibrary.act(() => imperative_api_1.router.navigate(path));
|
|
70
|
+
expect(rnTestingLibrary.screen).toHavePathnameWithParams(path);
|
|
68
71
|
},
|
|
69
72
|
/** Push the provided pathname and assert the pathname */
|
|
70
73
|
push(path) {
|
|
71
|
-
|
|
72
|
-
expect(
|
|
74
|
+
rnTestingLibrary.act(() => imperative_api_1.router.push(path));
|
|
75
|
+
expect(rnTestingLibrary.screen).toHavePathnameWithParams(path);
|
|
73
76
|
},
|
|
74
77
|
/** Replace with provided pathname and assert the pathname */
|
|
75
78
|
replace(path) {
|
|
76
|
-
|
|
77
|
-
expect(
|
|
79
|
+
rnTestingLibrary.act(() => imperative_api_1.router.replace(path));
|
|
80
|
+
expect(rnTestingLibrary.screen).toHavePathnameWithParams(path);
|
|
78
81
|
},
|
|
79
82
|
/** Go back in history and asset the new pathname */
|
|
80
83
|
back(path) {
|
|
81
84
|
expect(imperative_api_1.router.canGoBack()).toBe(true);
|
|
82
|
-
|
|
85
|
+
rnTestingLibrary.act(() => imperative_api_1.router.back());
|
|
83
86
|
if (path) {
|
|
84
|
-
expect(
|
|
87
|
+
expect(rnTestingLibrary.screen).toHavePathnameWithParams(path);
|
|
85
88
|
}
|
|
86
89
|
},
|
|
87
90
|
/** If there's history that supports invoking the `back` function. */
|
|
@@ -92,12 +95,12 @@ exports.testRouter = {
|
|
|
92
95
|
setParams(params, path) {
|
|
93
96
|
imperative_api_1.router.setParams(params);
|
|
94
97
|
if (path) {
|
|
95
|
-
expect(
|
|
98
|
+
expect(exports.screen).toHavePathnameWithParams(path);
|
|
96
99
|
}
|
|
97
100
|
},
|
|
98
101
|
/** If there's history that supports invoking the `back` function. */
|
|
99
102
|
dismissAll() {
|
|
100
|
-
|
|
103
|
+
rnTestingLibrary.act(() => imperative_api_1.router.dismissAll());
|
|
101
104
|
},
|
|
102
105
|
};
|
|
103
106
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing-library/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing-library/index.tsx"],"names":[],"mappings":";;;;;;AAuEA,oCAsCC;AA7GD,oBAAkB;AAClB,mBAAiB;AAGjB,kDAA0B;AAE1B,+CAAiF;AA+DrD,8FA/DA,2BAAa,OA+DA;AAAE,+FA/DA,4BAAc,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,IAAa;QAChB,MAAM,CAAC,uBAAM,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,uBAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAC1C,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;IACD,qEAAqE;IACrE,SAAS;QACP,OAAO,uBAAM,CAAC,SAAS,EAAE,CAAC;IAC5B,CAAC;IACD,wEAAwE;IACxE,SAAS,CAAC,MAA8B,EAAE,IAAa;QACrD,uBAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACzB,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,CAAC,cAAM,CAAC,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IACD,qEAAqE;IACrE,UAAU;QACR,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,uBAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IAClD,CAAC;CACF,CAAC","sourcesContent":["import './expect';\nimport './mocks';\n\nimport type { RenderResult } from '@testing-library/react-native';\nimport React from 'react';\n\nimport { MockContextConfig, getMockConfig, getMockContext } from './mock-config';\nimport { ExpoRoot } from '../ExpoRoot';\nimport { ExpoLinkingOptions } from '../getLinkingConfig';\nimport { ReactNavigationState, store } from '../global-state/router-store';\nimport { router } from '../imperative-api';\n\nconst rnTestingLibrary = ((): typeof import('@testing-library/react-native') => {\n try {\n return require('@testing-library/react-native');\n } catch (error: any) {\n if ('code' in error && error.code === 'MODULE_NOT_FOUND') {\n const newError = new Error(\n `[expo-router/testing-library] \"@testing-library/react-native\" failed to import. You need to install it to use expo-router's testing library.`\n );\n newError.stack = error.stack;\n newError.cause = error;\n throw newError;\n }\n throw error;\n }\n})();\n\nexport type * from '@testing-library/react-native';\n\n// TODO(@kitten): This is for backwards-compatibility. Consider removing this!\nexport declare const {\n act,\n cleanup,\n fireEvent,\n waitFor,\n waitForElementToBeRemoved,\n within,\n configure,\n resetToDefaults,\n isHiddenFromAccessibility,\n isInaccessible,\n getDefaultNormalizer,\n renderHook,\n userEvent,\n}: typeof rnTestingLibrary;\n\nexport declare let screen: typeof rnTestingLibrary.screen;\n\nObject.assign(exports, rnTestingLibrary);\nObject.defineProperty(exports, 'screen', {\n get() {\n return rnTestingLibrary.screen;\n },\n});\n\nexport type RenderRouterOptions = Parameters<typeof rnTestingLibrary.render>[1] & {\n initialUrl?: any;\n linking?: Partial<ExpoLinkingOptions>;\n};\n\ntype Result = ReturnType<typeof rnTestingLibrary.render> & {\n getPathname(): string;\n getPathnameWithParams(): string;\n getSegments(): string[];\n getSearchParams(): Record<string, string | string[]>;\n getRouterState(): ReactNavigationState | undefined;\n};\n\nexport { MockContextConfig, getMockConfig, getMockContext };\n\nexport function renderRouter(\n context: MockContextConfig = './app',\n { initialUrl = '/', linking, ...options }: RenderRouterOptions = {}\n): Result {\n jest.useFakeTimers();\n\n const mockContext = getMockContext(context);\n\n // Force the render to be synchronous\n process.env.EXPO_ROUTER_IMPORT_MODE = 'sync';\n\n const result = rnTestingLibrary.render(\n <ExpoRoot context={mockContext} location={initialUrl} linking={linking} />,\n options\n );\n\n /**\n * This is a hack to ensure that React Navigation's state updates are processed before we run assertions.\n * Some updates are async and we need to wait for them to complete, otherwise will we get a false positive.\n * (that the app will briefly be in the right state, but then update to an invalid state)\n */\n return Object.assign(result, {\n getPathname(this: RenderResult): string {\n return store.getRouteInfo().pathname;\n },\n getSegments(this: RenderResult): string[] {\n return store.getRouteInfo().segments;\n },\n getSearchParams(this: RenderResult): Record<string, string | string[]> {\n return store.getRouteInfo().params;\n },\n getPathnameWithParams(this: RenderResult): string {\n return store.getRouteInfo().pathnameWithParams;\n },\n getRouterState(this: RenderResult) {\n return store.state;\n },\n });\n}\n\nexport const testRouter = {\n /** Navigate to the provided pathname and the pathname */\n navigate(path: string) {\n rnTestingLibrary.act(() => router.navigate(path));\n expect(rnTestingLibrary.screen).toHavePathnameWithParams(path);\n },\n /** Push the provided pathname and assert the pathname */\n push(path: string) {\n rnTestingLibrary.act(() => router.push(path));\n expect(rnTestingLibrary.screen).toHavePathnameWithParams(path);\n },\n /** Replace with provided pathname and assert the pathname */\n replace(path: string) {\n rnTestingLibrary.act(() => router.replace(path));\n expect(rnTestingLibrary.screen).toHavePathnameWithParams(path);\n },\n /** Go back in history and asset the new pathname */\n back(path?: string) {\n expect(router.canGoBack()).toBe(true);\n rnTestingLibrary.act(() => router.back());\n if (path) {\n expect(rnTestingLibrary.screen).toHavePathnameWithParams(path);\n }\n },\n /** If there's history that supports invoking the `back` function. */\n canGoBack() {\n return router.canGoBack();\n },\n /** Update the current route query params and assert the new pathname */\n setParams(params: Record<string, string>, path?: string) {\n router.setParams(params);\n if (path) {\n expect(screen).toHavePathnameWithParams(path);\n }\n },\n /** If there's history that supports invoking the `back` function. */\n dismissAll() {\n rnTestingLibrary.act(() => router.dismissAll());\n },\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-router",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.2",
|
|
4
4
|
"description": "Expo Router is a file-based router for React Native and web applications.",
|
|
5
5
|
"author": "650 Industries, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -78,11 +78,10 @@
|
|
|
78
78
|
],
|
|
79
79
|
"peerDependencies": {
|
|
80
80
|
"@react-navigation/drawer": "^7.5.0",
|
|
81
|
-
"@testing-library/jest-native": ">= 5.0.0",
|
|
82
81
|
"@testing-library/react-native": ">= 12.0.0",
|
|
83
82
|
"expo": "*",
|
|
84
|
-
"expo-constants": "
|
|
85
|
-
"expo-linking": "
|
|
83
|
+
"expo-constants": "^18.0.2",
|
|
84
|
+
"expo-linking": "^8.0.2",
|
|
86
85
|
"react": "*",
|
|
87
86
|
"react-dom": "*",
|
|
88
87
|
"react-native": "*",
|
|
@@ -94,6 +93,9 @@
|
|
|
94
93
|
"react-server-dom-webpack": ">= 19.0.0"
|
|
95
94
|
},
|
|
96
95
|
"peerDependenciesMeta": {
|
|
96
|
+
"@testing-library/react-native": {
|
|
97
|
+
"optional": true
|
|
98
|
+
},
|
|
97
99
|
"react-dom": {
|
|
98
100
|
"optional": true
|
|
99
101
|
},
|
|
@@ -111,9 +113,6 @@
|
|
|
111
113
|
},
|
|
112
114
|
"@react-navigation/drawer": {
|
|
113
115
|
"optional": true
|
|
114
|
-
},
|
|
115
|
-
"@testing-library/react-native": {
|
|
116
|
-
"optional": true
|
|
117
116
|
}
|
|
118
117
|
},
|
|
119
118
|
"devDependencies": {
|
|
@@ -128,9 +127,9 @@
|
|
|
128
127
|
"tsd": "^0.28.1"
|
|
129
128
|
},
|
|
130
129
|
"dependencies": {
|
|
131
|
-
"@expo/metro-runtime": "6.0.
|
|
132
|
-
"@expo/schema-utils": "^0.1.
|
|
133
|
-
"@expo/server": "^0.7.
|
|
130
|
+
"@expo/metro-runtime": "6.0.2",
|
|
131
|
+
"@expo/schema-utils": "^0.1.2",
|
|
132
|
+
"@expo/server": "^0.7.2",
|
|
134
133
|
"@radix-ui/react-slot": "1.2.0",
|
|
135
134
|
"@radix-ui/react-tabs": "^1.1.12",
|
|
136
135
|
"@react-navigation/bottom-tabs": "^7.4.0",
|
|
@@ -152,5 +151,5 @@
|
|
|
152
151
|
"use-latest-callback": "^0.2.1",
|
|
153
152
|
"vaul": "^1.1.2"
|
|
154
153
|
},
|
|
155
|
-
"gitHead": "
|
|
154
|
+
"gitHead": "eaa9b645058cf2233fbb27bb21a19bc605c90a88"
|
|
156
155
|
}
|