Registry / testing / detox-server

detox-server

JSON →
library7.0.0jsnpmunverified

WebSocket proxy server for Detox, the gray-box end-to-end testing library for mobile apps. Version 7.0.0 is current and maintained. It acts as a middleware between Detox tests and the mobile device, handling app connectivity and command proxying. Releases are coupled with Detox's release cycle, roughly monthly. Key differentiator: it is a lightweight, dedicated server component that simplifies test infrastructure by managing WebSocket connections and device sessions, unlike generic WebSocket servers that require manual setup.

npm install detox-server
INSTALL
IMPORT
SIG · DETOX-SERVER
D
detox-server
testingjavascriptv7.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DetoxServer
import { DetoxServer } from 'detox-server'
const DetoxServer = require('detox-server').DetoxServer
DetoxServer is the default export. For CommonJS, use const DetoxServer = require('detox-server').
startServer
import { startServer } from 'detox-server'
const startServer = require('detox-server').startServer
startServer is a named export. In ESM, import { startServer } from 'detox-server'; in CJS, destructure from require('detox-server').
DetoxServerOptions
import type { DetoxServerOptions } from 'detox-server'
import { DetoxServerOptions } from 'detox-server'
DetoxServerOptions is a TypeScript type. Use import type for type-only imports to avoid runtime errors. Available in TypeScript v4.5+.

Initialize and start a Detox server on port 8099 with verbose logging.

import { DetoxServer } from 'detox-server'; const server = new DetoxServer({ port: 8099, log: 'verbose', }); server.start().then(() => { console.log('Detox server listening on port 8099'); });
Debug
Known issues
breakingIn v7, the DetoxServer constructor no longer accepts a 'host' option; use 'port' only. See migration guide.
fix
Remove 'host' option from DetoxServer constructor.
affects: >=7.0.0
deprecatedThe method 'start()' now returns a Promise instead of calling a callback. Old callback style is deprecated.
fix
Use async/await or .then() instead of callbacks.
affects: >=6.0.0
gotchaDetox server only supports WebSocket connections; ensure clients connect via ws:// (not TLS) unless configured.
fix
For TLS, configure a reverse proxy (e.g., nginx) to terminate TLS.
affects: all
Errors
Common errors & fixes
Error: listen EADDRINUSE: address already in use :::8099
Port 8099 is already occupied by another process (e.g., another Detox server or application).
fix
Kill the process using port 8099 or change the port in DetoxServer constructor.
TypeError: DetoxServer is not a constructor
Importing DetoxServer incorrectly (e.g., as a default import from a named export).
fix
Use default import: import DetoxServer from 'detox-server' (ESM) or const DetoxServer = require('detox-server') (CJS).
Error: Cannot find module 'ws'
Missing peer dependency 'ws'.
fix
Run npm install ws or add 'ws' to your package.json dependencies.
Upgrade
Version history
7.0.0latest on npm
Audit
Dependencies
wsrequiredWebSocket library for server-client and server-device communication
Agent activity
8 hits · last 30 days
node
6
Amazon
1
Resources
detox-server — npm install detox-server · libregistry