Skip to content

vitest watch fails on the second run using runInDurableObject #9913

@yoh-000

Description

@yoh-000

Which Cloudflare product(s) does this pertain to?

Workers Vitest Integration

What versions & operating system are you using?

Mac OS Sonoma 14.3, Node 21.7.1, also tried v22.12.0, @cloudflare/vitest-pool-workers 0.8.50, vitest 3.2.4, wrangler 4.24.0

Please provide a link to a minimal reproduction

https://github.com/yoh-000/min-repro-cf-do-testing

Describe the Bug

Tests pass with vitest run.
Tests pass with vitest watch initially.
Tests fail with vitest watch when a code change triggers a rerun.

Expected behavior

Tests pass with vitest watch initially and every subsequent rerun.

Steps to reproduce

  • git clone https://github.com/yoh-000/min-repro-cf-do-testing.git
  • cd min-repro-cf-do-testing
  • pnpm test:watch
  • Hit enter to cause a rerun.

Please provide any relevant error logs

❯ pnpm test:watch

> @ test:watch /Users/yohsuzuki/Development/Metatheory/min-repro-cf-do-testing
> DEBUG=vpw:* vitest watch


 DEV  v3.2.4 /Users/yohsuzuki/Development/Metatheory/min-repro-cf-do-testing

[vpw:info] Starting isolated runtimes for vitest.config.ts...
 ✓ src/index.test.ts (1 test) 11ms
   ✓ index > durable object test 7ms

 Test Files  1 passed (1)
      Tests  1 passed (1)
   Start at  23:24:17
   Duration  604ms (transform 21ms, setup 0ms, collect 19ms, tests 11ms, environment 0ms, prepare 114ms)

 PASS  Waiting for file changes...
       press h to show help, press q to quit






 RERUN  rerun all tests x1 

[vpw:debug] Reusing runtime for vitest.config.ts...
workerd/jsg/util.c++:320: error: e = workerd/util/sqlite.c++:499: failed: expected _ec == SQLITE_OK [14 == 0]; unable to open database file: SQLITE_CANTOPEN
stack: 1052e3f4f 1052e3a6b 10497d0af 10497cb07 10497c963 104f4df2b 104f2ad5b 104f2a8b7 104968a83 10496847b 10497b627 10497a9c3 1049a1613 1052b0670 1052b2b73 104937b38 1050c5120 104fdc2f0; sentryErrorContext = jsgInternalError; wdErrId = ni7cuqgpaeoig0bd1cg4sh1p
 ❯ src/index.test.ts (1 test | 1 failed) 15ms
   × index > durable object test 7ms
     → internal error; reference = ni7cuqgpaeoig0bd1cg4sh1p

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that isn't workingvitestRelating to the Workers Vitest integration

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions