chromedevtools--chrome-devtools-mcp
94752ffade
This PR prevents license notices being dropped when creating package for publication. This can happen when first import in the file is type-only import that gets removed during build. When there is no empty line between the license block comment and such import, the comment is treated as related to the import and gets removed alongside it. Adding an empty line between copyright notice and the import fixes the issue. Co-authored-by: Piotr Paulski <piotrpaulski@chromium.org>
50 行
1.4 KiB
TypeScript
50 行
1.4 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import assert from 'node:assert';
|
|
import {describe, it} from 'node:test';
|
|
|
|
import {
|
|
getTraceSummary,
|
|
parseRawTraceBuffer,
|
|
} from '../../src/trace-processing/parse.js';
|
|
|
|
import '../../src/DevtoolsUtils.js';
|
|
|
|
import {loadTraceAsBuffer} from './fixtures/load.js';
|
|
|
|
describe('Trace parsing', async () => {
|
|
it('can parse a Uint8Array from Tracing.stop())', async () => {
|
|
const rawData = loadTraceAsBuffer('basic-trace.json.gz');
|
|
const result = await parseRawTraceBuffer(rawData);
|
|
if ('error' in result) {
|
|
assert.fail(`Unexpected parse failure: ${result.error}`);
|
|
}
|
|
assert.ok(result?.parsedTrace);
|
|
assert.ok(result?.insights);
|
|
});
|
|
|
|
it('can format results of a trace', async t => {
|
|
const rawData = loadTraceAsBuffer('web-dev-with-commit.json.gz');
|
|
const result = await parseRawTraceBuffer(rawData);
|
|
if ('error' in result) {
|
|
assert.fail(`Unexpected parse failure: ${result.error}`);
|
|
}
|
|
assert.ok(result?.parsedTrace);
|
|
assert.ok(result?.insights);
|
|
|
|
const output = getTraceSummary(result);
|
|
t.assert.snapshot?.(output);
|
|
});
|
|
|
|
it('will return a message if there is an error', async () => {
|
|
const result = await parseRawTraceBuffer(undefined);
|
|
assert.deepEqual(result, {
|
|
error: 'No buffer was provided.',
|
|
});
|
|
});
|
|
});
|