e2e tests failing due to `TypeError: Converting circular structure to JSON`
Created by: mrnugget
-
Sourcegraph version:
master
- Platform information: macOS, Google Chrome
Steps to reproduce:
- Startup `./enterprise/dev/start.sh
- Run
cd web && yarn run test-e2e
Expected behavior:
Tests running/passing
Actual behavior:
Everything fails and the output is spammed with the following message:
console.error ../node_modules/jest-jasmine2/build/jasmine/Env.js:290
TypeError: Converting circular structure to JSON
at JSON.stringify (<anonymous>)
at Page.page.on.message (/Users/thorstenball/work/sourcegraph/web/src/e2e/index.e2e.test.tsx:82:88)
at Page.emit (events.js:189:13)
at Page._addConsoleMessage (/Users/thorstenball/work/sourcegraph/node_modules/puppeteer/lib/Page.js:583:10)
at Page._onConsoleAPI (/Users/thorstenball/work/sourcegraph/node_modules/puppeteer/lib/Page.js:505:10)
at CDPSession.Page.client.on.event (/Users/thorstenball/work/sourcegraph/node_modules/puppeteer/lib/Page.js:121:57)
at CDPSession.emit (events.js:189:13)
at CDPSession._onMessage (/Users/thorstenball/work/sourcegraph/node_modules/puppeteer/lib/Connection.js:200:12)
at Connection._onMessage (/Users/thorstenball/work/sourcegraph/node_modules/puppeteer/lib/Connection.js:112:17)
at WebSocketTransport._ws.addEventListener.event (/Users/thorstenball/work/sourcegraph/node_modules/puppeteer/lib/WebSocketTransport.js:41:24)
at WebSocket.onMessage (/Users/thorstenball/work/sourcegraph/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:189:13)
at Receiver.receiverOnMessage (/Users/thorstenball/work/sourcegraph/node_modules/ws/lib/websocket.js:741:20)
at Receiver.emit (events.js:189:13)
at Receiver.dataMessage (/Users/thorstenball/work/sourcegraph/node_modules/ws/lib/receiver.js:417:14)
at Receiver.getData (/Users/thorstenball/work/sourcegraph/node_modules/ws/lib/receiver.js:347:17)
at Receiver.startLoop (/Users/thorstenball/work/sourcegraph/node_modules/ws/lib/receiver.js:133:22)
at Receiver._write (/Users/thorstenball/work/sourcegraph/node_modules/ws/lib/receiver.js:69:10)
at doWrite (_stream_writable.js:410:12)
at writeOrBuffer (_stream_writable.js:394:5)
at Receiver.Writable.write (_stream_writable.js:294:11)
at Socket.socketOnData (/Users/thorstenball/work/sourcegraph/node_modules/ws/lib/websocket.js:816:35)
at Socket.emit (events.js:189:13)
at addChunk (_stream_readable.js:284:12)
at readableAddChunk (_stream_readable.js:265:11)
at Socket.Readable.push (_stream_readable.js:220:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
I can fix it, if I change this:
Into this:
page.on('console', message => console.log('Browser console message:', message))
Then I see what was being logged:
console.log src/e2e/index.e2e.test.tsx:83
Browser console message: ConsoleMessage {
_type: 'info',
_text:
'%cDownload the React DevTools for a better development experience: https://fb.me/react-devtools font-weight:bold',
_args:
[ JSHandle {
_context: [ExecutionContext],
_client: [CDPSession],
_remoteObject: [Object],
_disposed: false },
JSHandle {
_context: [ExecutionContext],
_client: [CDPSession],
_remoteObject: [Object],
_disposed: false } ],
_location:
{ url:
'webpack-internal:///../node_modules/react-dom/cjs/react-dom.development.js',
lineNumber: 3879,
columnNumber: 46 } }
The thing is, though:
- I do have the React Devtools installed
- Why do I need to have them to run the e2e tests?