mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-28 13:24:24 +08:00
* Make repeated unit test startup cheaper Check the cached Electron version and executable directly in the unit test launchers, while retaining an explicit forced prelaunch path for packaging changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Restore Windows test dependency bootstrap Keep the fresh-checkout npm install behavior before applying the faster Electron cache check. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Align Windows test dependency bootstrap Use npm install when node_modules is missing, matching the long-standing Unix unit-test launcher behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Keep unit test launchers dependency-neutral Restore the historical expectation that dependencies are installed before running tests, and use the shared npm Electron entry point on Windows and Unix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
52 lines
1.5 KiB
Batchfile
52 lines
1.5 KiB
Batchfile
@echo off
|
|
setlocal
|
|
|
|
set ELECTRON_RUN_AS_NODE=
|
|
|
|
pushd %~dp0\..
|
|
|
|
:: Get Code.exe location
|
|
set "NAMESHORT="
|
|
for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do if not defined NAMESHORT set "NAMESHORT=%%~a"
|
|
set NAMESHORT=%NAMESHORT: "=%
|
|
set NAMESHORT=%NAMESHORT:"=%.exe
|
|
set CODE=".build\electron\%NAMESHORT%"
|
|
|
|
:: Download Electron if needed
|
|
if "%VSCODE_SKIP_PRELAUNCH%"=="" (
|
|
call :ensure_electron
|
|
if errorlevel 1 exit /b 1
|
|
)
|
|
|
|
:: Run tests
|
|
set ELECTRON_ENABLE_LOGGING=1
|
|
%CODE% .\test\unit\electron\index.js --crash-reporter-directory=%~dp0\..\.build\crashes %*
|
|
|
|
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%
|
|
|
|
:ensure_electron
|
|
if defined VSCODE_FORCE_PRELAUNCH goto download_electron
|
|
if not exist %CODE% goto download_electron
|
|
if not exist ".build\electron\version" goto download_electron
|
|
|
|
set "EXPECTED_ELECTRON_VERSION="
|
|
for /f "tokens=2 delims==" %%a in ('findstr /B /C:"target=" .npmrc') do set "EXPECTED_ELECTRON_VERSION=%%~a"
|
|
set "INSTALLED_ELECTRON_VERSION="
|
|
set /p INSTALLED_ELECTRON_VERSION=<".build\electron\version"
|
|
if "%INSTALLED_ELECTRON_VERSION:~0,1%"=="v" set "INSTALLED_ELECTRON_VERSION=%INSTALLED_ELECTRON_VERSION:~1%"
|
|
if not "%INSTALLED_ELECTRON_VERSION%"=="%EXPECTED_ELECTRON_VERSION%" goto download_electron
|
|
exit /b 0
|
|
|
|
:download_electron
|
|
call npm run electron
|
|
exit /b %errorlevel%
|