trilium/scripts/vitest.config.ts
Elian Doran 72cdf3b597
fix(scripts): expire the Weblate language-stats cache
The freshness check compared the cache file mtime against a point one day
in the future, which is always true for a file already on disk. Once
`.language-stats-<project>.json` was written it was reused indefinitely, so
`check-translation-coverage.ts` and `manage-readme.ts` kept reading whatever
snapshot happened to be fetched first.

Extract the decision as `isCacheFresh()` and cover it. A future-stamped file
now counts as stale as well, so a skewed clock cannot reproduce the same
never-expiring cache.

CI is unaffected either way: the cache files are gitignored, so a fresh
checkout always queries Weblate.

The scripts project globbed `*.spec.ts`, matching only its own root, so no
spec under `scripts/translation/` would have run. Widen it to `**/*.spec.ts`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-20 10:10:22 +03:00

12 lines
359 B
TypeScript

import { defineConfig } from "vitest/config";
// The repo-root maintenance scripts are not a workspace package, so they get their
// own project rather than a `pnpm --filter` target. Run it with `pnpm scripts:test`.
export default defineConfig({
test: {
name: "scripts",
environment: "node",
include: [ "**/*.spec.ts" ]
}
});