Commit d9f16f1
authored
feat: add unit test project and update Vitest best practices (#11)
* feat: add unit test project and update Vitest best practices
- Add dual project setup: unit tests (jsdom) and storybook tests (browser)
- Create src/utils.ts with formatGreeting utility as example
- Create test/utils.test.ts demonstrating unit test patterns
- Add jsdom to devDependencies for unit test environment
- Update @Neovici/testing from ^2.0.0 to ^2.2.0 (adds renderHook, waitUntil)
- Update package.json scripts: test, test:unit, test:storybook, test:watch
- Update README with testing documentation and best practices
- Document important warning: never import from 'vitest' in story files
NEO-934
* fix: formatting of cosmoz-component usage example
* docs: remove renderHook mention from unit tests
renderHook from @Neovici/testing has ESM resolution issues in jsdom
and multiple Lit version conflicts in browser mode. Hooks should be
tested via Storybook interaction tests instead.
* chore: update @Neovici/testing to ^2.3.0 for ESM compatibility
* docs: add note about jsdom limitations for Pion/Lit imports
Unit tests in jsdom cannot use renderHook or import Pion/Lit components
due to ESM resolution issues in @pionjs/pion. Document this limitation
and recommend using Storybook interaction tests for hooks and components.
* fix: split usage example into separate JS and HTML code blocks1 parent 3ac0a10 commit d9f16f1
File tree
6 files changed
+530
-142
lines changed- docs
- src
- test
6 files changed
+530
-142
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
26 | 31 | | |
27 | | - | |
| 32 | + | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
| |||
35 | 40 | | |
36 | 41 | | |
37 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
38 | 95 | | |
39 | 96 | | |
40 | 97 | | |
0 commit comments