Skip to content

Commit 6d13a99

Browse files
committed
fix: fix relative path resolution
1 parent 9dd76e0 commit 6d13a99

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lib/src/matcher.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe("loadMatcher", () => {
6464
expect(pm.isMatch("fail", ["pattern"])).toBe(false);
6565
});
6666

67-
it("throws on unknown matcher", () => {
68-
expect(() => loadMatcher("invalid" as any)).rejects.toThrow(/Unknown matcher/);
67+
it("throws on unknown matcher", async () => {
68+
await expect(() => loadMatcher("invalid" as any)).rejects.toThrow(/Unknown matcher/);
6969
});
7070
});

lib/src/normalizer.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,22 @@ describe("normalizeConfig", () => {
6868
expect(result.rules.patterns["**.id.**"]).toHaveLength(1);
6969
});
7070

71-
it("throws on invalid bracket key", () => {
71+
it("throws on invalid bracket key", async () => {
7272
const config: Config<any> = {
7373
byStrategy: {
7474
merge: ["[a.b]"],
7575
},
7676
};
77-
expect(() => normalizeConfig(config)).rejects.toThrow(/Invalid bracket form/);
77+
await expect(() => normalizeConfig(config)).rejects.toThrow(/Invalid bracket form/);
7878
});
7979

80-
it("throws on empty rule key", () => {
80+
it("throws on empty rule key", async () => {
8181
const config: Config<any> = {
8282
byStrategy: {
8383
merge: ["!"],
8484
},
8585
};
86-
expect(() => normalizeConfig(config)).rejects.toThrow(/Invalid rule key/);
86+
await expect(() => normalizeConfig(config)).rejects.toThrow(/Invalid rule key/);
8787
});
8888

8989
it("expands rules tree into exact entries", async () => {

lib/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const listMatchingFiles = async (options: CollectFilesOptions): Promise<F
6161
if (!/node_modules|\.git/.test(entry.name)) {
6262
await walk(fullPath);
6363
}
64-
} else if (fileFilter(path.relative(fullPath, root))) {
64+
} else if (fileFilter(path.relative(root, fullPath))) {
6565
try {
6666
const content = await fs.readFile(fullPath, "utf8");
6767

0 commit comments

Comments
 (0)