Prevent false positives in isDependentPath
MODIFY
internal/core/server/commands/check.test.ts
internal/core/server/commands/check.test.ts
@@ -28,3 +28,27 @@ test(
},
),
);
+
+test(
+ "only checks files matching arguments",
+ createIntegrationTest(
+ {
+ files: {
+ "foo.js": "let foo",
+ "bar.js": "let bar",
+ },
+ },
+ async (t, {client}) => {
+ const res = await client.query({
+ commandName: "check",
+ args: ["foo.js"],
+ commandFlags: {apply: true},
+ });
+
+ t.true(res.type === "DIAGNOSTICS");
+ if (res.type === "DIAGNOSTICS") {
+ t.true(res.diagnostics.length === 1);
+ }
+ },
+ ),
+);

MODIFY
internal/core/server/fs/glob.ts
internal/core/server/fs/glob.ts
@@ -200,7 +200,7 @@ class GlobberWatcher {
isDependentPath(path: AbsoluteFilePath): boolean {
for (const arg of this.args) {
- if (path.equal(path) || path.isRelativeTo(arg)) {
+ if (path.equal(arg) || path.isRelativeTo(arg)) {
return true;
}
}

Prevent false positives in isDependentPath (#998)