Skip to content

chore: reuse puppeteer instance#2110

Closed
deer wants to merge 1 commit into
freshframework:mainfrom
deer:1418_redo
Closed

chore: reuse puppeteer instance#2110
deer wants to merge 1 commit into
freshframework:mainfrom
deer:1418_redo

Conversation

@deer

@deer deer commented Dec 1, 2023

Copy link
Copy Markdown
Contributor

Refreshing #1418, along with some minimal perf numbers by running deno test -A tests/partials_test.ts --reporter=dot:

before the change

  • ok | 50 passed | 0 failed (1m11s)
  • ok | 50 passed | 0 failed (1m16s)
  • ok | 50 passed | 0 failed (1m20s)

after the change:

  • ok | 51 passed | 0 failed (55s)
  • ok | 51 passed | 0 failed (50s)
  • ok | 51 passed | 0 failed (53s)

So this seems like a sizable improvement. It seems like the test runner doesn't wait for globalThis to finish doing its thing before starting, so I added some dummy tests at the top of the two modified files to make sure everything is warm before continuing. If there's a better way, please let me know.

@marvinhagemeister

Copy link
Copy Markdown
Contributor

@lucacasonato is there a way to disable the tracing ops feature of deno test globally?

@lucacasonato

Copy link
Copy Markdown
Member

@marvinhagemeister No. But usually the solution to the sanitizer failing is not to disable the sanitizer, but to fix the test.

In this PR for example, you leak puppeteer.Page instances all over the place. The place where you removed await browser.close(), you should replace with await page.close()

Comment thread tests/partials_test.ts
sanitizeOps: false,
sanitizeResources: false,
}, async () => {
await delay(1000);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Rather than awaiting on a delay here (flaky), await launchOrGetBrowser()

marvinhagemeister added a commit that referenced this pull request May 21, 2025
…icit resource management (#2901)

On my machine, reduces time taken to perform `deno task test` from
~1m20s to ~30s.

Inspired by and supersedes #2110.

---------

Co-authored-by: Marvin Hagemeister <marvin@deno.com>
@deer deer closed this Jun 29, 2025
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.

3 participants