File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ import os from 'node:os';
3232import path from 'node:path' ;
3333
3434import { downloadAndUnzipVSCode , runTests } from '@vscode/test-electron' ;
35+ import { writeRepoPackageManager } from '../pnpmInstall' ;
3536import { vscodeTestCachePath } from '../vscodeTestCache' ;
3637
3738interface TestSuite {
@@ -135,6 +136,8 @@ async function runIsolatedSuite(
135136 path . join ( profileRoot , 'node_modules' ) ,
136137 process . platform === 'win32' ? 'junction' : 'dir' ,
137138 ) ;
139+ } else {
140+ writeRepoPackageManager ( profileRoot , extensionDevelopmentPath ) ;
138141 }
139142
140143 await runTests ( {
Original file line number Diff line number Diff line change 11import { execFile as execFileCallback } from 'node:child_process' ;
2+ import fs from 'node:fs' ;
3+ import path from 'node:path' ;
24import { promisify } from 'node:util' ;
35
46const execFile = promisify ( execFileCallback ) ;
57
8+ /**
9+ * Writes the repo's `packageManager` pin into a tmpdir sandbox parent so
10+ * Corepack reuses the cached pnpm instead of fetching `pnpm/latest` from npm.
11+ */
12+ export function writeRepoPackageManager (
13+ sandboxRoot : string ,
14+ extensionDevelopmentPath : string ,
15+ ) : void {
16+ const { packageManager } = JSON . parse (
17+ fs . readFileSync (
18+ path . resolve ( extensionDevelopmentPath , '../../package.json' ) ,
19+ 'utf8' ,
20+ ) ,
21+ ) as { packageManager ?: string } ;
22+ if ( packageManager ) {
23+ fs . writeFileSync (
24+ path . join ( sandboxRoot , 'package.json' ) ,
25+ `${ JSON . stringify ( { packageManager } ) } \n` ,
26+ ) ;
27+ }
28+ }
29+
630/**
731 * Runs `pnpm install --frozen-lockfile --ignore-scripts` in `cwd`. pnpm 11
832 * prints install errors (e.g. ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION) to
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {
2828import { tmpdir } from 'node:os' ;
2929import path from 'node:path' ;
3030import { runTests } from '@vscode/test-electron' ;
31+ import { writeRepoPackageManager } from '../pnpmInstall' ;
3132import { vscodeTestCachePath } from '../vscodeTestCache' ;
3233
3334// Repo-relative fixture dirs whose installs this slice needs. workspace-2 has
@@ -134,6 +135,7 @@ async function main() {
134135 recursive : true ,
135136 filter : ( source ) => path . basename ( source ) !== 'node_modules' ,
136137 } ) ;
138+ writeRepoPackageManager ( recoveryRoot , extensionDevelopmentPath ) ;
137139 await runTests ( {
138140 ...launchOptions ,
139141 extensionTestsPath : path . resolve (
You can’t perform that action at this time.
0 commit comments