From 091f45b8794ba808a6b153c94a4e9a3e1853aa28 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Fri, 8 May 2020 11:30:37 -0700 Subject: [PATCH] chore: fix linting (#23473) --- spec-main/crash-spec.ts | 66 +++++++++---------- .../early-in-memory-session-create/index.js | 8 +-- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/spec-main/crash-spec.ts b/spec-main/crash-spec.ts index 228f954d5a87..5a7d42933e49 100644 --- a/spec-main/crash-spec.ts +++ b/spec-main/crash-spec.ts @@ -1,54 +1,54 @@ -import { expect } from 'chai' -import * as cp from 'child_process' -import * as fs from 'fs' -import * as path from 'path' +import { expect } from 'chai'; +import * as cp from 'child_process'; +import * as fs from 'fs'; +import * as path from 'path'; -const fixturePath = path.resolve(__dirname, 'fixtures', 'crash-cases') +const fixturePath = path.resolve(__dirname, 'fixtures', 'crash-cases'); -let children: cp.ChildProcessWithoutNullStreams[] = [] +let children: cp.ChildProcessWithoutNullStreams[] = []; const runFixtureAndEnsureCleanExit = (args: string[]) => { - let out = '' - const child = cp.spawn(process.execPath, args) - children.push(child) + let out = ''; + const child = cp.spawn(process.execPath, args); + children.push(child); child.stdout.on('data', (chunk: Buffer) => { - out += chunk.toString() - }) + out += chunk.toString(); + }); child.stderr.on('data', (chunk: Buffer) => { - out += chunk.toString() - }) + out += chunk.toString(); + }); return new Promise((resolve) => { child.on('exit', (code, signal) => { if (code !== 0 || signal !== null) { - console.error(out) + console.error(out); } - expect(signal).to.equal(null, 'exit signal should be null') - expect(code).to.equal(0, 'should have exited with code 0') - children = children.filter(c => c !== child) - resolve() - }) - }) -} + expect(signal).to.equal(null, 'exit signal should be null'); + expect(code).to.equal(0, 'should have exited with code 0'); + children = children.filter(c => c !== child); + resolve(); + }); + }); +}; describe('crash cases', () => { afterEach(() => { for (const child of children) { - child.kill() + child.kill(); } - expect(children).to.have.lengthOf(0, 'all child processes should have exited cleanly') - children.length = 0 - }) - const cases = fs.readdirSync(fixturePath) + expect(children).to.have.lengthOf(0, 'all child processes should have exited cleanly'); + children.length = 0; + }); + const cases = fs.readdirSync(fixturePath); for (const crashCase of cases) { it(`the "${crashCase}" case should not crash`, () => { - const fixture = path.resolve(fixturePath, crashCase) - const argsFile = path.resolve(fixture, 'electron.args') - const args = [fixture] + const fixture = path.resolve(fixturePath, crashCase); + const argsFile = path.resolve(fixture, 'electron.args'); + const args = [fixture]; if (fs.existsSync(argsFile)) { - args.push(...fs.readFileSync(argsFile, 'utf8').trim().split('\n')) + args.push(...fs.readFileSync(argsFile, 'utf8').trim().split('\n')); } - return runFixtureAndEnsureCleanExit(args) - }) + return runFixtureAndEnsureCleanExit(args); + }); } -}) +}); diff --git a/spec-main/fixtures/crash-cases/early-in-memory-session-create/index.js b/spec-main/fixtures/crash-cases/early-in-memory-session-create/index.js index d507b417df1d..2944eb8eb67c 100644 --- a/spec-main/fixtures/crash-cases/early-in-memory-session-create/index.js +++ b/spec-main/fixtures/crash-cases/early-in-memory-session-create/index.js @@ -1,6 +1,6 @@ -const { app, session } = require('electron') +const { app, session } = require('electron'); app.on('ready', () => { - session.fromPartition('in-memory') - process.exit(0) -}) + session.fromPartition('in-memory'); + process.exit(0); +});