Skip to content

Commit 3f00c6d

Browse files
Abe27342Abram Sanderson
andauthored
Add e2e test vscode workspace with more flexible launch targets (#21905)
## Description Adds a VSCode workspace set up for e2e test debugging. It has the following advantages over the primary (root) workspace: - Access to legacy module installation from the file explorer - Dedicated launch configurations for each driver we test against - Inputs selected at launch time for: - driver-specific config (e.g. odsp endpoint) - console output - whether break points can be set in legacy modules (this is a fairly large performance hit, so default is 'no') - Tinylicious launch target is a compound target which allows simultaneous server + client debugging - FF code under `.legacy` (i.e. the modules installed for compat testing) isn't under skipFiles by default, so break points in this code works (either in the js if source map loading is turned off, or in the ts if it is turned on, which is configurable at launch time) The r11s tests are difficult to run on Windows, so I didn't test that launch target. Other targets all work well as far as I can tell (which includes setting breakpoints in various places in dependent packages) Sample view of launch window when using this workspace: ![image](https://github.com/user-attachments/assets/e00569b6-9be0-4177-92f5-8e16d5587c87) --------- Co-authored-by: Abram Sanderson <[email protected]>
1 parent 7eee05d commit 3f00c6d

File tree

5 files changed

+312
-1
lines changed

5 files changed

+312
-1
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"folders": [
3+
{
4+
"name": "FluidFramework",
5+
"path": "../../../.."
6+
},
7+
{
8+
"name": "@fluid-private/test-end-to-end-tests",
9+
"path": ".."
10+
},
11+
// This is a reasonably convenient entrypoint for the set of installed packages for compat tests.
12+
{
13+
"name": "Legacy FluidFramework versions",
14+
"path": "../../test-version-utils/node_modules/.legacy"
15+
}
16+
]
17+
}
Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Debug Current e2e test (local driver)",
11+
"env": {
12+
"fluid__test__driver": "local",
13+
"fluid__test__backCompat": "${input:backCompat}",
14+
"FLUID_TEST_VERBOSE": "${input:verboseConsoleOutputt}",
15+
},
16+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/mocha",
17+
"windows": {
18+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/mocha.cmd",
19+
},
20+
"sourceMaps": true,
21+
"program": "${file}",
22+
"args": [
23+
// "--fgrep", // Uncomment to filter by test case name
24+
// "<test case name>",
25+
"--no-timeouts",
26+
"--exit",
27+
],
28+
"cwd": "${fileDirname}",
29+
"skipFiles": [
30+
"<node_internals>/**",
31+
// Allow debugging into legacy Fluid packages (and breakpoints to be set in them)
32+
"**/node_modules/!(.legacy)/**",
33+
],
34+
"outFiles": [
35+
// This config avoids loading dependent packages' test files, just those in test-end-to-end-tests.
36+
// This reduces the number of source files VSCode needs to load to debug the e2e tests
37+
// considerably, which decreases the time it takes to start debugging.
38+
// Note: these globs include files under node_modules, which is explicitly desirable when trying to set breakpoints
39+
// in legacy FF packages. When the user doesn't select that option, debugOldFluidModules will handle excluding node_modules.
40+
"${workspaceFolder}/lib/**/*.js",
41+
"${workspaceFolder:FluidFramework}/**/{dist,lib}/**/!(*.spec,*.test,*.tests).[mc]?js",
42+
"${input:debugOldFluidModules}",
43+
],
44+
"presentation": {
45+
"group": "e2e-tests",
46+
"order": 1,
47+
},
48+
"preLaunchTask": "Build Current Tests",
49+
"internalConsoleOptions": "openOnSessionStart",
50+
},
51+
{
52+
"type": "node",
53+
"request": "launch",
54+
"name": "Client: Debug Current e2e test (tinylicious)",
55+
"env": {
56+
"fluid__test__driver": "t9s",
57+
"fluid__test__backCompat": "${input:backCompat}",
58+
"FLUID_TEST_VERBOSE": "${input:verboseConsoleOutputt}",
59+
},
60+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/mocha",
61+
"windows": {
62+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/mocha.cmd",
63+
},
64+
"sourceMaps": true,
65+
"program": "${file}",
66+
"args": [
67+
// "--fgrep", // Uncomment to filter by test case name
68+
// "<test case name>",
69+
"--no-timeouts",
70+
"--exit",
71+
],
72+
"cwd": "${fileDirname}",
73+
"skipFiles": ["<node_internals>/**", "**/node_modules/!(.legacy)/**"],
74+
"outFiles": [
75+
"${workspaceFolder}/lib/**/*.js",
76+
"${workspaceFolder:FluidFramework}/**/{dist,lib}/**/!(*.spec,*.test,*.tests).[mc]?js",
77+
"${input:debugOldFluidModules}",
78+
],
79+
"presentation": {
80+
"hidden": true,
81+
},
82+
"preLaunchTask": "Build Current Tests",
83+
"internalConsoleOptions": "openOnSessionStart",
84+
},
85+
{
86+
"type": "node",
87+
"request": "launch",
88+
"name": "tinylicious",
89+
"cwd": "${workspaceFolder}",
90+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/tinylicious",
91+
"windows": {
92+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/tinylicious.cmd",
93+
},
94+
"sourceMaps": true,
95+
"skipFiles": ["<node_internals>/**"],
96+
// Only load source maps for tinylicious and Fluid packages
97+
"outFiles": [
98+
"${workspaceFolder:FluidFramework}/node_modules/**/tinylicious/**/*.[mc]?js",
99+
"${workspaceFolder:FluidFramework}/node_modules/**/@fluid*/**/*.[mc]?js",
100+
],
101+
"presentation": {
102+
"hidden": true,
103+
},
104+
},
105+
{
106+
"type": "node",
107+
"request": "launch",
108+
"name": "Debug Current e2e test (odsp)",
109+
"env": {
110+
"fluid__test__driver": "odsp",
111+
"fluid__test__backCompat": "${input:backCompat}",
112+
"FLUID_TEST_VERBOSE": "${input:verboseConsoleOutputt}",
113+
"fluid__test__odspEndpointName": "${input:odspEndpoint}",
114+
},
115+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/mocha",
116+
"windows": {
117+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/mocha.cmd",
118+
},
119+
"sourceMaps": true,
120+
"program": "${file}",
121+
"args": [
122+
// "--fgrep", // Uncomment to filter by test case name
123+
// "<test case name>",
124+
"--no-timeouts",
125+
"--exit",
126+
],
127+
"cwd": "${fileDirname}",
128+
"skipFiles": ["<node_internals>/**", "**/node_modules/!(.legacy)/**"],
129+
"outFiles": [
130+
"${workspaceFolder}/lib/**/*.js",
131+
"${workspaceFolder:FluidFramework}/**/{dist,lib}/**/!(*.spec,*.test,*.tests).[mc]?js",
132+
"${input:debugOldFluidModules}",
133+
],
134+
"presentation": {
135+
"group": "e2e-tests",
136+
"order": 3,
137+
},
138+
"preLaunchTask": "Build Current Tests",
139+
"internalConsoleOptions": "openOnSessionStart",
140+
},
141+
{
142+
"type": "node",
143+
"request": "launch",
144+
"name": "Debug Current e2e test (routerlicious)",
145+
"env": {
146+
"fluid__test__driver": "r11s",
147+
"fluid__test__backCompat": "${input:backCompat}",
148+
"fluid__test__r11sEndpointName": "${input:r11sEndpoint}",
149+
"FLUID_TEST_VERBOSE": "${input:verboseConsoleOutputt}",
150+
},
151+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/mocha",
152+
"windows": {
153+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/mocha.cmd",
154+
},
155+
"sourceMaps": true,
156+
"program": "${file}",
157+
"args": [
158+
// "--fgrep", // Uncomment to filter by test case name
159+
// "<test case name>",
160+
"--no-timeouts",
161+
"--exit",
162+
],
163+
"cwd": "${fileDirname}",
164+
"skipFiles": ["<node_internals>/**", "**/node_modules/!(.legacy)/**"],
165+
"outFiles": [
166+
"${workspaceFolder}/lib/**/*.js",
167+
"${workspaceFolder:FluidFramework}/**/{dist,lib}/**/!(*.spec,*.test,*.tests).[mc]?js",
168+
"${input:debugOldFluidModules}",
169+
],
170+
"presentation": {
171+
"group": "e2e-tests",
172+
"order": 4,
173+
},
174+
"preLaunchTask": "Build Current Tests",
175+
"internalConsoleOptions": "openOnSessionStart",
176+
},
177+
],
178+
"compounds": [
179+
{
180+
"name": "Debug Current e2e test (tinylicious)",
181+
"configurations": ["tinylicious", "Client: Debug Current e2e test (tinylicious)"],
182+
"presentation": {
183+
"group": "e2e-tests",
184+
"order": 2,
185+
},
186+
},
187+
],
188+
// Note: if launching some debug configuration with non-default values repeatedly, you can use "restart" to avoid specifying
189+
// the inputs each time.
190+
// We could consider using something like https://marketplace.visualstudio.com/items?itemName=spadin.memento-inputs to make
191+
// this a bit more ergonomic, but that would require extension installation to make these launch targets work.
192+
"inputs": [
193+
{
194+
"id": "argDriver",
195+
"description": "e2e test driver to use",
196+
"default": "local",
197+
"type": "pickString",
198+
"options": ["local", "tinylicious", "routerlicious", "odsp"],
199+
},
200+
{
201+
"id": "backCompat",
202+
"description": "compatibility matrix",
203+
"default": "small",
204+
"type": "pickString",
205+
"options": [
206+
{ "label": "default (PR)", "value": "" },
207+
{ "label": "full (CI)", "value": "FULL" },
208+
],
209+
},
210+
{
211+
"id": "verboseConsoleOutputt",
212+
"description": "Show console output?",
213+
"default": "",
214+
"type": "pickString",
215+
"options": [{ "label": "No", "value": "" }, { "label": "Yes", "value": "1" }],
216+
},
217+
{
218+
"id": "debugOldFluidModules",
219+
"description": "Load source maps for compat matrix? (slower, but allows breakpoints in compat Fluid packages)",
220+
"type": "pickString",
221+
"default": "!**/node_modules/**",
222+
"options": [
223+
{ "label": "No", "value": "!**/node_modules/**" },
224+
// VSCode doesn't correctly handle an empty string in outFiles. This is an arbitrary glob that doesn't match any files.
225+
{ "label": "Yes", "value": "**/dummy-folder-unused/**" },
226+
],
227+
},
228+
{
229+
"id": "odspEndpoint",
230+
"description": "Which odsp endpoint should be used?",
231+
"type": "pickString",
232+
"default": "odsp",
233+
"options": ["odsp", "odsp-df"],
234+
},
235+
{
236+
"id": "r11sEndpoint",
237+
"description": "Which r11s endpoint should be used?",
238+
"type": "pickString",
239+
"default": "frs",
240+
"options": [
241+
"frs",
242+
{
243+
"label": "docker (local service must be started separately prior to debugging)",
244+
"value": "docker",
245+
},
246+
],
247+
},
248+
],
249+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
// Enable biome as default formatter, and disable rules that disagree with it
3+
"editor.defaultFormatter": "biomejs.biome",
4+
"editor.insertSpaces": false,
5+
"[json]": {
6+
"editor.defaultFormatter": "biomejs.biome",
7+
},
8+
"[javascript]": {
9+
"editor.defaultFormatter": "biomejs.biome",
10+
},
11+
"[typescript]": {
12+
"editor.defaultFormatter": "biomejs.biome",
13+
},
14+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Build Current Tests",
6+
"type": "process",
7+
"command": "node",
8+
"args": [
9+
"${workspaceRoot:FluidFramework}/node_modules/@fluidframework/build-tools/dist/fluidBuild/fluidBuild.js",
10+
"--root",
11+
"${workspaceRoot:FluidFramework}",
12+
"--vscode",
13+
"-t",
14+
"build:test",
15+
"${fileDirname}",
16+
],
17+
"group": "build",
18+
"problemMatcher": [
19+
{
20+
"base": "$tsc",
21+
"fileLocation": "absolute",
22+
},
23+
"$tslint5",
24+
],
25+
},
26+
],
27+
}

packages/test/test-end-to-end-tests/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,11 @@ That same [directory](src/test) contains more complex examples too.
117117

118118
## Debugging
119119

120-
In order to debug legacy code running as part of an end-to-end test, you'll need to modify the debug launch configuration to include `node_modules` in its set of loaded files.
120+
This package contains a VSCode workspace with launch targets for debugging e2e tests with common configurations.
121+
The launch targets in this configuration allow selecting different drivers, compat modes, and setting breakpoints in dependent packages installed for compat testing.
122+
See `.vscode/e2e-tests.code-workspace` for details.
123+
124+
If not using this workspace, in order to debug legacy code running as part of an end-to-end test, you'll need to modify the debug launch configuration to include `node_modules` in its set of loaded files.
121125

122126
For example, if using "Debug Current Mocha Test" or one of its variants, remove the `node_modules` entry under `"skipFiles"`.
123127

0 commit comments

Comments
 (0)