Skip to content

Commit f4f5fca

Browse files
authored
Merge pull request #4538 from vsrs/vscode_tests
vscode client side tests
2 parents 4cc2ff6 + 1797b66 commit f4f5fca

File tree

12 files changed

+1018
-33
lines changed

12 files changed

+1018
-33
lines changed

.github/workflows/ci.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,13 @@ jobs:
9797

9898
typescript:
9999
name: TypeScript
100-
runs-on: ubuntu-latest
100+
strategy:
101+
fail-fast: false
102+
matrix:
103+
os: [ubuntu-latest, windows-latest, macos-latest]
104+
105+
runs-on: ${{ matrix.os }}
106+
101107
steps:
102108
- name: Checkout repository
103109
uses: actions/checkout@v2
@@ -111,10 +117,19 @@ jobs:
111117
working-directory: ./editors/code
112118

113119
- run: npm audit || { sleep 10 && npm audit; } || { sleep 30 && npm audit; }
120+
if: runner.os == 'Linux'
114121
working-directory: ./editors/code
115122

116123
- run: npm run lint
117124
working-directory: ./editors/code
118125

126+
- name: Run vscode tests
127+
uses: GabrielBB/[email protected]
128+
env:
129+
VSCODE_CLI: 1
130+
with:
131+
run: npm --prefix ./editors/code test
132+
# working-directory: ./editors/code # does not work: https://github.com/GabrielBB/xvfb-action/issues/8
133+
119134
- run: npm run package --scripts-prepend-node-path
120135
working-directory: ./editors/code

.vscode/launch.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,28 @@
7070
"__RA_LSP_SERVER_DEBUG": "${workspaceFolder}/target/release/rust-analyzer"
7171
}
7272
},
73+
{
74+
// Used for testing the extension with a local build of the LSP server (in `target/release`)
75+
// with all other extendions loaded.
76+
"name": "Run With Extensions",
77+
"type": "extensionHost",
78+
"request": "launch",
79+
"runtimeExecutable": "${execPath}",
80+
"args": [
81+
"--disable-extension", "matklad.rust-analyzer",
82+
"--extensionDevelopmentPath=${workspaceFolder}/editors/code"
83+
],
84+
"outFiles": [
85+
"${workspaceFolder}/editors/code/out/**/*.js"
86+
],
87+
"preLaunchTask": "Build Server (Release) and Extension",
88+
"skipFiles": [
89+
"<node_internals>/**/*.js"
90+
],
91+
"env": {
92+
"__RA_LSP_SERVER_DEBUG": "${workspaceFolder}/target/release/rust-analyzer"
93+
}
94+
},
7395
{
7496
// Used to attach LLDB to a running LSP server.
7597
// NOTE: Might require root permissions. For this run:
@@ -87,5 +109,17 @@
87109
"rust"
88110
]
89111
},
112+
{
113+
"name": "Run Unit Tests",
114+
"type": "extensionHost",
115+
"request": "launch",
116+
"runtimeExecutable": "${execPath}",
117+
"args": [
118+
"--extensionDevelopmentPath=${workspaceFolder}/editors/code",
119+
"--extensionTestsPath=${workspaceFolder}/editors/code/out/tests/unit" ],
120+
"sourceMaps": true,
121+
"outFiles": [ "${workspaceFolder}/editors/code/out/tests/unit/**/*.js" ],
122+
"preLaunchTask": "Pretest"
123+
}
90124
]
91125
}

.vscode/tasks.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@
4040
"command": "cargo build --release --package rust-analyzer",
4141
"problemMatcher": "$rustc"
4242
},
43+
{
44+
"label": "Pretest",
45+
"group": "build",
46+
"isBackground": false,
47+
"type": "npm",
48+
"script": "pretest",
49+
"path": "editors/code/",
50+
"problemMatcher": {
51+
"base": "$tsc",
52+
"fileLocation": ["relative", "${workspaceFolder}/editors/code/"]
53+
}
54+
},
4355

4456
{
4557
"label": "Build Server and Extension",

editors/code/.vscodeignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
**
2-
!out/main.js
2+
!out/src/main.js
33
!package.json
44
!package-lock.json
55
!ra_syntax_tree.tmGrammar.json

0 commit comments

Comments
 (0)