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

tests: default to 0 for network trace data length #16041

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions core/test/audits/dobetterweb/uses-http2-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import UsesHTTP2Audit from '../../../audits/dobetterweb/uses-http2.js';
import {networkRecordsToDevtoolsLog} from '../../network-records-to-devtools-log.js';
import {createTestTrace} from '../../create-test-trace.js';


function buildArtifacts(networkRecords) {
const frameUrl = networkRecords[0].url;
const trace = createTestTrace({
Expand All @@ -24,9 +23,9 @@ function buildArtifacts(networkRecords) {
return {
LinkElements: [],
URL: {
requestedUrl: networkRecords[0].url,
mainDocumentUrl: networkRecords[0].url,
finalDisplayedUrl: networkRecords[0].url,
requestedUrl: frameUrl,
mainDocumentUrl: frameUrl,
finalDisplayedUrl: frameUrl,
},
devtoolsLogs: {defaultPass: devtoolsLog},
traces: {defaultPass: trace},
Expand All @@ -35,11 +34,6 @@ function buildArtifacts(networkRecords) {
}

describe('Resources are fetched over http/2', () => {
// TODO(15841): investigate test differences (prob. fix createTestTrace)
if (process.env.INTERNAL_LANTERN_USE_TRACE !== undefined) {
return;
}

let context = {};

beforeEach(() => {
Expand Down Expand Up @@ -135,8 +129,6 @@ describe('Resources are fetched over http/2', () => {
},
];
const artifacts = buildArtifacts(networkRecords);
artifacts.devtoolsLogs.defaultPass =
networkRecordsToDevtoolsLog(networkRecords);

const result = await UsesHTTP2Audit.audit(artifacts, context);
const hosts = new Set(result.details.items.map(item => new URL(item.url).host));
Expand Down Expand Up @@ -197,7 +189,6 @@ describe('Resources are fetched over http/2', () => {
},
];
const artifacts = buildArtifacts(networkRecords);
artifacts.devtoolsLogs.defaultPass = networkRecordsToDevtoolsLog(networkRecords);

const result = await UsesHTTP2Audit.audit(artifacts, context);
const urls = new Set(result.details.items.map(item => item.url));
Expand Down Expand Up @@ -311,7 +302,6 @@ describe('Resources are fetched over http/2', () => {
},
];
const artifacts = buildArtifacts(networkRecords);
artifacts.devtoolsLogs.defaultPass = networkRecordsToDevtoolsLog(networkRecords);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive by deleting unnecessary lines

const result = await UsesHTTP2Audit.audit(artifacts, context);
const urls = new Set(result.details.items.map(item => item.url));
Expand Down
4 changes: 2 additions & 2 deletions core/test/create-test-trace.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ function createTestTrace(options) {
requestId,
frame: record.frameId,
finishTime: endTime / 1000 / 1000,
encodedDataLength: record.transferSize,
decodedBodyLength: record.resourceSize,
encodedDataLength: record.transferSize ?? 0,
decodedBodyLength: record.resourceSize ?? 0,
},
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only important change

},
});
Expand Down
Loading