Hacker News sort validator built with Node.js and Playwright — scrapes the 100 newest articles and verifies chronological ordering with a modular CLI and full test suite.
A Node.js + Playwright tool that scrapes the first 100 articles from Hacker News/newest and validates they are sorted newest-to-oldest by timestamp, reporting any out-of-order articles with detailed context.
JavaScript runtime for the CLI and scraper
Browser automation for scraping and tests
Async/await, modules, destructuring
Built-in test runner
Multi-page navigation with dynamic content extraction.
ISO timestamp parsing with precise out-of-order detection.
Flags, defaults, and built-in help documentation.
CLI parser, validator, logger, result handler, and debug utilities split into focused modules.
Test mode that intentionally breaks the data to verify the validator catches it.
Graceful handling of pagination failures, bad timestamps, and network hiccups.
# Fetch and validate 100 articles node index.js # Show first 5 article titles node index.js 100 5 # Verbose output node index.js 100 5 --verbose # Test mode with intentional sorting errors node index.js 100 0 --test-error # Help node index.js --help
Run the suite with npx playwright test: