Skip to content

Commit

Permalink
fix error tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Jan 24, 2025
1 parent c3a4497 commit 2ee55d2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
7 changes: 5 additions & 2 deletions packages/next/next_runtime.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ const externalsMap = {

const externalsRegexMap = {
'(.*)trace/tracer$': 'next/dist/server/lib/trace/tracer',
'(.*)/dist/compiled/babel/(.*)': '$1/dist/compiled/babel/$1',
'(.*)/dist/compiled/webpack/(.*)': '$1/dist/compiled/webpack/$1',
}

const bundleTypes = {
Expand Down Expand Up @@ -130,6 +128,11 @@ const bundleTypes = {
module.exports = ({ dev, turbo, bundleType, experimental }) => {
const externalHandler = ({ context, request, getResolve }, callback) => {
;(async () => {
if (request.match(/next[/\\]dist[/\\]compiled[/\\](babel|webpack)/)) {
callback(null, 'commonjs ' + request)
return
}

if (request.endsWith('.external')) {
const resolve = getResolve()
const resolved = await resolve(context, request)
Expand Down
1 change: 1 addition & 0 deletions test/e2e/react-compiler/react-compiler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ describe.each(
expect(cliOutput).toContain(
'' +
"\n ⨯ TypeError: Cannot read properties of undefined (reading 'H')" +
'\n at c (**)' +
// location not important. Just that this is the only frame.
// TODO: Stack should start at product code. Possible React limitation.
'\n at Container (**)' +
Expand Down
10 changes: 2 additions & 8 deletions test/integration/server-side-dev-errors/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,18 +218,12 @@ describe('server-side dev errors', () => {
if (isTurbopack) {
expect(stderrOutput).toContain(
' ⨯ ReferenceError: missingVar is not defined' +
'\n at handler (../../test/integration/server-side-dev-errors/pages/api/hello.js:2:2)' +
// Next.js internal frame. Feel free to adjust.
// Not ignore-listed because we're not in an isolated app and Next.js is symlinked so it's not in node_modules
'\n at async'
'\n at handler (../../test/integration/server-side-dev-errors/pages/api/hello.js:2:2)'
)
} else {
expect(stderrOutput).toStartWith(
'⨯ ReferenceError: missingVar is not defined' +
'\n at handler (../../test/integration/server-side-dev-errors/pages/api/hello.js:2:2)' +
// Next.js internal frame. Feel free to adjust.
// Not ignore-listed because we're not in an isolated app and Next.js is symlinked so it's not in node_modules
'\n at async'
'\n at handler (../../test/integration/server-side-dev-errors/pages/api/hello.js:2:2)'
)
}
expect(stderrOutput).toContain(
Expand Down

0 comments on commit 2ee55d2

Please sign in to comment.