Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve our broken link checking tests #3113

Open
1 of 6 tasks
domoscargin opened this issue Aug 31, 2023 · 2 comments · Fixed by #3173 · May be fixed by #3174
Open
1 of 6 tasks

Improve our broken link checking tests #3113

domoscargin opened this issue Aug 31, 2023 · 2 comments · Fixed by #3173 · May be fixed by #3174
Labels

Comments

@domoscargin
Copy link
Contributor

domoscargin commented Aug 31, 2023

What

External link checking

We use hyperlink to check our links on the compiled website.

It doesn't catch external link problems, since we use the --internal flag.

Removing that flag results in 244 failures that are not surfaced. Some of these appear to be related to our use of the --source-maps flag, which causes issues when running external checks. If we remove THAT flag, the failure list drops to 105.

It'd be good to:

  1. Audit and fix all those errors
  2. Split external and internal link checking, and run them at different times. We could keep running the internal checks every PR, but only run the external checks manually, or less frequently. We could also look at adjusting our concurrency levels for hyperlink and see if that helps.
"check-links": "npm run check-links:internal && npm run check-links:external",
"check-links:external": "npm run check-links:cli -- --external | tap-mocha-reporter min",
"check-links:internal": "npm run check-links:cli -- --internal --pretty --source-maps | tap-mocha-reporter min",
"check-links:cli": "hyperlink --canonicalroot https://design-system.service.gov.uk/ --recursive deploy/public/sitemap.xml"

Flaky tests

Either hyperlink or tap-mocha-reporter throw out error codes with no obvious output quite frequently, causing our tests to fail.

We should review our use of these tools and see if there's anything else out there. Previously we were using the now defunct metalsmith-broken-link-checker, but @metalsmith-plugins/metalsmith-link-checker is more up to date - but we possibly don't want to stick with a metalsmith-specific solution.

Who needs to work on this

Developer
Content Designer? (in the case that any of the links are dead and we need to find equivalents or reword)

Who needs to review this

Developer

Done when

  • Link checking tooling has been audited, and our tests are no longer flaky
  • We can run external and internal link checking separately
  • Identify broken links
  • Fix redirects
  • Find alternatives to pages that are gone
  • Add external broken link checker
@domoscargin domoscargin changed the title Link checking is flaky, and we don't check external links Improve our broken link checking tests Aug 31, 2023
@colinrotherham colinrotherham self-assigned this Sep 25, 2023
@colinrotherham colinrotherham linked a pull request Sep 25, 2023 that will close this issue
@colinrotherham
Copy link
Contributor

I've re-run my previously-a-spike PR branch 10x now and we're stable. Ready for review:

@colinrotherham
Copy link
Contributor

Re-opening to discuss external links

@stevenjmesser stevenjmesser removed their assignment Oct 4, 2023
@colinrotherham colinrotherham removed their assignment Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants