Skip to content

Commit

Permalink
fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Dec 19, 2024
1 parent 2b7ca40 commit 8e343d7
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,25 @@ describe('non-root-project-monorepo', () => {
if (isTurbopack) {
// TODO the function name should be hidden
expect(await getRedboxSource(browser)).toMatchInlineSnapshot(`
"app/source-maps-rsc/page.tsx (9:28) @ innerArrowFunction
7 | }
8 |
> 9 | const innerArrowFunction = () => {
| ^
10 | require('../separate-file')
11 | }
12 |"
"app/source-maps-rsc/page.tsx (13:28) @ innerArrowFunction
11 | }
12 |
> 13 | const innerArrowFunction = () => {
| ^
14 | require('../separate-file')
15 | }
16 |"
`)
// TODO stacktrace-parser breaks in some cases with the rsc:// protocol
expect(normalizeStackTrace(await getRedboxCallStack(browser)))
.toMatchInlineSnapshot(`
"<unknown>
[project]/apps/web/app/separate-file.ts [app-rsc] (ecmascript) (rsc://React/Server/file://<full-path>/apps/web/.next/server/chunks/ssr/apps_web_8d1c0a._.js (7:7)
innerFunction
app/source-maps-rsc/page.tsx (6:3)
Page
app/source-maps-rsc/page.tsx (2:3)"
"<unknown>
[project]/apps/web/app/separate-file.ts [app-rsc] (ecmascript) (rsc://React/Server/file://<full-path>/apps/web/.next/server/chunks/ssr/apps_web_8d1c0a._.js (7:7)
innerFunction
app/source-maps-rsc/page.tsx (10:3)
Page
app/source-maps-rsc/page.tsx (4:5)"
`)
} else {
// TODO the function name is incorrect
Expand All @@ -98,16 +98,16 @@ describe('non-root-project-monorepo', () => {
// TODO webpack runtime code shouldn't be included in stack trace
expect(normalizeStackTrace(await getRedboxCallStack(browser)))
.toMatchInlineSnapshot(`
"<unknown>
rsc)/./app/separate-file.ts (rsc://React/Server/file://<full-path>/apps/web/.next/server/app/source-maps-rsc/page.js
__webpack_require__
file://<full-path>/apps/web/.next/server/webpack-runtime.js
require
app/source-maps-rsc/page.tsx (10:3)
innerArrowFunction
app/source-maps-rsc/page.tsx (6:3)
innerFunction
app/source-maps-rsc/page.tsx (2:3)"
"<unknown>
rsc)/./app/separate-file.ts (rsc://React/Server/file://<full-path>/apps/web/.next/server/app/source-maps-rsc/page.js
__webpack_require__
file://<full-path>/apps/web/.next/server/webpack-runtime.js
require
app/source-maps-rsc/page.tsx (14:3)
innerArrowFunction
app/source-maps-rsc/page.tsx (10:3)
innerFunction
app/source-maps-rsc/page.tsx (4:5)"
`)
}
await browser.close()
Expand All @@ -128,12 +128,12 @@ describe('non-root-project-monorepo', () => {
`)
expect(normalizeStackTrace(await getRedboxCallStack(browser)))
.toMatchInlineSnapshot(`
"innerArrowFunction
app/source-maps-ssr/page.tsx (11:28)
innerFunction
app/source-maps-ssr/page.tsx (8:3)
Page
app/source-maps-ssr/page.tsx (4:3)"
"innerArrowFunction
app/source-maps-ssr/page.tsx (15:28)
innerFunction
app/source-maps-ssr/page.tsx (12:3)
Page
app/source-maps-ssr/page.tsx (6:5)"
`)
} else {
// TODO the function name should be hidden
Expand All @@ -147,20 +147,20 @@ describe('non-root-project-monorepo', () => {
// TODO webpack runtime code shouldn't be included in stack trace
expect(normalizeStackTrace(await getRedboxCallStack(browser)))
.toMatchInlineSnapshot(`
"./app/separate-file.ts
file://<full-path>/apps/web/.next/static/chunks/app/source-maps-ssr/page.js (27:1)
options.factory
file://<full-path>/apps/web/.next/static/chunks/webpack.js (700:31)
__webpack_require__
file://<full-path>/apps/web/.next/static/chunks/webpack.js (37:33)
fn
file://<full-path>/apps/web/.next/static/chunks/webpack.js (357:21)
require
app/source-maps-ssr/page.tsx (12:3)
innerArrowFunction
app/source-maps-ssr/page.tsx (8:3)
innerFunction
app/source-maps-ssr/page.tsx (4:3)"
"./app/separate-file.ts
file://<full-path>/apps/web/.next/static/chunks/app/source-maps-ssr/page.js (27:1)
options.factory
file://<full-path>/apps/web/.next/static/chunks/webpack.js (700:31)
__webpack_require__
file://<full-path>/apps/web/.next/static/chunks/webpack.js (37:33)
fn
file://<full-path>/apps/web/.next/static/chunks/webpack.js (357:21)
require
app/source-maps-ssr/page.tsx (16:3)
innerArrowFunction
app/source-maps-ssr/page.tsx (12:3)
innerFunction
app/source-maps-ssr/page.tsx (6:5)"
`)
}
await browser.close()
Expand Down
20 changes: 0 additions & 20 deletions test/integration/server-side-dev-errors/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ describe('server-side dev errors', () => {

const stderrOutput = stripAnsi(stderr.slice(stderrIdx)).trim()
if (isTurbopack) {
expect(stderrOutput).toStartWith(
' ⨯ ../../test/integration/server-side-dev-errors/pages/gsp.js (6:3) @ getStaticProps' +
'\n ⨯ ../../test/integration/server-side-dev-errors/pages/gsp.js (6:3) @ getStaticProps'
)
expect(stderrOutput).toContain(
' ⨯ ReferenceError: missingVar is not defined' +
'\n at getStaticProps (../../test/integration/server-side-dev-errors/pages/gsp.js:6:2)' +
Expand Down Expand Up @@ -121,10 +117,6 @@ describe('server-side dev errors', () => {

const stderrOutput = stripAnsi(stderr.slice(stderrIdx)).trim()
if (isTurbopack) {
expect(stderrOutput).toStartWith(
' ⨯ ../../test/integration/server-side-dev-errors/pages/gssp.js (6:3) @ getServerSideProps' +
'\n ⨯ ../../test/integration/server-side-dev-errors/pages/gssp.js (6:3) @ getServerSideProps'
)
expect(stderrOutput).toContain(
' ⨯ ReferenceError: missingVar is not defined' +
'\n at getServerSideProps (../../test/integration/server-side-dev-errors/pages/gssp.js:6:2)' +
Expand Down Expand Up @@ -176,10 +168,6 @@ describe('server-side dev errors', () => {

const stderrOutput = stripAnsi(stderr.slice(stderrIdx)).trim()
if (isTurbopack) {
expect(stderrOutput).toStartWith(
' ⨯ ../../test/integration/server-side-dev-errors/pages/blog/[slug].js (6:3) @ getServerSideProps' +
'\n ⨯ ../../test/integration/server-side-dev-errors/pages/blog/[slug].js (6:3) @ getServerSideProps'
)
expect(stderrOutput).toContain(
' ⨯ ReferenceError: missingVar is not defined' +
'\n at getServerSideProps (../../test/integration/server-side-dev-errors/pages/blog/[slug].js:6:2)' +
Expand Down Expand Up @@ -231,10 +219,6 @@ describe('server-side dev errors', () => {

const stderrOutput = stripAnsi(stderr.slice(stderrIdx)).trim()
if (isTurbopack) {
expect(stderrOutput).toStartWith(
' ⨯ ../../test/integration/server-side-dev-errors/pages/api/hello.js (2:3) @ handler' +
'\n ⨯ ../../test/integration/server-side-dev-errors/pages/api/hello.js (2:3) @ handler'
)
expect(stderrOutput).toContain(
' ⨯ ReferenceError: missingVar is not defined' +
'\n at handler (../../test/integration/server-side-dev-errors/pages/api/hello.js:2:2)' +
Expand Down Expand Up @@ -287,10 +271,6 @@ describe('server-side dev errors', () => {
const stderrOutput = stripAnsi(stderr.slice(stderrIdx)).trim()
// FIXME(veil): error repeated
if (isTurbopack) {
expect(stderrOutput).toStartWith(
' ⨯ ../../test/integration/server-side-dev-errors/pages/api/blog/[slug].js (2:3) @ handler' +
'\n ⨯ ../../test/integration/server-side-dev-errors/pages/api/blog/[slug].js (2:3) @ handler'
)
expect(stderrOutput).toContain(
' ⨯ ReferenceError: missingVar is not defined' +
'\n at handler (../../test/integration/server-side-dev-errors/pages/api/blog/[slug].js:2:2)' +
Expand Down

0 comments on commit 8e343d7

Please sign in to comment.