Skip to content

Commit d9a93e5

Browse files
bghgaryCopilot
andcommitted
Fix performance test flake on CI
Remove the upper-bound assertion from the elapsed time test. setTimeout only guarantees a minimum delay, not a maximum — on busy CI agents the callback can fire well beyond the tolerance window. Also remove the now-unused sanitizersEnabled plumbing (CMake define, C++ global, TS declaration) since this was its only consumer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 598f004 commit d9a93e5

3 files changed

Lines changed: 2 additions & 13 deletions

File tree

Tests/UnitTests/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ endif()
4646
add_executable(UnitTests ${SOURCES} ${SCRIPTS} ${TYPE_SCRIPTS} ${ASSETS})
4747
target_compile_definitions(UnitTests PRIVATE JSRUNTIMEHOST_PLATFORM="${JSRUNTIMEHOST_PLATFORM}")
4848

49-
if(ENABLE_SANITIZERS)
50-
target_compile_definitions(UnitTests PRIVATE JSRUNTIMEHOST_SANITIZERS_ENABLED=1)
51-
endif()
52-
5349
target_link_libraries(UnitTests
5450
PRIVATE AppRuntime
5551
PRIVATE Console

Tests/UnitTests/Scripts/tests.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ Mocha.reporter('spec');
77

88
declare const hostPlatform: string;
99
declare const setExitCode: (code: number) => void;
10-
declare const sanitizersEnabled: boolean;
1110

1211

1312
describe("AbortController", function () {
@@ -1235,11 +1234,11 @@ describe("Performance", function () {
12351234
it("should measure elapsed time accurately", function (done) {
12361235
const start = performance.now();
12371236
const delay = 50;
1238-
const tolerance = sanitizersEnabled ? 500 : 100;
12391237
setTimeout(() => {
12401238
const elapsed = performance.now() - start;
1239+
// setTimeout guarantees a minimum delay, not a maximum.
1240+
// Only check the lower bound to avoid flakes on busy CI agents.
12411241
expect(elapsed).to.be.at.least(delay - 5);
1242-
expect(elapsed).to.be.lessThan(delay + tolerance);
12431242
done();
12441243
}, delay);
12451244
});

Tests/UnitTests/Shared/Shared.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,6 @@ TEST(JavaScript, All)
8484
env.Global().Set("setExitCode", setExitCodeCallback);
8585

8686
env.Global().Set("hostPlatform", Napi::Value::From(env, JSRUNTIMEHOST_PLATFORM));
87-
88-
#ifdef JSRUNTIMEHOST_SANITIZERS_ENABLED
89-
env.Global().Set("sanitizersEnabled", Napi::Value::From(env, true));
90-
#else
91-
env.Global().Set("sanitizersEnabled", Napi::Value::From(env, false));
92-
#endif
9387
});
9488

9589
Babylon::ScriptLoader loader{runtime};

0 commit comments

Comments
 (0)