Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to Vite #1853

Merged
merged 39 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a8a47bd
Add vite
hsmr29 Apr 30, 2024
fe4ba72
Remove @bit/mui-org.material-ui.swipeable-drawer which breaks vite
hsmr29 Apr 30, 2024
6997267
MultiGesture: Change require react-native to import.
hsmr29 Apr 30, 2024
53ba3b3
Fix index.html
hsmr29 Apr 30, 2024
10fa989
Replace env REACT_APP_ with VITE_.
hsmr29 Apr 30, 2024
f18c3af
thoughtspace: Change require clearDocument from y-indexeddb to import.
hsmr29 Apr 30, 2024
e089d1e
Remove react-scripts and react-app-rewired.
hsmr29 Apr 30, 2024
5de5502
Add vitest and happy-dom.
hsmr29 Apr 30, 2024
8be2f10
Update tests to use vitest
hsmr29 May 1, 2024
cad106d
Add @mui/material library to use the SwipeableDrawer component
hsmr29 May 2, 2024
7f4ed60
Skip broken style test
hsmr29 May 3, 2024
5773438
Fix eslintsrc config to support type:module in package.json
hsmr29 May 4, 2024
e908a47
Add necessary vi import in mock-debounce-throttle
hsmr29 May 4, 2024
7d3d165
Host vite dev server on local network.
raineorshine May 4, 2024
d5b60e0
Remove global.crypto declaration in setupTest file
hsmr29 May 6, 2024
33ce70a
Create vitests workspace file and move the current test config into it
hsmr29 May 8, 2024
5010645
Update puppeteer tests and puppeteer-environment to use vitest
hsmr29 May 8, 2024
7a590fa
Remove unnecessary jest dependencies
hsmr29 May 8, 2024
94b3dd3
Update puppeteer snapshots images
hsmr29 May 8, 2024
7b6ba65
Puppeteer + MacOS (#1845)
raineorshine May 4, 2024
1b9c0b8
Temporarily disable the broken ios workflow.
raineorshine May 4, 2024
95c3aa1
autofocus: Enable working table view test.
raineorshine May 5, 2024
3c4e102
Delete obsolete appendChildPath test.
raineorshine May 5, 2024
5130bec
Delete obsolete chain test.
raineorshine May 5, 2024
f74e15f
setCursor: Fix context view test.
raineorshine May 5, 2024
a8ccc21
Do not override =headings style with .thought font-weight.
raineorshine May 6, 2024
3a83fcd
let-style: Add act to tests.
raineorshine May 6, 2024
74f876e
updateUrlHistory: Convert to test RTL and use act.
raineorshine May 6, 2024
066db4c
pushQueue test: Convert from Enzynme to RTL.
raineorshine May 6, 2024
2ddc34e
Divider: Convert test from Enzyme to RTL.
raineorshine May 6, 2024
5b03997
Remove Enzyme.
raineorshine May 6, 2024
e77c593
=style test: Wrap dispatch in act block.
raineorshine May 6, 2024
76965f4
cursorPrev/cursorNext test: Remove unneeded jest.useFakeTimers.
raineorshine May 6, 2024
a830ba6
Bump fake-indexeddb.
raineorshine May 6, 2024
1f7c601
Merge branch 'main' into vite-migration
hsmr29 May 9, 2024
6185af4
Switch environment for unit tests from happy-dom to jsdom
hsmr29 May 9, 2024
e749435
Update puppeteer snapshot images
hsmr29 May 9, 2024
160c50b
Update puppeteer version
hsmr29 May 10, 2024
5612743
Update puppeteer snapshot images
hsmr29 May 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
EXTEND_ESLINT=true

# ALGOLIA CONFIG
REACT_APP_ALGOLIA_SEARCH_KEY_ENDPOINT=https://us-central1-em-search-test.cloudfunctions.net/getSearchKey
REACT_APP_ALGOLIA_APPPLICATION_ID=AJCS0S8FVN
REACT_APP_ALGOLIA_INDEX=SEARCH_EM
VITE_ALGOLIA_SEARCH_KEY_ENDPOINT=https://us-central1-em-search-test.cloudfunctions.net/getSearchKey
VITE_ALGOLIA_APPPLICATION_ID=AJCS0S8FVN
VITE_ALGOLIA_INDEX=SEARCH_EM

# FIREBASE CONFIG
# Firebase API Key is safe to expose
# See: https://stackoverflow.com/questions/37482366/is-it-safe-to-expose-firebase-apikey-to-the-public
REACT_APP_FIREBASE_API_KEY=AIzaSyB7sj38woH-oJ7hcSwpq0lB7hUteyZMxNo
REACT_APP_FIREBASE_AUTH_DOMAIN=em-proto.firebaseapp.com
REACT_APP_FIREBASE_DATABASE_URL=https://em-proto.firebaseio.com
REACT_APP_FIREBASE_PROJECT_ID=em-proto
REACT_APP_FIREBASE_STORAGE_BUCKET=gs://em-proto.appspot.com/
REACT_APP_FIREBASE_MESSAGE_SENDER_ID=91947960488
VITE_FIREBASE_API_KEY=AIzaSyB7sj38woH-oJ7hcSwpq0lB7hUteyZMxNo
VITE_FIREBASE_AUTH_DOMAIN=em-proto.firebaseapp.com
VITE_FIREBASE_DATABASE_URL=https://em-proto.firebaseio.com
VITE_FIREBASE_PROJECT_ID=em-proto
VITE_FIREBASE_STORAGE_BUCKET=gs://em-proto.appspot.com/
VITE_FIREBASE_MESSAGE_SENDER_ID=91947960488

# Demo mode
# REACT_APP_DEMO=1
# VITE_DEMO=1
8 changes: 4 additions & 4 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
# See: https://create-react-app.dev/docs/adding-custom-environment-variables/#what-other-env-files-can-be-used

# FEEDBACK CONFIG
REACT_APP_FEEDBACK_URL=https://us-central1-em-search-test.cloudfunctions.net/sendFeedbackEmail
VITE_FEEDBACK_URL=https://us-central1-em-search-test.cloudfunctions.net/sendFeedbackEmail

# WEBSOCKET
REACT_APP_WEBSOCKET_HOST=localhost
REACT_APP_WEBSOCKET_PORT=3001
VITE_WEBSOCKET_HOST=localhost
VITE_WEBSOCKET_PORT=3001

# CAPACITOR
# Local IP addresses should only be defined in .env.development.local so that they are not checked into version control.
CAPACITOR_SERVER_URL=

# AI SERVER
REACT_APP_AI_URL=http://localhost:3001/ai
VITE_AI_URL=http://localhost:3001/ai
8 changes: 4 additions & 4 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# See: https://create-react-app.dev/docs/adding-custom-environment-variables/#what-other-env-files-can-be-used

# FEEDBACK CONFIG
REACT_APP_FEEDBACK_URL=https://us-central1-em-proto.cloudfunctions.net/sendFeedbackEmail
VITE_FEEDBACK_URL=https://us-central1-em-proto.cloudfunctions.net/sendFeedbackEmail

# WEBSOCKET
REACT_APP_WEBSOCKET_HOST=em-staging-sa2jm.ondigitalocean.app
REACT_APP_WEBSOCKET_PORT=
VITE_WEBSOCKET_HOST=em-staging-sa2jm.ondigitalocean.app
VITE_WEBSOCKET_PORT=

# AI SERVER
REACT_APP_AI_URL=https://em-staging-sa2jm.ondigitalocean.app/ai
VITE_AI_URL=https://em-staging-sa2jm.ondigitalocean.app/ai
File renamed without changes.
1 change: 0 additions & 1 deletion .ncurc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ module.exports = {
// https://github.com/jsdom/whatwg-encoding/pull/11
'ipfs-http-client',

// jest-puppeteer requires puppeteer <v10
'puppeteer',

// Broken: ^6.0.1 → ^7.0.5
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ The above scripts run in development mode by default. You can copy or sync in pr

em is an offline-first app that can run on a static web server.

Environment variables are set in the appropriate .env file: `.env.development` and `.env.production`. Only `.env.production` is kept in source control. Environment variables that are prepended with `REACT_APP_` will be bundled with the build and available client-side.
Environment variables are set in the appropriate .env file: `.env.development` and `.env.production`. Only `.env.production` is kept in source control. Environment variables that are prepended with `VITE_` will be bundled with the build and available client-side.

```sh
# build the static HTML/CSS/JS app in the /build directory
Expand Down
22 changes: 7 additions & 15 deletions public/index.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,15 @@
<meta name="apple-mobile-web-app-capable" content="yes" />

<!-- Favicons -->
<link rel="apple-touch-icon" sizes="180x180" href="%PUBLIC_URL%/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="%PUBLIC_URL%/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="%PUBLIC_URL%/favicon-16x16.png" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<!-- Fixes PWA w/o service worker bug. See https://stackoverflow.com/questions/49689208/issue-with-pwa-on-ios-113 -->
<!-- <link rel="manifest" href="%PUBLIC_URL%/site.webmanifest"> -->
<link rel="mask-icon" href="%PUBLIC_URL%/safari-pinned-tab.svg" color="#333333" />
<link href="%PUBLIC_URL%/fonts/lora.css" rel="stylesheet" />
<!-- <link rel="manifest" href="/site.webmanifest"> -->
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#333333" />
<link href="/fonts/lora.css" rel="stylesheet" />
<meta name="msapplication-TileColor" content="#000000" />
<meta name="theme-color" content="#000" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>em</title>

<style>
Expand All @@ -49,5 +40,6 @@
const theme = localStorage.getItem('storageCache/theme')?.toLowerCase() || 'dark'
document.body.classList.add(theme)
</script>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@
"last 1 safari version"
]
},
"type": "module",
"scripts": {
"cap:ios": "npm run cap:sync && cap open ios",
"cap:android": "npm run cap:sync && cap open android",
"cap:copy": "NODE_ENV=development && cap copy",
"cap:copy:prod": "NODE_ENV=production && cap copy",
"cap:sync": "NODE_ENV=development && cap sync",
"cap:sync:prod": "npm run build && NODE_ENV=production cap sync",
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"start": "vite --host --port 3000",
"build": "vite build",
"clean": "rm -rf ./node_modules/.cache",
"docs": "typedoc --options typedoc.json",
"deploy:major": "npm run lint && npm version major && npm run build && firebase deploy --only hosting",
Expand All @@ -41,9 +42,9 @@
"lint:no-npm": "node ./scripts/no-files.js package-lock.json",
"postinstall": "scripts/install-hooks",
"servebuild": "npx serve -s build -l 3000",
"test": "react-app-rewired test --testPathIgnorePatterns=./src/e2e",
"test:ios": "react-app-rewired test ./src/e2e/iOS --verbose",
"test:puppeteer": "react-app-rewired test ./src/e2e/puppeteer",
"test": "vitest --project unit",
"test:ios": "jest ./src/e2e/iOS --verbose",
"test:puppeteer": "vitest --project puppeteer-e2e",
"websocket-server": "cd server && npm run build && npm start"
},
"lockfile-lint": {
Expand All @@ -60,7 +61,6 @@
"empty-hostname": false,
"path": "yarn.lock"
},
"config-overrides-path": "react-app-rewired.config.js",
"jest": {
"resetMocks": false
},
Expand All @@ -69,14 +69,16 @@
"@typescript-eslint/parser": "^7.7.0"
},
"dependencies": {
"@bit/mui-org.material-ui.swipeable-drawer": "^4.9.10",
"@capacitor/android": "^4.6.1",
"@capacitor/clipboard": "^4.1.0",
"@capacitor/core": "^4.6.1",
"@capacitor/ios": "^4.6.1",
"@capacitor/keyboard": "^4.1.1",
"@capacitor/status-bar": "^4.1.1",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@hocuspocus/provider": "^2.7.0",
"@mui/material": "^5.15.16",
"algoliasearch": "^4.9.2",
"axios": "^1.6.8",
"classnames": "^2.3.1",
Expand Down Expand Up @@ -110,7 +112,6 @@
"react-native-gesture-handler": "^1.10.2",
"react-native-web": "^0.16.5",
"react-redux": "^7.2.4",
"react-scripts": "^5.0.1",
"react-signature-pad-wrapper": "^3.3.1",
"react-split-pane": "^0.1.92",
"react-transition-group": "^4.4.2",
Expand Down Expand Up @@ -143,7 +144,6 @@
"@types/expect-puppeteer": "^4.4.5",
"@types/html-escaper": "^3.0.0",
"@types/jest": "^26.0.23",
"@types/jest-environment-puppeteer": "^4.4.1",
"@types/jest-image-snapshot": "^5.1.0",
"@types/lodash": "^4.14.170",
"@types/murmurhash3js": "^3.0.2",
Expand All @@ -163,6 +163,7 @@
"@types/yallist": "^4.0.1",
"@typescript-eslint/eslint-plugin": "^7.7.0",
"@typescript-eslint/parser": "^7.7.0",
"@vitejs/plugin-react": "^4.2.1",
"browserstack-local": "^1.4.8",
"chalk": "^4.1.1",
"dotenv": "8.2.0",
Expand All @@ -183,20 +184,17 @@
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-react-native": "^3.11.0",
"fake-indexeddb": "^5.0.2",
"happy-dom": "^14.7.1",
"it-all": "^1.0.5",
"jest": "^27.5.1",
"jest-environment-node": "^27.0.3",
"jest-environment-puppeteer-jsdom": "^4.3.1",
"jest-extended": "^4.0.2",
"jest-image-snapshot": "^5.2.0",
"jest-localstorage-mock": "^2.4.14",
"jest-puppeteer": "^5.0.4",
"lockfile-lint": "^4.9.6",
"npm-run-all": "^4.1.5",
"postinstall-postinstall": "^2.1.0",
"prettier": "^3.0.0",
"puppeteer": "^9.1.1",
"react-app-rewired": "^2.2.1",
"puppeteer": "^22.8.0",
"react-dnd-test-backend": "^14.0.0",
"react-dnd-test-utils": "^11.1.3",
"redux-mock-store": "^1.5.4",
Expand All @@ -206,6 +204,8 @@
"typedoc-plugin-external-module-name": "^4.0.6",
"typedoc-plugin-rename-named-parameters": "^1.0.6",
"typescript": "^4.9.5",
"vite": "^5.2.10",
"vitest": "^1.5.3",
"webdriverio": "^7.7.3"
}
}
16 changes: 0 additions & 16 deletions react-app-rewired.config.js

This file was deleted.

12 changes: 6 additions & 6 deletions server/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
A websocket server that synchronizes thoughts between multiple devices and users.

The app will automatically connect to the server specified by the client-side env variables `REACT_APP_WEBSOCKET_HOST` and `REACT_APP_WEBSOCKET_PORT` (see [client](https://github.com/cybersemics/em/tree/staging2/server#client)).
The app will automatically connect to the server specified by the client-side env variables `VITE_WEBSOCKET_HOST` and `VITE_WEBSOCKET_PORT` (see [client](https://github.com/cybersemics/em/tree/staging2/server#client)).

# Local Development

Expand Down Expand Up @@ -35,7 +35,7 @@ Other npm scripts:

## Testing with live staging or production data

Normally in local development the app connects to the local websocket server and database. To test with live staging or production data, override `REACT_APP_WEBSOCKET_HOST` in `.env.development` with the value from `.env.production` or `.env.staging` and restart localhost. It is recommended that you run the app on a different port to ensure that local storage stays sandboxed, i.e. `PORT=3012 npm start`.
Normally in local development the app connects to the local websocket server and database. To test with live staging or production data, override `VITE_WEBSOCKET_HOST` in `.env.development` with the value from `.env.production` or `.env.staging` and restart localhost. It is recommended that you run the app on a different port to ensure that local storage stays sandboxed, i.e. `PORT=3012 npm start`.

Note: `NODE_ENV` itself cannot be manually overwritten, and is set based on how the server is started:

Expand Down Expand Up @@ -67,10 +67,10 @@ services:
npm run build
environment_slug: node-js
envs:
- key: REACT_APP_WEBSOCKET_HOST
- key: VITE_WEBSOCKET_HOST
scope: RUN_AND_BUILD_TIME
value: 0.0.0.0
- key: REACT_APP_WEBSOCKET_PORT
- key: VITE_WEBSOCKET_PORT
scope: RUN_AND_BUILD_TIME
value: '80'
- key: MONGODB_CONNECTION_STRING
Expand Down Expand Up @@ -98,8 +98,8 @@ services:
The client-side app needs the following envirionment variables set to connect to the websocket server. They are stored in `.env` files and embedded in the static build by react-scripts. See: https://create-react-app.dev/docs/adding-custom-environment-variables/#what-other-env-files-can-be-used.

```ini
REACT_APP_WEBSOCKET_HOST=app12345.ondigitalocean.app
REACT_APP_WEBSOCKET_PORT=
VITE_WEBSOCKET_HOST=app12345.ondigitalocean.app
VITE_WEBSOCKET_PORT=
```

### Server
Expand Down
6 changes: 1 addition & 5 deletions src/components/MultiGesture.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { GestureResponderEvent } from 'react-native'
import { GestureResponderEvent, PanResponder, View } from 'react-native'
import { useSelector } from 'react-redux'
import Direction from '../@types/Direction'
import GesturePath from '../@types/GesturePath'
Expand All @@ -10,10 +10,6 @@ import themeColors from '../selectors/themeColors'
import gestureStore from '../stores/gesture'
import TraceGesture from './TraceGesture'

// expects peer dependencies react-dom and react-native-web
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { PanResponder, View } = require('react-native')

interface Point {
x: number
y: number
Expand Down
4 changes: 2 additions & 2 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwipeableDrawer, { SwipeableDrawerProps } from '@bit/mui-org.material-ui.swipeable-drawer'
import SwipeableDrawer, { SwipeableDrawerProps } from '@mui/material/SwipeableDrawer'
import _ from 'lodash'
import React, { useRef, useState } from 'react'
import { useRef, useState } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import dragHold from '../action-creators/dragHold'
import dragInProgress from '../action-creators/dragInProgress'
Expand Down
6 changes: 3 additions & 3 deletions src/data-providers/yjs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import Share from '../../@types/Share'
import storage from '../../util/storage'
import { encodePermissionsDocumentName } from './documentNameEncoder'

const host = process.env.REACT_APP_WEBSOCKET_HOST || 'localhost'
const port = process.env.REACT_APP_WEBSOCKET_PORT || (host === 'localhost' ? 3001 : '')
const host = import.meta.env.VITE_WEBSOCKET_HOST || 'localhost'
const port = import.meta.env.VITE_WEBSOCKET_PORT || (host === 'localhost' ? 3001 : '')
const protocol = host === 'localhost' ? 'ws' : 'wss'

export const websocketUrl = `${protocol}://${host}${port ? ':' + port : ''}/hocuspocus`
Expand Down Expand Up @@ -59,7 +59,7 @@ export const clientIdReady = (
})

// Disable IndexedDB during tests because of TransactionInactiveError in fake-indexeddb.
if (process.env.NODE_ENV !== 'test') {
if (import.meta.env.MODE !== 'test') {
// eslint-disable-next-line no-new
new IndexeddbPersistence(encodePermissionsDocumentName(tsid), permissionsClientDoc)
}
Expand Down
13 changes: 5 additions & 8 deletions src/data-providers/yjs/thoughtspace.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HocuspocusProvider, HocuspocusProviderWebsocket } from '@hocuspocus/provider'
import { nanoid } from 'nanoid'
import { IndexeddbPersistence } from 'y-indexeddb'
import { IndexeddbPersistence, clearDocument } from 'y-indexeddb'
import * as Y from 'yjs'
import DocLogAction from '../../@types/DocLogAction'
import Index from '../../@types/IndexType'
Expand Down Expand Up @@ -33,9 +33,6 @@ import {
} from './documentNameEncoder'
import replicationController from './replicationController'

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { clearDocument } = require('y-indexeddb') as { clearDocument: (name: string) => Promise<void> }

/**********************************************************************
* Types
**********************************************************************/
Expand Down Expand Up @@ -295,7 +292,7 @@ export const init = async (options: ThoughtspaceOptions) => {
doclog.on('subdocs', ({ added, removed, loaded }: { added: Set<Y.Doc>; removed: Set<Y.Doc>; loaded: Set<Y.Doc> }) => {
loaded.forEach((subdoc: Y.Doc) => {
// Disable IndexedDB during tests because of TransactionInactiveError in fake-indexeddb.
if (process.env.NODE_ENV !== 'test') {
if (import.meta.env.MODE !== 'test') {
const persistence = new IndexeddbPersistence(subdoc.guid, subdoc)
persistence.whenSynced
.then(() => {
Expand All @@ -319,7 +316,7 @@ export const init = async (options: ThoughtspaceOptions) => {
})

// Disable IndexedDB during tests because of TransactionInactiveError in fake-indexeddb.
if (process.env.NODE_ENV !== 'test') {
if (import.meta.env.MODE !== 'test') {
const doclogPersistence = new IndexeddbPersistence(encodeDocLogDocumentName(tsid), doclog)
doclogPersistence.whenSynced
.then(() => {
Expand Down Expand Up @@ -770,7 +767,7 @@ export const replicateChildren = async (
// If the doc is cached, return as soon as the appropriate providers are synced.
// Disable IDB during tests because of TransactionInactiveError in fake-indexeddb.
// Disable websocket during tests because of infinite loop in sinon runAllAsync.
if (thoughtDocs.get(docKey) || process.env.NODE_ENV === 'test') {
if (thoughtDocs.get(docKey) || import.meta.env.MODE === 'test') {
// The Doc exists, but it may not be populated yet if replication has not completed.
// Wait for the appropriate replication to complete before accessing children.
if (background && remote) {
Expand Down Expand Up @@ -986,7 +983,7 @@ export const replicateLexeme = async (
// If the doc is cached, return as soon as the appropriate providers are synced.
// Disable IDB during tests because of TransactionInactiveError in fake-indexeddb.
// Disable websocket during tests because of infinite loop in sinon runAllAsync.
if (lexemeDocs.get(key) || process.env.NODE_ENV === 'test') {
if (lexemeDocs.get(key) || import.meta.env.MODE === 'test') {
if (background) {
await lexemeWebsocketSynced.get(key)
} else {
Expand Down
Loading