Context
8 test files were stubbed out in 7326372 because they imported sharp and the sharp dep is no longer installed (and per project rule, won't be reintroduced):
test/analyze.test.tstest/core.test.tstest/favicon.test.tstest/og.test.tstest/processor.test.tstest/responsive.test.tstest/sprite-generator.test.tstest/watermark.test.ts
Each is now a describe.skip(...) placeholder. Original bodies are recoverable from git history (git show 918ac9d:packages/ts-images/test/<file>).
What sharp was used for
Two distinct patterns across the 30+ call sites:
- Fixture generation:
sharp({ create: { width, height, channels, background } }).png().toFile(...)— synthesizing solid-color test images on the fly - Metadata assertions:
await sharp(path).metadata()— reading width/height/format from output files to verify ts-images produced the right thing
Proposal
- Metadata reads → dogfood: replace
sharp(x).metadata()withgetMetadata(await Bun.file(x).bytes())fromsrc/codecs/index.ts(already exported asImageMetadata) - Fixture generation: pre-commit small synthetic fixtures (PNG/JPEG/WebP at a few sizes) to
test/fixtures/instead of generating at runtime. Saves test time too. - Restore each test file from history once metadata + fixture path is sorted, swapping sharp calls for the replacements above
- Drop the
it.skip('placeholder')and thedescribe.skiponce each file is back to real coverage
Out of scope
- Reintroducing sharp as a dep — explicitly ruled out
Why this matters
- Restores test coverage for the core processing functions (currently 8 of ~16 test files are skipped)
- Forces ts-images to expose metadata reads as a first-class API (it already has
getMetadatain codecs — this just exercises it)