Skip to content

fixes and tests - #66

Merged
hirasso merged 17 commits into
mainfrom
fix/sitemap-reader-animation-duration
Nov 9, 2026
Merged

hirasso merged 17 commits into
mainfrom
fix/sitemap-reader-animation-duration

Conversation

@hirasso

@hirasso hirasso commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Fixes #65
Related: swup/docs#255

Quite a few issues found while tackling #65. This PR is a fix for all of them in one go:

Fixes

  • validate --sitemap: implement the sitemap reader (was a stub returning []). Handles entities and CDATA and follows sitemap indexes
  • validate --sitemap: support absolute local paths (join → resolve)
  • validate --crawl: migrate to the crawler v2 API (the v1 callback crashed at runtime)
  • transition-duration: await the animation duration (missing await)
  • transition-styles: wait long enough (duration was in seconds, used as ms)
  • transition-styles: pass if any expected style changes (the default opacity,transform made a plain fade always fail)
  • --animation and --parallel flags were ignored (read nonexistent flag names)
  • --tests containers is now wired up (advertised but never ran): each container selector must exist exactly once
  • Close pages after validating
  • Failed pages are now marked ✖ instead of ✔ in the task list
  • readSitemapUrls throws on non-OK HTTP responses (e.g. 404) instead of silently returning []
  • validate fails with "No pages found in " when the sitemap (or crawl) yields no URLs, instead of passing with 0/0 pages

Cleanup

  • Remove bin/dev.js/dev.cmd (needed a global ts-node), the unused screenshot and .eslintignore (duplicated ignorePatterns)
  • Remove stale .gitignore entries and package-lock.json from files
  • Drop @types/crawler (crawler v2 ships its own types), @oclif/test, @types/shelljs and the direct shelljs usage
  • Bump engines to Node >= 18 and CI workflows from Node 16 to lts/*
  • Replace the stale create --from=oclif test with a sitemap reader test

Tooling

  • tsconfig: target es2022. The test tsconfig now type-checks

  • Fix all ESLint problems (113 → 0), including proper types instead of @ts-ignore

  • Format the repo with its own swup package:format. Add .prettierignore for README.md (generated by oclif readme)

  • The PR is submitted to the main branch

  • The code was linted before pushing (npm run lint)

  • All tests are passing (npm run test)

  • New or updated tests are included

@hirasso hirasso changed the title fix: sitemap reader and animation duration fix: swup validate Nov 9, 2026
crawler v2 ships its own types and requires node >=18, so drop @types/crawler and bump engines
bin/dev.js needed a global ts-node, unused screenshot asset, .eslintignore duplicated ignorePatterns, workflows ran node 16
--tests containers was advertised but never ran. Also moves the sitemap reader to util.ts
Mostly autofix. Also: typed package info instead of @ts-ignore, drop shelljs (only used for exit), lint TS unused vars with the TS rule, read style properties in parallel
Default styles are opacity,transform, so a plain fade could never pass
Ignore README.md, its commands section is generated by oclif readme
@hirasso hirasso changed the title fix: swup validate fixes and tests Nov 9, 2026
@hirasso
hirasso requested a review from daun November 9, 2026 11:20
@daun

daun commented Nov 9, 2026

Copy link
Copy Markdown
Member

Failed pages are now marked ✖ instead of ✔ in the task list 🤣

@hirasso
hirasso merged commit 2102529 into main Nov 9, 2026
1 check passed
@hirasso
hirasso deleted the fix/sitemap-reader-animation-duration branch November 9, 2026 19:00
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.

[Bug] The sitemap reader is a stub (return [])

2 participants