mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 01:39:28 -06:00
Process only existing files and directories in the test harness
`fs.statSync` throws `ENOENT` if there is a symlink to a nonexistent target. This can be avoided by checking that the entry exists before using it. (This is annoying when editing tests in Emacs, since it keeps lock files for modified-but-unsaved files, which are `.#foo` symlinks to a nonexistent target.)
This commit is contained in:
parent
b0c2860a68
commit
716441d343
@ -72,6 +72,7 @@ namespace Harness {
|
||||
|
||||
for (const file of fs.readdirSync(folder)) {
|
||||
const pathToFile = pathModule.join(folder, file);
|
||||
if (!fs.existsSync(pathToFile)) continue; // ignore invalid symlinks
|
||||
const stat = fs.statSync(pathToFile);
|
||||
if (options.recursive && stat.isDirectory()) {
|
||||
paths = paths.concat(filesInFolder(pathToFile));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user