---
title: Your Deploys Break SEO Silently. Add Regression Tests to CI Before Launch Day.
description: SEO breaks in production through noindex leaks, lost canonicals, and redirect chains that no functional test catches. Five deterministic checks in CI stop them before they merge.
author: LETSGROW Dev Team
date: 2026-10-25
category: SEO
tags: ["Technical SEO", "CI/CD", "Lighthouse CI", "Redirects", "Developer Workflow"]
url: "https://letsgrow.dev/blog/seo-regression-testing-in-ci-before-launch"
---
Your deploy pipeline checks that the site builds, the unit tests pass, and the linter is quiet. It does not check that the canonical tags still point at the right URLs, that robots.txt still lets Googlebot in, or that the redirect map survived the last refactor. SEO breaks in production, silently, and you find out three weeks later when the traffic chart bends. The fix is not a better checklist. It is a test suite that runs on every pull request.

::stat-block
- value: 5 checks
  label: Cover the failures that cause most SEO regressions
- value: < 2 min
  label: Added to a typical CI run
- value: 0 manual QA
  label: Needed to catch a noindex before it ships
::

## The Regressions That Actually Happen

Teams imagine SEO risk as algorithm updates. The real risk is self-inflicted. A staging flag that leaks noindex into production. A framework upgrade that changes trailing slash behavior and fires a thousand redirect chains. A template change that drops the canonical tag from every product page. A new middleware that returns 302 where it used to return 301.

None of these are exotic, and none are caught by functional tests because the page still renders. A human looking at the page sees nothing wrong. Search engines see a different site. Because you cannot review what you do not test, the only reliable answer is to encode these expectations as assertions and let CI enforce them.

## Build the Five-Check Suite

You do not need a commercial crawler for this. A script that fetches a fixed list of URLs against the preview deployment and asserts on the response covers the failures that matter. Pick 20 to 50 representative URLs: the homepage, each template type, a few top landing pages, and a handful of legacy URLs that must redirect.

::checklist
- Status codes: every key URL returns 200, and every legacy URL returns a single 301 hop to the expected destination
- Indexability: no noindex in the meta robots tag or the X-Robots-Tag header on any URL that should rank
- Canonicals: each page has exactly one canonical tag, it is absolute, and it matches the expected URL
- Robots and sitemap: robots.txt allows your key paths, and every sitemap URL returns 200 and is canonical
- Structured data: JSON-LD parses, and required fields for your schema types are present
::

Here is the shape of the assertion for the first three, written as a plain Node test using fetch and a small HTML parser:

```js
for (const { path, canonical } of keyPages) {
  const res = await fetch(BASE + path, { redirect: 'manual' });
  expect(res.status).toBe(200);
  expect(res.headers.get('x-robots-tag') || '').not.toMatch(/noindex/i);
  const html = await res.text();
  expect(html).not.toMatch(/<meta[^>]+robots[^>]+noindex/i);
  const tags = [...html.matchAll(/<link[^>]+rel="canonical"[^>]+href="([^"]+)"/g)];
  expect(tags).toHaveLength(1);
  expect(tags[0][1]).toBe(canonical);
}
```

Note the manual redirect setting. If you let fetch follow redirects, a chain of three hops looks identical to a clean one. Count the hops explicitly and fail the build on anything beyond one.

## Wire It Into the Pipeline

Run the suite against the preview URL your host generates for every pull request, not against production. Production tests tell you about damage already done. Preview tests block the merge.

Run Lighthouse CI alongside it, but only for the assertions you will actually enforce: the SEO category score, plus a hard fail on the is-crawlable and canonical audits. Lighthouse performance scores wobble between runs and will train your team to ignore red builds. A flaky gate is worse than no gate, so keep every check deterministic.

Add a second, scheduled job that runs the same suite against production nightly. This catches the other class of breakage: CMS edits, CDN rules, and third-party scripts that change behavior without a deploy. When it fails, it posts to the channel the on-call engineer already watches, with the failing URL and the specific assertion in the message.

::compare-table
| Approach | Catches regressions before launch | Maintenance | Cost |
| --- | --- | --- | --- |
| Manual QA checklist | Sometimes | High, depends on people | Staff time |
| Weekly crawler report | No, after the fact | Medium | Tool license |
| CI assertions on preview | Yes | Low once written | Free |
| Nightly production run | After deploy, within hours | Low | Free |
::

## What to Do This Week

Start small and make it fail loudly. Write the status, indexability, and canonical checks first, against ten URLs. Merge it as a required status check so a red result blocks deployment. Then add a check every time an SEO incident teaches you something new. Each incident becomes a permanent test, and the suite becomes a record of every mistake you will never make twice.

Marketing owns the list of URLs and the expectations. Engineering owns the runner. That split matters, because the person who knows which pages earn revenue should decide what is protected, and the person who owns the pipeline should decide how it is enforced. Do that, and launch day stops being the moment you find out what you broke.