未验证 提交 ec39aa46 编写于 作者: J JJ Kasper 提交者: GitHub

Update optimize event with static 404 status (#10420)

Co-authored-by: NJoe Haddad <timer150@gmail.com>
上级 ecd628b7
......@@ -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,
})
)
......
......@@ -40,6 +40,7 @@ type EventBuildOptimized = {
ssrPageCount: number
hasDunderPages: boolean
hasTestPages: boolean
hasStatic404: boolean
}
export function eventBuildOptimize(
......
......@@ -8,6 +8,7 @@ import {
findPort,
killApp,
waitFor,
nextBuild,
} from 'next-test-utils'
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2
......@@ -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 = ''
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册