Files
Tim NeutkensandGitHub 3efa21aad6 Turbopack: Skip manifest loading in server when using route modules (#82903)
## What?

When using Turbopack we'd try to load these files even when they don't
exist, which adds latency because of the retrying. This PR ensures the
files are skipped from loading where possible, which moves the place
where it starts loading the manifest to the route modules instead. The
exception to this is the static generation steps as those don't rely on
route modules yet. This is something still being worked on.
2025-09-03 20:08:29 +02:00

36 lines
1.1 KiB
TypeScript

import { nextTestSetup } from 'e2e-utils'
describe('require-context', () => {
const { next } = nextTestSetup({
files: __dirname,
})
// Recommended for tests that check HTML. Cheerio is a HTML parser that has a jQuery like API.
it('should get correct require context when using regex filtering', async () => {
const $ = await next.render$('/require-context-with-regex')
expect($('pre').text()).toBe(
JSON.stringify([
'./parent/file1.js',
'./parent/file2.js',
'./parent2/file3.js',
])
)
})
// TODO: This test is already scaffolded and just needs to be turned on when turbopack supports it.
// eslint-disable-next-line jest/no-commented-out-tests
// it('should get correct require context when using no regex', async () => {
// const $ = await next.render$('/require-context-with-no-regex')
// expect($('pre').text()).toBe(
// JSON.stringify([
// './parent/file1',
// './parent/file1.js',
// './parent/file2',
// './parent/file2.js',
// './parent2/file3',
// './parent2/file3.js',
// ])
// )
// })
})