Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix flaky content tracing test #39682

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 4 additions & 6 deletions spec/api-content-tracing-spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { expect } from 'chai';

Check failure on line 1 in spec/api-content-tracing-spec.ts

View check run for this annotation

trop / Backportable? - 26-x-y

spec/api-content-tracing-spec.ts#L1

Patch Conflict
import { app, contentTracing, TraceConfig, TraceCategoriesAndOptions } from 'electron/main';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { setTimeout } from 'node:timers/promises';
import { ifdescribe } from './lib/spec-helpers';

// FIXME: The tests are skipped on arm/arm64 and ia32.
ifdescribe(!(['arm', 'arm64', 'ia32'].includes(process.arch)))('contentTracing', () => {
// FIXME: The tests are skipped on linux arm/arm64
ifdescribe(!(['arm', 'arm64'].includes(process.arch)) || (process.platform !== 'linux'))('contentTracing', () => {
const record = async (options: TraceConfig | TraceCategoriesAndOptions, outputFilePath: string | undefined, recordTimeInMilliseconds = 1e1) => {
await app.whenReady();

Expand Down Expand Up @@ -120,9 +120,7 @@

describe('captured events', () => {
it('include V8 samples from the main process', async function () {
// This test is flaky on macOS CI.
this.retries(3);

this.timeout(60000);
await contentTracing.startRecording({
categoryFilter: 'disabled-by-default-v8.cpu_profiler',
traceOptions: 'record-until-full'
Expand All @@ -131,8 +129,8 @@
const start = Date.now();
let n = 0;
const f = () => {};
while (Date.now() - start < 200 || n < 500) {
while (Date.now() - start < 200 && n < 500) {
await setTimeout(0);

Check failure on line 133 in spec/api-content-tracing-spec.ts

View check run for this annotation

trop / Backportable? - 26-x-y

spec/api-content-tracing-spec.ts#L133

Patch Conflict
Raw output
++<<<<<<< HEAD
 +        while (+new Date() - start < 200 || n < 500) {
++=======
+         while (Date.now() - start < 200 && n < 500) {
++>>>>>>> test: fix flaky content tracing test
f();
n++;
}
Expand Down