Skip to content

Commit db34352

Browse files
committed
Smoke test for getting the schema from settings
(for web) see #1194 Signed-off-by: David Thompson <davthomp@redhat.com>
1 parent eeeedd3 commit db34352

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@
287287
"smoke-test": "npm run test-compile && vscode-test --config .vscode-test.smoketest.mjs",
288288
"compile-smoke-test-web": "webpack --config smoke-test/webpack.config",
289289
"smoke-test-web": "npm run compile-smoke-test-web && vscode-test-web --extensionDevelopmentPath=. --extensionTestsPath=./out/smoke-test/smoke-test-runner.js ./smoke-test",
290-
"run-in-chromium": "npm run compile && vscode-test-web --browserType=chromium --extensionDevelopmentPath=. ."
290+
"run-in-chromium": "npm run compile && vscode-test-web --browserType=chromium --extensionDevelopmentPath=. smoke-test"
291291
},
292292
"devDependencies": {
293293
"@types/chai": "^4.2.12",

smoke-test/.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"yaml.schemas": {
3+
"dressSize.json": "references-schema-settings.yaml"
4+
}
5+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dress:
2+
size: -2

smoke-test/smoke.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,19 @@ describe('Smoke test suite', function () {
99
const DIAGNOSTICS_DELAY = 4_000;
1010

1111
const SCHEMA_INSTANCE_NAME = 'references-schema.yaml';
12+
const THROUGH_SETTINGS_NAME = 'references-schema-settings.yaml';
1213

1314
let schemaInstanceUri: URI;
15+
let throughSettingsUri: URI;
1416

1517
before(async function () {
1618
const workspaceUri = vscode.workspace.workspaceFolders[0].uri;
1719
schemaInstanceUri = workspaceUri.with({
1820
path: workspaceUri.path + (workspaceUri.path.endsWith('/') ? '' : '/') + SCHEMA_INSTANCE_NAME,
1921
});
22+
throughSettingsUri = workspaceUri.with({
23+
path: workspaceUri.path + (workspaceUri.path.endsWith('/') ? '' : '/') + THROUGH_SETTINGS_NAME,
24+
});
2025
});
2126

2227
it('has right diagnostics when schema is referenced through a comment', async function () {
@@ -28,4 +33,14 @@ describe('Smoke test suite', function () {
2833
assert.strictEqual(diagnostics.length, 1);
2934
assert.strictEqual(diagnostics[0].message, 'Value is below the minimum of 0.');
3035
});
36+
37+
it('has right diagnostics when schema is referenced through settings', async function () {
38+
const textDocument = await vscode.workspace.openTextDocument(throughSettingsUri);
39+
await vscode.window.showTextDocument(textDocument);
40+
await new Promise((resolve) => setTimeout(resolve, DIAGNOSTICS_DELAY));
41+
const diagnostics = vscode.languages.getDiagnostics(throughSettingsUri);
42+
43+
assert.strictEqual(diagnostics.length, 1);
44+
assert.strictEqual(diagnostics[0].message, 'Value is below the minimum of 0.');
45+
});
3146
});

0 commit comments

Comments
 (0)