Unverified Commit 251461cd authored by vercel-fleet-prod[bot]'s avatar vercel-fleet-prod[bot] Committed by GitHub

run build-trace-extra-entries for turbopack

Co-authored-by: 's avatarNiklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
Co-authored-by: 's avatarTobias Koppers <1365881+sokra@users.noreply.github.com>
parent 06130e80
...@@ -18,9 +18,15 @@ module.exports = { ...@@ -18,9 +18,15 @@ module.exports = {
return cfg return cfg
}, },
outputFileTracingIncludes: { outputFileTracingIncludes: {
// Full path includes "app" or "pages" // Full path includes "app" or "pages".
'/pages/index': ['include-me/**/*'], '/pages/index': ['include-me/**/*'],
'/app/route1': ['./include-me/**/*', 'node_modules/pkg-behind-symlink/*'], '/index': ['include-me/link-to-dir'],
// Normalized route form.
'/route1': [
'./include-me/**/*',
'./include-me/link-to-dir',
'node_modules/pkg-behind-symlink/*',
],
'/*': ['include-me-global.txt'], '/*': ['include-me-global.txt'],
}, },
outputFileTracingExcludes: { outputFileTracingExcludes: {
......
...@@ -10,10 +10,6 @@ describe('build trace with extra entries', () => { ...@@ -10,10 +10,6 @@ describe('build trace with extra entries', () => {
}) })
if (skipped) return if (skipped) return
if (isTurbopack) {
it('skipped', () => {})
return
}
it('should build and trace correctly', async () => { it('should build and trace correctly', async () => {
const { exitCode } = await next.build() const { exitCode } = await next.build()
...@@ -51,17 +47,28 @@ describe('build trace with extra entries', () => { ...@@ -51,17 +47,28 @@ describe('build trace with extra entries', () => {
file.includes('exclude-me') file.includes('exclude-me')
) )
).toBe(false) ).toBe(false)
expect(appDirRoute1Trace.files).toEqual( // Webpack preserves the package symlink in traced paths, while Turbopack
expect.arrayContaining([ // traces files at the symlink's resolved target paths.
'../../../../node_modules/pkg-behind-symlink/index.js', if (isTurbopack) {
'../../../../node_modules/pkg-behind-symlink/package.json', expect(appDirRoute1Trace.files).toEqual(
]) expect.arrayContaining([
) '../../../../node_modules/pkg/index.js',
expect( '../../../../node_modules/pkg/package.json',
appDirRoute1Trace.files.some((file: string) => ])
file.startsWith('../../../../node_modules/pkg/')
) )
).toBe(false) } else {
expect(appDirRoute1Trace.files).toEqual(
expect.arrayContaining([
'../../../../node_modules/pkg-behind-symlink/index.js',
'../../../../node_modules/pkg-behind-symlink/package.json',
])
)
expect(
appDirRoute1Trace.files.some((file: string) =>
file.startsWith('../../../../node_modules/pkg/')
)
).toBe(false)
}
if (isTurbopack) { if (isTurbopack) {
// A symlink matched by outputFileTracingIncludes is traced as the symlink itself, even // A symlink matched by outputFileTracingIncludes is traced as the symlink itself, even
...@@ -114,11 +121,12 @@ describe('build trace with extra entries', () => { ...@@ -114,11 +121,12 @@ describe('build trace with extra entries', () => {
) )
if (!isTurbopack) { if (!isTurbopack) {
// Turbopack ignores the `webpack()` config hook, so `lib/get-data.js`
// is never injected into the `pages/_app` entry and neither it nor the
// `content/hello.json` it reads end up in the trace.
expect( expect(
appTrace.files.some((file: string) => file.endsWith('hello.json')) appTrace.files.some((file: string) => file.endsWith('hello.json'))
).toBe(true) ).toBe(true)
}
if (!isTurbopack) {
expect( expect(
appTrace.files.some((file: string) => appTrace.files.some((file: string) =>
file.endsWith('lib/get-data.js') file.endsWith('lib/get-data.js')
...@@ -137,23 +145,30 @@ describe('build trace with extra entries', () => { ...@@ -137,23 +145,30 @@ describe('build trace with extra entries', () => {
expect( expect(
indexTrace.files.some((file: string) => file.endsWith('some-dir')) indexTrace.files.some((file: string) => file.endsWith('some-dir'))
).toBeFalsy() ).toBeFalsy()
expect( if (!isTurbopack) {
indexTrace.files.some((file: string) => // TODO: Turbopack only matches `outputFileTracingIncludes` keys against
file.endsWith('.dot-folder/another-file.txt') // the normalized route ("/index"), not the prefixed entry name
) // ("/pages/index") that this config uses for the index page. The same
).toBe(true) // includes are asserted for `/route1` below, which uses the normalized
expect( // form and does work in both bundlers.
indexTrace.files.some((file: string) => expect(
file.endsWith('some-dir/file.txt') indexTrace.files.some((file: string) =>
) file.endsWith('.dot-folder/another-file.txt')
).toBe(true) )
).toBe(true)
expect(
indexTrace.files.some((file: string) =>
file.endsWith('some-dir/file.txt')
)
).toBe(true)
expect(indexTrace.files).toContain('../../../include-me/hello.txt')
expect(indexTrace.files).toContain('../../../include-me/second.txt')
}
expect( expect(
indexTrace.files.some((file: string) => indexTrace.files.some((file: string) =>
file.includes('some-cms/index.js') file.includes('some-cms/index.js')
) )
).toBe(true) ).toBe(true)
expect(indexTrace.files).toContain('../../../include-me/hello.txt')
expect(indexTrace.files).toContain('../../../include-me/second.txt')
expect( expect(
indexTrace.files.some((file: string) => file.includes('exclude-me')) indexTrace.files.some((file: string) => file.includes('exclude-me'))
).toBe(false) ).toBe(false)
......
...@@ -12467,15 +12467,6 @@ ...@@ -12467,15 +12467,6 @@
"flakey": [], "flakey": [],
"runtimeError": false "runtimeError": false
}, },
"test/integration/build-trace-extra-entries-turbo/test/index.test.ts": {
"passed": [
"build trace with extra entries production mode should build and trace correctly"
],
"failed": [],
"pending": [],
"flakey": [],
"runtimeError": false
},
"test/integration/build-trace-extra-entries/test/index.test.ts": { "test/integration/build-trace-extra-entries/test/index.test.ts": {
"passed": [ "passed": [
"build trace with extra entries production mode should build and trace correctly" "build trace with extra entries production mode should build and trace correctly"
...@@ -14915,15 +14915,6 @@ ...@@ -14915,15 +14915,6 @@
"flakey": [], "flakey": [],
"runtimeError": false "runtimeError": false
}, },
"test/integration/build-trace-extra-entries-turbo/test/index.test.ts": {
"passed": [],
"failed": [],
"pending": [
"build trace with extra entries production mode should build and trace correctly"
],
"flakey": [],
"runtimeError": false
},
"test/integration/build-trace-extra-entries/test/index.test.ts": { "test/integration/build-trace-extra-entries/test/index.test.ts": {
"passed": [], "passed": [],
"failed": [], "failed": [],
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