Skip to content

Commit

Permalink
Show Quiet logs in e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EmiM committed Sep 20, 2023
1 parent 15a9d41 commit 6720c6f
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/e2e-tests/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,16 @@ export class BuildSetup {
await this.initPorts()
const env = {
DATA_DIR: this.dataDir || 'Quiet',
DEBUG: 'backend*',
DEBUG: 'backend*,desktop*',
}
if (process.platform === 'win32') {
console.log('!WINDOWS!')
this.child = spawn(`cd node_modules/.bin & chromedriver.cmd --port=${this.port}`, [], {
this.child = spawn(`cd node_modules/.bin & chromedriver.cmd --port=${this.port} --verbose`, [], {
shell: true,
env: Object.assign(process.env, env),
})
} else {
this.child = spawn(`node_modules/.bin/chromedriver --port=${this.port}`, [], {
this.child = spawn(`node_modules/.bin/chromedriver --port=${this.port} --verbose`, [], {
shell: true,
detached: false,
env: Object.assign(process.env, env),
Expand All @@ -125,7 +125,7 @@ export class BuildSetup {
)

this.child.on('error', () => {
console.log('ERROR')
console.error('ERROR')
this.killNine()
})

Expand All @@ -143,15 +143,21 @@ export class BuildSetup {
console.log('message', data)
})
this.child.on('error', data => {
console.log('error', data)
console.error('error', data)
})

this.child.stdout.on('data', data => {
console.log(`stdout:\n${data}`)
})

this.child.stderr.on('data', data => {
console.error(`stderr: ${data}`)
// Quiet logs (handled 'debug' package) are available in stderr and only with 'verbose' flag on chromedriver
const trashLogs = ['DevTools', 'COMMAND', 'INFO:CONSOLE', '[INFO]:']
const dataString = `${data}`
for (const l of trashLogs) {
if (dataString.includes(l)) return
}
console.log(dataString)
})

this.child.stdin.on('data', data => {
Expand Down

0 comments on commit 6720c6f

Please sign in to comment.