@dxos/react-client 0.6.13-main.ed424a1 → 0.6.13
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/dist/lib/browser/{chunk-RJRDB4LF.mjs → chunk-CL7JDETM.mjs} +60 -62
- package/dist/lib/browser/chunk-CL7JDETM.mjs.map +7 -0
- package/dist/lib/browser/devtools/index.mjs +1 -1
- package/dist/lib/browser/echo/index.mjs +4 -6
- package/dist/lib/browser/echo/index.mjs.map +3 -3
- package/dist/lib/browser/halo/index.mjs +1 -1
- package/dist/lib/browser/index.mjs +3 -1
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/mesh/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +32 -43
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-YNTACPMY.cjs → chunk-C4EWAKPZ.cjs} +60 -63
- package/dist/lib/node/chunk-C4EWAKPZ.cjs.map +7 -0
- package/dist/lib/node/devtools/index.cjs +2 -2
- package/dist/lib/node/echo/index.cjs +5 -7
- package/dist/lib/node/echo/index.cjs.map +3 -3
- package/dist/lib/node/halo/index.cjs +5 -5
- package/dist/lib/node/index.cjs +14 -12
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/mesh/index.cjs +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +33 -44
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/client/ClientProvider.d.ts +18 -59
- package/dist/types/src/client/ClientProvider.d.ts.map +1 -1
- package/dist/types/src/client/context.d.ts +4 -1
- package/dist/types/src/client/context.d.ts.map +1 -1
- package/dist/types/src/client/index.d.ts +1 -0
- package/dist/types/src/client/index.d.ts.map +1 -1
- package/dist/types/src/client/useClientServices.d.ts +3 -0
- package/dist/types/src/client/useClientServices.d.ts.map +1 -0
- package/dist/types/src/echo/useQuery.d.ts.map +1 -1
- package/dist/types/src/playwright/playwright.config.d.ts +2 -2
- package/dist/types/src/playwright/playwright.config.d.ts.map +1 -1
- package/dist/types/src/testing/ClientRepeater.d.ts +12 -9
- package/dist/types/src/testing/ClientRepeater.d.ts.map +1 -1
- package/dist/types/src/testing/util.d.ts +3 -5
- package/dist/types/src/testing/util.d.ts.map +1 -1
- package/dist/types/src/testing/withClientProvider.d.ts +1 -4
- package/dist/types/src/testing/withClientProvider.d.ts.map +1 -1
- package/dist/types/src/testing/withClientProvider.stories.d.ts +3 -4
- package/dist/types/src/testing/withClientProvider.stories.d.ts.map +1 -1
- package/package.json +38 -47
- package/project.json +22 -3
- package/src/client/ClientProvider.test.tsx +4 -7
- package/src/client/ClientProvider.tsx +100 -126
- package/src/client/context.ts +5 -4
- package/src/client/index.ts +3 -0
- package/src/client/useClientServices.ts +15 -0
- package/src/client/useConfig.test.tsx +12 -9
- package/src/echo/useQuery.ts +6 -3
- package/src/echo/useSpaces.test.tsx +8 -6
- package/src/halo/useDevices.test.tsx +5 -3
- package/src/playwright/playwright.config.ts +2 -13
- package/src/playwright/smoke.spec.ts +10 -5
- package/src/testing/ClientRepeater.tsx +20 -19
- package/src/testing/util.tsx +6 -11
- package/src/testing/withClientProvider.stories.tsx +10 -19
- package/src/testing/withClientProvider.tsx +18 -22
- package/tsconfig.json +58 -2
- package/dist/lib/browser/chunk-RJRDB4LF.mjs.map +0 -7
- package/dist/lib/node/chunk-YNTACPMY.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-UYJUBYMU.mjs +0 -165
- package/dist/lib/node-esm/chunk-UYJUBYMU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-V65AVUQO.mjs +0 -295
- package/dist/lib/node-esm/chunk-V65AVUQO.mjs.map +0 -7
- package/dist/lib/node-esm/devtools/index.mjs +0 -44
- package/dist/lib/node-esm/devtools/index.mjs.map +0 -7
- package/dist/lib/node-esm/echo/index.mjs +0 -134
- package/dist/lib/node-esm/echo/index.mjs.map +0 -7
- package/dist/lib/node-esm/halo/index.mjs +0 -100
- package/dist/lib/node-esm/halo/index.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -33
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/invitations/index.mjs +0 -18
- package/dist/lib/node-esm/invitations/index.mjs.map +0 -7
- package/dist/lib/node-esm/mesh/index.mjs +0 -18
- package/dist/lib/node-esm/mesh/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/testing/index.mjs +0 -177
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/worker.mjs +0 -5
- package/dist/lib/node-esm/worker.mjs.map +0 -7
- package/vitest.config.ts +0 -22
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
ClientProvider
|
|
4
|
-
} from "../chunk-V65AVUQO.mjs";
|
|
5
|
-
|
|
6
|
-
// packages/sdk/react-client/src/testing/index.ts
|
|
7
|
-
export * from "@dxos/client/testing";
|
|
8
|
-
|
|
9
|
-
// packages/sdk/react-client/src/testing/ClientRepeater.tsx
|
|
10
|
-
import React, { useState, useEffect, useRef } from "react";
|
|
11
|
-
import { Client } from "@dxos/client";
|
|
12
|
-
import { TestBuilder, performInvitation } from "@dxos/client/testing";
|
|
13
|
-
import { registerSignalsRuntime } from "@dxos/echo-signals/react";
|
|
14
|
-
import { faker } from "@dxos/random";
|
|
15
|
-
var ClientRepeater = (props) => {
|
|
16
|
-
const { component: Component, controls: Controls, count = 1, types, createIdentity, createSpace, onSpaceCreated } = props;
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
registerSignalsRuntime();
|
|
19
|
-
}, []);
|
|
20
|
-
const [clients, setClients] = useState(props.clients ?? []);
|
|
21
|
-
const [spaceKey, setSpaceKey] = useState();
|
|
22
|
-
const testBuilder = useRef(new TestBuilder());
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
const timeout = setTimeout(async () => {
|
|
25
|
-
const clients2 = [
|
|
26
|
-
...Array(count)
|
|
27
|
-
].map((_) => new Client({
|
|
28
|
-
services: testBuilder.current.createLocalClientServices(),
|
|
29
|
-
types
|
|
30
|
-
}));
|
|
31
|
-
await Promise.all(clients2.map((client) => client.initialize()));
|
|
32
|
-
if (createIdentity || createSpace) {
|
|
33
|
-
await Promise.all(clients2.map((client) => client.halo.createIdentity()));
|
|
34
|
-
}
|
|
35
|
-
if (createSpace) {
|
|
36
|
-
const client = clients2[0];
|
|
37
|
-
const space = await client.spaces.create({
|
|
38
|
-
name: faker.commerce.productName()
|
|
39
|
-
});
|
|
40
|
-
setSpaceKey(space.key);
|
|
41
|
-
await onSpaceCreated?.({
|
|
42
|
-
client,
|
|
43
|
-
space
|
|
44
|
-
});
|
|
45
|
-
await Promise.all(clients2.slice(1).flatMap((client2) => performInvitation({
|
|
46
|
-
host: space,
|
|
47
|
-
guest: client2.spaces
|
|
48
|
-
})));
|
|
49
|
-
}
|
|
50
|
-
setClients(clients2);
|
|
51
|
-
});
|
|
52
|
-
return () => clearTimeout(timeout);
|
|
53
|
-
}, []);
|
|
54
|
-
if (clients.length === 0) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, Controls && /* @__PURE__ */ React.createElement(Controls, {
|
|
58
|
-
clients
|
|
59
|
-
}), clients.map((client, index) => /* @__PURE__ */ React.createElement(ClientProvider, {
|
|
60
|
-
key: index,
|
|
61
|
-
client
|
|
62
|
-
}, /* @__PURE__ */ React.createElement(Component, {
|
|
63
|
-
id: index,
|
|
64
|
-
count: clients.length,
|
|
65
|
-
spaceKey,
|
|
66
|
-
...props.args
|
|
67
|
-
}))));
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
// packages/sdk/react-client/src/testing/withClientProvider.tsx
|
|
71
|
-
import React2, { useRef as useRef2 } from "react";
|
|
72
|
-
import { ErrorBoundary } from "react-error-boundary";
|
|
73
|
-
import { Trigger } from "@dxos/async";
|
|
74
|
-
import { performInvitation as performInvitation2, TestBuilder as TestBuilder2 } from "@dxos/client/testing";
|
|
75
|
-
var initializeClient = async (client, { createIdentity, createSpace, onSpaceCreated, onInitialized }) => {
|
|
76
|
-
if (createIdentity || createSpace) {
|
|
77
|
-
if (!client.halo.identity.get()) {
|
|
78
|
-
await client.halo.createIdentity();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
let space;
|
|
82
|
-
if (createSpace) {
|
|
83
|
-
space = await client.spaces.create({
|
|
84
|
-
name: "Test Space"
|
|
85
|
-
});
|
|
86
|
-
await onSpaceCreated?.({
|
|
87
|
-
client,
|
|
88
|
-
space
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
await onInitialized?.(client);
|
|
92
|
-
return space;
|
|
93
|
-
};
|
|
94
|
-
var withClientProvider = ({ createIdentity, createSpace, onSpaceCreated, onInitialized, ...props } = {}) => {
|
|
95
|
-
return (Story) => {
|
|
96
|
-
const handleInitialized = async (client) => {
|
|
97
|
-
await initializeClient(client, {
|
|
98
|
-
createIdentity,
|
|
99
|
-
createSpace,
|
|
100
|
-
onSpaceCreated,
|
|
101
|
-
onInitialized
|
|
102
|
-
});
|
|
103
|
-
};
|
|
104
|
-
return /* @__PURE__ */ React2.createElement(ErrorBoundary, {
|
|
105
|
-
FallbackComponent: ErrorFallback
|
|
106
|
-
}, /* @__PURE__ */ React2.createElement(ClientProvider, {
|
|
107
|
-
onInitialized: handleInitialized,
|
|
108
|
-
...props
|
|
109
|
-
}, /* @__PURE__ */ React2.createElement(Story, null)));
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
var withMultiClientProvider = ({ numClients = 2, createIdentity, createSpace, onSpaceCreated, onInitialized, ...props }) => {
|
|
113
|
-
return (Story) => {
|
|
114
|
-
const builder = useRef2(new TestBuilder2());
|
|
115
|
-
const hostRef = useRef2();
|
|
116
|
-
const spaceReady = useRef2(new Trigger());
|
|
117
|
-
const handleInitialized = async (client) => {
|
|
118
|
-
if (createSpace) {
|
|
119
|
-
if (!hostRef.current) {
|
|
120
|
-
hostRef.current = client;
|
|
121
|
-
const space = await initializeClient(client, {
|
|
122
|
-
createIdentity,
|
|
123
|
-
createSpace,
|
|
124
|
-
onSpaceCreated,
|
|
125
|
-
onInitialized
|
|
126
|
-
});
|
|
127
|
-
spaceReady.current.wake(space);
|
|
128
|
-
} else {
|
|
129
|
-
await initializeClient(client, {
|
|
130
|
-
createIdentity,
|
|
131
|
-
onInitialized
|
|
132
|
-
});
|
|
133
|
-
const space = await spaceReady.current.wait();
|
|
134
|
-
if (space) {
|
|
135
|
-
await Promise.all(performInvitation2({
|
|
136
|
-
host: space,
|
|
137
|
-
guest: client.spaces
|
|
138
|
-
}));
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, Array.from({
|
|
144
|
-
length: numClients
|
|
145
|
-
}).map((_, index) => /* @__PURE__ */ React2.createElement(ErrorBoundary, {
|
|
146
|
-
key: index,
|
|
147
|
-
FallbackComponent: ErrorFallback
|
|
148
|
-
}, /* @__PURE__ */ React2.createElement(ClientProvider, {
|
|
149
|
-
services: builder.current.createLocalClientServices(),
|
|
150
|
-
onInitialized: handleInitialized,
|
|
151
|
-
...props
|
|
152
|
-
}, /* @__PURE__ */ React2.createElement(Story, null)))));
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
var ErrorFallback = ({ error }) => {
|
|
156
|
-
const { name, message, stack } = error instanceof Error ? error : {
|
|
157
|
-
name: "Error",
|
|
158
|
-
message: String(error),
|
|
159
|
-
stack: void 0
|
|
160
|
-
};
|
|
161
|
-
return /* @__PURE__ */ React2.createElement("div", {
|
|
162
|
-
role: "alert",
|
|
163
|
-
className: "flex flex-col overflow-hidden p-4 gap-4"
|
|
164
|
-
}, /* @__PURE__ */ React2.createElement("h1", {
|
|
165
|
-
className: "text-xl text-red-500"
|
|
166
|
-
}, name), /* @__PURE__ */ React2.createElement("div", {
|
|
167
|
-
className: "text-lg"
|
|
168
|
-
}, message), stack && /* @__PURE__ */ React2.createElement("pre", {
|
|
169
|
-
className: "whitespace-pre-wrap text-sm text-subdued"
|
|
170
|
-
}, stack));
|
|
171
|
-
};
|
|
172
|
-
export {
|
|
173
|
-
ClientRepeater,
|
|
174
|
-
withClientProvider,
|
|
175
|
-
withMultiClientProvider
|
|
176
|
-
};
|
|
177
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/testing/index.ts", "../../../../src/testing/ClientRepeater.tsx", "../../../../src/testing/withClientProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2020 DXOS.org\n//\n\nexport * from '@dxos/client/testing';\n\nexport * from './ClientRepeater';\nexport * from './withClientProvider';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type Schema as S } from '@effect/schema';\nimport React, { useState, type FC, useEffect, useRef } from 'react';\n\nimport { Client, type PublicKey } from '@dxos/client';\nimport { TestBuilder, performInvitation } from '@dxos/client/testing';\nimport { registerSignalsRuntime } from '@dxos/echo-signals/react';\nimport { faker } from '@dxos/random';\n\nimport { type WithClientProviderProps } from './withClientProvider';\nimport { ClientProvider } from '../client';\n\nexport type ClientRepeatedComponentProps = { id: number; count: number; spaceKey?: PublicKey };\n\nexport type ClientRepeaterControlsProps = { clients: Client[] };\n\n// TODO(burdon): Reconcile with ClientProviderProps.\nexport type ClientRepeaterProps<P extends ClientRepeatedComponentProps> = {\n className?: string;\n component: FC<ClientRepeatedComponentProps>;\n controls?: FC<ClientRepeaterControlsProps>;\n count?: number;\n clients?: Client[];\n types?: S.Schema<any>[];\n args?: Omit<P, 'id' | 'count'>;\n} & Pick<WithClientProviderProps, 'createIdentity' | 'createSpace' | 'onSpaceCreated'>;\n\n/**\n * Utility component for Storybook stories which sets up clients for n peers.\n * The `Component` property is rendered n times, once for each peer.\n * @deprecated use `withClientProvider`.\n */\n// TODO(burdon): To discuss: evolve ClientRepeater with optional decorator that uses it.\n// NOTE: This is specifically not a storybook decorator because it broke stories as a decorator.\n// This seems primarily due to the fact that it required top-level await for the clients to initialize.\n// Storybook seemed to handle it alright, but Chromatic had a lot of trouble with it.\n// There was also a question of whether or not calling the story function multiple times was a good idea.\nexport const ClientRepeater = <P extends ClientRepeatedComponentProps>(props: ClientRepeaterProps<P>) => {\n const {\n component: Component,\n controls: Controls,\n count = 1,\n types,\n createIdentity,\n createSpace,\n onSpaceCreated,\n } = props;\n useEffect(() => {\n registerSignalsRuntime();\n }, []);\n\n const [clients, setClients] = useState(props.clients ?? []);\n const [spaceKey, setSpaceKey] = useState<PublicKey>();\n\n const testBuilder = useRef(new TestBuilder());\n useEffect(() => {\n const timeout = setTimeout(async () => {\n const clients = [...Array(count)].map(\n (_) => new Client({ services: testBuilder.current.createLocalClientServices(), types }),\n );\n\n await Promise.all(clients.map((client) => client.initialize()));\n if (createIdentity || createSpace) {\n await Promise.all(clients.map((client) => client.halo.createIdentity()));\n }\n\n if (createSpace) {\n const client = clients[0];\n const space = await client.spaces.create({ name: faker.commerce.productName() });\n setSpaceKey(space.key);\n await onSpaceCreated?.({ client, space });\n await Promise.all(\n clients.slice(1).flatMap((client) => performInvitation({ host: space, guest: client.spaces })),\n );\n }\n\n setClients(clients);\n });\n\n return () => clearTimeout(timeout);\n }, []);\n\n if (clients.length === 0) {\n return null;\n }\n\n return (\n <>\n {Controls && <Controls clients={clients} />}\n {clients.map((client, index) => (\n <ClientProvider key={index} client={client}>\n <Component id={index} count={clients.length} spaceKey={spaceKey} {...{ ...props.args }} />\n </ClientProvider>\n ))}\n </>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Decorator } from '@storybook/react';\nimport React, { useRef } from 'react';\nimport { type FallbackProps, ErrorBoundary } from 'react-error-boundary';\n\nimport { Trigger } from '@dxos/async';\nimport { type Client } from '@dxos/client';\nimport { type Space } from '@dxos/client/echo';\nimport { performInvitation, TestBuilder } from '@dxos/client/testing';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { ClientProvider, type ClientProviderProps } from '../client';\n\ntype InitializeProps = {\n createIdentity?: boolean;\n createSpace?: boolean;\n onSpaceCreated?: (props: { client: Client; space: Space }) => MaybePromise<void>;\n};\n\n/**\n * Initialize client, identity and first space.\n */\nconst initializeClient = async (\n client: Client,\n {\n createIdentity,\n createSpace,\n onSpaceCreated,\n onInitialized,\n }: InitializeProps & Pick<WithClientProviderProps, 'onInitialized'>,\n): Promise<Space | undefined> => {\n if (createIdentity || createSpace) {\n if (!client.halo.identity.get()) {\n await client.halo.createIdentity();\n }\n }\n\n let space: Space | undefined;\n if (createSpace) {\n space = await client.spaces.create({ name: 'Test Space' });\n await onSpaceCreated?.({ client, space });\n }\n\n await onInitialized?.(client);\n return space;\n};\n\nexport type WithClientProviderProps = InitializeProps & ClientProviderProps;\n\n/**\n * Decorator that provides the client context.\n */\nexport const withClientProvider = ({\n createIdentity,\n createSpace,\n onSpaceCreated,\n onInitialized,\n ...props\n}: WithClientProviderProps = {}): Decorator => {\n return (Story) => {\n const handleInitialized = async (client: Client) => {\n await initializeClient(client, { createIdentity, createSpace, onSpaceCreated, onInitialized });\n };\n\n return (\n <ErrorBoundary FallbackComponent={ErrorFallback}>\n <ClientProvider onInitialized={handleInitialized} {...props}>\n <Story />\n </ClientProvider>\n </ErrorBoundary>\n );\n };\n};\n\n// TODO(burdon): Implement context per client for context.\n// TODO(burdon): Callback once all invitations have completed.\n// TODO(burdon): Delay/jitter for creation of other clients.\nexport type WithMultiClientProviderProps = InitializeProps & ClientProviderProps & { numClients?: number };\n\n/**\n * Decorator that creates a scaffold for multiple clients.\n * Orchestrates invitations between a randomly selected host and the remaining clients.\n * NOTE: Should come before withLayout.\n */\nexport const withMultiClientProvider = ({\n numClients = 2,\n createIdentity,\n createSpace,\n onSpaceCreated,\n onInitialized,\n ...props\n}: WithMultiClientProviderProps): Decorator => {\n return (Story) => {\n const builder = useRef(new TestBuilder());\n const hostRef = useRef<Client>();\n const spaceReady = useRef(new Trigger<Space | undefined>());\n\n // Handle invitations.\n const handleInitialized = async (client: Client) => {\n if (createSpace) {\n if (!hostRef.current) {\n hostRef.current = client;\n const space = await initializeClient(client, { createIdentity, createSpace, onSpaceCreated, onInitialized });\n spaceReady.current.wake(space);\n } else {\n await initializeClient(client, { createIdentity, onInitialized });\n const space = await spaceReady.current.wait();\n if (space) {\n await Promise.all(performInvitation({ host: space, guest: client.spaces }));\n }\n }\n }\n };\n\n return (\n <>\n {Array.from({ length: numClients }).map((_, index) => (\n <ErrorBoundary key={index} FallbackComponent={ErrorFallback}>\n <ClientProvider\n services={builder.current.createLocalClientServices()}\n onInitialized={handleInitialized}\n {...props}\n >\n <Story />\n </ClientProvider>\n </ErrorBoundary>\n ))}\n </>\n );\n };\n};\n\nconst ErrorFallback = ({ error }: FallbackProps) => {\n const { name, message, stack } =\n error instanceof Error ? error : { name: 'Error', message: String(error), stack: undefined };\n return (\n <div role='alert' className='flex flex-col overflow-hidden p-4 gap-4'>\n <h1 className='text-xl text-red-500'>{name}</h1>\n <div className='text-lg'>{message}</div>\n {stack && <pre className='whitespace-pre-wrap text-sm text-subdued'>{stack}</pre>}\n </div>\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,cAAc;;;ACCd,OAAOA,SAASC,UAAmBC,WAAWC,cAAc;AAE5D,SAASC,cAA8B;AACvC,SAASC,aAAaC,yBAAyB;AAC/C,SAASC,8BAA8B;AACvC,SAASC,aAAa;AA8Bf,IAAMC,iBAAiB,CAAyCC,UAAAA;AACrE,QAAM,EACJC,WAAWC,WACXC,UAAUC,UACVC,QAAQ,GACRC,OACAC,gBACAC,aACAC,eAAc,IACZT;AACJU,YAAU,MAAA;AACRC,2BAAAA;EACF,GAAG,CAAA,CAAE;AAEL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;IAAQC,WAAU;KAC1B,gBAAAtC,OAAA,cAACuC,MAAAA;IAAGD,WAAU;KAAwB3C,IAAAA,GACtC,gBAAAK,OAAA,cAACoC,OAAAA;IAAIE,WAAU;KAAWP,OAAAA,GACzBC,SAAS,gBAAAhC,OAAA,cAACwC,OAAAA;IAAIF,WAAU;KAA4CN,KAAAA,CAAAA;AAG3E;",
|
|
6
|
-
"names": ["React", "useState", "useEffect", "useRef", "Client", "TestBuilder", "performInvitation", "registerSignalsRuntime", "faker", "ClientRepeater", "props", "component", "Component", "controls", "Controls", "count", "types", "createIdentity", "createSpace", "onSpaceCreated", "useEffect", "registerSignalsRuntime", "clients", "setClients", "useState", "spaceKey", "setSpaceKey", "testBuilder", "useRef", "TestBuilder", "timeout", "setTimeout", "Array", "map", "_", "Client", "services", "current", "createLocalClientServices", "Promise", "all", "client", "initialize", "halo", "space", "spaces", "create", "name", "faker", "commerce", "productName", "key", "slice", "flatMap", "performInvitation", "host", "guest", "clearTimeout", "length", "index", "ClientProvider", "id", "args", "React", "useRef", "ErrorBoundary", "Trigger", "performInvitation", "TestBuilder", "initializeClient", "client", "createIdentity", "createSpace", "onSpaceCreated", "onInitialized", "halo", "identity", "get", "space", "spaces", "create", "name", "withClientProvider", "props", "Story", "handleInitialized", "React", "ErrorBoundary", "FallbackComponent", "ErrorFallback", "ClientProvider", "withMultiClientProvider", "numClients", "builder", "useRef", "TestBuilder", "hostRef", "spaceReady", "Trigger", "current", "wake", "wait", "Promise", "all", "performInvitation", "host", "guest", "Array", "from", "length", "map", "_", "index", "key", "services", "createLocalClientServices", "error", "message", "stack", "Error", "String", "undefined", "div", "role", "className", "h1", "pre"]
|
|
7
|
-
}
|
package/vitest.config.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { defineConfig, mergeConfig } from 'vitest/config';
|
|
6
|
-
|
|
7
|
-
import { baseConfig } from '../../../vitest.shared';
|
|
8
|
-
|
|
9
|
-
// TODO(wittjosiah): Factor out to shared config as an option.
|
|
10
|
-
const specifiedEnv = (process.env.VITEST_ENV ?? 'node').toLowerCase();
|
|
11
|
-
const environment = specifiedEnv === 'node' ? 'jsdom' : undefined;
|
|
12
|
-
|
|
13
|
-
export default mergeConfig(
|
|
14
|
-
baseConfig({ cwd: __dirname }),
|
|
15
|
-
defineConfig({
|
|
16
|
-
test: {
|
|
17
|
-
environment,
|
|
18
|
-
// TODO(dmaretskyi): Enabled because client tests were flaky. Remove when that's not the case.
|
|
19
|
-
retry: 2,
|
|
20
|
-
},
|
|
21
|
-
}),
|
|
22
|
-
);
|