From 28fd495b395a4fc3b869c4207b2494e6a5e7001c Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Thu, 25 Dec 2025 17:43:43 -0800 Subject: [PATCH] Deflake test/js/bun/resolve/load-same-js-file-a-lot.test.ts --- .gitignore | 1 + .../bun/resolve/load-same-js-file-a-lot.test.ts | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 4b95245f9c..528cf0fa5f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ .ninja_deps .ninja_log .npm +.npmrc .npm.gz .parcel-cache .swcrc diff --git a/test/js/bun/resolve/load-same-js-file-a-lot.test.ts b/test/js/bun/resolve/load-same-js-file-a-lot.test.ts index cea9a08290..2fbd4699b6 100644 --- a/test/js/bun/resolve/load-same-js-file-a-lot.test.ts +++ b/test/js/bun/resolve/load-same-js-file-a-lot.test.ts @@ -1,8 +1,11 @@ import { expect, test } from "bun:test"; -import { isDebug } from "harness"; +import { isASAN, isDebug } from "harness"; + +const asanIsSlowMultiplier = isASAN ? 0.2 : 1; +const count = Math.floor(10000 * asanIsSlowMultiplier); test( - "load the same file 10,000 times", + `load the same file ${count} times`, async () => { const meta = { url: import.meta.url.toLocaleLowerCase().replace(".test.ts", ".js"), @@ -14,7 +17,7 @@ test( }; const prev = Bun.unsafe.gcAggressionLevel(); Bun.unsafe.gcAggressionLevel(0); - for (let i = 0; i < 10000; i++) { + for (let i = 0; i < count; i++) { const { default: { url, dir, file, path, dirname, filename }, } = await import("./load-same-js-file-a-lot.js?i=" + i); @@ -28,13 +31,13 @@ test( Bun.gc(true); Bun.unsafe.gcAggressionLevel(prev); }, - isDebug ? 20_000 : 5000, + isDebug || isASAN ? 20_000 : 5000, ); -test("load the same empty JS file 10,000 times", async () => { +test(`load the same empty JS file ${count} times`, async () => { const prev = Bun.unsafe.gcAggressionLevel(); Bun.unsafe.gcAggressionLevel(0); - for (let i = 0; i < 10000; i++) { + for (let i = 0; i < count; i++) { const { default: obj } = await import("./load-same-empty-js-file-a-lot.js?i=" + i); expect(obj).toEqual({}); }