vitest plugin: clock.set(ms) goes backwards, the engine's clock does not
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 69/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, typescript
Direzione di ricerca
Inizia tracciando mock.clock(on).set(ms) nel plugin Vitest e confronta il suo comportamento con la convalida dell’orologio del motore descritta nell’issue. La riproduzione usa vitest.config.ts e un test che fa avanzare l’orologio fino a 1000 ms, poi lo imposta a 500 ms. Il lavoro è completato quando anche nel plugin Vitest questo caso genera l’errore del motore per l’orologio che torna indietro.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
mock.clock(on).set(ms) moves the kit's clock backwards under the vitest plugin. Under claude plugin test it throws, because the engine's clock does not run backwards. A test that sets the clock to an earlier time (to check a mod that must survive a wall clock stepping back) passes under vitest and fails under the engine.
Versions
@kwitsch/vitest-plugin-claude-code-mod0.18.0claude --version: 2.1.336 (Claude Code)- vitest 5.1.2
- node v26.14.0
Minimal reproduction
Any plugin (the test uses no mod hook): package.json {"name":"scratch","version":"0.0.1","type":"module"}, plugin/.claude-plugin/plugin.json with the same name, plugin/hooks/hooks.json {"modules":["./register.js"]}, plugin/hooks/register.js export const register = (on) => { on("session.start", async ($, e, next) => next(e)); }; (also as src/register.js), vitest.config.ts with claudeCodeMod({ mod: "./src/register.js", portable: "error" }).
import { expect, mock, test } from "claude-code/testing";
test("T4 the clock can be set back", async ($, on) => {
const clock = mock.clock(on);
await clock.advance(1000);
await clock.set(500);
expect(clock.now()).toBe(500);
});
vitest: passes. claude plugin test:
(fail) T4 the clock can be set back [0.62ms]
TypeError: set(ms): a time in milliseconds at or past now (1000); the clock does not run backwards
Expected
clock.set(ms) with ms before the clock's now throws the engine's error (set(ms): a time in milliseconds at or past now (<now>); the clock does not run backwards) under the vitest plugin too.
Relations
- Part of #41, found while migrating jevfort (kwitsch/claude-plugins-development#196): its test "A clock that reads earlier than the last timeout ends the pause (a new session)" needs a clock reading earlier, which neither runner offers through
set. - Same family as #205, #206, #207 and #33 (the kit accepts what the engine rejects). jevfort also hit the other three: a second stub for one event (
on("session.start") registered twice, #205), an option of the wrong type (#206) andmock.envread live (#207).
- Lingua principale
- TypeScript
- Stelle
- 0
- Fork
- 0
- Merge medio
- 29m
- PR unite (30g)
- 138
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di kwitsch/claude-code-plugin-tooling
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
kwitsch/claude-code-plugin-tooling#219 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 54/100
kwitsch/claude-code-plugin-tooling#212 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
kwitsch/claude-code-plugin-tooling#209 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
kwitsch/claude-code-plugin-tooling#208 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 52/100
kwitsch/claude-code-plugin-tooling#207 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di kwitsch/claude-code-plugin-tooling
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
makecindy/cindy#15342 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
no-repo-link tool-submission
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 74/100
BraveOPotato/NoSignups#2618 ·
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
bug needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Priyanshu-byte-coder/devtrack#4067 ·
I maintainer di solito rispondono entro 1 giorno