Skip to content

Commit 82f3490

Browse files
authored
Merge pull request #755 from ruby-syntax-tree/updates
Updates
2 parents eda116a + b254bfd commit 82f3490

File tree

6 files changed

+1552
-606
lines changed

6 files changed

+1552
-606
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@master
1414
- uses: actions/setup-node@v4
1515
with:
16-
node-version: 18.x
16+
node-version: 20.x
1717
cache: yarn
1818
- name: Compile extension
1919
run: |
@@ -40,7 +40,7 @@ jobs:
4040
- uses: actions/checkout@master
4141
- uses: actions/setup-node@v4
4242
with:
43-
node-version: 18.x
43+
node-version: 20.x
4444
cache: yarn
4545
- uses: ruby/setup-ruby@v1
4646
with:

eslint.config.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import eslint from "@eslint/js";
2+
import tseslint from "typescript-eslint";
3+
import { defineConfig, globalIgnores } from "eslint/config";
4+
5+
export default defineConfig([
6+
eslint.configs.recommended,
7+
tseslint.configs.recommended,
8+
globalIgnores([".vscode-test/", "out/"])
9+
]);

package.json

Lines changed: 11 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,12 @@
1515
},
1616
"packageManager": "[email protected]",
1717
"engines": {
18-
"vscode": "^1.68.0"
18+
"vscode": "^1.75.0"
1919
},
2020
"activationEvents": [
2121
"onLanguage:haml",
2222
"onLanguage:ruby",
23-
"workspaceContains:Gemfile.lock",
24-
"onCommand:syntaxTree.start",
25-
"onCommand:syntaxTree.stop",
26-
"onCommand:syntaxTree.restart",
27-
"onCommand:syntaxTree.showOutputChannel",
28-
"onCommand:syntaxTree.visualize"
23+
"workspaceContains:Gemfile.lock"
2924
],
3025
"main": "./out/extension",
3126
"contributes": {
@@ -116,40 +111,21 @@
116111
"vscode-languageclient": "9.0.1"
117112
},
118113
"devDependencies": {
119-
"@types/glob": "^9.0.0",
114+
"@eslint/js": "^9.31.0",
120115
"@types/mocha": "^10.0.0",
121116
"@types/node": "^24.0.0",
122-
"@types/vscode": "^1.68.0",
123-
"@typescript-eslint/eslint-plugin": "^5.47.0",
124-
"@typescript-eslint/parser": "^5.47.0",
117+
"@types/vscode": "^1.75.0",
118+
"@typescript-eslint/eslint-plugin": "^8.37.0",
119+
"@typescript-eslint/parser": "^8.37.0",
125120
"@vscode/test-electron": "^2.2.0",
121+
"@vscode/vsce": "^3.6.0",
126122
"esbuild": "^0.25.0",
127-
"eslint": "^9.12.0",
123+
"eslint": "^9.31.0",
128124
"glob": "^11.0.0",
125+
"globals": "^16.3.0",
129126
"mocha": "^11.0.1",
130-
"typescript": "^5.0.2",
131-
"vsce": "^2.9.2"
132-
},
133-
"eslintConfig": {
134-
"parser": "@typescript-eslint/parser",
135-
"plugins": [
136-
"@typescript-eslint"
137-
],
138-
"extends": [
139-
"eslint:recommended",
140-
"plugin:@typescript-eslint/eslint-recommended",
141-
"plugin:@typescript-eslint/recommended"
142-
],
143-
"rules": {
144-
"quotes": [
145-
"error",
146-
"double"
147-
],
148-
"semi": "error"
149-
},
150-
"ignorePatterns": [
151-
"out"
152-
]
127+
"typescript": "=5.5.4",
128+
"typescript-eslint": "^8.37.0"
153129
},
154130
"__metadata": {
155131
"id": "b46118f9-0f6f-4320-9e2e-75c96492b4cb",

src/test/runTest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async function main() {
1515

1616
// Download VS Code, unzip it and run the integration test
1717
await runTests({ extensionDevelopmentPath, extensionTestsPath, launchArgs: ["--disable-extensions", "--disable-gpu", "--user-data-dir", USER_DATA_DIR, WORKSPACE_DIR] });
18-
} catch (err) {
18+
} catch {
1919
console.error("Failed to run tests");
2020
process.exit(1);
2121
}

src/test/suite/index.ts

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import * as path from "path";
22
import * as Mocha from "mocha";
3-
import * as glob from "glob";
3+
import { glob } from "glob";
44

55
import { TIMEOUT_MS } from "./setup";
66

7-
export function run(): Promise<void> {
7+
export async function run(): Promise<void> {
88
const mocha = new Mocha({
99
asyncOnly: true,
1010
color: true,
@@ -16,33 +16,32 @@ export function run(): Promise<void> {
1616

1717
const testsRoot = path.resolve(__dirname, "..");
1818

19-
return new Promise((c, e) => {
20-
glob("**/**.test.js", { cwd: testsRoot }, (err, files) => {
21-
if (err) {
22-
return e(err);
23-
}
19+
try {
20+
// Find all test files
21+
const files = await glob("**/**.test.js", { cwd: testsRoot });
2422

25-
// Add files to the test suite
26-
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
23+
// Add files to the test suite
24+
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
2725

28-
try {
29-
// Run the mocha test
30-
mocha.run(failures => {
31-
if (failures > 0) {
32-
// Let the cameras roll for a bit & make sure we capture the error
33-
if (process.env.CI) {
34-
setTimeout(() => e(new Error(`${failures} tests failed; pausing for dramatic effect.`)), 3000);
35-
} else {
36-
e(new Error(`${failures} tests failed.`));
37-
}
26+
// Run the mocha test and wrap in a promise since mocha.run uses callbacks
27+
await new Promise<void>((resolve, reject) => {
28+
mocha.run(failures => {
29+
if (failures > 0) {
30+
const error = new Error(`${failures} tests failed${process.env.CI ? '; pausing for dramatic effect.' : '.'}`);
31+
32+
// Let the cameras roll for a bit & make sure we capture the error
33+
if (process.env.CI) {
34+
setTimeout(() => reject(error), 3000);
3835
} else {
39-
c();
36+
reject(error);
4037
}
41-
});
42-
} catch (err) {
43-
console.error(err);
44-
e(err);
45-
}
38+
} else {
39+
resolve();
40+
}
41+
});
4642
});
47-
});
43+
} catch (err) {
44+
console.error(err);
45+
throw err;
46+
}
4847
}

0 commit comments

Comments
 (0)