From 629c2121baf987db282af1ea070008689d9e82cf Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 7 Feb 2020 01:15:55 +0900 Subject: [PATCH] chore: print more logging for failed tests (#22060) --- spec-main/api-menu-spec.ts | 6 +++++- spec-main/api-web-contents-view-spec.ts | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/spec-main/api-menu-spec.ts b/spec-main/api-menu-spec.ts index 241c5719e6b3..97453044b372 100644 --- a/spec-main/api-menu-spec.ts +++ b/spec-main/api-menu-spec.ts @@ -888,8 +888,12 @@ describe('Menu module', function () { let output = '' appProcess.stdout.on('data', data => { output += data }) + appProcess.stderr.on('data', data => { output += data }) - await emittedOnce(appProcess, 'exit') + const [code] = await emittedOnce(appProcess, 'exit') + if (!output.includes('Window has no menu')) { + console.log(code, output) + } expect(output).to.include('Window has no menu') }) }) diff --git a/spec-main/api-web-contents-view-spec.ts b/spec-main/api-web-contents-view-spec.ts index 1e2fda543bc0..78942baabce9 100644 --- a/spec-main/api-web-contents-view-spec.ts +++ b/spec-main/api-web-contents-view-spec.ts @@ -29,8 +29,14 @@ describe('WebContentsView', () => { it('does not crash on exit', async () => { const appPath = path.join(__dirname, 'fixtures', 'api', 'leak-exit-webcontentsview.js') const electronPath = process.execPath - const appProcess = ChildProcess.spawn(electronPath, [appPath]) + const appProcess = ChildProcess.spawn(electronPath, ['--enable-logging', appPath]) + let output = '' + appProcess.stdout.on('data', data => { output += data }) + appProcess.stderr.on('data', data => { output += data }) const [code] = await emittedOnce(appProcess, 'exit') + if (code !== 0) { + console.log(code, output) + } expect(code).to.equal(0) }) })