Commit 5af68f0
committed
test: Add Vitest test infrastructure
Sets up Vitest with WXT's `WxtVitest()` plugin so unit tests can run
against the real WXT config and use `fakeBrowser` for `chrome.*` APIs.
Uses happy-dom for DOM globals.
Adds two smoke test files:
- src/background/set_setting.test.ts — verifies sibling settings are
preserved on update and that uninitialized storage logs the expected
error without writing.
- src/content/auto_detection/show_banner.test.ts — mounts the banner,
asserts id/style/content, and advances fake timers to confirm the
default 10s and custom auto-hide cleanup.
New npm scripts: test, test:watch, test:coverage.1 parent 58d9d76 commit 5af68f0
6 files changed
Lines changed: 362 additions & 11 deletions
File tree
- src
- background
- content/auto_detection
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
62 | 77 | | |
63 | 78 | | |
64 | 79 | | |
0 commit comments