Merge commit 'be3e8236086165e5e45a5a10783823874b3f3ebd' as 'lib/vscode'
This commit is contained in:
37
lib/vscode/scripts/code-cli.bat
Normal file
37
lib/vscode/scripts/code-cli.bat
Normal file
@ -0,0 +1,37 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
title VSCode Dev
|
||||
|
||||
pushd %~dp0\..
|
||||
|
||||
:: Get electron, compile, built-in extensions
|
||||
if "%VSCODE_SKIP_PRELAUNCH%"=="" node build/lib/preLaunch.js
|
||||
|
||||
for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do set NAMESHORT=%%~a
|
||||
set NAMESHORT=%NAMESHORT: "=%
|
||||
set NAMESHORT=%NAMESHORT:"=%.exe
|
||||
set CODE=".build\electron\%NAMESHORT%"
|
||||
|
||||
:: Manage built-in extensions
|
||||
if "%1"=="--builtin" goto builtin
|
||||
|
||||
:: Configuration
|
||||
set ELECTRON_RUN_AS_NODE=1
|
||||
set NODE_ENV=development
|
||||
set VSCODE_DEV=1
|
||||
set ELECTRON_ENABLE_LOGGING=1
|
||||
set ELECTRON_ENABLE_STACK_DUMPING=1
|
||||
|
||||
:: Launch Code
|
||||
%CODE% --inspect=5874 out\cli.js . %*
|
||||
goto end
|
||||
|
||||
:builtin
|
||||
%CODE% build/builtin
|
||||
|
||||
:end
|
||||
|
||||
popd
|
||||
|
||||
endlocal
|
40
lib/vscode/scripts/code-cli.sh
Executable file
40
lib/vscode/scripts/code-cli.sh
Executable file
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
|
||||
ROOT=$(dirname $(dirname $(realpath "$0")))
|
||||
else
|
||||
ROOT=$(dirname $(dirname $(readlink -f $0)))
|
||||
fi
|
||||
|
||||
function code() {
|
||||
cd $ROOT
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
NAME=`node -p "require('./product.json').nameLong"`
|
||||
CODE="./.build/electron/$NAME.app/Contents/MacOS/Electron"
|
||||
else
|
||||
NAME=`node -p "require('./product.json').applicationName"`
|
||||
CODE=".build/electron/$NAME"
|
||||
fi
|
||||
|
||||
# Get electron, compile, built-in extensions
|
||||
if [[ -z "${VSCODE_SKIP_PRELAUNCH}" ]]; then
|
||||
node build/lib/preLaunch.js
|
||||
fi
|
||||
|
||||
# Manage built-in extensions
|
||||
if [[ "$1" == "--builtin" ]]; then
|
||||
exec "$CODE" build/builtin
|
||||
return
|
||||
fi
|
||||
|
||||
ELECTRON_RUN_AS_NODE=1 \
|
||||
NODE_ENV=development \
|
||||
VSCODE_DEV=1 \
|
||||
ELECTRON_ENABLE_LOGGING=1 \
|
||||
ELECTRON_ENABLE_STACK_DUMPING=1 \
|
||||
"$CODE" --inspect=5874 "$ROOT/out/cli.js" . "$@"
|
||||
}
|
||||
|
||||
code "$@"
|
39
lib/vscode/scripts/code.bat
Normal file
39
lib/vscode/scripts/code.bat
Normal file
@ -0,0 +1,39 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
title VSCode Dev
|
||||
|
||||
pushd %~dp0\..
|
||||
|
||||
:: Get electron, compile, built-in extensions
|
||||
if "%VSCODE_SKIP_PRELAUNCH%"=="" node build/lib/preLaunch.js
|
||||
|
||||
for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do set NAMESHORT=%%~a
|
||||
set NAMESHORT=%NAMESHORT: "=%
|
||||
set NAMESHORT=%NAMESHORT:"=%.exe
|
||||
set CODE=".build\electron\%NAMESHORT%"
|
||||
|
||||
:: Manage built-in extensions
|
||||
if "%1"=="--builtin" goto builtin
|
||||
|
||||
:: Configuration
|
||||
set NODE_ENV=development
|
||||
set VSCODE_DEV=1
|
||||
set VSCODE_CLI=1
|
||||
set ELECTRON_ENABLE_LOGGING=1
|
||||
set ELECTRON_ENABLE_STACK_DUMPING=1
|
||||
set VSCODE_LOGS=
|
||||
|
||||
:: Launch Code
|
||||
|
||||
%CODE% . %*
|
||||
goto end
|
||||
|
||||
:builtin
|
||||
%CODE% build/builtin
|
||||
|
||||
:end
|
||||
|
||||
popd
|
||||
|
||||
endlocal
|
78
lib/vscode/scripts/code.sh
Executable file
78
lib/vscode/scripts/code.sh
Executable file
@ -0,0 +1,78 @@
|
||||
#!/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)")")
|
||||
# If the script is running in Docker using the WSL2 engine, powershell.exe won't exist
|
||||
if grep -qi Microsoft /proc/version && type powershell.exe > /dev/null 2>&1; then
|
||||
IN_WSL=true
|
||||
fi
|
||||
fi
|
||||
|
||||
function code() {
|
||||
cd "$ROOT"
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
NAME=`node -p "require('./product.json').nameLong"`
|
||||
CODE="./.build/electron/$NAME.app/Contents/MacOS/Electron"
|
||||
else
|
||||
NAME=`node -p "require('./product.json').applicationName"`
|
||||
CODE=".build/electron/$NAME"
|
||||
fi
|
||||
|
||||
# Get electron, compile, built-in extensions
|
||||
if [[ -z "${VSCODE_SKIP_PRELAUNCH}" ]]; then
|
||||
node build/lib/preLaunch.js
|
||||
fi
|
||||
|
||||
# Manage built-in extensions
|
||||
if [[ "$1" == "--builtin" ]]; then
|
||||
exec "$CODE" build/builtin
|
||||
return
|
||||
fi
|
||||
|
||||
# Configuration
|
||||
export NODE_ENV=development
|
||||
export VSCODE_DEV=1
|
||||
export VSCODE_CLI=1
|
||||
export ELECTRON_ENABLE_STACK_DUMPING=1
|
||||
export ELECTRON_ENABLE_LOGGING=1
|
||||
export VSCODE_LOGS=
|
||||
|
||||
# Launch Code
|
||||
exec "$CODE" . --no-sandbox "$@"
|
||||
}
|
||||
|
||||
function code-wsl()
|
||||
{
|
||||
HOST_IP=$(echo "" | powershell.exe –noprofile -Command "& {(Get-NetIPAddress | Where-Object {\$_.InterfaceAlias -like '*WSL*' -and \$_.AddressFamily -eq 'IPv4'}).IPAddress | Write-Host -NoNewline}")
|
||||
export DISPLAY="$HOST_IP:0"
|
||||
|
||||
# in a wsl shell
|
||||
ELECTRON="$ROOT/.build/electron/Code - OSS.exe"
|
||||
if [ -f "$ELECTRON" ]; then
|
||||
local CWD=$(pwd)
|
||||
cd $ROOT
|
||||
export WSLENV=ELECTRON_RUN_AS_NODE/w:VSCODE_DEV/w:$WSLENV
|
||||
local WSL_EXT_ID="ms-vscode-remote.remote-wsl"
|
||||
local WSL_EXT_WLOC=$(echo "" | VSCODE_DEV=1 ELECTRON_RUN_AS_NODE=1 "$ROOT/.build/electron/Code - OSS.exe" "out/cli.js" --locate-extension $WSL_EXT_ID)
|
||||
cd $CWD
|
||||
if [ -n "$WSL_EXT_WLOC" ]; then
|
||||
# replace \r\n with \n in WSL_EXT_WLOC
|
||||
local WSL_CODE=$(wslpath -u "${WSL_EXT_WLOC%%[[:cntrl:]]}")/scripts/wslCode-dev.sh
|
||||
$WSL_CODE "$ROOT" "$@"
|
||||
exit $?
|
||||
else
|
||||
echo "Remote WSL not installed, trying to run VSCode in WSL."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if ! [ -z ${IN_WSL+x} ]; then
|
||||
code-wsl "$@"
|
||||
fi
|
||||
code "$@"
|
31
lib/vscode/scripts/generate-definitelytyped.sh
Executable file
31
lib/vscode/scripts/generate-definitelytyped.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Pass in a version like ./scripts/generate-vscode-dts.sh 1.30."
|
||||
echo "Failed to generate index.d.ts."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
header="// Type definitions for Visual Studio Code ${1}
|
||||
// Project: https://github.com/microsoft/vscode
|
||||
// Definitions by: Visual Studio Code Team, Microsoft <https://github.com/microsoft>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
* See https://github.com/microsoft/vscode/blob/master/LICENSE.txt for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Type Definition for Visual Studio Code ${1} Extension API
|
||||
* See https://code.visualstudio.com/api for more information
|
||||
*/"
|
||||
|
||||
if [ -f ./src/vs/vscode.d.ts ]; then
|
||||
echo "$header" > index.d.ts
|
||||
sed "1,4d" ./src/vs/vscode.d.ts >> index.d.ts
|
||||
echo "Generated index.d.ts for version ${1}."
|
||||
else
|
||||
echo "Can't find ./src/vs/vscode.d.ts. Run this script at vscode root."
|
||||
fi
|
18
lib/vscode/scripts/node-electron.bat
Normal file
18
lib/vscode/scripts/node-electron.bat
Normal file
@ -0,0 +1,18 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set ELECTRON_RUN_AS_NODE=1
|
||||
|
||||
pushd %~dp0\..
|
||||
|
||||
for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do set NAMESHORT=%%~a
|
||||
set NAMESHORT=%NAMESHORT: "=%
|
||||
set NAMESHORT=%NAMESHORT:"=%.exe
|
||||
set CODE=".build\electron\%NAMESHORT%"
|
||||
|
||||
%CODE% %*
|
||||
|
||||
popd
|
||||
|
||||
endlocal
|
||||
exit /b %errorlevel%
|
34
lib/vscode/scripts/node-electron.sh
Executable file
34
lib/vscode/scripts/node-electron.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
|
||||
ROOT=$(dirname $(dirname $(realpath "$0")))
|
||||
else
|
||||
ROOT=$(dirname $(dirname $(readlink -f $0)))
|
||||
fi
|
||||
|
||||
pushd $ROOT
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
NAME=`node -p "require('./product.json').nameLong"`
|
||||
CODE="$ROOT/.build/electron/$NAME.app/Contents/MacOS/Electron"
|
||||
else
|
||||
NAME=`node -p "require('./product.json').applicationName"`
|
||||
CODE="$ROOT/.build/electron/$NAME"
|
||||
fi
|
||||
|
||||
# Get electron
|
||||
yarn electron
|
||||
|
||||
popd
|
||||
|
||||
export VSCODE_DEV=1
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
ulimit -n 4096 ; ELECTRON_RUN_AS_NODE=1 \
|
||||
"$CODE" \
|
||||
"$@"
|
||||
else
|
||||
ELECTRON_RUN_AS_NODE=1 \
|
||||
"$CODE" \
|
||||
"$@"
|
||||
fi
|
2
lib/vscode/scripts/npm.bat
Normal file
2
lib/vscode/scripts/npm.bat
Normal file
@ -0,0 +1,2 @@
|
||||
@echo off
|
||||
yarn %*
|
3
lib/vscode/scripts/npm.sh
Executable file
3
lib/vscode/scripts/npm.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
yarn $*
|
17
lib/vscode/scripts/test-documentation.bat
Normal file
17
lib/vscode/scripts/test-documentation.bat
Normal file
@ -0,0 +1,17 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
echo Runs tests against the current documentation in https://github.com/microsoft/vscode-docs/tree/vnext
|
||||
|
||||
pushd %~dp0\..
|
||||
|
||||
:: Endgame tests in AMD
|
||||
call .\scripts\test.bat --runGlob **\*.releaseTest.js %*
|
||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
|
||||
|
||||
rmdir /s /q %VSCODEUSERDATADIR%
|
||||
|
||||
popd
|
||||
|
||||
endlocal
|
21
lib/vscode/scripts/test-documentation.sh
Executable file
21
lib/vscode/scripts/test-documentation.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
|
||||
ROOT=$(dirname $(dirname $(realpath "$0")))
|
||||
VSCODEUSERDATADIR=`mktemp -d -t 'myuserdatadir'`
|
||||
else
|
||||
ROOT=$(dirname $(dirname $(readlink -f $0)))
|
||||
VSCODEUSERDATADIR=`mktemp -d 2>/dev/null`
|
||||
fi
|
||||
|
||||
cd $ROOT
|
||||
|
||||
echo "Runs tests against the current documentation in https://github.com/microsoft/vscode-docs/tree/vnext"
|
||||
|
||||
# Tests in AMD
|
||||
./scripts/test.sh --runGlob **/*.releaseTest.js "$@"
|
||||
|
||||
|
||||
rm -r $VSCODEUSERDATADIR
|
86
lib/vscode/scripts/test-integration.bat
Normal file
86
lib/vscode/scripts/test-integration.bat
Normal file
@ -0,0 +1,86 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
pushd %~dp0\..
|
||||
|
||||
set VSCODEUSERDATADIR=%TEMP%\vscodeuserfolder-%RANDOM%-%TIME:~6,2%
|
||||
set VSCODECRASHDIR=%~dp0\..\.build\crashes
|
||||
|
||||
:: Figure out which Electron to use for running tests
|
||||
if "%INTEGRATION_TEST_ELECTRON_PATH%"=="" (
|
||||
:: Run out of sources: no need to compile as code.bat takes care of it
|
||||
chcp 65001
|
||||
set INTEGRATION_TEST_ELECTRON_PATH=.\scripts\code.bat
|
||||
set VSCODE_BUILD_BUILTIN_EXTENSIONS_SILENCE_PLEASE=1
|
||||
|
||||
echo Storing crash reports into '%VSCODECRASHDIR%'.
|
||||
echo Running integration tests out of sources.
|
||||
) else (
|
||||
:: 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-colorize-tests^
|
||||
compile-extension:markdown-language-features^
|
||||
compile-extension:typescript-language-features^
|
||||
compile-extension:vscode-custom-editor-tests^
|
||||
compile-extension:vscode-notebook-tests^
|
||||
compile-extension:emmet^
|
||||
compile-extension:css-language-features-server^
|
||||
compile-extension:html-language-features-server^
|
||||
compile-extension:json-language-features-server^
|
||||
compile-extension:git
|
||||
|
||||
:: Configuration for more verbose output
|
||||
set VSCODE_CLI=1
|
||||
set ELECTRON_ENABLE_LOGGING=1
|
||||
|
||||
echo Storing crash reports into '%VSCODECRASHDIR%'.
|
||||
echo Running integration tests with '%INTEGRATION_TEST_ELECTRON_PATH%' as build.
|
||||
)
|
||||
|
||||
:: Integration & performance tests in AMD
|
||||
::call .\scripts\test.bat --runGlob **\*.integrationTest.js %*
|
||||
::if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
|
||||
:: Tests in the extension host
|
||||
|
||||
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\testWorkspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\singlefolder-tests --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
|
||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
|
||||
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\testworkspace.code-workspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\workspace-tests --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
|
||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
|
||||
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-colorize-tests\test --extensionDevelopmentPath=%~dp0\..\extensions\vscode-colorize-tests --extensionTestsPath=%~dp0\..\extensions\vscode-colorize-tests\out --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
|
||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
|
||||
REM call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\typescript-language-features\test-workspace --extensionDevelopmentPath=%~dp0\..\extensions\typescript-language-features --extensionTestsPath=%~dp0\..\extensions\typescript-language-features\out\test --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
|
||||
REM if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
|
||||
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\markdown-language-features\test-workspace --extensionDevelopmentPath=%~dp0\..\extensions\markdown-language-features --extensionTestsPath=%~dp0\..\extensions\markdown-language-features\out\test --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
|
||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
|
||||
call "%INTEGRATION_TEST_ELECTRON_PATH%" $%~dp0\..\extensions\emmet\out\test\test-fixtures --extensionDevelopmentPath=%~dp0\..\extensions\emmet --extensionTestsPath=%~dp0\..\extensions\emmet\out\test --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR% .
|
||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
|
||||
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-notebook-tests\test --enable-proposed-api=vscode.vscode-notebook-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-notebook-tests --extensionTestsPath=%~dp0\..\extensions\vscode-notebook-tests\out --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
|
||||
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 "%INTEGRATION_TEST_ELECTRON_PATH%" %GITWORKSPACE% --extensionDevelopmentPath=%~dp0\..\extensions\git --extensionTestsPath=%~dp0\..\extensions\git\out\test --enable-proposed-api=vscode.git --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
|
||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
|
||||
:: Tests in commonJS (CSS, HTML)
|
||||
call %~dp0\node-electron.bat %~dp0\..\extensions\css-language-features/server/test/index.js
|
||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
|
||||
call %~dp0\node-electron.bat %~dp0\..\extensions\html-language-features/server/test/index.js
|
||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
|
||||
rmdir /s /q %VSCODEUSERDATADIR%
|
||||
|
||||
popd
|
||||
|
||||
endlocal
|
66
lib/vscode/scripts/test-integration.sh
Executable file
66
lib/vscode/scripts/test-integration.sh
Executable file
@ -0,0 +1,66 @@
|
||||
#!/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)))
|
||||
LINUX_NO_SANDBOX="--no-sandbox" # Electron 6 introduces a chrome-sandbox that requires root to run. This can fail. Disable sandbox via --no-sandbox.
|
||||
fi
|
||||
|
||||
VSCODEUSERDATADIR=`mktemp -d 2>/dev/null`
|
||||
VSCODECRASHDIR=$ROOT/.build/crashes
|
||||
cd $ROOT
|
||||
|
||||
# Figure out which Electron to use for running tests
|
||||
if [ -z "$INTEGRATION_TEST_ELECTRON_PATH" ]
|
||||
then
|
||||
# Run out of sources: no need to compile as code.sh takes care of it
|
||||
INTEGRATION_TEST_ELECTRON_PATH="./scripts/code.sh"
|
||||
|
||||
echo "Storing crash reports into '$VSCODECRASHDIR'."
|
||||
echo "Running integration tests out of sources."
|
||||
else
|
||||
# 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-colorize-tests \
|
||||
compile-extension:vscode-custom-editor-tests \
|
||||
compile-extension:vscode-notebook-tests \
|
||||
compile-extension:markdown-language-features \
|
||||
compile-extension:typescript-language-features \
|
||||
compile-extension:emmet \
|
||||
compile-extension:css-language-features-server \
|
||||
compile-extension:html-language-features-server \
|
||||
compile-extension:json-language-features-server \
|
||||
compile-extension:git
|
||||
|
||||
# Configuration for more verbose output
|
||||
export VSCODE_CLI=1
|
||||
export ELECTRON_ENABLE_STACK_DUMPING=1
|
||||
export ELECTRON_ENABLE_LOGGING=1
|
||||
|
||||
echo "Storing crash reports into '$VSCODECRASHDIR'."
|
||||
echo "Running integration tests with '$INTEGRATION_TEST_ELECTRON_PATH' as build."
|
||||
fi
|
||||
|
||||
# Integration tests in AMD
|
||||
./scripts/test.sh --runGlob **/*.integrationTest.js "$@"
|
||||
|
||||
# Tests in the extension host
|
||||
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $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 --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
|
||||
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $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 --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
|
||||
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/vscode-colorize-tests/test --extensionDevelopmentPath=$ROOT/extensions/vscode-colorize-tests --extensionTestsPath=$ROOT/extensions/vscode-colorize-tests/out --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
|
||||
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/markdown-language-features/test-workspace --extensionDevelopmentPath=$ROOT/extensions/markdown-language-features --extensionTestsPath=$ROOT/extensions/markdown-language-features/out/test --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
|
||||
#"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/typescript-language-features/test-workspace --extensionDevelopmentPath=$ROOT/extensions/typescript-language-features --extensionTestsPath=$ROOT/extensions/typescript-language-features/out/test --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
|
||||
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/emmet/out/test/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/emmet --extensionTestsPath=$ROOT/extensions/emmet/out/test --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
|
||||
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $(mktemp -d 2>/dev/null) --enable-proposed-api=vscode.git --extensionDevelopmentPath=$ROOT/extensions/git --extensionTestsPath=$ROOT/extensions/git/out/test --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
|
||||
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/vscode-notebook-tests/test --enable-proposed-api=vscode.vscode-notebook-tests --extensionDevelopmentPath=$ROOT/extensions/vscode-notebook-tests --extensionTestsPath=$ROOT/extensions/vscode-notebook-tests/out/ --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
|
||||
|
||||
# Tests in commonJS (CSS, HTML)
|
||||
cd $ROOT/extensions/css-language-features/server && $ROOT/scripts/node-electron.sh test/index.js
|
||||
cd $ROOT/extensions/html-language-features/server && $ROOT/scripts/node-electron.sh test/index.js
|
||||
|
||||
rm -rf $VSCODEUSERDATADIR
|
31
lib/vscode/scripts/test.bat
Normal file
31
lib/vscode/scripts/test.bat
Normal file
@ -0,0 +1,31 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set ELECTRON_RUN_AS_NODE=
|
||||
|
||||
pushd %~dp0\..
|
||||
|
||||
:: Get Code.exe location
|
||||
for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do set NAMESHORT=%%~a
|
||||
set NAMESHORT=%NAMESHORT: "=%
|
||||
set NAMESHORT=%NAMESHORT:"=%.exe
|
||||
set CODE=".build\electron\%NAMESHORT%"
|
||||
|
||||
:: Download Electron if needed
|
||||
node build\lib\electron.js
|
||||
if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron
|
||||
|
||||
:: Run tests
|
||||
set ELECTRON_ENABLE_LOGGING=1
|
||||
%CODE% .\test\unit\electron\index.js %*
|
||||
|
||||
popd
|
||||
|
||||
endlocal
|
||||
|
||||
:: app.exit(0) is exiting with code 255 in Electron 1.7.4.
|
||||
:: See https://github.com/microsoft/vscode/issues/28582
|
||||
echo errorlevel: %errorlevel%
|
||||
if %errorlevel% == 255 set errorlevel=0
|
||||
|
||||
exit /b %errorlevel%
|
38
lib/vscode/scripts/test.sh
Executable file
38
lib/vscode/scripts/test.sh
Executable file
@ -0,0 +1,38 @@
|
||||
#!/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
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
NAME=`node -p "require('./product.json').nameLong"`
|
||||
CODE="./.build/electron/$NAME.app/Contents/MacOS/Electron"
|
||||
else
|
||||
NAME=`node -p "require('./product.json').applicationName"`
|
||||
CODE=".build/electron/$NAME"
|
||||
fi
|
||||
|
||||
# Node modules
|
||||
test -d node_modules || yarn
|
||||
|
||||
# Get electron
|
||||
yarn electron
|
||||
|
||||
# Unit Tests
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
cd $ROOT ; ulimit -n 4096 ; \
|
||||
ELECTRON_ENABLE_LOGGING=1 \
|
||||
"$CODE" \
|
||||
test/unit/electron/index.js "$@"
|
||||
else
|
||||
cd $ROOT ; \
|
||||
ELECTRON_ENABLE_LOGGING=1 \
|
||||
"$CODE" \
|
||||
test/unit/electron/index.js --no-sandbox "$@" # Electron 6 introduces a chrome-sandbox that requires root to run. This can fail. Disable sandbox via --no-sandbox.
|
||||
fi
|
Reference in New Issue
Block a user