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

Update optimize event with static 404 status #10420

Merged
merged 2 commits into from
Feb 4, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions packages/next/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,7 @@ export default async function build(dir: string, conf = null): Promise<void> {
durationInSeconds: analysisEnd[0],
staticPageCount: staticPages.size,
ssrPageCount: pagePaths.length - staticPages.size,
hasStatic404: useStatic404,
})
)

Expand Down
1 change: 1 addition & 0 deletions packages/next/telemetry/events/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type EventBuildOptimized = {
ssrPageCount: number
hasDunderPages: boolean
hasTestPages: boolean
hasStatic404: boolean
}

export function eventBuildOptimize(
Expand Down
11 changes: 11 additions & 0 deletions test/integration/telemetry/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
findPort,
killApp,
waitFor,
nextBuild,
} from 'next-test-utils'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2
Expand Down Expand Up @@ -117,6 +118,16 @@ describe('Telemetry CLI', () => {
expect(event2).toMatch(/hasTestPages.*?true/)
})

it('detect static 404 correctly for `next build`', async () => {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
})

const event1 = /NEXT_BUILD_OPTIMIZED[\s\S]+?{([\s\S]+?)}/.exec(stderr).pop()
expect(event1).toMatch(/hasStatic404.*?true/)
})

it('detects isSrcDir dir correctly for `next dev`', async () => {
let port = await findPort()
let stderr = ''
Expand Down