-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy path.vscode-test.js
More file actions
441 lines (437 loc) · 12.8 KB
/
Copy path.vscode-test.js
File metadata and controls
441 lines (437 loc) · 12.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
const { defineConfig } = require("@vscode/test-cli");
const fs = require("node:fs");
const path = require("node:path");
const fixturesPath = path.join(__dirname, "src/e2e-tests/fixtures/");
// The multi-root suites write workspace-level settings, which land in the
// .code-workspace file itself. Those writes are part of what is under test and
// cannot always be cleaned reliably, so each suite runs against a throwaway
// gitignored copy of its committed workspace file, refreshed on every run.
const generatedWorkspaceFile = (fixture, name) => {
const generated = path.join(
fixturesPath,
fixture,
`${name}.generated.code-workspace`,
);
fs.copyFileSync(
path.join(fixturesPath, fixture, `${name}.code-workspace`),
generated,
);
return generated;
};
const multiRootWorkspaceFile = generatedWorkspaceFile(
"multi-root-workspace",
"multi-root",
);
const multiRootPythonWorkspaceFile = generatedWorkspaceFile(
"multi-root-python-workspace",
"multi-root-python",
);
// The Pkl extension is not published on the marketplace: Apple ships it as a
// `.vsix` on GitHub releases, fetched by `node --run fetch-pkl-vsix`. When it
// has not been fetched, the sdk-extensions suite skips its pkl tests instead
// of failing, so the other suites of the label still run.
const pklVsixDir = path.join(__dirname, ".vscode-test", "vsix");
const pklVsix = fs.existsSync(pklVsixDir)
? fs
.readdirSync(pklVsixDir)
.filter((file) => file.endsWith(".vsix"))
.map((file) => path.join(pklVsixDir, file))
: [];
// MISE_CEILING_PATHS stops mise from traversing above the fixtures directory,
// so the workspaces under test never inherit this repository's own mise config.
// Ceiling paths are exclusive: configs at the workspace root are still loaded.
// MISE_LOCKED=0 overrides the CI-wide locked mode: the fixtures have no
// lockfile, and locked mode would refuse to resolve their tools.
module.exports = defineConfig([
{
label: "default",
files: "src/e2e-tests/*.e2e.ts",
workspaceFolder: path.join(fixturesPath, "task-execution-workspace"),
env: {
MISE_CEILING_PATHS: fixturesPath,
MISE_LOCKED: "0",
},
installExtensions: ["tombi-toml.tombi"],
mocha: {
require: ["tsx/cjs"],
timeout: 60_000,
},
},
{
label: "tool-versions",
files: "src/e2e-tests/tool-versions/*.e2e.ts",
workspaceFolder: path.join(fixturesPath, "tool-versions-workspace"),
env: {
MISE_CEILING_PATHS: fixturesPath,
MISE_LOCKED: "0",
// Pre-trust the fixture .tool-versions so tool resolution never
// blocks on the trust dialog in CI.
MISE_TRUSTED_CONFIG_PATHS: fixturesPath,
},
mocha: {
require: ["tsx/cjs"],
timeout: 60_000,
},
},
{
label: "bootstrap",
files: "src/e2e-tests/bootstrap/*.e2e.ts",
workspaceFolder: path.join(fixturesPath, "bootstrap-workspace"),
env: {
MISE_CEILING_PATHS: fixturesPath,
MISE_LOCKED: "0",
MISE_TRUSTED_CONFIG_PATHS: fixturesPath,
// Keep the machine's real global config (tools, bootstrap sections)
// out of the tests so results match between dev machines and CI.
MISE_GLOBAL_CONFIG_FILE: path.join(
fixturesPath,
"bootstrap-workspace",
"global-config.toml",
),
},
mocha: {
require: ["tsx/cjs"],
timeout: 60_000,
},
},
{
label: "broken-config",
files: "src/e2e-tests/broken-config/*.e2e.ts",
workspaceFolder: path.join(fixturesPath, "broken-config-workspace"),
env: {
MISE_CEILING_PATHS: fixturesPath,
MISE_LOCKED: "0",
MISE_TRUSTED_CONFIG_PATHS: fixturesPath,
MISE_GLOBAL_CONFIG_FILE: path.join(
fixturesPath,
"broken-config-workspace",
"global-config.toml",
),
},
mocha: {
require: ["tsx/cjs"],
timeout: 60_000,
},
},
{
label: "command-injection",
files: "src/e2e-tests/command-injection/*.e2e.ts",
workspaceFolder: path.join(fixturesPath, "command-injection-workspace"),
env: {
MISE_CEILING_PATHS: fixturesPath,
MISE_LOCKED: "0",
MISE_TRUSTED_CONFIG_PATHS: fixturesPath,
},
mocha: {
require: ["tsx/cjs"],
timeout: 60_000,
},
},
{
label: "projects",
files: "src/e2e-tests/projects/*.e2e.ts",
workspaceFolder: path.join(fixturesPath, "projects-workspace"),
env: {
MISE_CEILING_PATHS: fixturesPath,
MISE_LOCKED: "0",
MISE_TRUSTED_CONFIG_PATHS: fixturesPath,
// Keep the machine's own tracked configs and global config out of the
// projects view so results match between dev machines and CI.
MISE_STATE_DIR: path.join(fixturesPath, "projects-workspace", ".state"),
MISE_GLOBAL_CONFIG_FILE: path.join(
fixturesPath,
"projects-workspace",
"global-config.toml",
),
},
mocha: {
require: ["tsx/cjs"],
timeout: 60_000,
},
},
{
label: "custom-extensions",
files: "src/e2e-tests/custom-extensions/*.e2e.ts",
workspaceFolder: path.join(fixturesPath, "custom-extensions-workspace"),
env: {
MISE_CEILING_PATHS: fixturesPath,
MISE_LOCKED: "0",
MISE_TRUSTED_CONFIG_PATHS: fixturesPath,
// Keep the machine's real global config out of the tests, and keep the
// tools installed by the suite out of the machine's mise data dir.
MISE_GLOBAL_CONFIG_FILE: path.join(
fixturesPath,
"custom-extensions-workspace",
"global-config.toml",
),
MISE_DATA_DIR: path.join(
fixturesPath,
"custom-extensions-workspace",
".mise-data",
),
MISE_CACHE_DIR: path.join(
fixturesPath,
"custom-extensions-workspace",
".mise-cache",
),
},
// foxundermoon.shell-format is the target extension under test: its
// `shellformat.path` setting is window-scoped, so the extension is
// allowed to write it to the workspace settings.
installExtensions: ["foxundermoon.shell-format"],
mocha: {
require: ["tsx/cjs"],
timeout: 120_000,
},
},
{
label: "supported-extensions",
files: "src/e2e-tests/supported-extensions/*.e2e.ts",
workspaceFolder: path.join(fixturesPath, "supported-extensions-workspace"),
env: {
MISE_CEILING_PATHS: fixturesPath,
MISE_LOCKED: "0",
MISE_TRUSTED_CONFIG_PATHS: fixturesPath,
// Keep the machine's real global config out of the tests, and keep the
// tools installed by the suite out of the machine's mise data dir.
MISE_GLOBAL_CONFIG_FILE: path.join(
fixturesPath,
"supported-extensions-workspace",
"global-config.toml",
),
MISE_DATA_DIR: path.join(
fixturesPath,
"supported-extensions-workspace",
".mise-data",
),
MISE_CACHE_DIR: path.join(
fixturesPath,
"supported-extensions-workspace",
".mise-cache",
),
},
// One marketplace extension per prebuilt-binary row of the
// supported-extensions docs table. The NodeJS row targets the built-in
// ms-vscode.js-debug, which needs no install.
installExtensions: [
"ms-python.python",
"denoland.vscode-deno",
"oven.bun-vscode",
"timonwong.shellcheck",
"foxundermoon.shell-format",
"signageos.signageos-vscode-sops",
"exiasr.hadolint",
"bufbuild.vscode-buf",
"charliermarsh.ruff",
"astral-sh.ty",
"biomejs.biome",
"sumneko.lua",
"twxs.cmake",
"ziglang.vscode-zig",
"bazelbuild.vscode-bazel",
],
mocha: {
require: ["tsx/cjs"],
// downloads over a dozen tools on a cold cache
timeout: 600_000,
},
},
{
label: "sdk-extensions",
files: "src/e2e-tests/sdk-extensions/*.e2e.ts",
workspaceFolder: path.join(fixturesPath, "sdk-extensions-workspace"),
env: {
MISE_CEILING_PATHS: fixturesPath,
MISE_LOCKED: "0",
MISE_TRUSTED_CONFIG_PATHS: fixturesPath,
// Keep the machine's real global config out of the tests, and keep the
// SDKs installed by the suite out of the machine's mise data dir.
MISE_GLOBAL_CONFIG_FILE: path.join(
fixturesPath,
"sdk-extensions-workspace",
"global-config.toml",
),
MISE_DATA_DIR: path.join(
fixturesPath,
"sdk-extensions-workspace",
".mise-data",
),
MISE_CACHE_DIR: path.join(
fixturesPath,
"sdk-extensions-workspace",
".mise-cache",
),
// tells the suite whether to assert the pkl rows or skip them
MISE_E2E_PKL_VSIX: pklVsix.length ? "1" : "",
},
// The java rows of the docs table: oracle.oracle-java plus the entries
// sharing its code path. salesforce.salesforcedx-vscode-apex shares it
// too but is left out, so its row stays unasserted. The pkl vsix is a
// local file, not a marketplace id.
installExtensions: [
"oracle.oracle-java",
"redhat.java",
"vscjava.vscode-gradle",
"SonarSource.sonarlint-vscode",
"ms-dotnettools.vscode-dotnet-runtime",
...pklVsix,
],
mocha: {
require: ["tsx/cjs"],
// installs a JDK and the dotnet SDK on a cold cache
timeout: 900_000,
},
},
{
label: "task-cache",
files: "src/e2e-tests/task-cache/*.e2e.ts",
workspaceFolder: path.join(fixturesPath, "task-cache-workspace"),
env: {
MISE_CEILING_PATHS: fixturesPath,
MISE_LOCKED: "0",
MISE_TRUSTED_CONFIG_PATHS: fixturesPath,
// keep the task artifact cache and the source freshness state of the
// suite inside the fixture, out of the machine's own mise directories
MISE_CACHE_DIR: path.join(
fixturesPath,
"task-cache-workspace",
".mise-cache",
),
MISE_STATE_DIR: path.join(
fixturesPath,
"task-cache-workspace",
".mise-state",
),
},
mocha: {
require: ["tsx/cjs"],
timeout: 60_000,
},
},
{
label: "multi-root",
files: "src/e2e-tests/multi-root/*.e2e.ts",
// a `.code-workspace` file, so vscode opens a multi-root workspace whose
// folders are subdirectories of the directory holding the file
workspaceFolder: multiRootWorkspaceFile,
env: {
MISE_CEILING_PATHS: fixturesPath,
MISE_LOCKED: "0",
MISE_TRUSTED_CONFIG_PATHS: fixturesPath,
MISE_GLOBAL_CONFIG_FILE: path.join(
fixturesPath,
"multi-root-workspace",
"global-config.toml",
),
// the go toolchains the suite installs stay inside the fixture
MISE_DATA_DIR: path.join(
fixturesPath,
"multi-root-workspace",
".mise-data",
),
MISE_CACHE_DIR: path.join(
fixturesPath,
"multi-root-workspace",
".mise-cache",
),
},
// golang.go is the extension under test: mise writes `go.goroot` and
// `go.alternateTools` for it. shell-format has a window-scoped setting
// (`shellformat.path`), which folder-scoped configuration cannot hold.
installExtensions: ["golang.go", "foxundermoon.shell-format"],
mocha: {
require: ["tsx/cjs"],
// the go suite installs two toolchains
timeout: 600_000,
},
},
{
label: "multi-root-python",
files: "src/e2e-tests/multi-root-python/*.e2e.ts",
// a multi-root workspace where a single folder is a python project
workspaceFolder: multiRootPythonWorkspaceFile,
env: {
MISE_CEILING_PATHS: fixturesPath,
MISE_LOCKED: "0",
MISE_TRUSTED_CONFIG_PATHS: fixturesPath,
// Keep the machine's real global config out of the tests, and keep the
// python installed by the suite out of the machine's mise data dir.
MISE_GLOBAL_CONFIG_FILE: path.join(
fixturesPath,
"multi-root-python-workspace",
"global-config.toml",
),
MISE_DATA_DIR: path.join(
fixturesPath,
"multi-root-python-workspace",
".mise-data",
),
MISE_CACHE_DIR: path.join(
fixturesPath,
"multi-root-python-workspace",
".mise-cache",
),
},
// ms-python.python is the extension under test: its interpreter path is
// relative to the folder it is written for
installExtensions: ["ms-python.python"],
mocha: {
require: ["tsx/cjs"],
// installs a python on a cold cache
timeout: 300_000,
},
},
{
label: "go",
files: "src/e2e-tests/go/*.e2e.ts",
workspaceFolder: path.join(fixturesPath, "go-workspace"),
env: {
MISE_CEILING_PATHS: fixturesPath,
MISE_LOCKED: "0",
MISE_TRUSTED_CONFIG_PATHS: fixturesPath,
MISE_GLOBAL_CONFIG_FILE: path.join(
fixturesPath,
"go-workspace",
"global-config.toml",
),
// shares the toolchain store of the multi-root fixture, so each go
// version is downloaded once per CI run
MISE_DATA_DIR: path.join(
fixturesPath,
"multi-root-workspace",
".mise-data",
),
MISE_CACHE_DIR: path.join(
fixturesPath,
"multi-root-workspace",
".mise-cache",
),
// keep the build cache in the fixture, and never let go swap in
// another toolchain than the one mise resolves
GOCACHE: path.join(fixturesPath, "go-workspace", ".gocache"),
GOTOOLCHAIN: "local",
},
installExtensions: ["golang.go"],
mocha: {
require: ["tsx/cjs"],
// installs a toolchain and compiles the go stdlib on a cold cache
timeout: 600_000,
},
},
{
label: "monorepo",
files: "src/e2e-tests/monorepo/*.e2e.ts",
workspaceFolder: path.join(fixturesPath, "monorepo-workspace"),
env: {
MISE_CEILING_PATHS: fixturesPath,
MISE_LOCKED: "0",
// Pre-trust the fixture configs (including subproject configs) so the
// extension never blocks on the trust dialog in CI.
MISE_TRUSTED_CONFIG_PATHS: fixturesPath,
},
mocha: {
require: ["tsx/cjs"],
timeout: 60_000,
},
},
]);