diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts index 36c1e66c852..b76e348e02e 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts @@ -850,17 +850,17 @@ import { assertNoRpc, poll } from '../utils'; collection.prepend('C', '~c2~'); // Verify get - deepStrictEqual(collection.get('A'), { value: '~a2~', type: EnvironmentVariableMutatorType.Replace, scope: undefined }); - deepStrictEqual(collection.get('B'), { value: '~b2~', type: EnvironmentVariableMutatorType.Append, scope: undefined }); - deepStrictEqual(collection.get('C'), { value: '~c2~', type: EnvironmentVariableMutatorType.Prepend, scope: undefined }); + deepStrictEqual(collection.get('A'), { value: '~a2~', type: EnvironmentVariableMutatorType.Replace }); + deepStrictEqual(collection.get('B'), { value: '~b2~', type: EnvironmentVariableMutatorType.Append }); + deepStrictEqual(collection.get('C'), { value: '~c2~', type: EnvironmentVariableMutatorType.Prepend }); // Verify forEach const entries: [string, EnvironmentVariableMutator][] = []; collection.forEach((v, m) => entries.push([v, m])); deepStrictEqual(entries, [ - ['A', { value: '~a2~', type: EnvironmentVariableMutatorType.Replace, scope: undefined }], - ['B', { value: '~b2~', type: EnvironmentVariableMutatorType.Append, scope: undefined }], - ['C', { value: '~c2~', type: EnvironmentVariableMutatorType.Prepend, scope: undefined }] + ['A', { value: '~a2~', type: EnvironmentVariableMutatorType.Replace }], + ['B', { value: '~b2~', type: EnvironmentVariableMutatorType.Append }], + ['C', { value: '~c2~', type: EnvironmentVariableMutatorType.Prepend }] ]); }); }); diff --git a/src/vs/workbench/contrib/terminal/test/common/environmentVariableCollection.test.ts b/src/vs/workbench/contrib/terminal/test/common/environmentVariableCollection.test.ts index eecfdf757b3..528fb863631 100644 --- a/src/vs/workbench/contrib/terminal/test/common/environmentVariableCollection.test.ts +++ b/src/vs/workbench/contrib/terminal/test/common/environmentVariableCollection.test.ts @@ -16,31 +16,31 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { const merged = new MergedEnvironmentVariableCollection(new Map([ ['ext1', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Prepend, variable: 'A' }] ]) }], ['ext2', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Append, variable: 'A' }] ]) }], ['ext3', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a3', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a3', type: EnvironmentVariableMutatorType.Prepend, variable: 'A' }] ]) }], ['ext4', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a4', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a4', type: EnvironmentVariableMutatorType.Append, variable: 'A' }] ]) }] ])); deepStrictEqual([...merged.getVariableMap(undefined).entries()], [ ['A', [ - { extensionIdentifier: 'ext4', type: EnvironmentVariableMutatorType.Append, value: 'a4', scope: undefined, variable: 'A' }, - { extensionIdentifier: 'ext3', type: EnvironmentVariableMutatorType.Prepend, value: 'a3', scope: undefined, variable: 'A' }, - { extensionIdentifier: 'ext2', type: EnvironmentVariableMutatorType.Append, value: 'a2', scope: undefined, variable: 'A' }, - { extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Prepend, value: 'a1', scope: undefined, variable: 'A' } + { extensionIdentifier: 'ext4', type: EnvironmentVariableMutatorType.Append, value: 'a4', variable: 'A' }, + { extensionIdentifier: 'ext3', type: EnvironmentVariableMutatorType.Prepend, value: 'a3', variable: 'A' }, + { extensionIdentifier: 'ext2', type: EnvironmentVariableMutatorType.Append, value: 'a2', variable: 'A' }, + { extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Prepend, value: 'a1', variable: 'A' } ]] ]); }); @@ -49,30 +49,30 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { const merged = new MergedEnvironmentVariableCollection(new Map([ ['ext1', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Prepend, variable: 'A' }] ]) }], ['ext2', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Append, variable: 'A' }] ]) }], ['ext3', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a3', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a3', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }] ]) }], ['ext4', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a4', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a4', type: EnvironmentVariableMutatorType.Append, variable: 'A' }] ]) }] ])); deepStrictEqual([...merged.getVariableMap(undefined).entries()], [ ['A', [ - { extensionIdentifier: 'ext3', type: EnvironmentVariableMutatorType.Replace, value: 'a3', scope: undefined, variable: 'A' }, - { extensionIdentifier: 'ext2', type: EnvironmentVariableMutatorType.Append, value: 'a2', scope: undefined, variable: 'A' }, - { extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Prepend, value: 'a1', scope: undefined, variable: 'A' } + { extensionIdentifier: 'ext3', type: EnvironmentVariableMutatorType.Replace, value: 'a3', variable: 'A' }, + { extensionIdentifier: 'ext2', type: EnvironmentVariableMutatorType.Append, value: 'a2', variable: 'A' }, + { extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Prepend, value: 'a1', variable: 'A' } ]] ], 'The ext4 entry should be removed as it comes after a Replace'); }); @@ -88,7 +88,7 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { }], ['ext2', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Append, variable: 'A' }] ]) }], ['ext3', { @@ -98,15 +98,15 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { }], ['ext4', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a4', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a4', type: EnvironmentVariableMutatorType.Append, variable: 'A' }] ]) }] ])); deepStrictEqual([...merged.getVariableMap(scope2).entries()], [ ['A', [ - { extensionIdentifier: 'ext4', type: EnvironmentVariableMutatorType.Append, value: 'a4', scope: undefined, variable: 'A' }, + { extensionIdentifier: 'ext4', type: EnvironmentVariableMutatorType.Append, value: 'a4', variable: 'A' }, { extensionIdentifier: 'ext3', type: EnvironmentVariableMutatorType.Prepend, value: 'a3', scope: scope2, variable: 'A' }, - { extensionIdentifier: 'ext2', type: EnvironmentVariableMutatorType.Append, value: 'a2', scope: undefined, variable: 'A' }, + { extensionIdentifier: 'ext2', type: EnvironmentVariableMutatorType.Append, value: 'a2', variable: 'A' }, ]] ]); }); @@ -122,7 +122,7 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { }], ['ext2', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Append, variable: 'A' }] ]) }], ['ext3', { @@ -132,14 +132,14 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { }], ['ext4', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a4', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a4', type: EnvironmentVariableMutatorType.Append, variable: 'A' }] ]) }] ])); deepStrictEqual([...merged.getVariableMap(undefined).entries()], [ ['A', [ - { extensionIdentifier: 'ext4', type: EnvironmentVariableMutatorType.Append, value: 'a4', scope: undefined, variable: 'A' }, - { extensionIdentifier: 'ext2', type: EnvironmentVariableMutatorType.Append, value: 'a2', scope: undefined, variable: 'A' }, + { extensionIdentifier: 'ext4', type: EnvironmentVariableMutatorType.Append, value: 'a4', variable: 'A' }, + { extensionIdentifier: 'ext2', type: EnvironmentVariableMutatorType.Append, value: 'a2', variable: 'A' }, ]] ]); }); @@ -151,9 +151,9 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { const merged = new MergedEnvironmentVariableCollection(new Map([ ['ext', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }], - ['B', { value: 'b', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'B' }], - ['C', { value: 'c', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'C' }] + ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }], + ['B', { value: 'b', type: EnvironmentVariableMutatorType.Append, variable: 'B' }], + ['C', { value: 'c', type: EnvironmentVariableMutatorType.Prepend, variable: 'C' }] ]) }] ])); @@ -178,7 +178,7 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { map: deserializeEnvironmentVariableCollection([ ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, scope: scope1, variable: 'A' }], ['B', { value: 'b', type: EnvironmentVariableMutatorType.Append, scope: scope2, variable: 'B' }], - ['C', { value: 'c', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'C' }] + ['C', { value: 'c', type: EnvironmentVariableMutatorType.Prepend, variable: 'C' }] ]) }] ])); @@ -199,9 +199,9 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { const merged = new MergedEnvironmentVariableCollection(new Map([ ['ext', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }], - ['B', { value: 'b', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'B' }], - ['C', { value: 'c', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'C' }] + ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }], + ['B', { value: 'b', type: EnvironmentVariableMutatorType.Append, variable: 'B' }], + ['C', { value: 'c', type: EnvironmentVariableMutatorType.Prepend, variable: 'C' }] ]) }] ])); @@ -218,9 +218,9 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { const merged = new MergedEnvironmentVariableCollection(new Map([ ['ext', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'a' }], - ['b', { value: 'b', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'b' }], - ['c', { value: 'c', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'c' }] + ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, variable: 'a' }], + ['b', { value: 'b', type: EnvironmentVariableMutatorType.Append, variable: 'b' }], + ['c', { value: 'c', type: EnvironmentVariableMutatorType.Prepend, variable: 'c' }] ]) }] ])); @@ -254,14 +254,14 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { const merged1 = new MergedEnvironmentVariableCollection(new Map([ ['ext1', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }] ]) }] ])); const merged2 = new MergedEnvironmentVariableCollection(new Map([ ['ext1', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }] ]) }] ])); @@ -273,7 +273,7 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { const merged2 = new MergedEnvironmentVariableCollection(new Map([ ['ext1', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }] ]) }] ])); @@ -282,7 +282,7 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { strictEqual(diff.removed.size, 0); const entries = [...diff.added.entries()]; deepStrictEqual(entries, [ - ['A', [{ extensionIdentifier: 'ext1', value: 'a', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }]] + ['A', [{ extensionIdentifier: 'ext1', value: 'a', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }]] ]); }); @@ -290,15 +290,15 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { const merged1 = new MergedEnvironmentVariableCollection(new Map([ ['ext1', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }] ]) }] ])); const merged2 = new MergedEnvironmentVariableCollection(new Map([ ['ext1', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }], - ['B', { value: 'b', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'B' }] + ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }], + ['B', { value: 'b', type: EnvironmentVariableMutatorType.Append, variable: 'B' }] ]) }] ])); @@ -307,7 +307,7 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { strictEqual(diff.removed.size, 0); const entries = [...diff.added.entries()]; deepStrictEqual(entries, [ - ['B', [{ extensionIdentifier: 'ext1', value: 'b', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'B' }]] + ['B', [{ extensionIdentifier: 'ext1', value: 'b', type: EnvironmentVariableMutatorType.Append, variable: 'B' }]] ]); }); @@ -315,7 +315,7 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { const merged1 = new MergedEnvironmentVariableCollection(new Map([ ['ext1', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Prepend, variable: 'A' }] ]) }] ])); @@ -323,12 +323,12 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { const merged2 = new MergedEnvironmentVariableCollection(new Map([ ['ext2', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Append, variable: 'A' }] ]) }], ['ext1', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Prepend, variable: 'A' }] ]) }] ])); @@ -336,19 +336,19 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { strictEqual(diff.changed.size, 0); strictEqual(diff.removed.size, 0); deepStrictEqual([...diff.added.entries()], [ - ['A', [{ extensionIdentifier: 'ext2', value: 'a2', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'A' }]] + ['A', [{ extensionIdentifier: 'ext2', value: 'a2', type: EnvironmentVariableMutatorType.Append, variable: 'A' }]] ]); const merged3 = new MergedEnvironmentVariableCollection(new Map([ ['ext1', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Prepend, variable: 'A' }] ]) }], // This entry should get removed ['ext2', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Append, variable: 'A' }] ]) }] ])); @@ -362,20 +362,20 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { const merged1 = new MergedEnvironmentVariableCollection(new Map([ ['ext1', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }] ]) }] ])); const merged4 = new MergedEnvironmentVariableCollection(new Map([ ['ext1', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }] ]) }], // This entry should get removed as it comes after a replace ['ext2', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Append, variable: 'A' }] ]) }] ])); @@ -387,15 +387,15 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { const merged1 = new MergedEnvironmentVariableCollection(new Map([ ['ext1', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }], - ['B', { value: 'b', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'B' }] + ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }], + ['B', { value: 'b', type: EnvironmentVariableMutatorType.Replace, variable: 'B' }] ]) }] ])); const merged2 = new MergedEnvironmentVariableCollection(new Map([ ['ext1', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }] + ['A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }] ]) }] ])); @@ -403,7 +403,7 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { strictEqual(diff.changed.size, 0); strictEqual(diff.added.size, 0); deepStrictEqual([...diff.removed.entries()], [ - ['B', [{ extensionIdentifier: 'ext1', value: 'b', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'B' }]] + ['B', [{ extensionIdentifier: 'ext1', value: 'b', type: EnvironmentVariableMutatorType.Replace, variable: 'B' }]] ]); }); @@ -411,16 +411,16 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { const merged1 = new MergedEnvironmentVariableCollection(new Map([ ['ext1', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }], - ['B', { value: 'b', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'B' }] + ['A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }], + ['B', { value: 'b', type: EnvironmentVariableMutatorType.Replace, variable: 'B' }] ]) }] ])); const merged2 = new MergedEnvironmentVariableCollection(new Map([ ['ext1', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }], - ['B', { value: 'b', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'B' }] + ['A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }], + ['B', { value: 'b', type: EnvironmentVariableMutatorType.Append, variable: 'B' }] ]) }] ])); @@ -428,8 +428,8 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { strictEqual(diff.added.size, 0); strictEqual(diff.removed.size, 0); deepStrictEqual([...diff.changed.entries()], [ - ['A', [{ extensionIdentifier: 'ext1', value: 'a2', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }]], - ['B', [{ extensionIdentifier: 'ext1', value: 'b', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'B' }]] + ['A', [{ extensionIdentifier: 'ext1', value: 'a2', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }]], + ['B', [{ extensionIdentifier: 'ext1', value: 'b', type: EnvironmentVariableMutatorType.Append, variable: 'B' }]] ]); }); @@ -437,28 +437,28 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { const merged1 = new MergedEnvironmentVariableCollection(new Map([ ['ext1', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }], - ['B', { value: 'b', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'B' }] + ['A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }], + ['B', { value: 'b', type: EnvironmentVariableMutatorType.Prepend, variable: 'B' }] ]) }] ])); const merged2 = new MergedEnvironmentVariableCollection(new Map([ ['ext1', { map: deserializeEnvironmentVariableCollection([ - ['A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }], - ['C', { value: 'c', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'C' }] + ['A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }], + ['C', { value: 'c', type: EnvironmentVariableMutatorType.Append, variable: 'C' }] ]) }] ])); const diff = merged1.diff(merged2, undefined)!; deepStrictEqual([...diff.added.entries()], [ - ['C', [{ extensionIdentifier: 'ext1', value: 'c', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'C' }]], + ['C', [{ extensionIdentifier: 'ext1', value: 'c', type: EnvironmentVariableMutatorType.Append, variable: 'C' }]], ]); deepStrictEqual([...diff.removed.entries()], [ - ['B', [{ extensionIdentifier: 'ext1', value: 'b', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'B' }]] + ['B', [{ extensionIdentifier: 'ext1', value: 'b', type: EnvironmentVariableMutatorType.Prepend, variable: 'B' }]] ]); deepStrictEqual([...diff.changed.entries()], [ - ['A', [{ extensionIdentifier: 'ext1', value: 'a2', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }]] + ['A', [{ extensionIdentifier: 'ext1', value: 'a2', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }]] ]); }); @@ -469,7 +469,7 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { ['ext1', { map: deserializeEnvironmentVariableCollection([ ['A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Replace, scope: scope1, variable: 'A' }], - ['B', { value: 'b', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'B' }] + ['B', { value: 'b', type: EnvironmentVariableMutatorType.Prepend, variable: 'B' }] ]) }] ])); @@ -484,7 +484,7 @@ suite('EnvironmentVariable - MergedEnvironmentVariableCollection', () => { const diff = merged1.diff(merged2, scope1)!; strictEqual(diff.added.size, 0); deepStrictEqual([...diff.removed.entries()], [ - ['B', [{ extensionIdentifier: 'ext1', value: 'b', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'B' }]] + ['B', [{ extensionIdentifier: 'ext1', value: 'b', type: EnvironmentVariableMutatorType.Prepend, variable: 'B' }]] ]); deepStrictEqual([...diff.changed.entries()], [ ['A', [{ extensionIdentifier: 'ext1', value: 'a2', type: EnvironmentVariableMutatorType.Replace, scope: scope1, variable: 'A' }]] diff --git a/src/vs/workbench/contrib/terminal/test/common/environmentVariableService.test.ts b/src/vs/workbench/contrib/terminal/test/common/environmentVariableService.test.ts index 2b31da927a6..c1651e86f9e 100644 --- a/src/vs/workbench/contrib/terminal/test/common/environmentVariableService.test.ts +++ b/src/vs/workbench/contrib/terminal/test/common/environmentVariableService.test.ts @@ -49,23 +49,23 @@ suite('EnvironmentVariable - EnvironmentVariableService', () => { test('should persist collections to the storage service and be able to restore from them', () => { const collection = new Map(); - collection.set('A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }); - collection.set('B-key', { value: 'b', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'B' }); - collection.set('C-key', { value: 'c', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'C' }); + collection.set('A-key', { value: 'a', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }); + collection.set('B-key', { value: 'b', type: EnvironmentVariableMutatorType.Append, variable: 'B' }); + collection.set('C-key', { value: 'c', type: EnvironmentVariableMutatorType.Prepend, variable: 'C' }); environmentVariableService.set('ext1', { map: collection, persistent: true }); deepStrictEqual([...environmentVariableService.mergedCollection.getVariableMap(undefined).entries()], [ - ['A', [{ extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Replace, value: 'a', scope: undefined, variable: 'A' }]], - ['B', [{ extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Append, value: 'b', scope: undefined, variable: 'B' }]], - ['C', [{ extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Prepend, value: 'c', scope: undefined, variable: 'C' }]] + ['A', [{ extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Replace, value: 'a', variable: 'A' }]], + ['B', [{ extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Append, value: 'b', variable: 'B' }]], + ['C', [{ extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Prepend, value: 'c', variable: 'C' }]] ]); // Persist with old service, create a new service with the same storage service to verify restore environmentVariableService.persistCollections(); const service2: TestEnvironmentVariableService = instantiationService.createInstance(TestEnvironmentVariableService); deepStrictEqual([...service2.mergedCollection.getVariableMap(undefined).entries()], [ - ['A', [{ extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Replace, value: 'a', scope: undefined, variable: 'A' }]], - ['B', [{ extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Append, value: 'b', scope: undefined, variable: 'B' }]], - ['C', [{ extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Prepend, value: 'c', scope: undefined, variable: 'C' }]] + ['A', [{ extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Replace, value: 'a', variable: 'A' }]], + ['B', [{ extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Append, value: 'b', variable: 'B' }]], + ['C', [{ extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Prepend, value: 'c', variable: 'C' }]] ]); }); @@ -74,21 +74,21 @@ suite('EnvironmentVariable - EnvironmentVariableService', () => { const collection1 = new Map(); const collection2 = new Map(); const collection3 = new Map(); - collection1.set('A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'A' }); - collection1.set('B-key', { value: 'b1', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'B' }); - collection2.set('A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }); - collection2.set('B-key', { value: 'b2', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'B' }); - collection3.set('A-key', { value: 'a3', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'A' }); - collection3.set('B-key', { value: 'b3', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'B' }); + collection1.set('A-key', { value: 'a1', type: EnvironmentVariableMutatorType.Append, variable: 'A' }); + collection1.set('B-key', { value: 'b1', type: EnvironmentVariableMutatorType.Replace, variable: 'B' }); + collection2.set('A-key', { value: 'a2', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }); + collection2.set('B-key', { value: 'b2', type: EnvironmentVariableMutatorType.Append, variable: 'B' }); + collection3.set('A-key', { value: 'a3', type: EnvironmentVariableMutatorType.Prepend, variable: 'A' }); + collection3.set('B-key', { value: 'b3', type: EnvironmentVariableMutatorType.Replace, variable: 'B' }); environmentVariableService.set('ext1', { map: collection1, persistent: true }); environmentVariableService.set('ext2', { map: collection2, persistent: true }); environmentVariableService.set('ext3', { map: collection3, persistent: true }); deepStrictEqual([...environmentVariableService.mergedCollection.getVariableMap(undefined).entries()], [ ['A', [ - { extensionIdentifier: 'ext2', type: EnvironmentVariableMutatorType.Replace, value: 'a2', scope: undefined, variable: 'A' }, - { extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Append, value: 'a1', scope: undefined, variable: 'A' } + { extensionIdentifier: 'ext2', type: EnvironmentVariableMutatorType.Replace, value: 'a2', variable: 'A' }, + { extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Append, value: 'a1', variable: 'A' } ]], - ['B', [{ extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Replace, value: 'b1', scope: undefined, variable: 'B' }]] + ['B', [{ extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Replace, value: 'b1', variable: 'B' }]] ]); }); @@ -96,9 +96,9 @@ suite('EnvironmentVariable - EnvironmentVariableService', () => { const collection1 = new Map(); const collection2 = new Map(); const collection3 = new Map(); - collection1.set('A-key', { value: ':a1', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'A' }); - collection2.set('A-key', { value: 'a2:', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'A' }); - collection3.set('A-key', { value: 'a3', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }); + collection1.set('A-key', { value: ':a1', type: EnvironmentVariableMutatorType.Append, variable: 'A' }); + collection2.set('A-key', { value: 'a2:', type: EnvironmentVariableMutatorType.Prepend, variable: 'A' }); + collection3.set('A-key', { value: 'a3', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }); environmentVariableService.set('ext1', { map: collection1, persistent: true }); environmentVariableService.set('ext2', { map: collection2, persistent: true }); environmentVariableService.set('ext3', { map: collection3, persistent: true }); @@ -106,9 +106,9 @@ suite('EnvironmentVariable - EnvironmentVariableService', () => { // The entries should be ordered in the order they are applied deepStrictEqual([...environmentVariableService.mergedCollection.getVariableMap(undefined).entries()], [ ['A', [ - { extensionIdentifier: 'ext3', type: EnvironmentVariableMutatorType.Replace, value: 'a3', scope: undefined, variable: 'A' }, - { extensionIdentifier: 'ext2', type: EnvironmentVariableMutatorType.Prepend, value: 'a2:', scope: undefined, variable: 'A' }, - { extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Append, value: ':a1', scope: undefined, variable: 'A' } + { extensionIdentifier: 'ext3', type: EnvironmentVariableMutatorType.Replace, value: 'a3', variable: 'A' }, + { extensionIdentifier: 'ext2', type: EnvironmentVariableMutatorType.Prepend, value: 'a2:', variable: 'A' }, + { extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Append, value: ':a1', variable: 'A' } ]] ]); @@ -125,7 +125,7 @@ suite('EnvironmentVariable - EnvironmentVariableService', () => { const collection2 = new Map(); const collection3 = new Map(); collection1.set('A-key', { value: ':a1', type: EnvironmentVariableMutatorType.Append, scope: scope1, variable: 'A' }); - collection2.set('A-key', { value: 'a2:', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'A' }); + collection2.set('A-key', { value: 'a2:', type: EnvironmentVariableMutatorType.Prepend, variable: 'A' }); collection3.set('A-key', { value: 'a3', type: EnvironmentVariableMutatorType.Replace, scope: scope2, variable: 'A' }); environmentVariableService.set('ext1', { map: collection1, persistent: true }); environmentVariableService.set('ext2', { map: collection2, persistent: true }); @@ -134,7 +134,7 @@ suite('EnvironmentVariable - EnvironmentVariableService', () => { // The entries should be ordered in the order they are applied deepStrictEqual([...environmentVariableService.mergedCollection.getVariableMap(scope1).entries()], [ ['A', [ - { extensionIdentifier: 'ext2', type: EnvironmentVariableMutatorType.Prepend, value: 'a2:', scope: undefined, variable: 'A' }, + { extensionIdentifier: 'ext2', type: EnvironmentVariableMutatorType.Prepend, value: 'a2:', variable: 'A' }, { extensionIdentifier: 'ext1', type: EnvironmentVariableMutatorType.Append, value: ':a1', scope: scope1, variable: 'A' } ]] ]); diff --git a/src/vs/workbench/contrib/terminal/test/common/environmentVariableShared.test.ts b/src/vs/workbench/contrib/terminal/test/common/environmentVariableShared.test.ts index 6ccf1005e6c..d3fb2177556 100644 --- a/src/vs/workbench/contrib/terminal/test/common/environmentVariableShared.test.ts +++ b/src/vs/workbench/contrib/terminal/test/common/environmentVariableShared.test.ts @@ -10,15 +10,15 @@ import { EnvironmentVariableMutatorType, IEnvironmentVariableMutator } from 'vs/ suite('EnvironmentVariable - deserializeEnvironmentVariableCollection', () => { test('should construct correctly with 3 arguments', () => { const c = deserializeEnvironmentVariableCollection([ - ['A', { value: 'a', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }], - ['B', { value: 'b', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'B' }], - ['C', { value: 'c', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'C' }] + ['A', { value: 'a', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }], + ['B', { value: 'b', type: EnvironmentVariableMutatorType.Append, variable: 'B' }], + ['C', { value: 'c', type: EnvironmentVariableMutatorType.Prepend, variable: 'C' }] ]); const keys = [...c.keys()]; deepStrictEqual(keys, ['A', 'B', 'C']); - deepStrictEqual(c.get('A'), { value: 'a', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }); - deepStrictEqual(c.get('B'), { value: 'b', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'B' }); - deepStrictEqual(c.get('C'), { value: 'c', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'C' }); + deepStrictEqual(c.get('A'), { value: 'a', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }); + deepStrictEqual(c.get('B'), { value: 'b', type: EnvironmentVariableMutatorType.Append, variable: 'B' }); + deepStrictEqual(c.get('C'), { value: 'c', type: EnvironmentVariableMutatorType.Prepend, variable: 'C' }); }); }); @@ -26,13 +26,13 @@ suite('EnvironmentVariable - serializeEnvironmentVariableCollection', () => { test('should correctly serialize the object', () => { const collection = new Map(); deepStrictEqual(serializeEnvironmentVariableCollection(collection), []); - collection.set('A', { value: 'a', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }); - collection.set('B', { value: 'b', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'B' }); - collection.set('C', { value: 'c', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'C' }); + collection.set('A', { value: 'a', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }); + collection.set('B', { value: 'b', type: EnvironmentVariableMutatorType.Append, variable: 'B' }); + collection.set('C', { value: 'c', type: EnvironmentVariableMutatorType.Prepend, variable: 'C' }); deepStrictEqual(serializeEnvironmentVariableCollection(collection), [ - ['A', { value: 'a', type: EnvironmentVariableMutatorType.Replace, scope: undefined, variable: 'A' }], - ['B', { value: 'b', type: EnvironmentVariableMutatorType.Append, scope: undefined, variable: 'B' }], - ['C', { value: 'c', type: EnvironmentVariableMutatorType.Prepend, scope: undefined, variable: 'C' }] + ['A', { value: 'a', type: EnvironmentVariableMutatorType.Replace, variable: 'A' }], + ['B', { value: 'b', type: EnvironmentVariableMutatorType.Append, variable: 'B' }], + ['C', { value: 'c', type: EnvironmentVariableMutatorType.Prepend, variable: 'C' }] ]); }); });