Skip to content

Commit b5ca1a8

Browse files
authored
test: switch to vs code tests (#262)
* fix: disabling continuous mode prevents future tests from being run * refactor: remove redundant code * fix!: remove watch commands since continuous is now a possibility * fix: linting * fix: missing subscription removal * tests: switch to vscode tests * fix: convert existing tests to mocha * fix: typecheck * fix: lint * fix: test setup * fix: display ref * fix: linting * fix: don't use mocha for sample tests * fix: bad import * fix: mocha preload * fix: linting * fix: mocha preload directly * fix: repeated pattern * revert: sample test changes
1 parent 3c1262b commit b5ca1a8

16 files changed

+618
-206
lines changed

.github/workflows/build.yml

+8
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,12 @@ jobs:
2828
- run: pnpm compile
2929
- run: pnpm typecheck
3030
- run: pnpm lint
31+
32+
# see: https://github.com/microsoft/vscode-test/blob/main/sample/azure-pipelines.yml
33+
- run: |
34+
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
35+
echo ">>> Started xvfb"
36+
3137
- run: pnpm test
38+
env:
39+
DISPLAY: ':99'

.vscode-test.mjs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { defineConfig } from '@vscode/test-cli'
2+
3+
export default defineConfig({
4+
files: 'test/**/*.test.ts',
5+
mocha: {
6+
ui: 'bdd',
7+
preload: 'tsx/cjs',
8+
},
9+
})

package.json

+8-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@
125125
"release": "bumpp package.json --commit --push --tag && git update-ref refs/heads/release refs/heads/main && git push origin release",
126126
"compile": "tsup --minify",
127127
"watch": "tsup --watch --sourcemap",
128-
"test": "vitest run --config vite.global-config.ts",
128+
"test": "vscode-test",
129+
"test:watch": "vscode-test --watch-files src/**/*.ts --watch-files test/**/*.test.ts",
129130
"typecheck": "tsc --noEmit",
130131
"lint": "eslint --cache .",
131132
"lint:fix": "eslint --cache --fix ."
@@ -143,9 +144,12 @@
143144
"@types/vscode": "^1.77.0",
144145
"@types/ws": "^8.5.10",
145146
"@vitest/ws-client": "^1.3.0",
147+
"@vscode/test-cli": "^0.0.6",
148+
"@vscode/test-electron": "^2.3.9",
146149
"@vue/reactivity": "^3.2.33",
147150
"birpc": "^0.2.15",
148151
"bumpp": "^9.3.0",
152+
"chai": "^5.1.0",
149153
"changelogithub": "^0.13.3",
150154
"eslint": "^8.56.0",
151155
"fast-glob": "^3.3.2",
@@ -156,12 +160,14 @@
156160
"glob": "^7.2.0",
157161
"micromatch": "^4.0.5",
158162
"mighty-promise": "^0.0.8",
163+
"mocha": "^10.3.0",
159164
"pathe": "^1.1.2",
160165
"semver": "^7.3.5",
161166
"tree-kill": "^1.2.2",
162167
"tsup": "^8.0.1",
168+
"tsx": "^4.7.1",
163169
"typescript": "^5.3.3",
164-
"vitest": "^1.3.0",
170+
"vitest": "^1.3.1",
165171
"ws": "^8.16.0"
166172
},
167173
"lint-staged": {

0 commit comments

Comments
 (0)