From 0cfa9d204ebbdca57bf2d66563f5f8043f3d58d4 Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Wed, 7 Oct 2026 03:39:32 -0500 Subject: [PATCH] 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 --- diigo-cache/README.md | 11 ++++++----- diigo-cache/package.json | 8 ++++++-- diigo-cache/tests/tsconfig.json | 8 ++++++++ diigo-cache/vitest.config.ts | 6 +----- 4 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 diigo-cache/tests/tsconfig.json diff --git a/diigo-cache/README.md b/diigo-cache/README.md index 2d189ca..cfc4cae 100644 --- a/diigo-cache/README.md +++ b/diigo-cache/README.md @@ -85,12 +85,13 @@ const ndjson = await env.DIIGO.dumpNdjson(4, 24); ## 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` -bound to [a fake webapp](tests/fake-webapp.js) serving diigo-shaped -items (`wrangler.tests.jsonc`). vitest is borrowed from -`../diigo-bookmarks/node_modules` (see `vitest.config.ts`). +Tests run the real worker and both DOs in the vitest pool, with +`WEBAPP` bound to [a fake webapp](tests/fake-webapp.js) serving +diigo-shaped items (`wrangler.tests.jsonc`). ## Run, deploy diff --git a/diigo-cache/package.json b/diigo-cache/package.json index 193f8aa..4bead99 100644 --- a/diigo-cache/package.json +++ b/diigo-cache/package.json @@ -4,10 +4,14 @@ "type": "module", "scripts": { "dev": "wrangler dev -c wrangler.jsonc -c ../webapp/wrangler.jsonc", - "test": "vitest run", - "typecheck": "tsc -p tsconfig.check.json" + "types": "wrangler types", + "lint": "wrangler types --check && tsc -p tsconfig.json && tsc -p tests/tsconfig.json", + "test": "vitest run" }, "devDependencies": { + "@cloudflare/vitest-plugin": "1.3.6", + "typescript": "^5.9.0", + "vitest": "4.1.11", "wrangler": "^4.148.0" } } diff --git a/diigo-cache/tests/tsconfig.json b/diigo-cache/tests/tsconfig.json new file mode 100644 index 0000000..d251ee9 --- /dev/null +++ b/diigo-cache/tests/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "types": ["@cloudflare/vitest-plugin/types"], + "allowJs": true + }, + "include": ["./**/*", "../worker-configuration.d.ts"] +} diff --git a/diigo-cache/vitest.config.ts b/diigo-cache/vitest.config.ts index 37b1516..e1d362a 100644 --- a/diigo-cache/vitest.config.ts +++ b/diigo-cache/vitest.config.ts @@ -1,9 +1,5 @@ import { defineProject } from "vitest/config"; -// the plugin resolves from diigo-bookmarks's store (the one vitest -// 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"; +import { cloudflareTest } from "@cloudflare/vitest-plugin"; export default defineProject({ plugins: [