mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
watcher - add test for atomic writes
This commit is contained in:
parent
b9cf83f70b
commit
8ce7d13c88
|
@ -115,7 +115,7 @@ flakySuite('Recursive Watcher (parcel)', () => {
|
|||
if (failOnEventReason) {
|
||||
reject(new Error(`Unexpected file event: ${failOnEventReason}`));
|
||||
} else {
|
||||
resolve();
|
||||
setImmediate(() => resolve()); // copied from parcel watcher tests, seems to drop unrelated events on macOS
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -272,6 +272,17 @@ flakySuite('Recursive Watcher (parcel)', () => {
|
|||
await changeFuture;
|
||||
});
|
||||
|
||||
(isMacintosh /* this test seems not possible with fsevents backend */ ? test.skip : test)('basics (atomic writes)', async function () {
|
||||
await service.watch([{ path: testDir, excludes: [] }]);
|
||||
|
||||
// Delete + Recreate file
|
||||
const newFilePath = join(testDir, 'deep', 'conway.js');
|
||||
let changeFuture: Promise<unknown> = awaitEvent(service, newFilePath, FileChangeType.UPDATED);
|
||||
await Promises.unlink(newFilePath);
|
||||
Promises.writeFile(newFilePath, 'Hello Atomic World');
|
||||
await changeFuture;
|
||||
});
|
||||
|
||||
(!isLinux /* polling is only used in linux environments (WSL) */ ? test.skip : test)('basics (polling)', async function () {
|
||||
await service.watch([{ path: testDir, excludes: [], pollingInterval: 100 }]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue