GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — app-vscode/scripts/test-integration.sh at main · code/app-vscode

Expand file tree

/

test-integration.sh

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
executable file
·
358 lines (312 loc) · 10.3 KB
/

test-integration.sh

Copy path

File metadata and controls

executable file
·
358 lines (312 loc) · 10.3 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#!/usr/bin/env bash
set -e
if [[ "$OSTYPE" == "darwin"* ]]; then
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
ROOT=$(dirname $(dirname $(realpath "$0")))
else
ROOT=$(dirname $(dirname $(readlink -f $0)))
fi
cd "$ROOT"
# Parse arguments
EXTRA_ARGS=()
BUILD_ARGS=()
RUN_FILE=""
RUN_GLOB=""
GREP_PATTERN=""
SUITE_FILTER=""
HELP=false
AGENT_HOST_E2E_GLOB="**/agentHost/test/node/e2e/{providers/*AgentHostE2E,conformance/*}.integrationTest.js"
while [[ $# -gt 0 ]]; do
case "$1" in
--help|-h)
HELP=true
shift
;;
--build)
BUILD_ARGS=(--build)
EXTRA_ARGS+=("$1")
shift
;;
--run)
RUN_FILE="$2"
EXTRA_ARGS+=("$1" "$2")
shift 2
;;
--grep|-g|-f)
GREP_PATTERN="$2"
EXTRA_ARGS+=("$1" "$2")
shift 2
;;
--runGlob|--glob|--runGrep)
RUN_GLOB="$2"
EXTRA_ARGS+=("$1" "$2")
shift 2
;;
--suite)
SUITE_FILTER="$2"
shift 2
;;
*)
EXTRA_ARGS+=("$1")
shift
;;
esac
done
# Known suite names (used for help text and validation)
KNOWN_SUITES="api-folder api-workspace colorize terminal-suggest typescript markdown emmet git git-base ipynb notebook-renderers configuration-editing github-authentication copilot css html json"
if $HELP; then
echo "Usage: $0 [options]"
echo ""
echo "Runs integration tests. When no filters are given, all integration tests"
echo "(node.js integration tests + extension host tests) are run."
echo "Agent Host E2E entrypoints run in parallel before the remaining node.js tests."
echo ""
echo "--run and --runGlob select which node.js integration test files to load."
echo "Extension host tests are skipped when these options are used."
echo ""
echo "--grep filters test cases by name across all test runners. When used alone,"
echo "the pattern is applied to both node.js integration tests and all extension"
echo "host suites. When combined with --suite, only the selected suites are run."
echo ""
echo "--suite selects which extension host test suites to run."
echo "Node.js integration tests are skipped when this option is used."
echo ""
echo "Options:"
echo " --build use the out-build directory for node.js and JSON tests"
echo " --run <file> run tests from a specific file (src/ path)"
echo " --runGlob, --glob <pattern> select test files by path glob (e.g. '**/editor/**/*.integrationTest.js')"
echo " --grep, -g, -f <pattern> filter test cases by name (matched against test titles)"
echo " --suite <pattern> run only matching extension host test suites"
echo " supports comma-separated list and glob patterns"
echo " --help, -h show this help"
echo ""
echo "Available suites: $KNOWN_SUITES"
echo ""
echo "All other options are forwarded to the node.js test runner (see scripts/test.sh --help)."
echo "Note: extra options are not forwarded to extension host suites (--suite mode)."
echo ""
echo "Examples:"
echo " $0 # run all integration tests"
echo " $0 --run src/vs/editor/test/browser/controller.integrationTest.ts"
echo " $0 --grep 'some test name'"
echo " $0 --runGlob '**/editor/**/*.integrationTest.js'"
echo " $0 --suite git # run only Git tests"
echo " $0 --suite 'api*' # run API folder + workspace tests"
echo " $0 --suite 'git,emmet,typescript' # run multiple suites"
echo " $0 --suite api-folder --grep 'some test' # grep within a suite"
exit 0
fi
HAS_FILTER=false
if [[ -n "$RUN_FILE" || -n "$RUN_GLOB" ]]; then
HAS_FILTER=true
fi
# Check whether a given suite name matches the --suite filter.
# Supports comma-separated patterns with shell globbing (e.g. "git*,api*").
should_run_suite() {
if [[ -z "$SUITE_FILTER" ]]; then
return 0
fi
IFS=',' read -ra PATTERNS <<< "$SUITE_FILTER"
for pattern in "${PATTERNS[@]}"; do
pattern="${pattern## }" # trim leading spaces
pattern="${pattern%% }" # trim trailing spaces
if [[ "$1" == $pattern ]]; then
return 0
fi
done
return 1
}
VSCODEUSERDATADIR=`mktemp -d 2>/dev/null`
VSCODECRASHDIR=$ROOT/.build/crashes
VSCODELOGSDIR=$ROOT/.build/logs/integration-tests
# Seed user settings to disable OS notifications (dock bounce, toast, etc.)
mkdir -p "$VSCODEUSERDATADIR/User"
cat > "$VSCODEUSERDATADIR/User/settings.json" <<EOF
{
"chat.notifyWindowOnConfirmation": "off",
"chat.notifyWindowOnResponseReceived": "off"
}
EOF
# Figure out which Electron to use for running tests
if [ -z "$INTEGRATION_TEST_ELECTRON_PATH" ]
then
INTEGRATION_TEST_ELECTRON_PATH="./scripts/code.sh"
echo "Running integration tests out of sources."
else
export VSCODE_CLI=1
export ELECTRON_ENABLE_LOGGING=1
echo "Running integration tests with '$INTEGRATION_TEST_ELECTRON_PATH' as build."
fi
echo "Storing crash reports into '$VSCODECRASHDIR'."
echo "Storing log files into '$VSCODELOGSDIR'."
# Validate --suite filter matches at least one known suite
if [[ -n "$SUITE_FILTER" ]]; then
SUITE_MATCHED=false
for suite in $KNOWN_SUITES; do
if should_run_suite "$suite"; then
SUITE_MATCHED=true
break
fi
done
if [[ "$SUITE_MATCHED" == "false" ]]; then
echo "Error: no suites match filter '$SUITE_FILTER'"
echo "Available suites: $KNOWN_SUITES"
rm -rf -- "$VSCODEUSERDATADIR"
exit 1
fi
fi
# Unit tests
if [[ -z "$SUITE_FILTER" ]]; then
echo
echo "### node.js integration tests"
echo
if [[ -z "$RUN_GLOB" && -z "$RUN_FILE" ]]; then
if [[ "$VSCODE_SKIP_AGENT_HOST_E2E" == "1" ]]; then
echo "Skipping Agent Host E2E tests because no relevant files changed."
else
node ./scripts/test-agent-host-e2e.ts "${EXTRA_ARGS[@]}"
fi
VSCODE_SKIP_PRELAUNCH=1 ./scripts/test.sh --runGlob "**/*.integrationTest.js" --excludeRunGlob "$AGENT_HOST_E2E_GLOB" "${EXTRA_ARGS[@]}"
else
./scripts/test.sh "${EXTRA_ARGS[@]}"
fi
fi
# Skip extension host tests when a non-suite filter is active
if [[ -z "$SUITE_FILTER" ]] && $HAS_FILTER; then
echo ""
echo "Filter active, skipping extension host tests."
rm -rf -- "$VSCODEUSERDATADIR"
exit 0
fi
# Tests in the extension host
# Forward grep pattern to extension test runners
GREP_ARGS=()
if [[ -n "$GREP_PATTERN" ]]; then
export MOCHA_GREP="$GREP_PATTERN"
GREP_ARGS=(--grep "$GREP_PATTERN")
fi
API_TESTS_EXTRA_ARGS="--disable-telemetry --disable-experiments --skip-welcome --skip-release-notes --crash-reporter-directory=$VSCODECRASHDIR --logsPath=$VSCODELOGSDIR --no-cached-data --disable-updates --use-inmemory-secretstorage --disable-extensions --disable-workspace-trust --user-data-dir=$VSCODEUSERDATADIR"
if [ -z "$INTEGRATION_TEST_APP_NAME" ]; then
kill_app() { true; }
else
kill_app() { killall $INTEGRATION_TEST_APP_NAME || true; }
fi
if should_run_suite api-folder; then
echo
echo "### API tests (folder)"
echo
"$INTEGRATION_TEST_ELECTRON_PATH" $ROOT/extensions/vscode-api-tests/testWorkspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/singlefolder-tests $API_TESTS_EXTRA_ARGS
kill_app
fi
if should_run_suite api-workspace; then
echo
echo "### API tests (workspace)"
echo
"$INTEGRATION_TEST_ELECTRON_PATH" $ROOT/extensions/vscode-api-tests/testworkspace.code-workspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/workspace-tests $API_TESTS_EXTRA_ARGS
kill_app
fi
if should_run_suite colorize; then
echo
echo "### Colorize tests"
echo
npm run test-extension -- -l vscode-colorize-tests "${GREP_ARGS[@]}"
kill_app
fi
if should_run_suite terminal-suggest; then
echo
echo "### Terminal Suggest tests"
echo
npm run test-extension -- -l terminal-suggest --enable-proposed-api=vscode.vscode-api-tests "${GREP_ARGS[@]}"
kill_app
fi
if should_run_suite typescript; then
echo
echo "### TypeScript tests"
echo
"$INTEGRATION_TEST_ELECTRON_PATH" $ROOT/extensions/typescript-language-features/test-workspace --extensionDevelopmentPath=$ROOT/extensions/typescript-language-features --extensionTestsPath=$ROOT/extensions/typescript-language-features/out/test/unit $API_TESTS_EXTRA_ARGS
kill_app
fi
if should_run_suite markdown; then
echo
echo "### Markdown tests"
echo
npm run test-extension -- -l markdown-language-features "${GREP_ARGS[@]}"
kill_app
fi
if should_run_suite emmet; then
echo
echo "### Emmet tests"
echo
"$INTEGRATION_TEST_ELECTRON_PATH" $ROOT/extensions/emmet/test-workspace --extensionDevelopmentPath=$ROOT/extensions/emmet --extensionTestsPath=$ROOT/extensions/emmet/out/test $API_TESTS_EXTRA_ARGS
kill_app
fi
if should_run_suite git; then
echo
echo "### Git tests"
echo
"$INTEGRATION_TEST_ELECTRON_PATH" $(mktemp -d 2>/dev/null) --extensionDevelopmentPath=$ROOT/extensions/git --extensionTestsPath=$ROOT/extensions/git/out/test $API_TESTS_EXTRA_ARGS
kill_app
fi
if should_run_suite git-base; then
echo
echo "### Git Base tests"
echo
npm run test-extension -- -l git-base "${GREP_ARGS[@]}"
kill_app
fi
if should_run_suite ipynb; then
echo
echo "### Ipynb tests"
echo
npm run test-extension -- -l ipynb "${GREP_ARGS[@]}"
kill_app
fi
if should_run_suite notebook-renderers; then
echo
echo "### Notebook Output tests"
echo
npm run test-extension -- -l notebook-renderers "${GREP_ARGS[@]}"
kill_app
fi
if should_run_suite configuration-editing; then
echo
echo "### Configuration editing tests"
echo
npm run test-extension -- -l configuration-editing "${GREP_ARGS[@]}"
kill_app
fi
if should_run_suite github-authentication; then
echo
echo "### GitHub Authentication tests"
echo
npm run test-extension -- -l github-authentication "${GREP_ARGS[@]}"
kill_app
fi
if should_run_suite copilot; then
echo
echo "### Copilot tests"
echo
npm run test-extension -- -l copilot "${GREP_ARGS[@]}"
kill_app
fi
# Tests standalone (CommonJS)
if should_run_suite css; then
echo
echo "### CSS tests"
echo
cd "$ROOT/extensions/css-language-features/server" && "$ROOT/scripts/node-electron.sh" test/index.js
fi
if should_run_suite html; then
echo
echo "### HTML tests"
echo
cd "$ROOT/extensions/html-language-features/server" && "$ROOT/scripts/node-electron.sh" test/index.js
fi
if should_run_suite json; then
echo
echo "### JSON tests"
echo
"$ROOT/scripts/node-electron.sh" "$ROOT/extensions/json-language-features/client/out/test/index.js" "${BUILD_ARGS[@]}"
fi
# Cleanup
rm -rf -- "$VSCODEUSERDATADIR"
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.