Skip to content

Commit fcfec8c

Browse files
authored
Reduce timeout for symlink Watching tests (microsoft#58000)
1 parent 26358d2 commit fcfec8c

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

src/testRunner/unittests/sys/symlinkWatching.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ describe("unittests:: sys:: symlinkWatching::", () => {
121121
verifyEventAndFileNames(`${opType}:: link`, linkResult.actual, expectedResult);
122122
}
123123
deferred.resolve();
124-
}, 4000);
124+
}, !!process.env.CI ? 1000 : 500);
125125
return deferred.promise;
126126
}
127127

@@ -150,6 +150,19 @@ describe("unittests:: sys:: symlinkWatching::", () => {
150150
(ts.isString(expected.event) ? actual.event === expected.event : ts.contains(expected.event, actual.event));
151151
}
152152

153+
function osFlavorToString(osFlavor: TestServerHostOsFlavor) {
154+
switch (osFlavor) {
155+
case TestServerHostOsFlavor.Windows:
156+
return "Windows";
157+
case TestServerHostOsFlavor.MacOs:
158+
return "MacOs";
159+
case TestServerHostOsFlavor.Linux:
160+
return "Linux";
161+
default:
162+
ts.Debug.assertNever(osFlavor);
163+
}
164+
}
165+
153166
interface FsEventsForWatchDirectory extends Record<string, readonly ExpectedEventAndFileName[] | undefined> {
154167
// The first time events are most of the time are not predictable, so just create random file for that reason
155168
init?: readonly ExpectedEventAndFileName[];
@@ -169,7 +182,7 @@ describe("unittests:: sys:: symlinkWatching::", () => {
169182
link: string,
170183
osFlavor: TestServerHostOsFlavor,
171184
) {
172-
it(`watchDirectory using fsEvents`, async () => {
185+
it(`watchDirectory using fsEvents ${osFlavorToString(osFlavor)}`, async () => {
173186
const tableOfEvents: FsEventsForWatchDirectory = osFlavor === TestServerHostOsFlavor.MacOs ?
174187
{
175188
fileCreate: [
@@ -443,7 +456,7 @@ describe("unittests:: sys:: symlinkWatching::", () => {
443456
parallelLinkFileDelete: undefined,
444457
};
445458

446-
it(`recursive watchDirectory using fsEvents`, async () => {
459+
it(`recursive watchDirectory using fsEvents ${osFlavorToString(osFlavor)}`, async () => {
447460
await testWatchDirectoryOperations(
448461
sys,
449462
fsWatch,
@@ -466,7 +479,7 @@ describe("unittests:: sys:: symlinkWatching::", () => {
466479
);
467480
});
468481

469-
it(`recursive watchDirectory using fsEvents when linked in same folder`, async () => {
482+
it(`recursive watchDirectory using fsEvents when linked in same folder ${osFlavorToString(osFlavor)}`, async () => {
470483
await testWatchDirectoryOperations(
471484
sys,
472485
fsWatch,
@@ -485,7 +498,7 @@ describe("unittests:: sys:: symlinkWatching::", () => {
485498
);
486499
});
487500

488-
it(`recursive watchDirectory using fsEvents when links not in directory`, async () => {
501+
it(`recursive watchDirectory using fsEvents when links not in directory ${osFlavorToString(osFlavor)}`, async () => {
489502
await testWatchDirectoryOperations(
490503
sys,
491504
fsWatch,

0 commit comments

Comments
 (0)