4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
6
import * as cp from 'child_process' ;
7
- import { downloadAndUnzipVSCode , DownloadVersion , DownloadPlatform } from './download' ;
7
+ import * as path from 'path' ;
8
+ import { downloadAndUnzipVSCode , DownloadVersion , DownloadPlatform , defaultCachePath } from './download' ;
8
9
9
10
export interface TestOptions {
10
11
/**
@@ -37,6 +38,15 @@ export interface TestOptions {
37
38
*/
38
39
platform ?: DownloadPlatform ;
39
40
41
+ /**
42
+ * Whether VS Code should be launched using default settings and extensions
43
+ * installed on this machine. If `false`, then separate directories will be
44
+ * used inside the `.vscode-test` folder within the project.
45
+ *
46
+ * Defaults to `false`.
47
+ */
48
+ reuseMachineInstall ?: boolean ;
49
+
40
50
/**
41
51
* Absolute path to the extension root. Passed to `--extensionDevelopmentPath`.
42
52
* Must include a `package.json` Extension Manifest.
@@ -91,6 +101,8 @@ export async function runTests(options: TestOptions): Promise<number> {
91
101
let args = [
92
102
// https://github.com/microsoft/vscode/issues/84238
93
103
'--no-sandbox' ,
104
+ '--skip-welcome' ,
105
+ '--skip-release-notes' ,
94
106
'--disable-workspace-trust' ,
95
107
'--extensionDevelopmentPath=' + options . extensionDevelopmentPath ,
96
108
'--extensionTestsPath=' + options . extensionTestsPath
@@ -100,9 +112,23 @@ export async function runTests(options: TestOptions): Promise<number> {
100
112
args = options . launchArgs . concat ( args ) ;
101
113
}
102
114
115
+ if ( ! options . reuseMachineInstall ) {
116
+ if ( ! hasArg ( 'extensions-dir' , args ) ) {
117
+ args . push ( `--extensions-dir=${ path . join ( defaultCachePath , 'extensions' ) } ` )
118
+ }
119
+
120
+ if ( ! hasArg ( 'user-data-dir' , args ) ) {
121
+ args . push ( `--user-data-dir=${ path . join ( defaultCachePath , 'user-data' ) } ` )
122
+ }
123
+ }
124
+
103
125
return innerRunTests ( options . vscodeExecutablePath , args , options . extensionTestsEnv ) ;
104
126
}
105
127
128
+ function hasArg ( argName : string , argList : readonly string [ ] ) {
129
+ return argList . some ( a => a === `--${ argName } ` || a . startsWith ( `--${ argName } =` ) ) ;
130
+ }
131
+
106
132
async function innerRunTests (
107
133
executable : string ,
108
134
args : string [ ] ,
0 commit comments