diff --git a/packages/next/src/build/collect-build-traces.ts b/packages/next/src/build/collect-build-traces.ts index 08249048e65e8..39956374130da 100644 --- a/packages/next/src/build/collect-build-traces.ts +++ b/packages/next/src/build/collect-build-traces.ts @@ -244,9 +244,11 @@ export async function collectBuildTraces({ '**/node_modules/sharp/**/*', ] : []), + ...(!hasSsrAmpPages ? ['**/next/dist/compiled/@ampproject/toolbox-optimizer/**/*'] : []), + ...additionalIgnores, ...(isStandalone ? [] : TRACE_IGNORES), @@ -334,21 +336,11 @@ export async function collectBuildTraces({ }) const reasons = result.reasons const fileList = result.fileList - result.esmFileList.forEach((file) => fileList.add(file)) + for (const file of result.esmFileList) { + fileList.add(file) + } const parentFilesMap = getFilesMapFromReasons(fileList, reasons) - const allEntryFiles = new Set() - - // get this from buildTraceContext - const entryFiles = new Set() - - entryFiles.forEach((file) => { - parentFilesMap - .get(path.relative(outputFileTracingRoot, file)) - ?.forEach((child) => { - allEntryFiles.add(path.join(traceContext, child)) - }) - }) for (const [entries, tracedFiles] of [ [serverEntries, serverTracedFiles], @@ -358,7 +350,7 @@ export async function collectBuildTraces({ const curFiles = parentFilesMap.get( path.relative(outputFileTracingRoot, file) ) - tracedFiles.add(path.relative(distDir, file)) + tracedFiles.add(path.relative(distDir, file).replace(/\\/g, '/')) for (const curFile of curFiles || []) { const filePath = path.join(outputFileTracingRoot, curFile) @@ -369,7 +361,9 @@ export async function collectBuildTraces({ contains: true, }) ) { - tracedFiles.add(path.relative(distDir, filePath)) + tracedFiles.add( + path.relative(distDir, filePath).replace(/\\/g, '/') + ) } } } @@ -414,10 +408,12 @@ export async function collectBuildTraces({ ) for (const curFile of curFiles || []) { curTracedFiles.add( - path.relative( - traceOutputDir, - path.join(outputFileTracingRoot, curFile) - ) + path + .relative( + traceOutputDir, + path.join(outputFileTracingRoot, curFile) + ) + .replace(/\\/g, '/') ) } } @@ -520,17 +516,17 @@ export async function collectBuildTraces({ for (const curGlob of includeGlobKeys) { if (isMatch(page, [curGlob], { dot: true, contains: true })) { - outputFileTracingIncludes[curGlob].forEach((include) => { - combinedIncludes.add(include) - }) + for (const include of outputFileTracingIncludes[curGlob]) { + combinedIncludes.add(include.replace(/\\/g, '/')) + } } } for (const curGlob of excludeGlobKeys) { if (isMatch(page, [curGlob], { dot: true, contains: true })) { - outputFileTracingExcludes[curGlob].forEach((exclude) => { + for (const exclude of outputFileTracingExcludes[curGlob]) { combinedExcludes.add(exclude) - }) + } } } diff --git a/test/lib/e2e-utils.ts b/test/lib/e2e-utils.ts index a9051a19945c7..ee43a460d6f25 100644 --- a/test/lib/e2e-utils.ts +++ b/test/lib/e2e-utils.ts @@ -14,7 +14,10 @@ export type { NextInstance } // if either test runs for the --turbo or have a custom timeout, set reduced timeout instead. // this is due to current --turbo test have a lot of tests fails with timeouts, ends up the whole // test job exceeds the 6 hours limit. -let testTimeout = shouldRunTurboDevTest() ? (240 * 1000) / 4 : 120 * 1000 +let testTimeout = shouldRunTurboDevTest() + ? (240 * 1000) / 4 + : (process.platform === 'win32' ? 240 : 120) * 1000 + if (process.env.NEXT_E2E_TEST_TIMEOUT) { try { testTimeout = parseInt(process.env.NEXT_E2E_TEST_TIMEOUT, 10)