1414 */
1515
1616import { defineConfig } from '@vscode/test-cli' ;
17+ import { cpSync , rmSync } from 'fs' ;
1718import { join } from 'path' ;
1819import { fileURLToPath } from 'url' ;
1920
@@ -23,6 +24,34 @@ import { fileURLToPath } from 'url';
2324const extensionRoot = fileURLToPath ( new URL ( '.' , import . meta. url ) ) ;
2425const userDataDir = join ( extensionRoot , '..' , '..' , '.tmp' , 'vsc-ud' ) ;
2526
27+ // The multi-root workspace tests mutate the workspace folder list via
28+ // `vscode.workspace.updateWorkspaceFolders`, which makes VS Code persist (and
29+ // normalize, e.g. appending a `"settings": {}` block) the backing
30+ // `.code-workspace` file. Opening the tracked fixture directly would therefore
31+ // leave the working tree dirty and fail the CI "uncommitted changes" check.
32+ // Copy the fixture into the gitignored .tmp/ on each run and open the copy so
33+ // the tracked fixture is never modified. Folder entries inside the workspace
34+ // file are relative, so copying the whole directory preserves them.
35+ const multiRootFixture = join (
36+ extensionRoot ,
37+ 'test' ,
38+ 'fixtures' ,
39+ 'multi-root-workspace' ,
40+ ) ;
41+ const multiRootWorkspaceCopy = join (
42+ extensionRoot ,
43+ '..' ,
44+ '..' ,
45+ '.tmp' ,
46+ 'multi-root-workspace' ,
47+ ) ;
48+ rmSync ( multiRootWorkspaceCopy , { recursive : true , force : true } ) ;
49+ cpSync ( multiRootFixture , multiRootWorkspaceCopy , { recursive : true } ) ;
50+ const multiRootWorkspaceFile = join (
51+ multiRootWorkspaceCopy ,
52+ 'test.code-workspace' ,
53+ ) ;
54+
2655export default defineConfig ( [
2756 {
2857 label : 'noWorkspace' ,
@@ -51,7 +80,7 @@ export default defineConfig([
5180 label : 'multiRoot' ,
5281 files : 'dist/test/suite/*.test.cjs' ,
5382 version : 'stable' ,
54- workspaceFolder : './test/fixtures/multi-root-workspace/test.code-workspace' ,
83+ workspaceFolder : multiRootWorkspaceFile ,
5584 launchArgs : [ '--user-data-dir' , userDataDir ] ,
5685 mocha : {
5786 ui : 'tdd' ,
0 commit comments