-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: more robust handling of export output (#418)
* chore: rename fixtures * chore: add custom dist export fixture * fix: more robust handling of export output * chore: ignore new dist * chore: fix error snapshot
- Loading branch information
Showing
16 changed files
with
214 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { expect, type Locator } from '@playwright/test' | ||
import { nextVersionSatisfies } from '../utils/next-version-helpers.mjs' | ||
import { test } from '../utils/playwright-helpers.js' | ||
|
||
const expectImageWasLoaded = async (locator: Locator) => { | ||
expect(await locator.evaluate((img: HTMLImageElement) => img.naturalHeight)).toBeGreaterThan(0) | ||
} | ||
test('Renders the Home page correctly with output export', async ({ page, outputExport }) => { | ||
const response = await page.goto(outputExport.url) | ||
const headers = response?.headers() || {} | ||
|
||
await expect(page).toHaveTitle('Simple Next App') | ||
|
||
expect(headers['cache-status']).toBe('"Netlify Edge"; fwd=miss') | ||
|
||
const h1 = page.locator('h1') | ||
await expect(h1).toHaveText('Home') | ||
|
||
await expectImageWasLoaded(page.locator('img')) | ||
}) | ||
|
||
test('Renders the Home page correctly with output export and publish set to out', async ({ | ||
page, | ||
ouputExportPublishOut, | ||
}) => { | ||
const response = await page.goto(ouputExportPublishOut.url) | ||
const headers = response?.headers() || {} | ||
|
||
await expect(page).toHaveTitle('Simple Next App') | ||
|
||
expect(headers['cache-status']).toBe('"Netlify Edge"; fwd=miss') | ||
|
||
const h1 = page.locator('h1') | ||
await expect(h1).toHaveText('Home') | ||
|
||
await expectImageWasLoaded(page.locator('img')) | ||
}) | ||
|
||
test('Renders the Home page correctly with output export and custom dist dir', async ({ | ||
page, | ||
outputExportCustomDist, | ||
}) => { | ||
const response = await page.goto(outputExportCustomDist.url) | ||
const headers = response?.headers() || {} | ||
|
||
await expect(page).toHaveTitle('Simple Next App') | ||
|
||
expect(headers['cache-status']).toBe('"Netlify Edge"; fwd=miss') | ||
|
||
const h1 = page.locator('h1') | ||
await expect(h1).toHaveText('Home') | ||
|
||
await expectImageWasLoaded(page.locator('img')) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
custom-dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export const metadata = { | ||
title: 'Simple Next App', | ||
description: 'Description for Simple Next App', | ||
} | ||
|
||
export default function RootLayout({ children }) { | ||
return ( | ||
<html lang="en"> | ||
<body>{children}</body> | ||
</html> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export default function Home() { | ||
return ( | ||
<main> | ||
<h1>Home</h1> | ||
<img src="/squirrel.jpg" alt="a cute squirrel" width="300px" /> | ||
</main> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
output: 'export', | ||
distDir: 'custom-dist', | ||
eslint: { | ||
ignoreDuringBuilds: true, | ||
}, | ||
} | ||
|
||
module.exports = nextConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "output-export", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"postinstall": "next build", | ||
"dev": "next dev", | ||
"build": "next build" | ||
}, | ||
"dependencies": { | ||
"next": "latest", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters