Skip to content

Commit c90cbfc

Browse files
committed
Remove more duplicates
1 parent 168dcd7 commit c90cbfc

File tree

1 file changed

+15
-88
lines changed

1 file changed

+15
-88
lines changed

test/e2e/app-dir/cache-components-errors/cache-components-errors.test.ts

Lines changed: 15 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,8 +1983,7 @@ describe('Cache Components Errors', () => {
19831983
it('should show a redbox error', async () => {
19841984
const browser = await next.browser(pathname)
19851985

1986-
if (isTurbopack) {
1987-
await expect(browser).toDisplayRedbox(`
1986+
await expect(browser).toDisplayRedbox(`
19881987
{
19891988
"description": "Route /use-cache-cookies used \`cookies()\` inside "use cache". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use \`cookies()\` outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache",
19901989
"environmentLabel": null,
@@ -1997,21 +1996,6 @@ describe('Cache Components Errors', () => {
19971996
],
19981997
}
19991998
`)
2000-
} else {
2001-
await expect(browser).toDisplayRedbox(`
2002-
{
2003-
"description": "Route /use-cache-cookies used \`cookies()\` inside "use cache". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use \`cookies()\` outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache",
2004-
"environmentLabel": null,
2005-
"label": "Runtime Error",
2006-
"source": "app/use-cache-cookies/page.tsx (22:18) @ CookiesReadingComponent
2007-
> 22 | await cookies()
2008-
| ^",
2009-
"stack": [
2010-
"CookiesReadingComponent app/use-cache-cookies/page.tsx (22:18)",
2011-
],
2012-
}
2013-
`)
2014-
}
20151999
})
20162000
} else {
20172001
it('should error the build', async () => {
@@ -2106,8 +2090,7 @@ describe('Cache Components Errors', () => {
21062090
it('should show a redbox error', async () => {
21072091
const browser = await next.browser(pathname)
21082092

2109-
if (isTurbopack) {
2110-
await expect(browser).toDisplayRedbox(`
2093+
await expect(browser).toDisplayRedbox(`
21112094
{
21122095
"description": "Route /use-cache-draft-mode used "draftMode().enable()" inside "use cache". The enabled status of \`draftMode()\` can be read in caches but you must not enable or disable \`draftMode()\` inside a cache. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache",
21132096
"environmentLabel": null,
@@ -2120,21 +2103,6 @@ describe('Cache Components Errors', () => {
21202103
],
21212104
}
21222105
`)
2123-
} else {
2124-
await expect(browser).toDisplayRedbox(`
2125-
{
2126-
"description": "Route /use-cache-draft-mode used "draftMode().enable()" inside "use cache". The enabled status of \`draftMode()\` can be read in caches but you must not enable or disable \`draftMode()\` inside a cache. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache",
2127-
"environmentLabel": null,
2128-
"label": "Runtime Error",
2129-
"source": "app/use-cache-draft-mode/page.tsx (20:26) @ DraftModeEnablingComponent
2130-
> 20 | ;(await draftMode()).enable()
2131-
| ^",
2132-
"stack": [
2133-
"DraftModeEnablingComponent app/use-cache-draft-mode/page.tsx (20:26)",
2134-
],
2135-
}
2136-
`)
2137-
}
21382106
})
21392107
} else {
21402108
it('should error the build', async () => {
@@ -2207,22 +2175,7 @@ describe('Cache Components Errors', () => {
22072175
it('should show a redbox error', async () => {
22082176
const browser = await next.browser(pathname)
22092177

2210-
if (isTurbopack) {
2211-
await expect(browser).toDisplayRedbox(`
2212-
{
2213-
"description": "Route /use-cache-headers used \`headers()\` inside "use cache". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use \`headers()\` outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache",
2214-
"environmentLabel": null,
2215-
"label": "Runtime Error",
2216-
"source": "app/use-cache-headers/page.tsx (21:18) @ HeadersReadingComponent
2217-
> 21 | await headers()
2218-
| ^",
2219-
"stack": [
2220-
"HeadersReadingComponent app/use-cache-headers/page.tsx (21:18)",
2221-
],
2222-
}
2223-
`)
2224-
} else {
2225-
await expect(browser).toDisplayRedbox(`
2178+
await expect(browser).toDisplayRedbox(`
22262179
{
22272180
"description": "Route /use-cache-headers used \`headers()\` inside "use cache". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use \`headers()\` outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache",
22282181
"environmentLabel": null,
@@ -2235,7 +2188,6 @@ describe('Cache Components Errors', () => {
22352188
],
22362189
}
22372190
`)
2238-
}
22392191
})
22402192
} else {
22412193
it('should error the build', async () => {
@@ -2737,9 +2689,10 @@ describe('Cache Components Errors', () => {
27372689
Export encountered an error on /use-cache-private-in-unstable-cache/page: /use-cache-private-in-unstable-cache, exiting the build."
27382690
`)
27392691
}
2740-
} else if (isRspack) {
2692+
} else {
27412693
if (isDebugPrerender) {
2742-
expect(output).toMatchInlineSnapshot(`
2694+
if (isRspack) {
2695+
expect(output).toMatchInlineSnapshot(`
27432696
"Error: "use cache: private" must not be used within \`unstable_cache()\`.
27442697
at 0 (bundler:///app/use-cache-private-in-unstable-cache/page.tsx:21:38)
27452698
at a (<next-dist-dir>)
@@ -2756,21 +2709,8 @@ describe('Cache Components Errors', () => {
27562709
> Export encountered errors on following paths:
27572710
/use-cache-private-in-unstable-cache/page: /use-cache-private-in-unstable-cache"
27582711
`)
2759-
} else {
2760-
expect(output).toMatchInlineSnapshot(`
2761-
"Error: "use cache: private" must not be used within \`unstable_cache()\`.
2762-
at a (<next-dist-dir>)
2763-
at b (<next-dist-dir>)
2764-
To get a more detailed stack trace and pinpoint the issue, try one of the following:
2765-
- Start the app in development mode by running \`next dev\`, then open "/use-cache-private-in-unstable-cache" in your browser to investigate the error.
2766-
- Rerun the production build with \`next build --debug-prerender\` to generate better stack traces.
2767-
Error occurred prerendering page "/use-cache-private-in-unstable-cache". Read more: https://nextjs.org/docs/messages/prerender-error
2768-
Export encountered an error on /use-cache-private-in-unstable-cache/page: /use-cache-private-in-unstable-cache, exiting the build."
2769-
`)
2770-
}
2771-
} else {
2772-
if (isDebugPrerender) {
2773-
expect(output).toMatchInlineSnapshot(`
2712+
} else {
2713+
expect(output).toMatchInlineSnapshot(`
27742714
"Error: "use cache: private" must not be used within \`unstable_cache()\`.
27752715
at 0 (bundler:///app/use-cache-private-in-unstable-cache/page.tsx:21:38)
27762716
19 | }
@@ -2786,6 +2726,7 @@ describe('Cache Components Errors', () => {
27862726
> Export encountered errors on following paths:
27872727
/use-cache-private-in-unstable-cache/page: /use-cache-private-in-unstable-cache"
27882728
`)
2729+
}
27892730
} else {
27902731
expect(output).toMatchInlineSnapshot(`
27912732
"Error: "use cache: private" must not be used within \`unstable_cache()\`.
@@ -2928,9 +2869,10 @@ describe('Cache Components Errors', () => {
29282869
Export encountered an error on /use-cache-private-in-use-cache/page: /use-cache-private-in-use-cache, exiting the build."
29292870
`)
29302871
}
2931-
} else if (isRspack) {
2872+
} else {
29322873
if (isDebugPrerender) {
2933-
expect(output).toMatchInlineSnapshot(`
2874+
if (isRspack) {
2875+
expect(output).toMatchInlineSnapshot(`
29342876
"Error: "use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private".
29352877
at 0 (bundler:///app/use-cache-private-in-use-cache/page.tsx:15:1)
29362878
at a (<next-dist-dir>)
@@ -2957,24 +2899,8 @@ describe('Cache Components Errors', () => {
29572899
> Export encountered errors on following paths:
29582900
/use-cache-private-in-use-cache/page: /use-cache-private-in-use-cache"
29592901
`)
2960-
} else {
2961-
expect(output).toMatchInlineSnapshot(`
2962-
"Error: "use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private".
2963-
at a (<next-dist-dir>)
2964-
at b (<next-dist-dir>)
2965-
Error: "use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private".
2966-
at c (<next-dist-dir>)
2967-
at d (<next-dist-dir>)
2968-
To get a more detailed stack trace and pinpoint the issue, try one of the following:
2969-
- Start the app in development mode by running \`next dev\`, then open "/use-cache-private-in-use-cache" in your browser to investigate the error.
2970-
- Rerun the production build with \`next build --debug-prerender\` to generate better stack traces.
2971-
Error occurred prerendering page "/use-cache-private-in-use-cache". Read more: https://nextjs.org/docs/messages/prerender-error
2972-
Export encountered an error on /use-cache-private-in-use-cache/page: /use-cache-private-in-use-cache, exiting the build."
2973-
`)
2974-
}
2975-
} else {
2976-
if (isDebugPrerender) {
2977-
expect(output).toMatchInlineSnapshot(`
2902+
} else {
2903+
expect(output).toMatchInlineSnapshot(`
29782904
"Error: "use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private".
29792905
at 0 (bundler:///app/use-cache-private-in-use-cache/page.tsx:15:1)
29802906
13 | }
@@ -2999,6 +2925,7 @@ describe('Cache Components Errors', () => {
29992925
> Export encountered errors on following paths:
30002926
/use-cache-private-in-use-cache/page: /use-cache-private-in-use-cache"
30012927
`)
2928+
}
30022929
} else {
30032930
expect(output).toMatchInlineSnapshot(`
30042931
"Error: "use cache: private" must not be used within "use cache". It can only be nested inside of another "use cache: private".

0 commit comments

Comments
 (0)