Closed daniel-nagy closed 4 years ago
I can't log to stdout using console.log
either.
debugger support is a little complicated, because the test are not run in one process, but rather across multiple processes, and i'm not sure how to point the debugger to the right process yet.
stdout is pretty much the same story. it gets printed in some other process and the output sometimes is not forwarded to the main process. i will look into fixing this soon, it's blocking some other features as well!
Yes having a big issue with this myself, seems pretty much impossible to get an interactive debugger on breakpoints in electron with jest or mocha. jest-electron has been awesome for me, but would be a god send if this was included @aaronabramov
Or if you know any workaround or alternative at the moment I'd love to hear it. Cheers.
Also interested in any updates about debugging/logging. Really awesome otherwise so far!
Is there another way people are debugging? When my tests fail it's really hard to tell why. Would something like this work?
require('electron').remote.getCurrentWindow().show();
to show the BrowserWindow instead of running headlessNODE_ENV === 'test'
async
and at the end of my test, await promiseForever();
(a Promise that never resolves) so that I have time to inspect the Chrome DevTools console before it auto-closes when the tests exit.I don't know of any other ways I can inspect variables in a failing test. Any ideas?
@aguynamedben I'm still on using console.log
. If you find any solution I'd love to hear.
debug mode, have a try with jest-electron. https://github.com/facebook-atom/jest-electron-runner/issues/50
@aaronabramov is there a path forward on adding debugger support while using this test runner? Or is this just a side effect the multiple process implementation you mentioned? Is it possible to configure this to run on one process?
I am using vscode with the following in my launch.json and no breakpoints or console.log statements seem are hit. Is it possible maybe to add configuration to point to the the node debugger process?
{ "type": "node", "request": "launch", "name": "Jest Test", "program": "${workspaceFolder}\\node_modules\\jest\\bin\\jest", "args": ["--runInBand", "--config=${workspaceFolder}\\jest.config.js"], "console": "integratedTerminal", "internalConsoleOptions": "neverOpen", },
I am unable to put a
debugger
statement in my tests as described in Troubleshooting. The test run without hitting thedebugger
.