Skip to content

tests: fix a few tests failing with INTERNAL_LANTERN_USE_TRACE#16870

Open
iamakulov wants to merge 3 commits intoGoogleChrome:mainfrom
iamakulov:fix/trace-tests
Open

tests: fix a few tests failing with INTERNAL_LANTERN_USE_TRACE#16870
iamakulov wants to merge 3 commits intoGoogleChrome:mainfrom
iamakulov:fix/trace-tests

Conversation

@iamakulov
Copy link

This PR takes a tiny stab at #16805. It doesn’t actually fix any of the tests which have if (process.env.INTERNAL_LANTERN_USE_TRACE) in them, but it does fix a few which were nonetheless failing with INTERNAL_LANTERN_USE_TRACE=1.

Why a tiny stab? I started fixing the tests. But then I submitted #16869, which made switching to INTERNAL_LANTERN_USE_TRACE much less pressing. So I decided to not pursue fixing further. Still, I figured the changes I made so far would still be useful, so I’m PRing them.

Re-running this test over and over keeps either
- succeeding
- or failing because this URL is missing
- or failing because of a timeout? (Even DevTools Lighthouse times out if you run it against http://localhost:10200/oopif-requests.html)

I can never see the request in actual DevTools either when I open the URL.

Choosing to remove the request to solve at least some flakiness.
@iamakulov iamakulov requested a review from a team as a code owner January 29, 2026 22:51
@iamakulov iamakulov requested review from connorjclark and removed request for a team January 29, 2026 22:51
@iamakulov iamakulov changed the title test: correctly pass networkRecords() into createTestTrace() test: fix a few tests failing with INTERNAL_LANTERN_USE_TRACE Jan 29, 2026
@iamakulov iamakulov changed the title test: fix a few tests failing with INTERNAL_LANTERN_USE_TRACE tests: fix a few tests failing with INTERNAL_LANTERN_USE_TRACE Jan 29, 2026
// Disqus iframe (OOPIF)
{url: /^https:\/\/disqus\.com\/embed\/comments\//, finished: true, statusCode: 200, resourceType: 'Document'},
// Disqus subframe (that's a new OOPIF)
{url: 'https://accounts.google.com/o/oauth2/iframe', finished: true, statusCode: 200, resourceType: 'Document'},
Copy link
Author

Choose a reason for hiding this comment

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

This test was really flaky. Re-running this test over and over kept either

  • succeeding
  • or failing because this URL was missing
  • or, weirdly, failing because of a Lighthouse’s timeout? (Even DevTools Lighthouse times out if you run it against http://localhost:10200/oopif-requests.html)

I can’t see this URL in actual DevTools no matter how many times I reload http://localhost:10200/oopif-requests.html or https://www.paulirish.com/2012/why-moving-elements-with-translate-is-better-than-posabs-topleft/ (which it wraps). So I assumed the URL was there in earlier version of Disqus, or maybe is loaded very intermittently, and decided to drop it.

largestContentfulPaint: 15,
traceEnd: 10_000,
frameUrl: mainDocumentUrl,
networkRecords: [Object.assign(new NetworkRequest(), mainDocumentRequest)],
Copy link
Author

Choose a reason for hiding this comment

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

With INTERNAL_LANTERN_USE_TRACE, the test needed networkRecords to be present. (Coincidentally, with INTERNAL_LANTERN_USE_TRACE, the test also doesn’t need devtoolsLog, but I’m not removing it because the CDP branch still needs it.)


const totalSelfImpact = tasksImpactingTbt.reduce((sum, t) => sum += t.selfTbtImpact, 0);
expect(totalSelfImpact).toMatchInlineSnapshot(`2819.9999999999545`);
expect(totalSelfImpact).toBeCloseTo(2820, 6);
Copy link
Author

Choose a reason for hiding this comment

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

Minor floating arithmetic differences with and without INTERNAL_LANTERN_USE_TRACE :)

Snapshot name: `TBTImpactTasks works on real artifacts with lantern 2`

Snapshot: 2819.9999999999545
Received: 2819.999999999922
    at Context.<anonymous> (file:///Users/iamakulov/Repos/lighthouse/core/test/computed/tbt-impact-tasks-test.js:269:31)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant