Reproduction for a clerk/javascript bug report. It adds two tests to packages/clerk-js/src/core/__tests__/tokenCache.test.ts.
| Test | Device clock | Expected | On main 44b09ba |
|---|---|---|---|
| control | matches the server | token served at T+50, gone at T+70 | passes |
| skew | 40 s behind the server | token served at T+50, gone at T+70 | fails: the token is still served at T+70, 10 s after it expired |
git clone https://github.com/clerk/javascript.git js && cd js
git checkout 44b09badc83099854ac746f7340d3cec77b031d7
git apply /path/to/tokenCache-device-clock-skew.test.diff
npx -y [email protected] install --filter @clerk/clerk-js... --frozen-lockfile --ignore-scripts
(cd packages/shared && npx -y [email protected] run build)
cd packages/clerk-js && npx vitest --watch=false src/core/__tests__/tokenCache.test.tsResult on main: Tests 1 failed | 69 passed (70); the failure is
device clock skew > serves no token the server considers expired when the device clock runs behind
(AssertionError: expected { entry: … } to be undefined).