-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy path.vscode-test.js
More file actions
283 lines (281 loc) · 8.1 KB
/
Copy path.vscode-test.js
File metadata and controls
283 lines (281 loc) · 8.1 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
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 the suite runs against a throwaway
// gitignored copy of the committed workspace file, refreshed on every run.
const multiRootWorkspaceFile = path.join(
fixturesPath,
"multi-root-workspace",
"multi-root.generated.code-workspace",
);
fs.copyFileSync(
path.join(fixturesPath, "multi-root-workspace", "multi-root.code-workspace"),
multiRootWorkspaceFile,
);
// 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: "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: "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,
},
},
]);