javascript - Jest referenceError 'is not defined' -


i'm never calling websocket directly, dependency of asteroid. why jest failing load it? also, supposed default create-react-app test check app "renders without crashing". app loads fine though jest test says should crash.

my commit: https://github.com/falieson/typescript-react-asteroid-meteor/commit/ab640bee540f1f2f5da2f0fe7b4be58f75b83d28#commitcomment-23644562

> node scripts/test.js --env=jsdom --silent   fail  src/routes/app.test.tsx   ● test suite failed run      referenceerror: websocket not defined        @ asteroid.init (node_modules/asteroid/lib/base-mixins/ddp.js:46:67)       @ node_modules/asteroid/lib/asteroid.js:72:33       @ array.foreach (native)       @ new asteroid (node_modules/asteroid/lib/asteroid.js:70:16)       @ object.<anonymous> (src/config/asteroid.ts:6:16)       @ object.<anonymous> (src/routes/login.tsx:14:18)       @ object.<anonymous> (src/routes/app.tsx:19:15)       @ object.<anonymous> (src/routes/app.test.tsx:5:13)           @ <anonymous>       @ process._tickcallback (internal/process/next_tick.js:188:7)  test suites: 1 failed, 1 total tests:       0 total snapshots:   0 total time:        1.915s 

thanks help

i have been bugged asteroid while before figured out can specify websocket want use in constructor so:

const asteroid = require('asteroid'); const websocket = require('ws');  const connection = asteroid.createclass()  const portal = new connection({     endpoint: 'ws://localhost:3000/websocket',     socketconstructor: websocket // <-------------- here }) 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -