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 = {
return cfg
},
outputFileTracingIncludes: {
// Full path includes "app" or "pages"
// Full path includes "app" or "pages".
'/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'],
},
outputFileTracingExcludes: {
......
......@@ -10,10 +10,6 @@ describe('build trace with extra entries', () => {
})
if (skipped) return
if (isTurbopack) {
it('skipped', () => {})
return
}
it('should build and trace correctly', async () => {
const { exitCode } = await next.build()
......@@ -51,17 +47,28 @@ describe('build trace with extra entries', () => {
file.includes('exclude-me')
)
).toBe(false)
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/')
// Webpack preserves the package symlink in traced paths, while Turbopack
// traces files at the symlink's resolved target paths.
if (isTurbopack) {
expect(appDirRoute1Trace.files).toEqual(
expect.arrayContaining([
'../../../../node_modules/pkg/index.js',
'../../../../node_modules/pkg/package.json',
])
)
).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) {
// A symlink matched by outputFileTracingIncludes is traced as the symlink itself, even
......@@ -114,11 +121,12 @@ describe('build trace with extra entries', () => {
)
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(
appTrace.files.some((file: string) => file.endsWith('hello.json'))
).toBe(true)
}
if (!isTurbopack) {
expect(
appTrace.files.some((file: string) =>
file.endsWith('lib/get-data.js')
......@@ -137,23 +145,30 @@ describe('build trace with extra entries', () => {
expect(
indexTrace.files.some((file: string) => file.endsWith('some-dir'))
).toBeFalsy()
expect(
indexTrace.files.some((file: string) =>
file.endsWith('.dot-folder/another-file.txt')
)
).toBe(true)
expect(
indexTrace.files.some((file: string) =>
file.endsWith('some-dir/file.txt')
)
).toBe(true)
if (!isTurbopack) {
// TODO: Turbopack only matches `outputFileTracingIncludes` keys against
// the normalized route ("/index"), not the prefixed entry name
// ("/pages/index") that this config uses for the index page. The same
// includes are asserted for `/route1` below, which uses the normalized
// form and does work in both bundlers.
expect(
indexTrace.files.some((file: string) =>
file.endsWith('.dot-folder/another-file.txt')
)
).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(
indexTrace.files.some((file: string) =>
file.includes('some-cms/index.js')
)
).toBe(true)
expect(indexTrace.files).toContain('../../../include-me/hello.txt')
expect(indexTrace.files).toContain('../../../include-me/second.txt')
expect(
indexTrace.files.some((file: string) => file.includes('exclude-me'))
).toBe(false)
......
......@@ -12467,15 +12467,6 @@
"flakey": [],
"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": {
"passed": [
"build trace with extra entries production mode should build and trace correctly"
......@@ -14915,15 +14915,6 @@
"flakey": [],
"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": {
"passed": [],
"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