From cd8e99a6e306384090ac5f5384e38c857cdc9813 Mon Sep 17 00:00:00 2001 From: Finn Woelm Date: Tue, 15 Dec 2020 11:50:25 +0800 Subject: [PATCH] Fix cypress:local: Skip test for cache control header The cache control header in netlify dev does not include "public" for static assets. This is unlike netlify.app. We should probably set headers in a _headers file as suggested by: https://github.com/netlify/next-on-netlify/issues/110 For now, we simply skip the test when running the Cypress tests locally. --- cypress/integration/optionalCatchAll_at_root_spec.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cypress/integration/optionalCatchAll_at_root_spec.js b/cypress/integration/optionalCatchAll_at_root_spec.js index de8da37..268df93 100644 --- a/cypress/integration/optionalCatchAll_at_root_spec.js +++ b/cypress/integration/optionalCatchAll_at_root_spec.js @@ -104,9 +104,11 @@ describe("pre-rendered pages: /subfolder/[id].js", () => { }); it("serves the pre-rendered HTML (and not the Netlify Function)", () => { - cy.request("/subfolder/static").then((response) => { - expect(response.headers["cache-control"]).to.include("public"); - }); + if (Cypress.env("DEPLOY") !== "local") { + cy.request("/subfolder/static").then((response) => { + expect(response.headers["cache-control"]).to.include("public"); + }); + } }); });