GeezerVison is showing github.com — fix(scripts): check:changed lints Astro components and runs knip for … · pingdotgg/t3code@8cebee4
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: scripts/check-changed.test.ts +11Lines changed: 11 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -407,6 +407,17 @@ it("checks changed source paths through the Windows launcher", () => { |
407 | 407 | expect(result.stdout).toContain("fixture stderr: lint"); |
408 | 408 | }); |
409 | 409 |
|
| 410 | +it("lints an Astro component and runs knip when only it changed", () => { |
| 411 | + using project = launcherFixture(); |
| 412 | + const page = "packages/example/Page.astro"; |
| 413 | + project.write(page, "---\nconst title = 1;\n---\n<h1>{title}</h1>\n"); |
| 414 | + const result = project.run(); |
| 415 | + expect(result.status, result.stdout + result.stderr).toBe(0); |
| 416 | + const calls = project.calls(); |
| 417 | + expect(calls.find(({ args }) => args[0] === "lint")?.args).toEqual(["lint", page]); |
| 418 | + expect(calls.some(({ args }) => args[0] === "exec" && args[1] === "knip")).toBe(true); |
| 419 | +}); |
| 420 | + |
410 | 421 | it.each(["install", "lint"])("reports a failing %s step with its output", (step) => { |
411 | 422 | using project = launcherFixture(); |
412 | 423 | project.write(project.source, "export const value = 2;\n"); |
|
Collapse file
Copy file name to clipboardExpand all lines: scripts/check-changed.ts +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -172,7 +172,8 @@ export const comparisonBase = Effect.fn("checkChanged.comparisonBase")(function* |
172 | 172 | return closest; |
173 | 173 | }); |
174 | 174 |
|
175 | | -const CODE = /\.[cm]?[jt]sx?$/; |
| 175 | +// CI's lint and knip also read Astro components' frontmatter. |
| 176 | +const CODE = /\.(?:[cm]?[jt]sx?|astro)$/; |
176 | 177 | const TEST = /\.test\.[cm]?[jt]sx?$/; |
177 | 178 | // CI runs the .github/scripts tests with `node --test`; vitest passes a failing node:test file. |
178 | 179 | const NODE_TEST = /^\.github[/\\]scripts[/\\]/; |
|