diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/code-server.bat | 2 | ||||
-rw-r--r-- | scripts/code-server.js | 87 | ||||
-rwxr-xr-x | scripts/code-server.sh | 2 | ||||
-rw-r--r-- | scripts/code-web.bat | 2 | ||||
-rw-r--r-- | scripts/code-web.js | 130 | ||||
-rwxr-xr-x | scripts/code-web.sh | 2 | ||||
-rw-r--r-- | scripts/test-remote-integration.bat | 80 | ||||
-rwxr-xr-x | scripts/test-remote-integration.sh | 115 | ||||
-rw-r--r-- | scripts/test-web-integration.bat | 55 | ||||
-rwxr-xr-x | scripts/test-web-integration.sh | 36 |
10 files changed, 507 insertions, 4 deletions
diff --git a/scripts/code-server.bat b/scripts/code-server.bat index 6c3bf915366..549f69aeddd 100644 --- a/scripts/code-server.bat +++ b/scripts/code-server.bat @@ -17,7 +17,7 @@ call yarn gulp node :: Launch Server FOR /F "tokens=*" %%g IN ('node build/lib/node.js') do (SET NODE=%%g) -call "%NODE%" resources\server\bin-dev\code-server.js %* +call "%NODE%" scripts\code-server.js %* popd diff --git a/scripts/code-server.js b/scripts/code-server.js new file mode 100644 index 00000000000..363c3dd6388 --- /dev/null +++ b/scripts/code-server.js @@ -0,0 +1,87 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// @ts-check + +const cp = require('child_process'); +const path = require('path'); +const os = require('os'); +const opn = require('opn'); +const crypto = require('crypto'); +const minimist = require('minimist'); + +const args = minimist(process.argv.slice(2), { + boolean: [ + 'help', + 'launch' + ], + string: [ + 'host', + 'port', + 'driver', + 'connection-token', + 'server-data-dir' + ], +}); + +if (args.help) { + console.log( + './scripts/code-server.sh|bat [options]\n' + + ' --launch Opens a browser' + ); +} + +const serverArgs = process.argv.slice(2).filter(v => v !== '--launch'); + +const HOST = args['host'] ?? 'localhost'; +const PORT = args['port'] ?? '9888'; +const TOKEN = args['connection-token'] ?? String(crypto.randomInt(0xffffffff)); + +if (args['launch'] && args['connection-token'] === undefined && args['connection-token-file'] === undefined && !args['no-connection-token']) { + serverArgs.push('--connection-token', TOKEN); +} +if (args['host'] === undefined) { + serverArgs.push('--host', HOST); +} +if (args['port'] === undefined) { + serverArgs.push('--port', PORT); +} + +const env = { ...process.env }; + +const entryPoint = path.join(__dirname, '..', 'out', 'server-main.js'); +startServer(); + +function startServer() { + console.log(`Starting server: ${entryPoint} ${serverArgs.join(' ')}`); + const proc = cp.spawn(process.execPath, [entryPoint, ...serverArgs], { env }); + + proc.stdout.on('data', data => { + // Log everything + console.log(data.toString()); + }); + + // Log errors + proc.stderr.on('data', data => { + console.error(data.toString()); + }); + + proc.on('exit', (code) => process.exit(code)); + + process.on('exit', () => proc.kill()); + process.on('SIGINT', () => { + proc.kill(); + process.exit(128 + 2); // https://nodejs.org/docs/v14.16.0/api/process.html#process_signal_events + }); + process.on('SIGTERM', () => { + proc.kill(); + process.exit(128 + 15); // https://nodejs.org/docs/v14.16.0/api/process.html#process_signal_events + }); + +} + +if (args['launch']) { + opn(`http://${HOST}:${PORT}/?tkn=${TOKEN}`); +} diff --git a/scripts/code-server.sh b/scripts/code-server.sh index b1c266ec2e4..e932e106b38 100755 --- a/scripts/code-server.sh +++ b/scripts/code-server.sh @@ -20,7 +20,7 @@ function code() { NODE_ENV=development \ VSCODE_DEV=1 \ - $NODE ./resources/server/bin-dev/code-server.js "$@" + $NODE ./scripts/code-server.js "$@" } code "$@" diff --git a/scripts/code-web.bat b/scripts/code-web.bat index 5ad704aea78..5775eccf3a1 100644 --- a/scripts/code-web.bat +++ b/scripts/code-web.bat @@ -13,7 +13,7 @@ call yarn gulp node :: Launch Server FOR /F "tokens=*" %%g IN ('node build/lib/node.js') do (SET NODE=%%g) -call "%NODE%" resources\web\bin-dev\code-web-playground.js %* +call "%NODE%" scripts\code-web.js %* popd diff --git a/scripts/code-web.js b/scripts/code-web.js new file mode 100644 index 00000000000..345d3538f39 --- /dev/null +++ b/scripts/code-web.js @@ -0,0 +1,130 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// @ts-check + +const testWeb = require('@vscode/test-web'); + +const fs = require('fs'); +const path = require('path'); + +const minimist = require('minimist'); +const fancyLog = require('fancy-log'); +const ansiColors = require('ansi-colors'); +const remote = require('gulp-remote-retry-src'); +const vfs = require('vinyl-fs'); +const opn = require('opn'); + +const APP_ROOT = path.join(__dirname, '..'); +const WEB_DEV_EXTENSIONS_ROOT = path.join(APP_ROOT, '.build', 'builtInWebDevExtensions'); + +const WEB_PLAYGROUND_VERSION = '0.0.13'; + +const args = minimist(process.argv.slice(2), { + boolean: [ + 'help', + 'verbose', + 'open-devtools' + ], + string: [ + 'host', + 'port', + 'extension', + 'browserType' + ], +}); + +if (args.help) { + console.log( + './scripts/code-web.sh|bat [options]\n' + + ' --host Server host address\n' + + ' --port Server port\n' + + ' --browserType The browser type to launch: `chromium` (default), `firefox`, `webkit` or `none`' + + ' --extension Path of an extension to include\n' + + ' --open-devtools Open the dev tools' + + ' --verbose Print out more information\n' + + ' --help\n' + + '[Example]\n' + + ' ./scripts/code-web.sh|bat --port 8080' + ); + process.exit(0); +} + +openTestWeb(); + + +async function openTestWeb() { + await ensureWebDevExtensions(); + const extensionPaths = [WEB_DEV_EXTENSIONS_ROOT]; + const extensions = args['extension']; + if (Array.isArray(extensions)) { + extensionPaths.push(...extensions); + } else if (extensions) { + extensionPaths.push(extensions); + } + const host = args.host || 'localhost'; + const port = args.port || 8080; + + await testWeb.open({ + browserType: args['browserType'] ?? 'none', + host, + port, + folderUri: 'memfs:///sample-folder', + vsCodeDevPath: APP_ROOT, + extensionPaths, + devTools: !!args['open-devtools'], + hideServerLog: !args['verbose'], + verbose: !!args['verbose'] + }); + + + if (!args['browserType']) { + opn(`http://${host}:${port}/`); + } +} + +async function directoryExists(path) { + try { + return (await fs.promises.stat(path)).isDirectory(); + } catch { + return false; + } +} + +async function ensureWebDevExtensions() { + + // Playground (https://github.com/microsoft/vscode-web-playground) + const webDevPlaygroundRoot = path.join(WEB_DEV_EXTENSIONS_ROOT, 'vscode-web-playground'); + const webDevPlaygroundExists = await directoryExists(webDevPlaygroundRoot); + + let downloadPlayground = false; + if (webDevPlaygroundExists) { + try { + const webDevPlaygroundPackageJson = JSON.parse(((await fs.promises.readFile(path.join(webDevPlaygroundRoot, 'package.json'))).toString())); + if (webDevPlaygroundPackageJson.version !== WEB_PLAYGROUND_VERSION) { + downloadPlayground = true; + } + } catch (error) { + downloadPlayground = true; + } + } else { + downloadPlayground = true; + } + + if (downloadPlayground) { + if (args.verbose) { + fancyLog(`${ansiColors.magenta('Web Development extensions')}: Downloading vscode-web-playground to ${webDevPlaygroundRoot}`); + } + await new Promise((resolve, reject) => { + remote(['package.json', 'dist/extension.js', 'dist/extension.js.map'], { + base: 'https://raw.githubusercontent.com/microsoft/vscode-web-playground/main/' + }).pipe(vfs.dest(webDevPlaygroundRoot)).on('end', resolve).on('error', reject); + }); + } else { + if (args.verbose) { + fancyLog(`${ansiColors.magenta('Web Development extensions')}: Using existing vscode-web-playground in ${webDevPlaygroundRoot}`); + } + } +} diff --git a/scripts/code-web.sh b/scripts/code-web.sh index dd32d01117e..fe468f37fb7 100755 --- a/scripts/code-web.sh +++ b/scripts/code-web.sh @@ -18,7 +18,7 @@ function code() { NODE=$(node build/lib/node.js) - $NODE ./resources/web/bin-dev/code-web-playground.js "$@" + $NODE ./scripts/code-web.js "$@" } code "$@" diff --git a/scripts/test-remote-integration.bat b/scripts/test-remote-integration.bat new file mode 100644 index 00000000000..f67c213048a --- /dev/null +++ b/scripts/test-remote-integration.bat @@ -0,0 +1,80 @@ +@echo off +setlocal + +pushd %~dp0\.. + +IF "%~1" == "" ( + set AUTHORITY=vscode-remote://test+test/ + :: backward to forward slashed + set EXT_PATH=%CD:\=/%/extensions + + :: Download nodejs executable for remote + call yarn gulp node +) else ( + set AUTHORITY=%1 + set EXT_PATH=%2 + set VSCODEUSERDATADIR=%3 +) +IF "%VSCODEUSERDATADIR%" == "" ( + set VSCODEUSERDATADIR=%TMP%\vscodeuserfolder-%RANDOM%-%TIME:~6,5% +) + +set REMOTE_VSCODE=%AUTHORITY%%EXT_PATH% +set VSCODECRASHDIR=%~dp0\..\.build\crashes +set VSCODELOGSDIR=%~dp0\..\.build\logs\integration-tests-remote +set TESTRESOLVER_DATA_FOLDER=%TMP%\testresolverdatafolder-%RANDOM%-%TIME:~6,5% +set TESTRESOLVER_LOGS_FOLDER=%VSCODELOGSDIR%\server + +if "%VSCODE_REMOTE_SERVER_PATH%"=="" ( + echo "Using remote server out of sources for integration tests" +) else ( + set TESTRESOLVER_INSTALL_BUILTIN_EXTENSION=ms-vscode.vscode-smoketest-check + echo "Using %VSCODE_REMOTE_SERVER_PATH% as server path" +) + +set API_TESTS_EXTRA_ARGS=--disable-telemetry --skip-welcome --skip-release-notes --crash-reporter-directory=%VSCODECRASHDIR% --logsPath=%VSCODELOGSDIR% --no-cached-data --disable-updates --disable-keytar --disable-inspect --disable-workspace-trust --user-data-dir=%VSCODEUSERDATADIR% + +:: Figure out which Electron to use for running tests +if "%INTEGRATION_TEST_ELECTRON_PATH%"=="" ( + echo "Storing crash reports into '%VSCODECRASHDIR%'." + echo "Storing log files into '%VSCODELOGSDIR%'." + + :: Tests in the extension host running from sources + call .\scripts\code.bat --folder-uri=%REMOTE_VSCODE%/vscode-api-tests/testWorkspace --extensionDevelopmentPath=%REMOTE_VSCODE%/vscode-api-tests --extensionTestsPath=%REMOTE_VSCODE%/vscode-api-tests/out/singlefolder-tests %API_TESTS_EXTRA_ARGS% + if %errorlevel% neq 0 exit /b %errorlevel% + + call .\scripts\code.bat --file-uri=%REMOTE_VSCODE%/vscode-api-tests/testworkspace.code-workspace --extensionDevelopmentPath=%REMOTE_VSCODE%/vscode-api-tests --extensionTestsPath=%REMOTE_VSCODE%/vscode-api-tests/out/workspace-tests %API_TESTS_EXTRA_ARGS% + if %errorlevel% neq 0 exit /b %errorlevel% +) else ( + echo "Storing crash reports into '%VSCODECRASHDIR%'." + echo "Storing log files into '%VSCODELOGSDIR%'." + echo "Using %INTEGRATION_TEST_ELECTRON_PATH% as Electron path" + + :: Run from a built: need to compile all test extensions + :: because we run extension tests from their source folders + :: and the build bundles extensions into .build webpacked + call yarn gulp compile-extension:vscode-api-tests^ + compile-extension:vscode-test-resolver + + :: Configuration for more verbose output + set VSCODE_CLI=1 + set ELECTRON_ENABLE_LOGGING=1 + set ELECTRON_ENABLE_STACK_DUMPING=1 + + :: Tests in the extension host running from built version (both client and server) + call "%INTEGRATION_TEST_ELECTRON_PATH%" --folder-uri=%REMOTE_VSCODE%/vscode-api-tests/testWorkspace --extensionDevelopmentPath=%REMOTE_VSCODE%/vscode-api-tests --extensionTestsPath=%REMOTE_VSCODE%/vscode-api-tests/out/singlefolder-tests %API_TESTS_EXTRA_ARGS% --extensions-dir=%EXT_PATH% --enable-proposed-api=vscode.vscode-test-resolver --enable-proposed-api=vscode.vscode-api-tests --enable-proposed-api=vscode.image-preview + if %errorlevel% neq 0 exit /b %errorlevel% + + call "%INTEGRATION_TEST_ELECTRON_PATH%" --file-uri=%REMOTE_VSCODE%/vscode-api-tests/testworkspace.code-workspace --extensionDevelopmentPath=%REMOTE_VSCODE%/vscode-api-tests --extensionTestsPath=%REMOTE_VSCODE%/vscode-api-tests/out/workspace-tests %API_TESTS_EXTRA_ARGS% --extensions-dir=%EXT_PATH% --enable-proposed-api=vscode.vscode-test-resolver --enable-proposed-api=vscode.vscode-api-tests --enable-proposed-api=vscode.image-preview + if %errorlevel% neq 0 exit /b %errorlevel% +) + +IF "%3" == "" ( + rmdir /s /q %VSCODEUSERDATADIR% +) + +rmdir /s /q %TESTRESOLVER_DATA_FOLDER% + +popd + +endlocal diff --git a/scripts/test-remote-integration.sh b/scripts/test-remote-integration.sh new file mode 100755 index 00000000000..066e136aa2c --- /dev/null +++ b/scripts/test-remote-integration.sh @@ -0,0 +1,115 @@ +#!/bin/bash +set -e + +if [[ "$OSTYPE" == "darwin"* ]]; then + realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; } + ROOT=$(dirname $(dirname $(realpath "$0"))) + VSCODEUSERDATADIR=`mktemp -d -t 'myuserdatadir'` + TESTRESOLVER_DATA_FOLDER=`mktemp -d -t 'testresolverdatafolder'` +else + ROOT=$(dirname $(dirname $(readlink -f $0))) + VSCODEUSERDATADIR=`mktemp -d 2>/dev/null` + TESTRESOLVER_DATA_FOLDER=`mktemp -d 2>/dev/null` + # --disable-dev-shm-usage --use-gl=swiftshader: when run on docker containers where size of /dev/shm + # partition < 64MB which causes OOM failure for chromium compositor that uses the partition for shared memory + LINUX_EXTRA_ARGS="--disable-dev-shm-usage --use-gl=swiftshader" +fi + +cd $ROOT +if [[ "$1" == "" ]]; then + AUTHORITY=vscode-remote://test+test + EXT_PATH=$ROOT/extensions + # Load remote node + yarn gulp node +else + AUTHORITY=$1 + EXT_PATH=$2 + VSCODEUSERDATADIR=${3:-$VSCODEUSERDATADIR} +fi + +export REMOTE_VSCODE=$AUTHORITY$EXT_PATH +VSCODECRASHDIR=$ROOT/.build/crashes +VSCODELOGSDIR=$ROOT/.build/logs/integration-tests-remote + +# Figure out which Electron to use for running tests +if [ -z "$INTEGRATION_TEST_ELECTRON_PATH" ] +then + echo "Storing crash reports into '$VSCODECRASHDIR'." + echo "Storing log files into '$VSCODELOGSDIR'." + + # code.sh makes sure Test Extensions are compiled + INTEGRATION_TEST_ELECTRON_PATH="./scripts/code.sh" + + # No extra arguments when running out of sources + EXTRA_INTEGRATION_TEST_ARGUMENTS="" +else + echo "Storing crash reports into '$VSCODECRASHDIR'." + echo "Storing log files into '$VSCODELOGSDIR'." + echo "Using $INTEGRATION_TEST_ELECTRON_PATH as Electron path for integration tests" + + # Run from a built: need to compile all test extensions + # because we run extension tests from their source folders + # and the build bundles extensions into .build webpacked + yarn gulp compile-extension:vscode-api-tests \ + compile-extension:vscode-test-resolver \ + compile-extension:markdown-language-features \ + compile-extension:typescript-language-features \ + compile-extension:emmet \ + compile-extension:git \ + compile-extension-media + + # Configuration for more verbose output + export VSCODE_CLI=1 + export ELECTRON_ENABLE_STACK_DUMPING=1 + export ELECTRON_ENABLE_LOGGING=1 + + # Running from a build, we need to enable the vscode-test-resolver extension + EXTRA_INTEGRATION_TEST_ARGUMENTS="--extensions-dir=$EXT_PATH --enable-proposed-api=vscode.vscode-test-resolver --enable-proposed-api=vscode.vscode-api-tests --enable-proposed-api=vscode.image-preview --enable-proposed-api=vscode.git" +fi + +if [ -z "$INTEGRATION_TEST_APP_NAME" ]; then + after_suite() { true; } +else + after_suite() { killall $INTEGRATION_TEST_APP_NAME || true; } +fi + +export TESTRESOLVER_DATA_FOLDER=$TESTRESOLVER_DATA_FOLDER +export TESTRESOLVER_LOGS_FOLDER=$VSCODELOGSDIR/server + +# Figure out which remote server to use for running tests +if [ -z "$VSCODE_REMOTE_SERVER_PATH" ] +then + echo "Using remote server out of sources for integration tests" +else + echo "Using $VSCODE_REMOTE_SERVER_PATH as server path for integration tests" + export TESTRESOLVER_INSTALL_BUILTIN_EXTENSION='ms-vscode.vscode-smoketest-check' +fi + +# Tests in the extension host + +API_TESTS_DEFAULT_EXTRA_ARGS="--disable-telemetry --skip-welcome --skip-release-notes --crash-reporter-directory=$VSCODECRASHDIR --logsPath=$VSCODELOGSDIR --no-cached-data --disable-updates --disable-keytar --disable-inspect --disable-workspace-trust --user-data-dir=$VSCODEUSERDATADIR" + +"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS --folder-uri=$REMOTE_VSCODE/vscode-api-tests/testWorkspace --extensionDevelopmentPath=$REMOTE_VSCODE/vscode-api-tests --extensionTestsPath=$REMOTE_VSCODE/vscode-api-tests/out/singlefolder-tests $API_TESTS_DEFAULT_EXTRA_ARGS $EXTRA_INTEGRATION_TEST_ARGUMENTS +after_suite + +"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS --file-uri=$REMOTE_VSCODE/vscode-api-tests/testworkspace.code-workspace --extensionDevelopmentPath=$REMOTE_VSCODE/vscode-api-tests --extensionTestsPath=$REMOTE_VSCODE/vscode-api-tests/out/workspace-tests $API_TESTS_DEFAULT_EXTRA_ARGS $EXTRA_INTEGRATION_TEST_ARGUMENTS +after_suite + +"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS --folder-uri=$REMOTE_VSCODE/typescript-language-features/test-workspace --enable-proposed-api=vscode.typescript-language-features --extensionDevelopmentPath=$REMOTE_VSCODE/typescript-language-features --extensionTestsPath=$REMOTE_VSCODE/typescript-language-features/out/test/unit $API_TESTS_DEFAULT_EXTRA_ARGS $EXTRA_INTEGRATION_TEST_ARGUMENTS +after_suite + +"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS --folder-uri=$REMOTE_VSCODE/markdown-language-features/test-workspace --extensionDevelopmentPath=$REMOTE_VSCODE/markdown-language-features --extensionTestsPath=$REMOTE_VSCODE/markdown-language-features/out/test $API_TESTS_DEFAULT_EXTRA_ARGS $EXTRA_INTEGRATION_TEST_ARGUMENTS +after_suite + +"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS --folder-uri=$REMOTE_VSCODE/emmet/test-workspace --extensionDevelopmentPath=$REMOTE_VSCODE/emmet --extensionTestsPath=$REMOTE_VSCODE/emmet/out/test $API_TESTS_DEFAULT_EXTRA_ARGS $EXTRA_INTEGRATION_TEST_ARGUMENTS +after_suite + +"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS --folder-uri=$AUTHORITY$(mktemp -d 2>/dev/null) --extensionDevelopmentPath=$REMOTE_VSCODE/git --extensionTestsPath=$REMOTE_VSCODE/git/out/test $API_TESTS_DEFAULT_EXTRA_ARGS $EXTRA_INTEGRATION_TEST_ARGUMENTS +after_suite + +# Clean up +if [[ "$3" == "" ]]; then + rm -rf $VSCODEUSERDATADIR +fi + +rm -rf $TESTRESOLVER_DATA_FOLDER diff --git a/scripts/test-web-integration.bat b/scripts/test-web-integration.bat new file mode 100644 index 00000000000..68c6a84eba2 --- /dev/null +++ b/scripts/test-web-integration.bat @@ -0,0 +1,55 @@ +@echo off +setlocal + +pushd %~dp0\.. + +IF "%~1" == "" ( + set AUTHORITY=vscode-remote://test+test/ + :: backward to forward slashed + set EXT_PATH=%CD:\=/%/extensions + + :: Download nodejs executable for remote + call yarn gulp node +) else ( + set AUTHORITY=%1 + set EXT_PATH=%2 +) + +set REMOTE_VSCODE=%AUTHORITY%%EXT_PATH% + +if "%VSCODE_REMOTE_SERVER_PATH%"=="" ( + echo "Using remote server out of sources for integration web tests" +) else ( + echo "Using %VSCODE_REMOTE_SERVER_PATH% as server path for web integration tests" + + :: Run from a built: need to compile all test extensions + :: because we run extension tests from their source folders + :: and the build bundles extensions into .build webpacked + call yarn gulp compile-extension:vscode-api-tests^ + compile-extension:markdown-language-features^ + compile-extension:typescript-language-features^ + compile-extension:emmet^ + compile-extension:git^ + compile-extension-media +) + +call node .\test\integration\browser\out\index.js --workspacePath=.\extensions\vscode-api-tests\testWorkspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=.\extensions\vscode-api-tests --extensionTestsPath=.\extensions\vscode-api-tests\out\singlefolder-tests %* +if %errorlevel% neq 0 exit /b %errorlevel% + +call node .\test\integration\browser\out\index.js --workspacePath=.\extensions\vscode-api-tests\testworkspace.code-workspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=.\extensions\vscode-api-tests --extensionTestsPath=.\extensions\vscode-api-tests\out\workspace-tests %* +if %errorlevel% neq 0 exit /b %errorlevel% + +call node .\test\integration\browser\out\index.js --workspacePath=.\extensions\typescript-language-features\test-workspace --extensionDevelopmentPath=.\extensions\typescript-language-features --extensionTestsPath=.\extensions\typescript-language-features\out\test\unit %* +if %errorlevel% neq 0 exit /b %errorlevel% + +call node .\test\integration\browser\out\index.js --workspacePath=.\extensions\markdown-language-features\test-workspace --extensionDevelopmentPath=.\extensions\markdown-language-features --extensionTestsPath=.\extensions\markdown-language-features\out\test %* +if %errorlevel% neq 0 exit /b %errorlevel% + +call node .\test\integration\browser\out\index.js --workspacePath=.\extensions\emmet\test-workspace --extensionDevelopmentPath=.\extensions\emmet --extensionTestsPath=.\extensions\emmet\out\test %* +if %errorlevel% neq 0 exit /b %errorlevel% + +for /f "delims=" %%i in ('node -p "require('fs').realpathSync.native(require('os').tmpdir())"') do set TEMPDIR=%%i +set GITWORKSPACE=%TEMPDIR%\git-%RANDOM% +mkdir %GITWORKSPACE% +call node .\test\integration\browser\out\index.js --workspacePath=%GITWORKSPACE% --extensionDevelopmentPath=.\extensions\git --extensionTestsPath=.\extensions\git\out\test --enable-proposed-api=vscode.git %* +if %errorlevel% neq 0 exit /b %errorlevel% diff --git a/scripts/test-web-integration.sh b/scripts/test-web-integration.sh new file mode 100755 index 00000000000..3c96fafe751 --- /dev/null +++ b/scripts/test-web-integration.sh @@ -0,0 +1,36 @@ +#!/bin/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 + +if [ -z "$VSCODE_REMOTE_SERVER_PATH" ] +then + echo "Using remote server out of sources for integration web tests" +else + echo "Using $VSCODE_REMOTE_SERVER_PATH as server path for web integration tests" + + # Run from a built: need to compile all test extensions + # because we run extension tests from their source folders + # and the build bundles extensions into .build webpacked + yarn gulp compile-extension:vscode-api-tests \ + compile-extension:markdown-language-features \ + compile-extension:typescript-language-features \ + compile-extension:emmet \ + compile-extension:git \ + compile-extension-media +fi + +# Tests in the extension host +node test/integration/browser/out/index.js --workspacePath $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 "$@" +node test/integration/browser/out/index.js --workspacePath $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 "$@" +node test/integration/browser/out/index.js --workspacePath $ROOT/extensions/typescript-language-features/test-workspace --extensionDevelopmentPath=$ROOT/extensions/typescript-language-features --extensionTestsPath=$ROOT/extensions/typescript-language-features/out/test/unit "$@" +node test/integration/browser/out/index.js --workspacePath $ROOT/extensions/markdown-language-features/test-workspace --extensionDevelopmentPath=$ROOT/extensions/markdown-language-features --extensionTestsPath=$ROOT/extensions/markdown-language-features/out/test "$@" +node test/integration/browser/out/index.js --workspacePath $ROOT/extensions/emmet/test-workspace --extensionDevelopmentPath=$ROOT/extensions/emmet --extensionTestsPath=$ROOT/extensions/emmet/out/test "$@" +node test/integration/browser/out/index.js --workspacePath $(mktemp -d 2>/dev/null) --enable-proposed-api=vscode.git --extensionDevelopmentPath=$ROOT/extensions/git --extensionTestsPath=$ROOT/extensions/git/out/test "$@" |