Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix retrieval of deploy test build logs #67971

Merged
merged 2 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions test/e2e/prerender.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -957,18 +957,21 @@ describe('Prerender', () => {
})
})

it('should show warning when large amount of page data is returned', async () => {
await renderViaHTTP(next.url, '/large-page-data')
await check(
() => 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(
() => 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 (!isDeploy) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive-by fix since this is reliably failing when I used this file as my test subject

// relies on runtime logs, which aren't currently captured by `next.cliOutput` in deploys
it('should show warning when large amount of page data is returned', async () => {
await renderViaHTTP(next.url, '/large-page-data')
await check(
() => 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(
() => 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) {
it('should show warning every time page with large amount of page data is returned', async () => {
Expand Down
24 changes: 8 additions & 16 deletions test/lib/next-modes/next-deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,32 +147,24 @@ export class NextDeployInstance extends NextInstance {

require('console').log(`Got buildId: ${this._buildId}`)

// Use the vercel logs command to get the CLI output from the build.
const logs = await execa(
// Use the vercel inspect command to get the CLI output from the build.
const buildLogs = await execa(
'vercel',
[
'logs',
this._url,
'--output',
'raw',
// The default # of lines to show in the output is 100, but some of our tests have noisy output,
// so bump to 1000
'-n',
1000,
...vercelFlags,
],
['inspect', '--logs', this._url, ...vercelFlags],
{
env: vercelEnv,
reject: false,
}
)
if (logs.exitCode !== 0) {
throw new Error(`Failed to get build output logs: ${logs.stderr}`)
if (buildLogs.exitCode !== 0) {
throw new Error(`Failed to get build output logs: ${buildLogs.stderr}`)
}

// Use the stdout from the logs command as the CLI output. The CLI will
// output other unrelated logs to stderr.
this._cliOutput = logs.stdout

// TODO: Combine with runtime logs (via `vercel logs`)
this._cliOutput = buildLogs.stdout
}

public get cliOutput() {
Expand Down
Loading