mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
chore: migrate api-crash-reporter-spec.ts to vitest
This commit is contained in:
@@ -3,6 +3,7 @@ import { app } from 'electron/main';
|
||||
import * as Busboy from 'busboy';
|
||||
import { expect } from 'chai';
|
||||
import * as uuid from 'uuid';
|
||||
import { describe, it } from 'vitest';
|
||||
|
||||
import * as childProcess from 'node:child_process';
|
||||
import { EventEmitter } from 'node:events';
|
||||
@@ -263,10 +264,9 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_
|
||||
// Regression: base::circular_deque relocates elements on growth,
|
||||
// corrupting crashpad::Annotation's self-referential pointers and
|
||||
// causing missing crash keys or a hung handler. See crash_keys.cc.
|
||||
it('does not corrupt the crashpad annotation list after deque reallocation', async function () {
|
||||
it('does not corrupt the crashpad annotation list after deque reallocation', { timeout: 45000 }, async () => {
|
||||
// Tight timeout so a hanging handler fails fast instead of waiting
|
||||
// for the mocha default of 120s.
|
||||
this.timeout(45000);
|
||||
// for the suite default.
|
||||
const { port, waitForCrash } = await startServer();
|
||||
runCrashApp('renderer-dynamic-keys', port);
|
||||
const crash = await Promise.race([
|
||||
@@ -330,20 +330,22 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_
|
||||
});
|
||||
|
||||
describe('OOM crash keys', () => {
|
||||
it('reports OOM stack trace and heap statistics when renderer runs out of memory', async function () {
|
||||
this.timeout(120000);
|
||||
const { port, waitForCrash } = await startServer();
|
||||
runCrashApp('renderer-oom', port, ['--js-flags=--max-old-space-size=128']);
|
||||
const crash = await waitForCrash();
|
||||
expect(crash.process_type).to.equal('renderer');
|
||||
expect(crash['electron.v8-oom.stack']).to.be.a('string');
|
||||
expect(crash['electron.v8-oom.stack']).to.include('oomTrigger');
|
||||
expect(crash['electron.v8-oom.heap.used']).to.be.a('string');
|
||||
expect(crash['electron.v8-oom.heap.limit']).to.be.a('string');
|
||||
});
|
||||
it(
|
||||
'reports OOM stack trace and heap statistics when renderer runs out of memory',
|
||||
{ timeout: 120000 },
|
||||
async () => {
|
||||
const { port, waitForCrash } = await startServer();
|
||||
runCrashApp('renderer-oom', port, ['--js-flags=--max-old-space-size=128']);
|
||||
const crash = await waitForCrash();
|
||||
expect(crash.process_type).to.equal('renderer');
|
||||
expect(crash['electron.v8-oom.stack']).to.be.a('string');
|
||||
expect(crash['electron.v8-oom.stack']).to.include('oomTrigger');
|
||||
expect(crash['electron.v8-oom.heap.used']).to.be.a('string');
|
||||
expect(crash['electron.v8-oom.heap.limit']).to.be.a('string');
|
||||
}
|
||||
);
|
||||
|
||||
it('captures the calling function on JSON.stringify OOM', async function () {
|
||||
this.timeout(120000);
|
||||
it('captures the calling function on JSON.stringify OOM', { timeout: 120000 }, async () => {
|
||||
const { port, waitForCrash } = await startServer();
|
||||
runCrashApp('renderer-oom-json', port, ['--js-flags=--max-old-space-size=128']);
|
||||
const crash = await waitForCrash();
|
||||
@@ -352,8 +354,7 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_
|
||||
expect(crash['electron.v8-oom.stack']).to.include('serializeData');
|
||||
});
|
||||
|
||||
it('captures OOM crash keys inside a web worker', async function () {
|
||||
this.timeout(120000);
|
||||
it('captures OOM crash keys inside a web worker', { timeout: 120000 }, async () => {
|
||||
const { port, waitForCrash } = await startServer();
|
||||
runCrashApp('renderer-oom-worker', port, ['--js-flags=--max-old-space-size=128']);
|
||||
const crash = await waitForCrash();
|
||||
Reference in New Issue
Block a user