Skip to content

Commit 2bea998

Browse files
authored
Fix running as a web extension, add smoke tests to prevent another regression (#1193)
* On web, send a message to the worker containing the translations Translations weren't working at all when running the language server in a web worker. In fact, the server was crashing immediately, since the server was trying to load them from the filesystem. This PR provides the translations to the server using the webworker message passing mechanism. Requires redhat-developer/yaml-language-server#1165 Signed-off-by: David Thompson <[email protected]> * Fix web support, add smoke tests 1. Fix schema content resolving when running on web (referencing a schema with a relative path wasn't working) 2. Add smoke tests for desktop using `@vscode/test-cli` 3. Add smoke tests for web using `@vscode/test-web` The smoke tests are very minimal; it loads a YAML file that references a schema using a relative path and verifies the expected diagnostics appear. Signed-off-by: David Thompson <[email protected]> --------- Signed-off-by: David Thompson <[email protected]>
1 parent c126488 commit 2bea998

File tree

15 files changed

+1189
-709
lines changed

15 files changed

+1189
-709
lines changed

.github/workflows/CI.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,37 @@ jobs:
7979
path: |
8080
test-resources/screenshots/*.png
8181
retention-days: 2
82+
83+
Smoke-Test-Web:
84+
runs-on: 'ubuntu-latest'
85+
steps:
86+
- uses: actions/checkout@v4
87+
- name: Use Node 20
88+
uses: actions/setup-node@v4
89+
with:
90+
node-version: 20
91+
- name: Install dependencies
92+
run: npm ci
93+
- name: Update yaml-language-server
94+
run: npm i yaml-language-server@next
95+
- name: Build extension
96+
run: npm run build
97+
- name: Run tests on web
98+
run: xvfb-run npm run smoke-test-web
99+
100+
Smoke-Test-Desktop:
101+
runs-on: 'ubuntu-latest'
102+
steps:
103+
- uses: actions/checkout@v4
104+
- name: Use Node 20
105+
uses: actions/setup-node@v4
106+
with:
107+
node-version: 20
108+
- name: Install dependencies
109+
run: npm ci
110+
- name: Update yaml-language-server
111+
run: npm i yaml-language-server@next
112+
- name: Build extension
113+
run: npm run build
114+
- name: Run tests on web
115+
run: xvfb-run npm run smoke-test

.vscode-test.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { defineConfig } from '@vscode/test-cli';
2+
3+
export default defineConfig({
4+
files: 'out/smoke-test/**/*.test.js',
5+
workspaceFolder: './smoke-test/',
6+
});

.vscode/launch.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@
4242
"--extensionDevelopmentPath=${workspaceFolder}",
4343
"--extensionDevelopmentKind=web"
4444
],
45+
"sourceMaps": true,
4546
"env": {
47+
"DEBUG_VSCODE_YAML": "true",
4648
"VSCODE_REDHAT_TELEMETRY_DEBUG":"true"
4749
},
4850
"outFiles": ["${workspaceRoot}/dist/**/*.js"],

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@
1111
"other": true,
1212
"comments": true,
1313
"strings": true
14-
}
14+
},
15+
"yaml.schemas": {},
16+
"yaml.schemaStore.enable": true
1517
}

0 commit comments

Comments
 (0)