vitest plugin: clock.set(ms) goes backwards, the engine's clock does not
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 69/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- node.js, typescript
Línea de trabajo
Empieza por rastrear mock.clock(on).set(ms) en el plugin de Vitest y compara su comportamiento con la validación del reloj del motor descrita en el issue. La reproducción usa vitest.config.ts y una prueba que avanza el reloj hasta 1000 ms y luego lo establece en 500 ms. El trabajo estará terminado cuando ese caso también lance el error del motor por retroceso del reloj en el plugin de Vitest.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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).
- Lenguaje dominante
- TypeScript
- Estrellas
- 0
- Forks
- 0
- Merge medio
- 29 min
- PR fusionados (30 d)
- 138
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de kwitsch/claude-code-plugin-tooling
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
kwitsch/claude-code-plugin-tooling#219 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 54/100
kwitsch/claude-code-plugin-tooling#212 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
kwitsch/claude-code-plugin-tooling#209 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
kwitsch/claude-code-plugin-tooling#208 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 52/100
kwitsch/claude-code-plugin-tooling#207 ·
Los mantenedores suelen responder en 1 día
Todos los issues de kwitsch/claude-code-plugin-tooling
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
makecindy/cindy#15342 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
no-repo-link tool-submission
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100
BraveOPotato/NoSignups#2618 ·
-
enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
-
bug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Priyanshu-byte-coder/devtrack#4067 ·
Los mantenedores suelen responder en 1 día