Files
Maurice 81ec7dd28d fix(plugin-sdk): validate checks apiVersion and the manifest rules exactly as an install does
The SDK accepted any number as apiVersion while the host refuses anything
but a positive integer no newer than its plugin API, a false green for an
author. The manifest patterns, sets and caps now live in the host's
protocol/manifest-rules.ts, and gen-plugin-facts writes them and
PLUGIN_API_VERSION into the SDK, so check:plugin-facts covers them. One
manifest corpus is judged by both validators in a server test (the SDK may
only be stricter, case by case), and a typecheck test holds the SDK's plugin
API types to the host child's copy, which gains rawBodyBase64.
2026-10-10 20:16:08 +02:00

32 lines
1.1 KiB
TypeScript

import fs from 'node:fs';
import { defineConfig } from 'vitest/config';
// The host's copy of the plugin API, which test/host-types.test-d.ts compares the SDK's
// types against. It exists only inside the TREK monorepo; a standalone checkout of the
// published package has no server, so the type parity check is off there.
const hostTypes = new URL('../server/src/nest/plugins/runtime/plugin-sdk.ts', import.meta.url);
export default defineConfig({
test: {
typecheck: {
enabled: fs.existsSync(hostTypes),
include: ['test/**/*.test-d.ts'],
tsconfig: './tsconfig.typecheck.json',
},
coverage: {
provider: 'v8',
reporter: ['lcov', 'text'],
reportsDirectory: './coverage',
include: ['src/**/*.ts'],
// Mirrored in the repo root's sonar.coverage.exclusions — a file skipped
// here emits no lcov entry, so Sonar must not count it as uncovered either.
exclude: [
// Machine-written by server/scripts/gen-plugin-facts.ts.
'src/generated/**',
// Generated snapshot (scripts/gen-lucide-icon-names.mjs) — pure data.
'src/lucide-icon-names.ts',
],
},
},
});