From 7223b288292277c6550f7ecb177af8460e7626b8 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Fri, 15 Mar 2019 09:12:04 -0700 Subject: [PATCH] Add config for running extension tests (#4495) * Add .bat for running extension tests (currently only Notebook) and set up launch.json with 2 new launch configs for running & debugging extension tests. * Rename files to make it clear these aren't the integration tests * Update launch.config too * Fix spacing and missed file name update --- .vscode/launch.json | 25 ++++++++++++++++++- scripts/test-extensions-unit.bat | 22 ++++++++++++++++ ...-extensions.sh => test-extensions-unit.sh} | 2 ++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 scripts/test-extensions-unit.bat rename scripts/{test-extensions.sh => test-extensions-unit.sh} (95%) mode change 100755 => 100644 diff --git a/.vscode/launch.json b/.vscode/launch.json index c18f0fbcb6..fea405af38 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -147,7 +147,23 @@ "outFiles": [ "${workspaceFolder}/out/**/*.js" ] - } + }, + { + "type": "chrome", + "request": "launch", + "name": "Run Extension Unit Tests", + "windows": { + "runtimeExecutable": "${workspaceFolder}/scripts/test-extensions-unit.bat" + }, + "osx": { + "runtimeExecutable": "${workspaceFolder}/scripts/test-extensions-unit.sh" + }, + "linux": { + "runtimeExecutable": "${workspaceFolder}/scripts/test-extensions-unit.sh" + }, + "webRoot": "${workspaceFolder}", + "timeout": 45000 + }, ], "compounds": [ { @@ -157,6 +173,13 @@ "Run Unit Tests" ] }, + { + "name": "Debug Extension Unit Tests", + "configurations": [ + "Attach to Extension Host", + "Run Extension Unit Tests" + ] + }, { "name": "Debug azuredatastudio Main and Renderer", "configurations": [ diff --git a/scripts/test-extensions-unit.bat b/scripts/test-extensions-unit.bat new file mode 100644 index 0000000000..8069a9cb01 --- /dev/null +++ b/scripts/test-extensions-unit.bat @@ -0,0 +1,22 @@ +:: Runs unit tests for Extensions + +setlocal + +pushd %~dp0\.. + +set VSCODEUSERDATADIR=%TMP%\adsuser-%RANDOM%-%TIME:~6,5% +set VSCODEEXTENSIONSDIR=%TMP%\adsext-%RANDOM%-%TIME:~6,5% +echo %VSCODEUSERDATADIR% +echo %VSCODEEXTENSIONSDIR% +@echo OFF + +call .\scripts\code.bat --extensionDevelopmentPath=%~dp0\..\extensions\notebook --extensionTestsPath=%~dp0\..\extensions\notebook\out\test --user-data-dir=%VSCODEUSERDATADIR% --extensions-dir=%VSCODEEXTENSIONSDIR% --remote-debugging-port=9222 + +if %errorlevel% neq 0 exit /b %errorlevel% + +rmdir /s /q %VSCODEUSERDATADIR% +rmdir /s /q %VSCODEEXTENSIONSDIR% + +popd + +endlocal diff --git a/scripts/test-extensions.sh b/scripts/test-extensions-unit.sh old mode 100755 new mode 100644 similarity index 95% rename from scripts/test-extensions.sh rename to scripts/test-extensions-unit.sh index 46c0d4a863..4b318aa971 --- a/scripts/test-extensions.sh +++ b/scripts/test-extensions-unit.sh @@ -1,4 +1,6 @@ #!/bin/bash + +# Runs unit tests for Extensions set -e if [[ "$OSTYPE" == "darwin"* ]]; then