Skip to content

chore(test): run unit tests with vitest and add playwright e2e tests - #108

Merged
brandyscarney merged 4 commits into
chore/fix-lint-warningsfrom
chore/add-test-infrastructure
Oct 27, 2026
Merged

brandyscarney merged 4 commits into
chore/fix-lint-warningsfrom
chore/add-test-infrastructure

Conversation

@brandyscarney

@brandyscarney brandyscarney commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

What This Does

Moves the unit tests from Karma and Jasmine to Vitest, adds Playwright end-to-end tests, and runs both in CI.

New Behavior

  • npm run test:unit runs the unit tests once (Vitest, through Angular's @angular/build:unit-test builder). npm run test:unit:watch reruns them on changes.
  • npm run test:e2e runs the Playwright tests in Mobile Chrome (Pixel 7). It starts the dev server on port 4311, a port reserved for this app's e2e tests so it never reuses another app's server. The first time, install the browser with npx playwright install chromium.
  • npm test runs both.
  • npm run lint also type-checks the Playwright tests and playwright.config.ts. Playwright and ESLint don't type-check on their own, so a type error in an e2e spec used to pass both lint and the e2e run.
  • Every pull request also runs an E2E job on Linux, which uploads the Playwright HTML report.

Changes

  • Playwright config and a smoke spec in e2e/: the first tab loads, and the tab bar opens the photo gallery.
  • Unit tests run on Vitest through @angular/build:unit-test. The 7 existing specs needed no changes (Angular's refactor-jasmine-vitest schematic found nothing to convert).
  • Removes Karma, Jasmine, and their config.
  • tsconfig.e2e.json and a typecheck:e2e script (tsc -p tsconfig.e2e.json), run from lint between ESLint and Prettier.
  • @types/node as a dev dependency (for process.env in playwright.config.ts), with a Renovate rule keeping it on Node 24, the version CI runs.
  • vitest.config.mts turns off Vitest's file-system module cache (see Notes).
  • Renovate keeps Vitest below 6 until @angular/build supports it.
  • CI: the Test job runs npm run test:unit, and the new E2E job runs npm run test:e2e.
  • renovate.json: the testing group covers Vitest, jsdom, and Playwright.
  • A Testing section in the README.

Notes

  • This PR sets up the test tooling with smoke tests; tests for the photo gallery itself come in the next PR.
  • Vitest's file-system module cache is off because, with Angular's unit-test builder, it could serve a stale build after a non-spec file changed, so local reruns could pass against old code. CI wasn't affected. The config is .mts because the package is CommonJS.

@brandyscarney
brandyscarney added this pull request to stack #107 October 23, 2026 17:09
@brandyscarney
brandyscarney requested a review from a team as a code owner October 23, 2026 17:09
@brandyscarney
brandyscarney requested review from thetaPC and removed request for a team October 23, 2026 17:09
@vercel

vercel Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tutorial-photo-gallery-angular Ready Ready Preview Oct 27, 2026 3:24pm UTC

Request Review

@ShaneK ShaneK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 🚀

@brandyscarney
brandyscarney merged commit 324d93c into main Oct 27, 2026
6 checks passed
@brandyscarney
brandyscarney deleted the chore/add-test-infrastructure branch October 27, 2026 20:51

This branch was successfully deployed

1 active deployment
Preview — 53458937 Deployed Oct 27, 2026 by vercel[bot]
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