cloudfour / cloudfour/lighthouse-parade
Crawler integration is untested (simplecrawler at 0% function coverage)
- Dominant language
- TypeScript
- Stars
- 373
- Forks
- 15
- Avg merge
- 13h 36m
- Merged PRs (30d)
- 34
Description
## Background
`src/crawl.ts` sits at **40.7% coverage**. The covered part is `createUrlFilter`, which is genuinely well tested — `test/path-filter-globs.test.ts` has nine cases covering globstars, exclude precedence, brace expansion, and trailing-slash normalization.
Lines 33–76 — the actual `simplecrawler` integration — are at 0%. Nothing exercises:
- Crawler configuration (user agent, max depth, `respectRobotsTxt`).
- The `fetchcomplete` / `fetcherror` / `complete` event wiring.
- Content-type filtering, i.e. that non-HTML responses are skipped.
- Error and redirect handling.
`src/crawl.mock.ts` substitutes a fake crawler for `test/scan-task.test.ts`, which is the right call for testing orchestration — but it means the real integration has no coverage anywhere.
## Proposal
Stand up a local HTTP server in the test (`node:http`, ephemeral port) serving a handful of interlinked fixture pages, then run the real crawler against it. That keeps it fast, offline, and deterministic. Worth covering:
- Following links across pages and reporting each URL found.
- Respecting `--max-crawl-depth`.
- Skipping non-HTML content types (serve a CSS file and a JSON endpoint and assert they don't come back as pages).
- Honoring `robots.txt`, and ignoring it when `--ignore-robots` is set.
- Reporting a warning rather than crashing on a 404 or a connection error.
## Priority
Lower than the Lighthouse integration test (#363). `simplecrawler` is pinned at 1.1.9 and effectively frozen upstream, so the odds of a dependency upgrade breaking this are low. The value here is more about protecting the crawl logic during future refactors than about vetting dependency bumps.
Related: #363
Contributor guide
Research direction
Start with the real integration in src/crawl.ts, compare it with src/crawl.mock.ts and test/scan-task.test.ts, and review the existing path-filter coverage in test/path-filter-globs.test.ts. Add a fast, offline node:http fixture server covering links, depth, content types, robots.txt, 404s, and connection errors; done means the real crawler behavior is exercised deterministically.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- cli, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100