mirror of
https://github.com/withastro/astro.git
synced 2025-02-17 22:44:24 -05:00
Late test should only run in SSR
This commit is contained in:
parent
ab0539b951
commit
83ed3669be
2 changed files with 6 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
||||||
---
|
---
|
||||||
import Redirect from '../components/redirect.astro';
|
import Redirect from '../components/redirect.astro';
|
||||||
|
const staticMode = import.meta.env.STATIC_MODE;
|
||||||
---
|
---
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -7,6 +8,8 @@ import Redirect from '../components/redirect.astro';
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Testing</h1>
|
<h1>Testing</h1>
|
||||||
<Redirect />
|
{ !staticMode ? (
|
||||||
|
<Redirect />
|
||||||
|
) : <div></div>}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -29,7 +29,7 @@ describe('Astro.redirect', () => {
|
||||||
const request = new Request('http://example.com/late');
|
const request = new Request('http://example.com/late');
|
||||||
const response = await app.render(request);
|
const response = await app.render(request);
|
||||||
try {
|
try {
|
||||||
const text = await response.text();
|
await response.text();
|
||||||
expect(false).to.equal(true);
|
expect(false).to.equal(true);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
expect(e.message).to.equal(
|
expect(e.message).to.equal(
|
||||||
|
@ -41,6 +41,7 @@ describe('Astro.redirect', () => {
|
||||||
|
|
||||||
describe('output: "static"', () => {
|
describe('output: "static"', () => {
|
||||||
before(async () => {
|
before(async () => {
|
||||||
|
process.env.STATIC_MODE = true;
|
||||||
fixture = await loadFixture({
|
fixture = await loadFixture({
|
||||||
root: './fixtures/ssr-redirect/',
|
root: './fixtures/ssr-redirect/',
|
||||||
output: 'static',
|
output: 'static',
|
||||||
|
|
Loading…
Add table
Reference in a new issue