I'm never calling WebSocket directly; it’s a dependency of Asteroid. Why is Jest failing to load it?
Also, this is supposed to be a default create-react-app test to check the App "renders without crashing". But the app loads fine even though the Jest test says it should crash.
node scripts/test.js --env=jsdom --silent
Output:
FAIL src/routes/App.test.tsx
● Test suite failed to run
ReferenceError: WebSocket is not defined
at Asteroid.init (node_modules/asteroid/lib/base-mixins/ddp.js:46:67)
at node_modules/asteroid/lib/asteroid.js:72:33
at Array.forEach (native)
at new Asteroid (node_modules/asteroid/lib/asteroid.js:70:16)
at Object.<anonymous> (src/config/asteroid.ts:6:16)
at Object.<anonymous> (src/routes/Login.tsx:14:18)
at Object.<anonymous> (src/routes/App.tsx:19:15)
at Object.<anonymous> (src/routes/App.test.tsx:5:13)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 1.915s