Skip to content

Fix implicit glob detection when ancestor directory contains . #47418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
@@ -3509,7 +3509,7 @@ namespace ts {
? WatchDirectoryFlags.Recursive : WatchDirectoryFlags.None
};
}
if (isImplicitGlob(spec)) {
if (isImplicitGlob(spec.substring(spec.lastIndexOf(directorySeparator) + 1))) {
return {
key: useCaseSensitiveFileNames ? spec : toFileNameLowerCase(spec),
flags: WatchDirectoryFlags.Recursive
9 changes: 9 additions & 0 deletions src/testRunner/unittests/config/tsconfigParsing.ts
Original file line number Diff line number Diff line change
@@ -412,5 +412,14 @@ namespace ts {
Diagnostics.Compiler_option_0_requires_a_value_of_type_1.code,
/*noLocation*/ true);
});

it("parses wildcard directories even when parent directories have dots", () => {
const parsed = parseConfigFileTextToJson("/foo.bar/tsconfig.json", JSON.stringify({
include: ["src"]
}));

const parsedCommand = parseJsonConfigFileContent(parsed.config, sys, "/foo.bar");
assert.deepEqual(parsedCommand.wildcardDirectories, { "/foo.bar/src": WatchDirectoryFlags.Recursive });
});
Comment on lines +415 to +423
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be worth adding a test for /repo/src/example.com as well? (Dot in the include path, but not in the repo path.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A dot in the last component of the include path is still going to cause a problem—I’m not sure we’ve settled on what the expected behavior for that is.

});
}