Skip to content

Test does not work with Node v22 #61

@shuuji3

Description

@shuuji3

The current vitest works only with Node v20 (previous LTS), but not with v22 (current LTS).

There seem to be two issues:

  • better-sqlite3 error (on Linux and macOS)
  • "no test files found" error and internal error with 500 (reported by @MathurAditya724 on Windows machine)

Node v20

$ node -v
v20.18.2

$ pnpm --filter @tsky/client test

> @tsky/[email protected] test /tmp/tsky/packages/client
> vitest


 DEV  v3.0.5 /tmp/tsky/packages/client

🌐 Created test network:
- pds: http://localhost:44389
- plc: http://localhost:45513
🙋 Created new account: @alice.test
🙋 Created new account: @bob.test
 ✓ src/tsky/tsky.test.ts (2 tests) 738ms
   ✓ createAgent > can create agent for Alice 381ms
   ✓ createAgent > can resume from stored session 355ms
 ✓ src/user/profile.test.ts (2 tests) 1989ms
   ✓ profile > Getting alice's profile 1248ms
   ✓ profile > Getting bob's profile 741ms
 ✓ src/user/preferences/preferences.test.ts (2 tests) 2269ms
   ✓ preferences > .get() 1259ms
   ✓ preferences > .set() 1010ms
 ✓ src/feed/feed.test.ts (1 test) 2573ms
   ✓ feed > .getFeed() 2572ms

 Test Files  4 passed (4)
      Tests  7 passed (7)
   Start at  16:01:16
   Duration  3.77s (transform 100ms, setup 0ms, collect 281ms, tests 7.57s, environment 0ms, prepare 152ms)

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

Node v22

better-sqlite3 error

$ node -v
v22.12.0

$ pnpm --filter @tsky/client test

> @tsky/[email protected] test /tmp/tsky/packages/client
> vitest


 DEV  v3.0.5 /tmp/tsky/packages/client

No test files found. You can change the file name pattern by pressing "p"

include: **/*.{test,spec}.?(c|m)[jt]s?(x)
exclude:  **/node_modules/**, **/dist/**, **/cypress/**, **/.{idea,git,cache,output,temp}/**, **/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*


⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: The module '/tmp/tsky/node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/build/Release/better_sqlite3.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 115. This version of Node.js requires
NODE_MODULE_VERSION 127. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
 ❯ Object..node node:internal/modules/cjs/loader:1734:18
 ❯ Module.load node:internal/modules/cjs/loader:1318:32
 ❯ Function._load node:internal/modules/cjs/loader:1128:12
 ❯ TracingChannel.traceSync node:diagnostics_channel:322:14
 ❯ wrapModuleLoad node:internal/modules/cjs/loader:219:24
 ❯ Module.require node:internal/modules/cjs/loader:1340:12
 ❯ require node:internal/modules/helpers:138:16
 ❯ bindings ../../node_modules/.pnpm/[email protected]/node_modules/bindings/bindings.js:112:48
 ❯ new Database ../../node_modules/.pnpm/[email protected]/node_modules/better-sqlite3/lib/database.js:48:64
 ❯ Database.sqlite ../../node_modules/.pnpm/@[email protected]/node_modules/@atproto/pds/dist/db/db.js:37:26

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { code: 'ERR_DLOPEN_FAILED' }

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions