mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-20 02:08:47 +00:00
tests - enable API tests with test runner (#241149)
* Revert "Revert "tests - enable API tests with test runner" (#241146)"
This reverts commit 105d4af21c.
* update
* try to fix
* fix: set extension development path for API tests
---------
Co-authored-by: Connor Peet <connor@peet.io>
This commit is contained in:
@@ -19,7 +19,7 @@ const { defineConfig } = require('@vscode/test-cli');
|
|||||||
* A list of extension folders who have opted into tests, or configuration objects.
|
* A list of extension folders who have opted into tests, or configuration objects.
|
||||||
* Edit me to add more!
|
* Edit me to add more!
|
||||||
*
|
*
|
||||||
* @type {Array<string | (Partial<import("@vscode/test-cli").TestConfiguration> & { label: string })>}
|
* @type {Array<Partial<import("@vscode/test-cli").TestConfiguration> & { label: string }>}
|
||||||
*/
|
*/
|
||||||
const extensions = [
|
const extensions = [
|
||||||
{
|
{
|
||||||
@@ -65,6 +65,20 @@ const extensions = [
|
|||||||
{
|
{
|
||||||
label: 'microsoft-authentication',
|
label: 'microsoft-authentication',
|
||||||
mocha: { timeout: 60_000 }
|
mocha: { timeout: 60_000 }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'vscode-api-tests-folder',
|
||||||
|
extensionDevelopmentPath: `extensions/vscode-api-tests`,
|
||||||
|
workspaceFolder: `extensions/vscode-api-tests/testWorkspace`,
|
||||||
|
mocha: { timeout: 60_000 },
|
||||||
|
files: 'extensions/vscode-api-tests/out/singlefolder-tests/**/*.test.js',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'vscode-api-tests-workspace',
|
||||||
|
extensionDevelopmentPath: `extensions/vscode-api-tests`,
|
||||||
|
workspaceFolder: `extensions/vscode-api-tests/testworkspace.code-workspace`,
|
||||||
|
mocha: { timeout: 60_000 },
|
||||||
|
files: 'extensions/vscode-api-tests/out/workspace-tests/**/*.test.js',
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -75,9 +89,12 @@ const defaultLaunchArgs = process.env.API_TESTS_EXTRA_ARGS?.split(' ') || [
|
|||||||
|
|
||||||
const config = defineConfig(extensions.map(extension => {
|
const config = defineConfig(extensions.map(extension => {
|
||||||
/** @type {import('@vscode/test-cli').TestConfiguration} */
|
/** @type {import('@vscode/test-cli').TestConfiguration} */
|
||||||
const config = typeof extension === 'object'
|
const config = {
|
||||||
? { files: `extensions/${extension.label}/out/**/*.test.js`, ...extension }
|
platform: 'desktop',
|
||||||
: { files: `extensions/${extension}/out/**/*.test.js`, label: extension };
|
files: `extensions/${extension.label}/out/**/*.test.js`,
|
||||||
|
extensionDevelopmentPath: `extensions/${extension.label}`,
|
||||||
|
...extension,
|
||||||
|
};
|
||||||
|
|
||||||
config.mocha ??= {};
|
config.mocha ??= {};
|
||||||
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
|
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
|
||||||
|
|||||||
@@ -1,124 +1,124 @@
|
|||||||
@echo off
|
@echo off
|
||||||
setlocal
|
setlocal
|
||||||
|
|
||||||
pushd %~dp0\..
|
pushd %~dp0\..
|
||||||
|
|
||||||
set VSCODEUSERDATADIR=%TEMP%\vscodeuserfolder-%RANDOM%-%TIME:~6,2%
|
set VSCODEUSERDATADIR=%TEMP%\vscodeuserfolder-%RANDOM%-%TIME:~6,2%
|
||||||
set VSCODECRASHDIR=%~dp0\..\.build\crashes
|
set VSCODECRASHDIR=%~dp0\..\.build\crashes
|
||||||
set VSCODELOGSDIR=%~dp0\..\.build\logs\integration-tests
|
set VSCODELOGSDIR=%~dp0\..\.build\logs\integration-tests
|
||||||
|
|
||||||
:: Figure out which Electron to use for running tests
|
:: Figure out which Electron to use for running tests
|
||||||
if "%INTEGRATION_TEST_ELECTRON_PATH%"=="" (
|
if "%INTEGRATION_TEST_ELECTRON_PATH%"=="" (
|
||||||
chcp 65001
|
chcp 65001
|
||||||
set INTEGRATION_TEST_ELECTRON_PATH=.\scripts\code.bat
|
set INTEGRATION_TEST_ELECTRON_PATH=.\scripts\code.bat
|
||||||
set VSCODE_BUILD_BUILTIN_EXTENSIONS_SILENCE_PLEASE=1
|
set VSCODE_BUILD_BUILTIN_EXTENSIONS_SILENCE_PLEASE=1
|
||||||
|
|
||||||
echo Running integration tests out of sources.
|
echo Running integration tests out of sources.
|
||||||
) else (
|
) else (
|
||||||
set VSCODE_CLI=1
|
set VSCODE_CLI=1
|
||||||
set ELECTRON_ENABLE_LOGGING=1
|
set ELECTRON_ENABLE_LOGGING=1
|
||||||
|
|
||||||
echo Running integration tests with '%INTEGRATION_TEST_ELECTRON_PATH%' as build.
|
echo Running integration tests with '%INTEGRATION_TEST_ELECTRON_PATH%' as build.
|
||||||
)
|
)
|
||||||
|
|
||||||
echo Storing crash reports into '%VSCODECRASHDIR%'.
|
echo Storing crash reports into '%VSCODECRASHDIR%'.
|
||||||
echo Storing log files into '%VSCODELOGSDIR%'.
|
echo Storing log files into '%VSCODELOGSDIR%'.
|
||||||
|
|
||||||
|
|
||||||
:: Unit tests
|
:: Unit tests
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ### node.js integration tests
|
echo ### node.js integration tests
|
||||||
call .\scripts\test.bat --runGlob **\*.integrationTest.js %*
|
call .\scripts\test.bat --runGlob **\*.integrationTest.js %*
|
||||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||||
|
|
||||||
|
|
||||||
:: Tests in the extension host
|
:: Tests in the extension host
|
||||||
|
|
||||||
set API_TESTS_EXTRA_ARGS=--disable-telemetry --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%
|
set API_TESTS_EXTRA_ARGS=--disable-telemetry --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%
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ### API tests (folder)
|
echo ### API tests (folder)
|
||||||
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 %API_TESTS_EXTRA_ARGS%
|
call npm run test-extension -- -l vscode-api-tests-folder --enable-proposed-api=vscode.vscode-api-tests %API_TESTS_EXTRA_ARGS%
|
||||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ### API tests (workspace)
|
echo ### API tests (workspace)
|
||||||
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 %API_TESTS_EXTRA_ARGS%
|
call npm run test-extension -- -l vscode-api-tests-workspace --enable-proposed-api=vscode.vscode-api-tests %API_TESTS_EXTRA_ARGS%
|
||||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ### Colorize tests
|
echo ### Colorize tests
|
||||||
call npm run test-extension -- -l vscode-colorize-tests
|
call npm run test-extension -- -l vscode-colorize-tests
|
||||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ### Terminal Suggest tests
|
echo ### Terminal Suggest tests
|
||||||
call npm run test-extension -- -l terminal-suggest --enable-proposed-api=vscode.vscode-api-tests
|
call npm run test-extension -- -l terminal-suggest --enable-proposed-api=vscode.vscode-api-tests
|
||||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ### TypeScript tests
|
echo ### TypeScript tests
|
||||||
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\unit %API_TESTS_EXTRA_ARGS%
|
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\unit %API_TESTS_EXTRA_ARGS%
|
||||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ### Markdown tests
|
echo ### Markdown tests
|
||||||
call npm run test-extension -- -l markdown-language-features
|
call npm run test-extension -- -l markdown-language-features
|
||||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ### Emmet tests
|
echo ### Emmet tests
|
||||||
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\emmet\test-workspace --extensionDevelopmentPath=%~dp0\..\extensions\emmet --extensionTestsPath=%~dp0\..\extensions\emmet\out\test %API_TESTS_EXTRA_ARGS%
|
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\emmet\test-workspace --extensionDevelopmentPath=%~dp0\..\extensions\emmet --extensionTestsPath=%~dp0\..\extensions\emmet\out\test %API_TESTS_EXTRA_ARGS%
|
||||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ### Git tests
|
echo ### Git tests
|
||||||
for /f "delims=" %%i in ('node -p "require('fs').realpathSync.native(require('os').tmpdir())"') do set TEMPDIR=%%i
|
for /f "delims=" %%i in ('node -p "require('fs').realpathSync.native(require('os').tmpdir())"') do set TEMPDIR=%%i
|
||||||
set GITWORKSPACE=%TEMPDIR%\git-%RANDOM%
|
set GITWORKSPACE=%TEMPDIR%\git-%RANDOM%
|
||||||
mkdir %GITWORKSPACE%
|
mkdir %GITWORKSPACE%
|
||||||
call "%INTEGRATION_TEST_ELECTRON_PATH%" %GITWORKSPACE% --extensionDevelopmentPath=%~dp0\..\extensions\git --extensionTestsPath=%~dp0\..\extensions\git\out\test %API_TESTS_EXTRA_ARGS%
|
call "%INTEGRATION_TEST_ELECTRON_PATH%" %GITWORKSPACE% --extensionDevelopmentPath=%~dp0\..\extensions\git --extensionTestsPath=%~dp0\..\extensions\git\out\test %API_TESTS_EXTRA_ARGS%
|
||||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ### Ipynb tests
|
echo ### Ipynb tests
|
||||||
call npm run test-extension -- -l ipynb
|
call npm run test-extension -- -l ipynb
|
||||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ### Notebook Output tests
|
echo ### Notebook Output tests
|
||||||
call npm run test-extension -- -l notebook-renderers
|
call npm run test-extension -- -l notebook-renderers
|
||||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ### Configuration editing tests
|
echo ### Configuration editing tests
|
||||||
set CFWORKSPACE=%TEMPDIR%\cf-%RANDOM%
|
set CFWORKSPACE=%TEMPDIR%\cf-%RANDOM%
|
||||||
mkdir %CFWORKSPACE%
|
mkdir %CFWORKSPACE%
|
||||||
call npm run test-extension -- -l configuration-editing
|
call npm run test-extension -- -l configuration-editing
|
||||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ### GitHub Authentication tests
|
echo ### GitHub Authentication tests
|
||||||
call npm run test-extension -- -l github-authentication
|
call npm run test-extension -- -l github-authentication
|
||||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||||
|
|
||||||
:: Tests standalone (CommonJS)
|
:: Tests standalone (CommonJS)
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ### CSS tests
|
echo ### CSS tests
|
||||||
call %~dp0\node-electron.bat %~dp0\..\extensions\css-language-features/server/test/index.js
|
call %~dp0\node-electron.bat %~dp0\..\extensions\css-language-features/server/test/index.js
|
||||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ### HTML tests
|
echo ### HTML tests
|
||||||
call %~dp0\node-electron.bat %~dp0\..\extensions\html-language-features/server/test/index.js
|
call %~dp0\node-electron.bat %~dp0\..\extensions\html-language-features/server/test/index.js
|
||||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||||
|
|
||||||
|
|
||||||
:: Cleanup
|
:: Cleanup
|
||||||
|
|
||||||
rmdir /s /q %VSCODEUSERDATADIR%
|
rmdir /s /q %VSCODEUSERDATADIR%
|
||||||
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
endlocal
|
endlocal
|
||||||
|
|||||||
@@ -55,13 +55,13 @@ fi
|
|||||||
echo
|
echo
|
||||||
echo "### API tests (folder)"
|
echo "### API tests (folder)"
|
||||||
echo
|
echo
|
||||||
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $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
|
npm run test-extension -- -l vscode-api-tests-folder --enable-proposed-api=vscode.vscode-api-tests $API_TESTS_EXTRA_ARGS
|
||||||
kill_app
|
kill_app
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "### API tests (workspace)"
|
echo "### API tests (workspace)"
|
||||||
echo
|
echo
|
||||||
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $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
|
npm run test-extension -- -l vscode-api-tests-workspace --enable-proposed-api=vscode.vscode-api-tests $API_TESTS_EXTRA_ARGS
|
||||||
kill_app
|
kill_app
|
||||||
|
|
||||||
echo
|
echo
|
||||||
@@ -71,7 +71,7 @@ npm run test-extension -- -l vscode-colorize-tests
|
|||||||
kill_app
|
kill_app
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "### Terminal Suggest tests"
|
echo "### Terminal Suggest tests"
|
||||||
echo
|
echo
|
||||||
npm run test-extension -- -l terminal-suggest --enable-proposed-api=vscode.vscode-api-tests
|
npm run test-extension -- -l terminal-suggest --enable-proposed-api=vscode.vscode-api-tests
|
||||||
kill_app
|
kill_app
|
||||||
|
|||||||
Reference in New Issue
Block a user