Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ steps:

- ${{ if eq(parameters.VSCODE_RUN_ELECTRON_TESTS, true) }}:
- script: ./scripts/test.sh --build --tfs "Unit Tests"
env:
VSCODE_SKIP_PRELAUNCH: '1'
displayName: 🧪 Run unit tests (Electron)
timeoutInMinutes: 15
- script: npm run test-node -- --build
Expand Down Expand Up @@ -64,6 +66,7 @@ steps:
./scripts/test-integration.sh --build --tfs "Integration Tests"
env:
VSCODE_REMOTE_SERVER_PATH: $(agent.builddirectory)/vscode-server-darwin-$(VSCODE_ARCH)
VSCODE_SKIP_PRELAUNCH: '1'
displayName: 🧪 Run integration tests (Electron)
timeoutInMinutes: 20

Expand All @@ -85,6 +88,7 @@ steps:
./scripts/test-remote-integration.sh
env:
VSCODE_REMOTE_SERVER_PATH: $(agent.builddirectory)/vscode-server-darwin-$(VSCODE_ARCH)
VSCODE_SKIP_PRELAUNCH: '1'
displayName: 🧪 Run integration tests (Remote)
timeoutInMinutes: 20

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ steps:

- ${{ if eq(parameters.VSCODE_RUN_ELECTRON_TESTS, true) }}:
- script: ./scripts/test.sh --build --tfs "Unit Tests"
env:
VSCODE_SKIP_PRELAUNCH: '1'
displayName: 🧪 Run unit tests (Electron)
timeoutInMinutes: 15
- script: npm run test-node -- --build
Expand Down Expand Up @@ -75,6 +77,7 @@ steps:
./scripts/test-integration.sh --build --tfs "Integration Tests"
env:
VSCODE_REMOTE_SERVER_PATH: $(agent.builddirectory)/vscode-server-linux-$(VSCODE_ARCH)
VSCODE_SKIP_PRELAUNCH: '1'
displayName: 🧪 Run integration tests (Electron)
timeoutInMinutes: 20

Expand All @@ -95,6 +98,7 @@ steps:
./scripts/test-remote-integration.sh
env:
VSCODE_REMOTE_SERVER_PATH: $(agent.builddirectory)/vscode-server-linux-$(VSCODE_ARCH)
VSCODE_SKIP_PRELAUNCH: '1'
displayName: 🧪 Run integration tests (Remote)
timeoutInMinutes: 20

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ steps:

- ${{ if eq(parameters.VSCODE_RUN_ELECTRON_TESTS, true) }}:
- powershell: .\scripts\test.bat --build --tfs "Unit Tests"
env:
VSCODE_SKIP_PRELAUNCH: '1'
displayName: 🧪 Run unit tests (Electron)
timeoutInMinutes: 15
- powershell: npm run test-node -- --build
Expand Down Expand Up @@ -82,6 +84,8 @@ steps:
$env:INTEGRATION_TEST_ELECTRON_PATH = "$AppRoot\$AppNameShort.exe"
$env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\test\vscode-server-win32-$(VSCODE_ARCH)"
exec { .\scripts\test-integration.bat --build --tfs "Integration Tests" }
env:
VSCODE_SKIP_PRELAUNCH: '1'
displayName: 🧪 Run integration tests (Electron)
timeoutInMinutes: 20

Expand All @@ -105,6 +109,8 @@ steps:
$env:INTEGRATION_TEST_ELECTRON_PATH = "$AppRoot\$AppNameShort.exe"
$env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\test\vscode-server-win32-$(VSCODE_ARCH)"
exec { .\scripts\test-remote-integration.bat }
env:
VSCODE_SKIP_PRELAUNCH: '1'
displayName: 🧪 Run integration tests (Remote)
timeoutInMinutes: 20

Expand Down
10 changes: 2 additions & 8 deletions build/lib/electron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,9 @@ function getElectron(arch: string): () => NodeJS.ReadWriteStream {
}

async function main(arch: string = process.arch): Promise<void> {
const version = electronVersion;
const electronPath = path.join(root, '.build', 'electron');
const versionFile = path.join(electronPath, versionedResourcesFolder, 'version');
const isUpToDate = fs.existsSync(versionFile) && fs.readFileSync(versionFile, 'utf8') === `${version}`;

if (!isUpToDate) {
await util.rimraf(electronPath)();
await util.streamToPromise(getElectron(arch)());
}
await util.rimraf(electronPath)();
await util.streamToPromise(getElectron(arch)());
}

if (import.meta.main) {
Expand Down
2 changes: 2 additions & 0 deletions extensions/vscode-test-resolver/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ export function activate(context: vscode.ExtensionContext) {

outputChannel.appendLine(`Launching server: "${serverCommandPath}" ${commandArgs.join(' ')}`);
const shell = (process.platform === 'win32');
// Skip prelaunch to avoid redownloading electron while it may be in use
env['VSCODE_SKIP_PRELAUNCH'] = '1';
extHostProcess = cp.spawn(serverCommandPath, commandArgs, { env, cwd: vscodePath, shell });
} else {
const extensionToInstall = process.env['TESTRESOLVER_INSTALL_BUILTIN_EXTENSION'];
Expand Down
4 changes: 3 additions & 1 deletion scripts/node-electron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ else
fi

# Get electron
npm run electron
if [[ -z "${VSCODE_SKIP_PRELAUNCH}" ]]; then
npm run electron
fi

popd

Expand Down
6 changes: 4 additions & 2 deletions scripts/test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ set NAMESHORT=%NAMESHORT:"=%.exe
set CODE=".build\electron\%NAMESHORT%"

:: Download Electron if needed
call node build\lib\electron.ts
if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron
if "%VSCODE_SKIP_PRELAUNCH%"=="" (
call node build\lib\electron.ts
if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron
)

:: Run tests
set ELECTRON_ENABLE_LOGGING=1
Expand Down
4 changes: 3 additions & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ VSCODECRASHDIR=$ROOT/.build/crashes
test -d node_modules || npm i

# Get electron
Comment thread
deepak1556 marked this conversation as resolved.
npm run electron
if [[ -z "${VSCODE_SKIP_PRELAUNCH}" ]]; then
npm run electron
fi

# Unit Tests
if [[ "$OSTYPE" == "darwin"* ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ suite('PolicyExport Integration Tests', () => {
? join(rootPath, 'scripts', 'code.bat')
: join(rootPath, 'scripts', 'code.sh');

// Skip prelaunch to avoid redownloading electron while the parent VS Code is using it
await exec(`"${scriptPath}" --export-policy-data="${tempFile}"`, {
cwd: rootPath
cwd: rootPath,
env: { ...process.env, VSCODE_SKIP_PRELAUNCH: '1' }
});

// Read both files
Expand Down
Loading