diigo-cache: own test toolchain; pnpm lint, pnpm test

vitest, @cloudflare/vitest-plugin, and typescript are devDependencies
here instead of being borrowed from diigo-bookmarks through hand-made
node_modules symlinks and a deep-path import.

- lint: wrangler types, then tsc over src/ and tests/ (Cloudflare's
  documented typecheck shape: regenerate types, then tsc)
- test: vitest run
- tests/tsconfig.json per the vitest-plugin docs; the dangling
  typecheck script (tsconfig.check.json never existed) is gone

Generated-by: Claude Opus 5.5
This commit is contained in:
dckc committed 2026-10-07 04:19:54 -05:00
1 parent 22ae9a2b61
commit 0cfa9d204e
4 files changed
+21 -12

No files matched your search

+6 -5
View File
@@ -85,12 +85,13 @@ const ndjson = await env.DIIGO.dumpNdjson(4, 24);
## Test ## Test
pnpm test pnpm types # regenerate worker-configuration.d.ts (after wrangler.jsonc changes)
pnpm lint # fails if those types are stale; tsc over src/ and tests/
pnpm test # vitest
Runs the real worker and both DOs in the vitest pool, with `WEBAPP` Tests run the real worker and both DOs in the vitest pool, with
bound to [a fake webapp](tests/fake-webapp.js) serving diigo-shaped `WEBAPP` bound to [a fake webapp](tests/fake-webapp.js) serving
items (`wrangler.tests.jsonc`). vitest is borrowed from diigo-shaped items (`wrangler.tests.jsonc`).
`../diigo-bookmarks/node_modules` (see `vitest.config.ts`).
## Run, deploy ## Run, deploy
+6 -2
View File
@@ -4,10 +4,14 @@
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "wrangler dev -c wrangler.jsonc -c ../webapp/wrangler.jsonc", "dev": "wrangler dev -c wrangler.jsonc -c ../webapp/wrangler.jsonc",
"test": "vitest run", "types": "wrangler types",
"typecheck": "tsc -p tsconfig.check.json" "lint": "wrangler types --check && tsc -p tsconfig.json && tsc -p tests/tsconfig.json",
"test": "vitest run"
}, },
"devDependencies": { "devDependencies": {
"@cloudflare/vitest-plugin": "1.3.6",
"typescript": "^5.9.0",
"vitest": "4.1.11",
"wrangler": "^4.148.0" "wrangler": "^4.148.0"
} }
} }
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"types": ["@cloudflare/vitest-plugin/types"],
"allowJs": true
},
"include": ["./**/*", "../worker-configuration.d.ts"]
}
+1 -5
View File
@@ -1,9 +1,5 @@
import { defineProject } from "vitest/config"; import { defineProject } from "vitest/config";
// the plugin resolves from diigo-bookmarks's store (the one vitest import { cloudflareTest } from "@cloudflare/vitest-plugin";
// install on disk); direct-path import sidesteps pnpm's exports-map
// restriction *for the config file*. cloudflareTest (the plugin form,
// not the bare pool) is what provides the `cloudflare:test` module.
import { cloudflareTest } from "../diigo-bookmarks/node_modules/.pnpm/@cloudflare+vitest-plugin@1.3.6_@cloudflare+workers-types@5.20261005.1_@types+node@26.6.4_@vi_7mty7nznaeeyt2ohspxbzj4p6m/node_modules/@cloudflare/vitest-plugin/dist/pool/index.mjs";
export default defineProject({ export default defineProject({
plugins: [ plugins: [