Files
LexAI/vitest.config.ts
john kevin asprec 324cfcc486 refactor: extract shared types + safe chrome wrappers into src/lib
- src/lib/types.ts: message contract (both ANALYZE_TEXT shapes preserved),
  config/response types, storage-key constants.
- src/lib/messaging.ts: single safeStorageGet/safeStorageSet/safeSendMessage/
  isExtensionValid implementation replacing the three divergent copies in
  Options, Popup, and content. Content script keeps its refresh-toast
  behavior via an onContextInvalidated callback.
- New '@lib' import alias (wxt force-overwrites '~' and '@' to srcDir, so
  those cannot point at ./src); wired in wxt.config, tsconfig, vitest.
- tests/unit/messaging.test.ts: 14 unit tests over the wrappers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 21:33:56 +08:00

18 lines
407 B
TypeScript

import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vitest/config';
export default defineConfig({
resolve: {
alias: {
'@lib': fileURLToPath(new URL('./src/lib', import.meta.url)),
},
},
test: {
environment: 'jsdom',
globals: true,
setupFiles: ['./tests/unit/setup.ts'],
include: ['tests/unit/**/*.test.ts'],
exclude: ['tests/e2e/**/*'],
},
});