@quiesco/native is a React Native TurboModule and
@quiesco/agent a plain JS package, so an app made with the React Native Community CLI
(npx @react-native-community/cli init) can be tested on iOS and Android without installing expo.
The app needs React Native 0.83 or later with the New Architecture. For an Expo app, see
Set up an Expo app.
quiesco init does the setup and quiesco build makes the e2e build, in the project’s own ios/ and
android/: nothing of Expo is installed or run. A complete example is in the repository:
examples/bare-rn-app.
init asks which test runner to use (Vitest, Jest or Cucumber), never overwrites a file and lists what it
left to you (CLI).
What is set up
1
Packages
@quiesco/vitest is the Vitest integration; Jest and Cucumber work the same way.2
Metro
metro.config.js
withQuiesco() puts the agent into bundles made with EXPO_PUBLIC_QUIESCO=1 and a no-op stub into
every other bundle. The variable keeps its name in apps without Expo. init wraps the config of
React Native’s template; for another one it says what to add.3
The entry file
index.js
<QuiescoRoot> connects the app to the test run.
init writes this for the entry of React Native’s template; you can also wrap the root component in
App.tsx yourself.4
The config
quiesco.config.mts
devServer.url says that the debug builds load their
JS from Metro: quiesco test starts it when it is not running. reversePorts lets the emulator
reach it. Every option is in configuration; the runner’s own config and a first test are
in test runners.Build and run
- iOS
- Android
quiesco build ios runs pod install and xcodebuild; quiesco build android deletes React Native’s
autolinking list and runs gradlew. Both set EXPO_PUBLIC_QUIESCO=1, because autolinking takes
@quiesco/native only then (CLI).
The log of a run says whether the native module is in the app (native module true). When it says
false, the build was made without the variable, or with the autolinking result of an earlier build:
actions then fall back to js mode.
Build without the CLI
quiesco build runs ordinary React Native builds. The same by hand, for example in a CI job that has
its own build steps:
- iOS
- Android
quiesco test starts it
that way). A release build has its JS inside; build it with the variable, and remove devServer from
quiesco.config.mts.
Builds that are not e2e builds
Without the variable autolinking leaves@quiesco/native out and Metro bundles a stub in place of the
agent, so a release contains nothing of Quiesco and your app needs no setting for that. When you go back
from an e2e build:
- iOS: run
pod installagain without the variable. The pod stays in the Xcode project until you do. - Android: a build that would still link the module from the cached list stops with a message and deletes the list; run it again.
The web
An app that also runs in the browser withreact-native-web is tested there too. The web build is the
project’s own. Quiesco supports one made with Vite: quiescoAgent() does for Vite what withQuiesco()
does for Metro.
vite.config.mts
EXPO_PUBLIC_QUIESCO=1 and a no-op stub into every other
build. The agent must be the first import of the web build’s entry file too (the module script of
index.html).
quiesco.config.mts
quiesco test starts Vite’s dev server with the variable when nothing answers at apps.web.url, and
stops it afterwards. To test a built app, set apps.web.distDir to the output of vite build, made with
the variable. quiesco init does this setup when the project has react-native-web and a Vite config.
Touches and text come from Playwright in the browser, so @quiesco/native is not in the web build. Vite
is the only bundler with a plugin.
What is different from an Expo app
- The app must be able to reach the test run on
localhost. A debug build can; a release build needsNSAllowsLocalNetworkingin the Info.plist’s App Transport Security settings (the React Native template has it) and, on Android, a network security config that allows cleartext traffic tolocalhost.@quiesco/expo-pluginwrites both for an Expo app. apps.<platform>.devClientis for Expo development builds. Do not set it: a React Native debug build finds Metro by itself, anddevServer.urltellsquiesco testwhere that is.app.device.relaunch({ url })gives the app the link through React Native’sLinking.getInitialURL().- The web build is the project’s own, made with Vite; Expo’s web export is not used (the web).
quiesco buildnever generates or deletesios/andandroid/, and always builds: the native projects are yours.