Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/ci_vscode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ jobs:
working-directory: editors/vscode
run: xvfb-run -a pnpm run test:oxlint && xvfb-run -a pnpm run test:oxlint-multi-root

- name: VSCode oxlint plugin test (flaky)
if: steps.oxlint.outputs.src == 'true'
working-directory: editors/vscode
continue-on-error: true
run: xvfb-run -a pnpm run test:oxlint-js

- name: VSCode oxfmt tests
if: steps.oxfmt.outputs.src == 'true'
working-directory: editors/vscode
Expand Down
14 changes: 14 additions & 0 deletions editors/vscode/.vscode-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@ const allTestSuites = new Map([
},
},
],
[
"oxlint-js",
{
...baseTest,
workspaceFolder: multiRootWorkspaceFile,
files: "out_test/integration/e2e_server_linter-js.spec.js",
env: {
SINGLE_FOLDER_WORKSPACE: "true",
OXLINT_JS_PLUGIN: "true",
SERVER_PATH_DEV: path.resolve(import.meta.dirname, `../../apps/oxlint/dist/cli.js`),
SKIP_FORMATTER_TEST: "true",
},
},
],
[
"oxfmt-lsp",
{
Expand Down
1 change: 1 addition & 0 deletions editors/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"test": "cross-env TEST=true pnpm run compile && vscode-test",
"test:unit": "cross-env TEST=true pnpm run compile && cross-env TEST_SUITE=unit vscode-test",
"test:oxlint": "cross-env TEST=true pnpm run compile && cross-env TEST_SUITE=oxlint-lsp vscode-test",
"test:oxlint-js": "cross-env TEST=true pnpm run compile && cross-env TEST_SUITE=oxlint-js vscode-test",
"test:oxlint-multi-root": "cross-env TEST=true pnpm run compile && cross-env TEST_SUITE=oxlint-lsp-multi-root vscode-test",
"test:oxfmt": "cross-env TEST=true pnpm run compile && cross-env TEST_SUITE=oxfmt-lsp vscode-test"
},
Expand Down
2 changes: 2 additions & 0 deletions editors/vscode/tests/integration/code_actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ suite("code actions", () => {
strictEqual(quickFixesNoFix.length, 0);
await workspace.getConfiguration("oxc").update("unusedDisableDirectives", "warn");
await workspace.saveAll();
await sleep(500);

const codeActionsWithFix: ProviderResult<Array<CodeAction>> = await commands.executeCommand(
"vscode.executeCodeActionProvider",
fileUri,
Expand Down
45 changes: 45 additions & 0 deletions editors/vscode/tests/integration/e2e_server_linter-js.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { strictEqual } from "assert";
import { DiagnosticSeverity, workspace } from "vscode";
import { activateExtension, getDiagnosticsWithoutClose, loadFixture, sleep } from "../test-helpers";
import assert = require("assert");

suiteSetup(async () => {
await activateExtension();
});

teardown(async () => {
await workspace.getConfiguration("oxc").update("fixKind", undefined);
await workspace.getConfiguration("oxc").update("tsConfigPath", undefined);
await workspace.getConfiguration("oxc").update("typeAware", undefined);
await workspace.getConfiguration("oxc").update("fmt.experimental", undefined);
await workspace.getConfiguration("oxc").update("fmt.configPath", undefined);
await workspace.getConfiguration("editor").update("defaultFormatter", undefined);
await workspace.saveAll();
});

suite("E2E Server Linter", () => {
// Skip tests if linter tests are disabled
if (process.env.SKIP_LINTER_TEST === "true") {
return;
}

test("js plugin support", async () => {
// Flaky test; JS plugin support is a work in progress.
// this test is allowed to fail in CI until then.
// Make sure to run the test in CI multiple times before marking it as fixed.
// Move the test into `e2e_server_linter.spec.ts` once stable.
if (process.env.OXLINT_JS_PLUGIN !== "true") {
return;
}
await loadFixture("js_plugins");
await sleep(500);

const diagnostics = await getDiagnosticsWithoutClose("index.js");
strictEqual(diagnostics.length, 1);

assert(typeof diagnostics[0].code == "string");
strictEqual(diagnostics[0].code, "js-plugin(test-rule)");
strictEqual(diagnostics[0].message, "Custom name JS Plugin Test Rule.");
strictEqual(diagnostics[0].severity, DiagnosticSeverity.Error);
});
});
13 changes: 0 additions & 13 deletions editors/vscode/tests/integration/e2e_server_linter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,17 +343,4 @@ suite("E2E Server Linter", () => {
await workspace.saveAll();
await sleep(500);
});

test("js plugin support", async () => {
await loadFixture("js_plugins");
await sleep(500);

const diagnostics = await getDiagnosticsWithoutClose("index.js");
strictEqual(diagnostics.length, 1);

assert(typeof diagnostics[0].code == "string");
strictEqual(diagnostics[0].code, "js-plugin(test-rule)");
strictEqual(diagnostics[0].message, "Custom name JS Plugin Test Rule.");
strictEqual(diagnostics[0].severity, DiagnosticSeverity.Error);
});
});
Loading