forked from pascalgn/size-label-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Seems since using files API in pascalgn#54, `IGNORED` stopped to work
- Loading branch information
Showing
5 changed files
with
585 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { parseIgnored } from "./index"; | ||
|
||
describe("parseIgnored", () => { | ||
it.each(["", null, undefined, "\r\n", "\n", "#", "#file"])("doesn't ignore when no patterns to ignore provided (%s)", (input) => { | ||
// when | ||
const isIgnored = parseIgnored(input); | ||
|
||
// then | ||
expect(isIgnored("file")).toBe(false); | ||
// always ignored | ||
expect(isIgnored(null)).toBe(true); | ||
expect(isIgnored("/dev/null")).toBe(true); | ||
}); | ||
|
||
it("ignores ordinary patterns", () => { | ||
// when | ||
const isIgnored = parseIgnored("**/src/integration/**\n**/src/test/**\n**/src/testFixtures/**"); | ||
|
||
// then | ||
expect(isIgnored("file")).toBe(false); | ||
expect(isIgnored("src/test/file")).toBe(true); | ||
expect(isIgnored("codebase/src/testFixtures/file")).toBe(true); | ||
}); | ||
|
||
it("accepts negated patterns", () => { | ||
// when | ||
const isIgnored = parseIgnored(".*\n!.gitignore\nyarn.lock\ngenerated/**"); | ||
|
||
// then | ||
expect(isIgnored(".git")).toBe(true); | ||
expect(isIgnored(".gitignore")).toBe(false); | ||
expect(isIgnored("yarn.lock")).toBe(true); | ||
expect(isIgnored("generated/source")).toBe(true); | ||
}); | ||
}); |
Oops, something went wrong.