Skip to content

Commit

Permalink
test: fix flaky contentTracing.startRecording spec (electron#31409)
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz authored and t57ser committed Oct 29, 2021
1 parent 901c202 commit 8ec49a2
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions spec-main/api-content-tracing-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,10 @@ ifdescribe(!(['arm', 'arm64'].includes(process.arch)))('contentTracing', () => {
};
await record(config, outputFilePath);

expect(fs.existsSync(outputFilePath)).to.be.true('output exists');

// If the `excluded_categories` param above is not respected
// the file size will be above 50KB.
const fileSizeInKiloBytes = getFileSizeInKiloBytes(outputFilePath);
const expectedMaximumFileSize = 10; // Depends on a platform.

expect(fileSizeInKiloBytes).to.be.above(0,
`the trace output file is empty, check "${outputFilePath}"`);
expect(fileSizeInKiloBytes).to.be.below(expectedMaximumFileSize,
`the trace output file is suspiciously large (${fileSizeInKiloBytes}KB),
check "${outputFilePath}"`);
// If the `excluded_categories` param above is not respected, categories
// like `node,node.environment` will be included in the output.
const content = fs.readFileSync(outputFilePath).toString();
expect(content.includes('"cat":"node,node.environment"')).to.be.false();
});

it('accepts "categoryFilter" and "traceOptions" as a config', async () => {
Expand Down

0 comments on commit 8ec49a2

Please sign in to comment.