flotwig / cypress-log-to-output

A Cypress plugin that sends all logs that occur in the browser to stdout in the terminal.
146 stars 19 forks source link

Electron support - possible solution? #2

Open Cleudi opened 5 years ago

Cleudi commented 5 years ago

There is an env named ELECTRON_ENABLE_LOGGING=1 which seems to fix the electron issue. Can you please test this?

See also https://github.com/cypress-io/cypress/issues/3199#issuecomment-492728331

konekoya commented 5 years ago

There is an env named ELECTRON_ENABLE_LOGGING=1 which seems to fix the electron issue. Can you please test this?

I tried this today. But it didn't work. But it works okay with @xhubbsaxo's snippet

flotwig commented 5 years ago

You can also run Cypress with debug logs enabled to get the Electron logs in stderr:

It will share some extra data, but console.logs and stuff are in there too.

nmschulte-aviture commented 4 years ago

Does the new browser launch API, with Cypress v4, make it possible to support Electron? https://docs.cypress.io/api/plugins/browser-launch-api.html#Usage

flotwig commented 4 years ago

unfortunately not @nmschulte-aviture

pkyeck commented 3 years ago

You can also run Cypress with debug logs enabled to get the Electron logs in stderr:

  • On Linux/macOS: DEBUG=cypress:server:browsers:electron cypress ...
  • On Windows: npx cross-env DEBUG=cypress:server:browsers:electron cypress ...

It will share some extra data, but console.logs and stuff are in there too.

That works – thanks. But do you have an idea how we could filter + reformat the DEBUG-logs?

cypress:server:browsers:electron console message: { column: 1430321, level: 'log', line: 2, source: 'console-api', text: ' prev state color: #9E9E9E; font-weight: bold [object Object]', url: 'http://ui/static/js/2.feecd219.chunk.js' }
cypress:server:browsers:electron console message: { column: 1430441, level: 'log', line: 2, source: 'console-api', text: ' action     color: #03A9F4; font-weight: bold [object Object]', url: 'http://ui/static/js/2.feecd219.chunk.js' }

These super-noisy lines aren't helpful after all :(

flotwig commented 3 years ago

@pkyeck no possible way to do it currently. Maybe you could hack something by piping through awk/sed

pkyeck commented 3 years ago

@flotwig yeah, already thought about that. But it's too late at this point because we have a lot of [object Object]s in there that should be stringified (or something similar) before printing them to stdout.