-
Notifications
You must be signed in to change notification settings - Fork 27.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
106 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
import { | ||
assertHasRedbox, | ||
getStackFramesContent, | ||
toggleCollapseCallStackFrames, | ||
} from 'next-test-utils' | ||
import { outdent } from 'outdent' | ||
|
||
describe('errors - node-internal-stack-frame', () => { | ||
const { next } = nextTestSetup({ | ||
files: { | ||
'pages/index.js': outdent` | ||
export default function Page() {} | ||
export function getServerSideProps() { | ||
new URL("/", "invalid"); | ||
return { props: {} }; | ||
}`, | ||
}, | ||
}) | ||
|
||
test('should hide unrelated frames in stack trace with node:internal calls', async () => { | ||
const browser = await next.browser('/') | ||
|
||
await assertHasRedbox(browser) | ||
|
||
const stack = await getStackFramesContent(browser) | ||
if (process.env.TURBOPACK) { | ||
// FIXME: ignore the next internal frames from node_modules | ||
expect(stack).toMatchInlineSnapshot(` | ||
"at getServerSideProps () | ||
at spanContext () | ||
at async doRender () | ||
at async responseGenerator () | ||
at async DevServer.renderToResponseWithComponentsImpl () | ||
at async DevServer.renderPageComponent () | ||
at async DevServer.renderToResponseImpl () | ||
at async DevServer.pipeImpl () | ||
at async NextNodeServer.handleCatchallRenderRequest () | ||
at async DevServer.handleRequestImpl () | ||
at async Span.traceAsyncFn () | ||
at async DevServer.handleRequest () | ||
at async invokeRender () | ||
at async handleRequest () | ||
at async requestHandlerImpl () | ||
at async Server.requestListener ()" | ||
`) | ||
} else { | ||
expect(stack).toMatchInlineSnapshot(` | ||
"at eval () | ||
at renderToHTMLImpl ()" | ||
`) | ||
} | ||
await toggleCollapseCallStackFrames(browser) | ||
|
||
// TODO: Since there're still the locations | ||
const expandedStack = await getStackFramesContent(browser) | ||
expect(expandedStack).toContain(`at new URL ()`) | ||
}) | ||
}) |