mirror of
https://github.com/denoland/deno.git
synced 2025-01-01 11:58:45 -05:00
chore(node/tests): increase tolerance of timers test on CI (#27077)
Increases the tolerance of the interval test on the CI.
This commit is contained in:
parent
4f776a7d49
commit
4c567677bf
1 changed files with 5 additions and 4 deletions
|
@ -118,7 +118,7 @@ Deno.test({
|
|||
expectedValue: 42,
|
||||
intervalMs: 100,
|
||||
iterations: 3,
|
||||
tolerancePercent: 50,
|
||||
tolerancePercent: Deno.env.get("CI") != null ? 75 : 50,
|
||||
};
|
||||
|
||||
const { setInterval } = timersPromises;
|
||||
|
@ -200,6 +200,7 @@ Deno.test({
|
|||
const INTERVAL_MS = 500;
|
||||
const TOTAL_DURATION_MS = 3000;
|
||||
const TOLERANCE_MS = 500;
|
||||
const DELTA_TOLERANCE_MS = Deno.env.get("CI") != null ? 100 : 50;
|
||||
|
||||
const abortController = new AbortController();
|
||||
const { setInterval } = timersPromises;
|
||||
|
@ -247,14 +248,14 @@ Deno.test({
|
|||
);
|
||||
|
||||
intervalDeltas.forEach((delta, i) => {
|
||||
const isIntervalValid = delta >= (INTERVAL_MS - 50) &&
|
||||
delta <= (INTERVAL_MS + 50);
|
||||
const isIntervalValid = delta >= (INTERVAL_MS - DELTA_TOLERANCE_MS) &&
|
||||
delta <= (INTERVAL_MS + DELTA_TOLERANCE_MS);
|
||||
assertEquals(
|
||||
isIntervalValid,
|
||||
true,
|
||||
`Interval ${
|
||||
i + 1
|
||||
} duration (${delta}ms) should be within ±50ms of ${INTERVAL_MS}ms`,
|
||||
} duration (${delta}ms) should be within ±${DELTA_TOLERANCE_MS}ms of ${INTERVAL_MS}ms`,
|
||||
);
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue