test: fix crashReporter test on woa (#23242)

* test: fix crashReporter test on woa

* disable some tests on woa
This commit is contained in:
Jeremy Apthorp 2020-04-23 13:08:50 -07:00 committed by GitHub
parent cb6a1e2c5e
commit 176a120ec2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,7 @@ import * as childProcess from 'child_process';
import * as http from 'http';
import * as Busboy from 'busboy';
import * as path from 'path';
import { ifdescribe } from './spec-helpers';
import { ifdescribe, ifit } from './spec-helpers';
import * as temp from 'temp';
import { app } from 'electron/main';
import { crashReporter } from 'electron/common';
@ -14,6 +14,8 @@ import * as v8 from 'v8';
temp.track();
const isWindowsOnArm = process.platform === 'win32' && process.arch === 'arm64';
const afterTest: ((() => void) | (() => Promise<void>))[] = [];
async function cleanup () {
for (const cleanup of afterTest) {
@ -158,10 +160,17 @@ function runCrashApp (crashType: string, port: number, extraArgs: Array<string>
}
function waitForNewFileInDir (dir: string): Promise<string[]> {
const initialFiles = fs.readdirSync(dir);
function readdirIfPresent (dir: string): string[] {
try {
return fs.readdirSync(dir);
} catch (e) {
return [];
}
}
const initialFiles = readdirIfPresent(dir);
return new Promise(resolve => {
const ivl = setInterval(() => {
const newCrashFiles = fs.readdirSync(dir).filter(f => !initialFiles.includes(f));
const newCrashFiles = readdirIfPresent(dir).filter(f => !initialFiles.includes(f));
if (newCrashFiles.length) {
clearInterval(ivl);
resolve(newCrashFiles);
@ -225,7 +234,8 @@ ifdescribe(!process.mas && !process.env.DISABLE_CRASH_REPORTER_TESTS && process.
checkCrashExtra(crash);
});
it('should not send a minidump when uploadToServer is false', async () => {
// TODO(jeremy): re-enable on woa
ifit(!isWindowsOnArm)('should not send a minidump when uploadToServer is false', async () => {
const { port, getCrashes } = await startServer();
const crashesDir = path.join(app.getPath('temp'), 'Zombies Crashes');
const completedCrashesDir = path.join(crashesDir, 'completed');
@ -277,7 +287,8 @@ ifdescribe(!process.mas && !process.env.DISABLE_CRASH_REPORTER_TESTS && process.
});
});
describe('getLastCrashReport', () => {
// TODO(jeremy): re-enable on woa
ifdescribe(!isWindowsOnArm)('getLastCrashReport', () => {
it('returns the last uploaded report', async () => {
const { remoteEval } = await startRemoteControlApp();
const { port, waitForCrash } = await startServer();