Skip to content

Commit 4b2d97d

Browse files
authored
use fake timers to make tests faster (microsoft#151883)
1 parent 07bdf34 commit 4b2d97d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/vs/workbench/services/configuration/test/browser/configurationService.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ suite('WorkspaceConfigurationService - Folder', () => {
12101210
await promise;
12111211
});
12121212

1213-
test('creating workspace settings', async () => {
1213+
test('creating workspace settings', () => runWithFakedTimers({ useFakeTimers: true }, async () => {
12141214
await fileService.writeFile(environmentService.settingsResource, VSBuffer.fromString('{ "configurationService.folder.testSetting": "userValue" }'));
12151215
await testObject.reloadConfiguration();
12161216
await new Promise<void>((c, e) => {
@@ -1222,9 +1222,9 @@ suite('WorkspaceConfigurationService - Folder', () => {
12221222
});
12231223
fileService.writeFile(joinPath(workspaceService.getWorkspace().folders[0].uri, '.vscode', 'settings.json'), VSBuffer.fromString('{ "configurationService.folder.testSetting": "workspaceValue" }')).catch(e);
12241224
});
1225-
});
1225+
}));
12261226

1227-
test('deleting workspace settings', async () => {
1227+
test('deleting workspace settings', () => runWithFakedTimers({ useFakeTimers: true }, async () => {
12281228
await fileService.writeFile(environmentService.settingsResource, VSBuffer.fromString('{ "configurationService.folder.testSetting": "userValue" }'));
12291229
const workspaceSettingsResource = joinPath(workspaceService.getWorkspace().folders[0].uri, '.vscode', 'settings.json');
12301230
await fileService.writeFile(workspaceSettingsResource, VSBuffer.fromString('{ "configurationService.folder.testSetting": "workspaceValue" }'));
@@ -1235,7 +1235,7 @@ suite('WorkspaceConfigurationService - Folder', () => {
12351235
});
12361236
assert.ok(e.affectsConfiguration('configurationService.folder.testSetting'));
12371237
assert.strictEqual(testObject.getValue('configurationService.folder.testSetting'), 'userValue');
1238-
});
1238+
}));
12391239

12401240
test('restricted setting is read from workspace when workspace is trusted', async () => {
12411241
testObject.updateWorkspaceTrust(true);
@@ -1335,15 +1335,15 @@ suite('WorkspaceConfigurationService - Folder', () => {
13351335
assert.ok(event.affectsConfiguration('configurationService.folder.restrictedSetting'));
13361336
});
13371337

1338-
test('adding an restricted setting triggers change event', async () => {
1338+
test('adding an restricted setting triggers change event', () => runWithFakedTimers({ useFakeTimers: true }, async () => {
13391339
await fileService.writeFile(environmentService.settingsResource, VSBuffer.fromString('{ "configurationService.folder.restrictedSetting": "userValue" }'));
13401340
testObject.updateWorkspaceTrust(false);
13411341

13421342
const promise = Event.toPromise(testObject.onDidChangeRestrictedSettings);
13431343
await fileService.writeFile(joinPath(workspaceService.getWorkspace().folders[0].uri, '.vscode', 'settings.json'), VSBuffer.fromString('{ "configurationService.folder.restrictedSetting": "workspaceValue" }'));
13441344

13451345
return promise;
1346-
});
1346+
}));
13471347

13481348
test('remove an unregistered setting', async () => {
13491349
const key = 'configurationService.folder.unknownSetting';

0 commit comments

Comments
 (0)