// The tests of src/lib. Vitest prefers this file to vite.config.ts, the // SvelteKit configuration of the page, so the library tests run without the // SvelteKit plugin; the page helpers in src/lib/inspector import the library // by relative paths and need no $lib alias. import { defineConfig } from 'vitest/config'; export default defineConfig({ test: { include: ['src/**/*.test.ts'], // BLS12-381 point checks and the 65 536-extension cases take a moment. testTimeout: 30_000, coverage: { provider: 'v8', include: ['src/lib/dkc/**/*.ts', 'src/lib/inspector/**/*.ts'], exclude: ['src/lib/**/*.test.ts', 'src/lib/dkc/testing/**', 'src/lib/dkc/index.ts'], reporter: ['text', 'html', 'json-summary'], thresholds: { // The codec is covered completely (plan §7), and so are the IBE and // the release verification (plan of phase 2, section 10, steps 3 // and 4). 'src/lib/dkc/cbor.ts': { 100: true }, 'src/lib/dkc/ibe.ts': { 100: true }, 'src/lib/dkc/release.ts': { 100: true }, // The stanza X25519 and its Bech32 identities (step 5). 'src/lib/dkc/x25519.ts': { 100: true }, 'src/lib/dkc/bech32.ts': { 100: true }, 'src/lib/dkc/digest.ts': { 100: true }, // The tlock recipient (step 7). 'src/lib/dkc/tlock.ts': { 100: true }, // The prefix reads, and the opening of the page (step 8). 'src/lib/dkc/prefix.ts': { 100: true }, 'src/lib/inspector/fixtures.ts': { 100: true }, 'src/lib/inspector/opener.ts': { 100: true }, 'src/lib/inspector/opening.ts': { 100: true }, 'src/lib/inspector/release-input.ts': { 100: true }, 'src/lib/inspector/tempfile.ts': { 100: true }, // The pieces of the writer (plan of phase 3, step 2) and the age // files shared by the opening and the writer. 'src/lib/dkc/recipient.ts': { 100: true }, 'src/lib/dkc/random.ts': { 100: true }, 'src/lib/dkc/agefile.ts': { 100: true }, 'src/lib/dkc/padding.ts': { 100: true }, // The writer (plan of phase 3, steps 3 and 4). 'src/lib/dkc/writer.ts': { 100: true }, 'src/lib/dkc/encrypt.ts': { 100: true }, // The page of step 7: the lengths known before writing, the local // times, the form and the writing loaded on demand. 'src/lib/dkc/lengths.ts': { 100: true }, 'src/lib/inspector/localtime.ts': { 100: true }, 'src/lib/inspector/create-input.ts': { 100: true }, 'src/lib/inspector/creator.ts': { 100: true }, // Format 3 (plan of format 3 in datekeys-ts): the rules of the paths // and texts of the head, the codec of BODY, of the security area and of // the head, step 17 and its sink, the ZIP in which the page delivers // files, and what the pages show and check of the files. 'src/lib/dkc/pathrule.ts': { 100: true }, 'src/lib/dkc/body.ts': { 100: true }, 'src/lib/dkc/security.ts': { 100: true }, 'src/lib/dkc/head.ts': { 100: true }, 'src/lib/dkc/open3.ts': { 100: true }, 'src/lib/dkc/sink.ts': { 100: true }, 'src/lib/inspector/crc32.ts': { 100: true }, 'src/lib/inspector/zip.ts': { 100: true }, 'src/lib/inspector/zipsink.ts': { 100: true }, 'src/lib/inspector/files.ts': { 100: true }, 'src/lib/inspector/create-files.ts': { 100: true }, 'src/lib/inspector/create-check.ts': { 100: true }, 'src/lib/inspector/drand.ts': { 100: true }, 'src/lib/dkc/wordkey.ts': { 100: true }, // The locator of datekeys.capsule: its data, its addresses and their // IP addresses, its plaintext, and the age files of its sealing and of // the envelope. 'src/lib/dkc/locator.ts': { 100: true }, 'src/lib/dkc/ipaddr.ts': { 100: true }, 'src/lib/dkc/ageio.ts': { 100: true }, 'src/lib/dkc/envelope.ts': { 100: true }, // The author keys, their signing and the tables of Go they read with. 'src/lib/dkc/authorkey.ts': { 100: true }, 'src/lib/dkc/ed25519sign.ts': { 100: true }, 'src/lib/dkc/gounicode.ts': { 100: true }, 'src/lib/dkc/**/*.ts': { statements: 95, branches: 90, functions: 95, lines: 95 }, // The page model and helpers of the inspector (plan §8, phase 1). 'src/lib/inspector/**/*.ts': { statements: 95, branches: 90, functions: 95, lines: 95 }, }, }, }, });