Skip to content

Commit

Permalink
Add tests for inode watching by making fsWatch part of system functio…
Browse files Browse the repository at this point in the history
…n that tests presence before creating fs watch
  • Loading branch information
sheetalkamat committed May 6, 2022
1 parent 884678e commit 03fa5b3
Show file tree
Hide file tree
Showing 337 changed files with 3,931 additions and 3,576 deletions.
307 changes: 160 additions & 147 deletions src/compiler/sys.ts

Large diffs are not rendered by default.

153 changes: 84 additions & 69 deletions src/harness/virtualFileSystemWithWatch.ts

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions src/testRunner/unittests/tscWatch/watchEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,5 +581,41 @@ namespace ts.tscWatch {
verifyWorker("-extendedDiagnostics");
});
});

describe("with fsWatch on inodes", () => {
verifyTscWatch({
scenario,
subScenario: `fsWatch/when using file watching thats on inode`,
commandLineArgs: ["-w", "--extendedDiagnostics"],
sys: () => {
const configFile: File = {
path: `${projectRoot}/tsconfig.json`,
content: JSON.stringify({ watchOptions: { watchFile: "useFsEvents" }, files: ["foo.d.ts", "main.ts"] })
};
const main: File = {
path: `${projectRoot}/main.ts`,
content: `import { foo } from "./foo"; foo();`
};
const foo: File = {
path: `${projectRoot}/foo.d.ts`,
content: `export function foo(): string;`
};
const files = [libFile, main, foo, configFile];
return createWatchedSystem(files, { currentDirectory: projectRoot, inodeWatching: true });
},
changes: [
{
caption: "Replace file with rename event that introduces error",
change: sys => sys.modifyFile(`${projectRoot}/foo.d.ts`, `export function foo2(): string;`, { invokeFileDeleteCreateAsPartInsteadOfChange: true }),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2),
},
{
caption: "Replace file with rename event that fixes error",
change: sys => sys.modifyFile(`${projectRoot}/foo.d.ts`, `export function foo(): string;`, { invokeFileDeleteCreateAsPartInsteadOfChange: true }),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2),
},
]
});
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,11 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/demo/core:
{"directoryName":"/user/username/projects/demo/core","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/demo/core"}
/user/username/projects/demo/animals:
{"directoryName":"/user/username/projects/demo/animals","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/demo/animals"}
/user/username/projects/demo/zoo:
{"directoryName":"/user/username/projects/demo/zoo","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/demo/zoo"}

exitCode:: ExitStatus.undefined

Expand Down Expand Up @@ -543,11 +543,11 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/demo/core:
{"directoryName":"/user/username/projects/demo/core","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/demo/core"}
/user/username/projects/demo/animals:
{"directoryName":"/user/username/projects/demo/animals","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/demo/animals"}
/user/username/projects/demo/zoo:
{"directoryName":"/user/username/projects/demo/zoo","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/demo/zoo"}

exitCode:: ExitStatus.undefined

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/demo/animals:
{"directoryName":"/user/username/projects/demo/animals","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/demo/animals"}
/user/username/projects/demo/zoo:
{"directoryName":"/user/username/projects/demo/zoo","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/demo/zoo"}
/user/username/projects/demo/core:
{"directoryName":"/user/username/projects/demo/core","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/demo/core"}

exitCode:: ExitStatus.undefined

Expand Down Expand Up @@ -324,11 +324,11 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/demo/animals:
{"directoryName":"/user/username/projects/demo/animals","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/demo/animals"}
/user/username/projects/demo/zoo:
{"directoryName":"/user/username/projects/demo/zoo","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/demo/zoo"}
/user/username/projects/demo/core:
{"directoryName":"/user/username/projects/demo/core","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/demo/core"}

exitCode:: ExitStatus.undefined

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject/packages/pkg2:
{"directoryName":"/user/username/projects/myproject/packages/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject/packages/pkg2"}
/user/username/projects/myproject/packages/pkg1:
{"directoryName":"/user/username/projects/myproject/packages/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject/packages/pkg1"}

exitCode:: ExitStatus.undefined

Expand Down Expand Up @@ -355,9 +355,9 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject/packages/pkg2:
{"directoryName":"/user/username/projects/myproject/packages/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject/packages/pkg2"}
/user/username/projects/myproject/packages/pkg1:
{"directoryName":"/user/username/projects/myproject/packages/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject/packages/pkg1"}

exitCode:: ExitStatus.undefined

Expand Down Expand Up @@ -457,9 +457,9 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject/packages/pkg2:
{"directoryName":"/user/username/projects/myproject/packages/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject/packages/pkg2"}
/user/username/projects/myproject/packages/pkg1:
{"directoryName":"/user/username/projects/myproject/packages/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject/packages/pkg1"}

exitCode:: ExitStatus.undefined

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject/packages/pkg2:
{"directoryName":"/user/username/projects/myproject/packages/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject/packages/pkg2"}
/user/username/projects/myproject/packages/pkg1:
{"directoryName":"/user/username/projects/myproject/packages/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject/packages/pkg1"}

exitCode:: ExitStatus.undefined

Expand Down Expand Up @@ -374,9 +374,9 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject/packages/pkg2:
{"directoryName":"/user/username/projects/myproject/packages/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject/packages/pkg2"}
/user/username/projects/myproject/packages/pkg1:
{"directoryName":"/user/username/projects/myproject/packages/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject/packages/pkg1"}

exitCode:: ExitStatus.undefined

Expand Down Expand Up @@ -483,9 +483,9 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject/packages/pkg2:
{"directoryName":"/user/username/projects/myproject/packages/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject/packages/pkg2"}
/user/username/projects/myproject/packages/pkg1:
{"directoryName":"/user/username/projects/myproject/packages/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject/packages/pkg1"}

exitCode:: ExitStatus.undefined

Expand Down Expand Up @@ -604,9 +604,9 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject/packages/pkg2:
{"directoryName":"/user/username/projects/myproject/packages/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject/packages/pkg2"}
/user/username/projects/myproject/packages/pkg1:
{"directoryName":"/user/username/projects/myproject/packages/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject/packages/pkg1"}

exitCode:: ExitStatus.undefined

Expand Down Expand Up @@ -692,9 +692,9 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject/packages/pkg2:
{"directoryName":"/user/username/projects/myproject/packages/pkg2","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject/packages/pkg2"}
/user/username/projects/myproject/packages/pkg1:
{"directoryName":"/user/username/projects/myproject/packages/pkg1","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject/packages/pkg1"}

exitCode:: ExitStatus.undefined

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject:
{"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject"}

exitCode:: ExitStatus.undefined

Expand Down Expand Up @@ -164,7 +164,7 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject:
{"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject"}

exitCode:: ExitStatus.undefined

Expand Down Expand Up @@ -217,7 +217,7 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject:
{"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject"}

exitCode:: ExitStatus.undefined

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject:
{"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject"}

exitCode:: ExitStatus.undefined

Expand Down Expand Up @@ -116,7 +116,7 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject:
{"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject"}

exitCode:: ExitStatus.undefined

Expand Down Expand Up @@ -169,7 +169,7 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/myproject:
{"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/myproject"}

exitCode:: ExitStatus.undefined

Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ FsWatches::
FsWatchesRecursive::
/user/username/projects/noemitonerror:
{"directoryName":"/user/username/projects/noemitonerror","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/noemitonerror"}
exitCode:: ExitStatus.undefined
Expand Down Expand Up @@ -141,7 +141,7 @@ FsWatches::
FsWatchesRecursive::
/user/username/projects/noemitonerror:
{"directoryName":"/user/username/projects/noemitonerror","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/noemitonerror"}
exitCode:: ExitStatus.undefined
Expand Down Expand Up @@ -203,7 +203,7 @@ FsWatches::
FsWatchesRecursive::
/user/username/projects/noemitonerror:
{"directoryName":"/user/username/projects/noemitonerror","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/noemitonerror"}
exitCode:: ExitStatus.undefined
Expand Down Expand Up @@ -338,7 +338,7 @@ FsWatches::
FsWatchesRecursive::
/user/username/projects/noemitonerror:
{"directoryName":"/user/username/projects/noemitonerror","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/noemitonerror"}
exitCode:: ExitStatus.undefined
Expand Down Expand Up @@ -467,7 +467,7 @@ FsWatches::
FsWatchesRecursive::
/user/username/projects/noemitonerror:
{"directoryName":"/user/username/projects/noemitonerror","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/noemitonerror"}
exitCode:: ExitStatus.undefined
Expand Down Expand Up @@ -523,7 +523,7 @@ FsWatches::
FsWatchesRecursive::
/user/username/projects/noemitonerror:
{"directoryName":"/user/username/projects/noemitonerror","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/noemitonerror"}
exitCode:: ExitStatus.undefined
Expand Down Expand Up @@ -639,7 +639,7 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/noemitonerror:
{"directoryName":"/user/username/projects/noemitonerror","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/noemitonerror"}

exitCode:: ExitStatus.undefined

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ FsWatches::
FsWatchesRecursive::
/user/username/projects/noemitonerror:
{"directoryName":"/user/username/projects/noemitonerror","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/noemitonerror"}
exitCode:: ExitStatus.undefined
Expand Down Expand Up @@ -141,7 +141,7 @@ FsWatches::
FsWatchesRecursive::
/user/username/projects/noemitonerror:
{"directoryName":"/user/username/projects/noemitonerror","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/noemitonerror"}
exitCode:: ExitStatus.undefined
Expand Down Expand Up @@ -203,7 +203,7 @@ FsWatches::
FsWatchesRecursive::
/user/username/projects/noemitonerror:
{"directoryName":"/user/username/projects/noemitonerror","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/noemitonerror"}
exitCode:: ExitStatus.undefined
Expand Down Expand Up @@ -281,7 +281,7 @@ FsWatches::
FsWatchesRecursive::
/user/username/projects/noemitonerror:
{"directoryName":"/user/username/projects/noemitonerror","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/noemitonerror"}
exitCode:: ExitStatus.undefined
Expand Down Expand Up @@ -335,7 +335,7 @@ FsWatches::
FsWatchesRecursive::
/user/username/projects/noemitonerror:
{"directoryName":"/user/username/projects/noemitonerror","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/noemitonerror"}
exitCode:: ExitStatus.undefined
Expand Down Expand Up @@ -391,7 +391,7 @@ FsWatches::
FsWatchesRecursive::
/user/username/projects/noemitonerror:
{"directoryName":"/user/username/projects/noemitonerror","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/noemitonerror"}
exitCode:: ExitStatus.undefined
Expand Down Expand Up @@ -450,7 +450,7 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/noemitonerror:
{"directoryName":"/user/username/projects/noemitonerror","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/noemitonerror"}

exitCode:: ExitStatus.undefined

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ FsWatches::

FsWatchesRecursive::
/user/username/projects/sample1/core:
{"directoryName":"/user/username/projects/sample1/core","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/sample1/core"}
/user/username/projects/sample1/logic:
{"directoryName":"/user/username/projects/sample1/logic","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
{"directoryName":"/user/username/projects/sample1/logic"}

exitCode:: ExitStatus.undefined

Expand Down
Loading

0 comments on commit 03fa5b3

Please sign in to comment.