useOracleClock: return advance(ms), and fake performance (or document what it fakes)

Aperta
#67 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
32/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
javascript
Ambito
testing

Direzione di ricerca

Start in src/oracle-property.ts near the toFake list (around line 1070), which covers setTimeout, setInterval, and Date but not performance. Then read the framework self-oracle's controlled-clock law, since the issue requires an oracle-first change (P9) before the code change. Done means useOracleClock returns advance(ms), performance is either faked or its fakes are listed in the JSDoc, and the self-oracle passes.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Reported from an adopter's first session, at c58b0c2. Not yet reproduced here.

(a) Add an advance(ms) helper. useOracleClock should return advance(ms). Then drivers never import their own vi, which also avoids the problem in the two-Vitest-copies issue.

(b) Fake performance. Today toFake covers setTimeout, clearTimeout, setInterval, clearInterval and Date (src/oracle-property.ts around line 1070). In the adopter's client, a deadline timer re-checks performance.now(), so a virtual timeout kept re-arming until real time caught up. Their workaround: vi.spyOn(performance, 'now').mockImplementation(() => Date.now()). Add performance to toFake, or at least list in the JSDoc exactly what it fakes.

This is a framework change, so it needs an oracle-first change (P9) to the framework self-oracle's controlled-clock law.

This issue was written by Isaac.

Lingua principale
JavaScript
Stelle
5
Fork
1
Merge medio
6h
PR unite (30g)
56

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TanStack/oracles

Tutte le issue di TanStack/oracles

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.