From 49dd43665fa794f751ef4a5418f9a82d0c22c938 Mon Sep 17 00:00:00 2001 From: Sara Gowen <9001998+dynamictulip@users.noreply.github.com> Date: Sun, 13 Oct 2024 18:12:28 +0100 Subject: [PATCH] Add Playwright to pre-commit hooks --- .husky/pre-commit | 1 + README.md | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/.husky/pre-commit b/.husky/pre-commit index 2312dc5..3496908 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1,2 @@ npx lint-staged +npm run test diff --git a/README.md b/README.md index cac6a79..285f736 100644 --- a/README.md +++ b/README.md @@ -87,3 +87,14 @@ Background colour classes to set the sections to the predefined colours: When adding a new page, add the name and route to `tests\all-pages-to-test.ts` to enable automated accessibility and visual comparison tests. If adding or changing a link in the nav, ensure it is add/changed in `tests\navigation.spec.ts`. + +### Pre-commit hooks + +> [!IMPORTANT] +> Playwright tests are run on pre-commit hooks and will fail if Playwright is not installed. See [running the tests](#running-the-tests) for info on how to set up Playwright + +Pre-commit hooks are managed by [Husky](https://typicode.github.io/husky/get-started.html) and will be run whenever you make a commit. If they fail then the commit will be aborted and you will see an error. + +To run pre-commit hooks without committing, stage all your changes and then execute the `.husky/pre-commit` file. + +To commit but skip pre-commit hooks, run `git commit -m "my amazing commit message" --no-verify`