From 83ed3669be4ae87b5d6819b8df2e9d282a0e912d Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Fri, 19 May 2023 15:42:18 -0400 Subject: [PATCH] Late test should only run in SSR --- .../astro/test/fixtures/ssr-redirect/src/pages/late.astro | 5 ++++- packages/astro/test/redirects.test.js | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/astro/test/fixtures/ssr-redirect/src/pages/late.astro b/packages/astro/test/fixtures/ssr-redirect/src/pages/late.astro index dcfedb8da6..62d3541192 100644 --- a/packages/astro/test/fixtures/ssr-redirect/src/pages/late.astro +++ b/packages/astro/test/fixtures/ssr-redirect/src/pages/late.astro @@ -1,5 +1,6 @@ --- import Redirect from '../components/redirect.astro'; +const staticMode = import.meta.env.STATIC_MODE; --- @@ -7,6 +8,8 @@ import Redirect from '../components/redirect.astro';

Testing

- + { !staticMode ? ( + + ) :
} diff --git a/packages/astro/test/redirects.test.js b/packages/astro/test/redirects.test.js index 80c783fe2e..f3e6c1121b 100644 --- a/packages/astro/test/redirects.test.js +++ b/packages/astro/test/redirects.test.js @@ -29,7 +29,7 @@ describe('Astro.redirect', () => { const request = new Request('http://example.com/late'); const response = await app.render(request); try { - const text = await response.text(); + await response.text(); expect(false).to.equal(true); } catch (e) { expect(e.message).to.equal( @@ -41,6 +41,7 @@ describe('Astro.redirect', () => { describe('output: "static"', () => { before(async () => { + process.env.STATIC_MODE = true; fixture = await loadFixture({ root: './fixtures/ssr-redirect/', output: 'static',