vitest plugin: clock.set(ms) goes backwards, the engine's clock does not
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 69/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- node.js, typescript
Direção de pesquisa
Comece rastreando mock.clock(on).set(ms) no plugin do Vitest e compare seu comportamento com a validação do relógio do engine descrita na issue. A reprodução usa vitest.config.ts e um teste que avança o relógio até 1000 ms e, em seguida, o define como 500 ms. O trabalho estará concluído quando esse caso também gerar o erro do engine por retrocesso do relógio no plugin do Vitest.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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).
- Linguagem predominante
- TypeScript
- Estrelas
- 0
- Forks
- 0
- Merge médio
- 29min
- PRs com merge (30d)
- 138
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de kwitsch/claude-code-plugin-tooling
-
enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
kwitsch/claude-code-plugin-tooling#219 ·
Mantenedores costumam responder em até 1 dia
-
enhancement
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 54/100
kwitsch/claude-code-plugin-tooling#212 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
kwitsch/claude-code-plugin-tooling#209 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 45/100
kwitsch/claude-code-plugin-tooling#208 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 52/100
kwitsch/claude-code-plugin-tooling#207 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de kwitsch/claude-code-plugin-tooling
Issues semelhantes
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
makecindy/cindy#15342 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
Mantenedores costumam responder em até 1 dia
-
no-repo-link tool-submission
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 74/100
BraveOPotato/NoSignups#2618 ·
-
enhancement good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
-
bug needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Priyanshu-byte-coder/devtrack#4067 ·
Mantenedores costumam responder em até 1 dia