Skip to content

Commit b9f9e54

Browse files
committed
test: init extension test
1 parent d1f7cf6 commit b9f9e54

File tree

8 files changed

+633
-23
lines changed

8 files changed

+633
-23
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ node_modules
77
.env
88

99
# OSX files
10-
.DS_Store
10+
.DS_Store
11+
12+
out-test/

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,21 @@ The extension caches component metadata based on the the configurable TTL and pr
231231

232232
* [MDC Syntax Reference](https://content.nuxt.com/docs/files/markdown)
233233

234+
## Running Extension Tests
235+
236+
To run the integration tests for this extension:
237+
238+
1. Install dependencies:
239+
```sh
240+
pnpm install
241+
```
242+
2. Build the extension and run tests:
243+
```sh
244+
pnpm test
245+
```
246+
247+
This will compile the source and test files, then run the integration tests using VS Code's test runner.
248+
234249
<!-- Badges -->
235250
[extension-href]: https://marketplace.visualstudio.com/items?itemName=Nuxt.mdc
236251
[extension-version-src]: https://img.shields.io/visual-studio-marketplace/v/Nuxt.mdc?label=Visual%20Studio%20Code&style=flat&colorA=020420&colorB=28CF8D

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,23 +203,29 @@
203203
}
204204
},
205205
"scripts": {
206-
"vscode:prepublish": "npm run build",
206+
"vscode:prepublish": "pnpm run build",
207207
"build": "tsc -p ./ && esno scripts/build.ts",
208208
"dev": "tsc -p ./ && esno watch scripts/build.ts",
209209
"lint": "eslint src --ext ts",
210-
"test": "vitest",
210+
"test:compile": "tsc -p tsconfig.test.json",
211+
"test": "pnpm run test:compile && node ./out-test/test/runTest.js",
211212
"release": "release-it",
212213
"generate": "vsce package",
213214
"publish": "vsce publish"
214215
},
215216
"devDependencies": {
216217
"@nuxt/schema": "^3.15.4",
217218
"@nuxtjs/eslint-config-typescript": "^12.1.0",
219+
"@types/glob": "^8.1.0",
220+
"@types/mocha": "^10.0.10",
218221
"@types/node": "^18.19.70",
219222
"@types/vscode": "1.42.0",
223+
"@vscode/test-electron": "^2.5.2",
220224
"@vscode/vsce": "^2.32.0",
221225
"eslint": "^8.57.1",
222226
"esno": "^0.17.0",
227+
"glob": "^11.0.3",
228+
"mocha": "^11.7.1",
223229
"release-it": "^18.1.2",
224230
"typescript": "5.2.2",
225231
"vscode": "^1.1.37",

0 commit comments

Comments
 (0)