Skip to content

Commit

Permalink
fix: serverTiming duration testing is robust across platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtPooki committed Jan 7, 2025
1 parent 917ef0d commit 2c95c94
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/verified-fetch/test/utils/server-timing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ describe('serverTiming', () => {

const [, timingDuration] = result.header.split(';')
const durationValue = Number(timingDuration.replace('dur=', ''))
expect(durationValue).to.be.greaterThan(20).and.lessThan(30)
// round durationValue to nearest 10ms. On windows and firefox, a delay of 20ms returns ~19.x ms
expect(Math.ceil(durationValue / 10) * 10).to.be.greaterThanOrEqual(20).and.lessThanOrEqual(30)
})
})

0 comments on commit 2c95c94

Please sign in to comment.