Unverified Commit bfbd9719 authored by Zack Tanner's avatar Zack Tanner Committed by GitHub

capture test-deploy stderr in cliOutput (#67976)

This particular test was failing because build logs were being piped to
stderr, despite being successful. This ensures `next.cliOutput` captures
both `stdout` and `stderr`.
parent 2be71317
...@@ -957,21 +957,18 @@ describe('Prerender', () => { ...@@ -957,21 +957,18 @@ describe('Prerender', () => {
}) })
}) })
if (!isDeploy) { it('should show warning when large amount of page data is returned', async () => {
// relies on runtime logs, which aren't currently captured by `next.cliOutput` in deploys await renderViaHTTP(next.url, '/large-page-data')
it('should show warning when large amount of page data is returned', async () => { await check(
await renderViaHTTP(next.url, '/large-page-data') () => next.cliOutput,
await check( /Warning: data for page "\/large-page-data" is 256 kB which exceeds the threshold of 128 kB, this amount of data can reduce performance/
() => next.cliOutput, )
/Warning: data for page "\/large-page-data" is 256 kB which exceeds the threshold of 128 kB, this amount of data can reduce performance/ await renderViaHTTP(next.url, '/blocking-fallback/lots-of-data')
) await check(
await renderViaHTTP(next.url, '/blocking-fallback/lots-of-data') () => next.cliOutput,
await check( /Warning: data for page "\/blocking-fallback\/\[slug\]" \(path "\/blocking-fallback\/lots-of-data"\) is 256 kB which exceeds the threshold of 128 kB, this amount of data can reduce performance/
() => next.cliOutput, )
/Warning: data for page "\/blocking-fallback\/\[slug\]" \(path "\/blocking-fallback\/lots-of-data"\) is 256 kB which exceeds the threshold of 128 kB, this amount of data can reduce performance/ })
)
})
}
if ((global as any).isNextDev) { if ((global as any).isNextDev) {
it('should show warning every time page with large amount of page data is returned', async () => { it('should show warning every time page with large amount of page data is returned', async () => {
......
...@@ -164,7 +164,8 @@ export class NextDeployInstance extends NextInstance { ...@@ -164,7 +164,8 @@ export class NextDeployInstance extends NextInstance {
// output other unrelated logs to stderr. // output other unrelated logs to stderr.
// TODO: Combine with runtime logs (via `vercel logs`) // TODO: Combine with runtime logs (via `vercel logs`)
this._cliOutput = buildLogs.stdout // Build logs seem to be piped to stderr, so we'll combine them to make sure we get all the logs.
this._cliOutput = buildLogs.stdout + buildLogs.stderr
} }
public get cliOutput() { public get cliOutput() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment