You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Worker tests: two date tests fail when a run crosses midnight UTC (D417, D124) #1342
The cause.cloudflare-worker/test/entity_obligations_d417.test.ts fixes const TODAY = new Date().toISOString().slice(0, 10); once, when the file loads (line 46). The route computes days_left from the clock on every request.
So any test that runs after midnight, in a file loaded before it, is off by one day.
The two failures were days_left 1 for 2 and 39 for 40 (line 367), and 19 for 20 (line 388).
One more file.expiry_gate_datetime_d124.test.ts has the same exposure, in one test.
How it was found. The reviewer shifted the clock across a fake midnight for each of the 79 Worker test files that do date arithmetic. Only these two files are sensitive.
The work
D417's test works out "today" from the same clock the route reads, at each assertion: compute it inside each test, or inject a clock. It must stop being a module constant.
S1: Task for slot S11, found while reviewing #1329. Test files only: no decision, no migration.
What is true on
maintest:driftran from 23:58 to 00:02 UTC and failed two Worker tests that have nothing to do with the PR. A local run of the same merge passes.cloudflare-worker/test/entity_obligations_d417.test.tsfixesconst TODAY = new Date().toISOString().slice(0, 10);once, when the file loads (line 46). The route computesdays_leftfrom the clock on every request.days_left1 for 2 and 39 for 40 (line 367), and 19 for 20 (line 388).expiry_gate_datetime_d124.test.tshas the same exposure, in one test.The work
Files this task owns
cloudflare-worker/test/entity_obligations_d417.test.tscloudflare-worker/test/expiry_gate_datetime_d124.test.tsDone when