Skip to content

Commit 9fd5409

Browse files
committed
Add Test program.
1 parent 98b5f28 commit 9fd5409

File tree

9 files changed

+1522
-5
lines changed

9 files changed

+1522
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
2727

2828
> 22 November 2024
2929
30-
- Fix sample code syntax error [`#47`](https://github.com/logue/vue-codemirror6/pull/47)
30+
- Fix sample code syntax error [`#47`](https://github.com/logue/vue-codemirror6/pull/47)
3131
- chore: demo docs [`#43`](https://github.com/logue/vue-codemirror6/pull/43)
3232
- fix: editor not update content when `modelValue` change and selection is out of range [`#44`](https://github.com/logue/vue-codemirror6/pull/44)
3333
- chore: props and readme doc [`#31`](https://github.com/logue/vue-codemirror6/pull/31)
@@ -59,7 +59,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
5959
6060
- chore(CODEOWNERS): CODEOWNERS.com Bot, at your service! [`#14`](https://github.com/logue/vue-codemirror6/pull/14)
6161
- Update demo code. (Replaced @codemirror/html to @codemirror/vue.) [`8da1a8a`](https://github.com/logue/vue-codemirror6/commit/8da1a8a4e37d713cc78281ce9c304c42a06940dc)
62-
- Changed implementation to generate *.d.ts with vite-plugin-dts. [`1caaa20`](https://github.com/logue/vue-codemirror6/commit/1caaa20b1423a3d252a6c770a630fb60e2e3440d)
62+
- Changed implementation to generate \*.d.ts with vite-plugin-dts. [`1caaa20`](https://github.com/logue/vue-codemirror6/commit/1caaa20b1423a3d252a6c770a630fb60e2e3440d)
6363
- Update README.md. [`f8dd493`](https://github.com/logue/vue-codemirror6/commit/f8dd4934a7b9cc089cd830473db5250d28b3389b)
6464

6565
#### [1.1.11](https://github.com/logue/vue-codemirror6/compare/1.1.3...1.1.11)

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,33 @@ const config: UserConfig = {
409409
};
410410
```
411411

412+
## Development
413+
414+
### Testing
415+
416+
This project uses [Vitest](https://vitest.dev/) for unit testing.
417+
418+
```bash
419+
# Run tests
420+
pnpm test
421+
422+
# Run tests in watch mode
423+
pnpm test:watch
424+
425+
# Run tests with UI
426+
pnpm test:ui
427+
428+
# Run tests with coverage
429+
pnpm test:coverage
430+
```
431+
432+
The test suite includes:
433+
434+
- **Component Tests**: Testing basic rendering, props, events, and v-model binding
435+
- **SSR Tests**: Ensuring proper server-side rendering compatibility for Nuxt.js and other SSR frameworks
436+
- **Method Tests**: Verifying all exposed methods work correctly
437+
- **Edge Cases**: Testing error handling and unusual scenarios
438+
412439
## LICENSE
413440

414441
©2022-2025 by Logue.

package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,23 +79,27 @@
7979
"preview": "vite preview --mode=docs",
8080
"build-only": "vite build",
8181
"type-check": "vue-tsc --declaration --emitDeclarationOnly",
82+
"test": "vitest",
83+
"test:ui": "vitest --ui",
84+
"test:run": "vitest run",
85+
"test:coverage": "vitest run --coverage",
8286
"prepare": "husky",
8387
"version": "auto-changelog -p && git add CHANGELOG.md"
8488
},
8589
"dependencies": {
8690
"vue-demi": "latest"
8791
},
8892
"peerDependencies": {
89-
"vue": "^2.7.14 || ^3.3.4",
9093
"@codemirror/autocomplete": "^6.0.0",
9194
"@codemirror/commands": "^6.0.0",
9295
"@codemirror/language": "^6.0.0",
9396
"@codemirror/lint": "^6.0.0",
9497
"@codemirror/search": "^6.0.0",
9598
"@codemirror/state": "^6.0.0",
9699
"@codemirror/view": "^6.0.0",
100+
"codemirror": "^6.0.0",
97101
"style-mod": "^4.0.0",
98-
"codemirror": "^6.0.0"
102+
"vue": "^2.7.14 || ^3.3.4"
99103
},
100104
"devDependencies": {
101105
"@codemirror/lang-javascript": "^6.2.4",
@@ -105,6 +109,7 @@
105109
"@tsconfig/node-lts": "^22.0.2",
106110
"@types/node": "^24.8.0",
107111
"@vitejs/plugin-vue": "^6.0.1",
112+
"@vitest/ui": "^3.2.4",
108113
"@vue/compiler-sfc": "^3.5.22",
109114
"@vue/eslint-config-prettier": "^10.2.0",
110115
"@vue/eslint-config-typescript": "^14.6.0",
@@ -120,6 +125,7 @@
120125
"eslint-plugin-playwright": "^2.2.2",
121126
"eslint-plugin-vue": "^10.5.1",
122127
"eslint-plugin-vuejs-accessibility": "^2.4.1",
128+
"happy-dom": "^20.0.4",
123129
"husky": "^9.1.7",
124130
"jiti": "^2.6.1",
125131
"lint-staged": "^16.2.4",
@@ -135,6 +141,7 @@
135141
"vite-plugin-banner": "^0.8.1",
136142
"vite-plugin-checker": "^0.11.0",
137143
"vite-plugin-dts": "^4.5.4",
144+
"vitest": "^3.2.4",
138145
"vue": "^3.5.22",
139146
"vue-eslint-parser": "^10.2.0",
140147
"vue-markdown-wasm": "^0.5.2",

0 commit comments

Comments
 (0)