Skip to content

Fix CI: generate test_image.png fixture in test setup - #1

Merged
Rishet11 merged 5 commits into
mainfrom
fix/ci-test-image-fixture
Jul 5, 2026
Merged

Rishet11 merged 5 commits into
mainfrom
fix/ci-test-image-fixture

Conversation

@Rishet11

@Rishet11 Rishet11 commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Problem

CI failed on every push. Root cause: the image and edge-case test suites depend on cli/test_image.png, which is gitignored by the test*.* rule and never generated by any setup hook. It only existed as a stale local artifact, so tests passed locally but failed on clean CI checkouts with File not found: .../cli/test_image.png (20+ cascading failures). Node 20 showed 'Cancelled' only because matrix fail-fast killed it when Node 22 failed first.

Fix

Generate test_image.png deterministically in the setup hooks of both suites (matches the existing pattern for __tiny_test.png / __transparent_test.png).

Verification

Removed the local cli/test_image.png to simulate a clean checkout, then ran the suite: 145/145 pass.

CI failed because the image/edge-case suites depend on cli/test_image.png,
which is gitignored (test*.*) and never generated. It only existed as a
stale local artifact, so tests passed locally but failed on clean checkouts
with 'File not found'. Create it deterministically in setup hooks.
Copilot AI review requested due to automatic review settings July 5, 2026 18:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to fix CI failures caused by test_image.png being a gitignored, stale local artifact by generating the fixture deterministically during test setup in the CLI test suites.

Changes:

  • Generate test_image.png (100×100 PNG) in image.test.ts test setup when missing.
  • Generate test_image.png in edge-cases.test.ts beforeAll and add sharp as a dependency for that suite.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
cli/src/__tests__/image.test.ts Adds setup logic to create test_image.png fixture when absent.
cli/src/__tests__/edge-cases.test.ts Adds sharp-based beforeAll fixture generation for test_image.png.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +12 to +18
beforeAll(async () => {
// Base image copied under various names by the edge-case tests
if (!fs.existsSync(TEST_IMAGE)) {
await sharp({
create: { width: 100, height: 100, channels: 3, background: { r: 100, g: 150, b: 200 } }
}).png().toFile(TEST_IMAGE);
}
Comment on lines +34 to +39
// Primary 100×100 opaque PNG — used across the conversion/compression suite
if (!fs.existsSync(TEST_IMAGE)) {
await sharp({
create: { width: 100, height: 100, channels: 3, background: { r: 100, g: 150, b: 200 } }
}).png().toFile(TEST_IMAGE);
}
Rishet11 added 4 commits July 5, 2026 23:57
document.test.ts depended on gitignored cli/test.pdf, test.txt, test.docx
(same test*.* stale-artifact bug). Copy them from the committed fixtures/
dir in a beforeAll so a clean checkout has them.
Content-preservation tests convert DOCX/TXT via pandoc through the real CLI.
The runner had no pandoc, so those conversions exited 1. Install it before
the test step.
Root tsconfig had no exclude, so 'npm run lint' (tsc --noEmit) type-checked
cli/'s test files against the wrong project (78 spurious errors). Exclude
cli/dist/node_modules. Also fix the one real error: App.tsx used
React.ReactNode without importing the React namespace.
@Rishet11
Rishet11 merged commit 4422e13 into main Jul 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants