mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
test(editor): add test setup (#7361)
Tried it with `vitest`, but there was too many problems with `vscode` integration. That why I followed the official guide: - https://code.visualstudio.com/api/working-with-extensions/testing-extension#migrating-from-vscode - https://code.visualstudio.com/api/working-with-extensions/continuous-integration
This commit is contained in:
parent
d3a0119a42
commit
5190b7fb28
6 changed files with 899 additions and 61 deletions
11
.github/workflows/ci_vscode.yml
vendored
11
.github/workflows/ci_vscode.yml
vendored
|
|
@ -45,3 +45,14 @@ jobs:
|
|||
- name: Lint VSCode
|
||||
working-directory: editors/vscode
|
||||
run: pnpm run lint
|
||||
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: taiki-e/checkout-action@v1
|
||||
- uses: ./.github/actions/pnpm
|
||||
|
||||
- name: Test VSCode
|
||||
working-directory: editors/vscode
|
||||
run: xvfb-run -a pnpm run test
|
||||
|
|
|
|||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -11,6 +11,7 @@ target/
|
|||
/tasks/compat_data/node_modules/
|
||||
|
||||
# vscode
|
||||
/editors/vscode/.vscode-test/
|
||||
/editors/vscode/node_modules/
|
||||
/editors/vscode/icon.png
|
||||
/editors/vscode/out/
|
||||
|
|
|
|||
5
editors/vscode/.vscode-test.mjs
Normal file
5
editors/vscode/.vscode-test.mjs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { defineConfig } from '@vscode/test-cli';
|
||||
|
||||
export default defineConfig({
|
||||
files: 'out/**/*.spec.js',
|
||||
});
|
||||
12
editors/vscode/client/config.spec.ts
Normal file
12
editors/vscode/client/config.spec.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { strictEqual } from 'assert';
|
||||
import { ConfigService } from './config.js';
|
||||
|
||||
suite('default values on initialization', () => {
|
||||
const service = new ConfigService();
|
||||
|
||||
strictEqual(service.runTrigger, 'onType');
|
||||
strictEqual(service.enable, true);
|
||||
strictEqual(service.trace, 'off');
|
||||
strictEqual(service.configPath, '.eslintrc');
|
||||
strictEqual(service.binPath, '');
|
||||
});
|
||||
|
|
@ -136,11 +136,15 @@
|
|||
"install-extension": "code --install-extension oxc_language_server.vsix --force",
|
||||
"server:build:debug": "cargo build -p oxc_language_server",
|
||||
"server:build:release": "cross-env CARGO_TARGET_DIR=./target cargo build -p oxc_language_server --release",
|
||||
"lint": "npx oxlint --config=oxlint.json --tsconfig=tsconfig.json"
|
||||
"lint": "npx oxlint --config=oxlint.json --tsconfig=tsconfig.json",
|
||||
"test": "esbuild client/config.spec.ts --bundle --outfile=out/config.spec.js --external:vscode --format=cjs --platform=node --target=node16 --minify --sourcemap && vscode-test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mocha": "^10.0.9",
|
||||
"@types/node": "^22.0.0",
|
||||
"@types/vscode": "1.95.0",
|
||||
"@vscode/test-cli": "^0.0.10",
|
||||
"@vscode/test-electron": "^2.4.1",
|
||||
"@vscode/vsce": "^3.0.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"esbuild": "^0.24.0",
|
||||
|
|
|
|||
925
pnpm-lock.yaml
925
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue