|
1 | 1 | import { nextTestSetup } from 'e2e-utils'
|
2 | 2 | import { check } from 'next-test-utils'
|
3 | 3 |
|
4 |
| -const isPPREnabledByDefault = process.env.__NEXT_EXPERIMENTAL_PPR === 'true' |
5 |
| - |
6 | 4 | describe('app dir - css', () => {
|
7 | 5 | const { next, isNextDev, skipped } = nextTestSetup({
|
8 | 6 | files: __dirname,
|
@@ -490,47 +488,31 @@ describe('app dir - css', () => {
|
490 | 488 | // Even if it's deduped by Float, it should still only be included once in the payload.
|
491 | 489 |
|
492 | 490 | const matches = initialHtml
|
493 |
| - .match(/\/_next\/static\/css\/.+?\.css/g) |
494 | 491 | // The same css chunk could be split into 2 RSC script
|
495 |
| - // normalize "/_next/static/css/app/\"])</script><script>self.__next_f.push([1,\"not-found.css" |
| 492 | + // e.g. |
| 493 | + // "/_next/static/css/app/"])</script><script>self.__next_f.push([1,"not-found.css" |
| 494 | + // "/_next/stati"])</script><script>self.__next_f.push([1,"c/css/app/not-found.css?v=1749205445967" |
496 | 495 | // to "/_next/static/css/app/not-found.css"
|
497 |
| - .map((href) => |
498 |
| - href.replace('"])</script><script>self.__next_f.push([1,"', '') |
499 |
| - ) |
| 496 | + .replaceAll('"])</script><script>self.__next_f.push([1,"', '') |
| 497 | + .match(/\/_next\/static\/css\/.+?\.css/g) |
500 | 498 | .sort()
|
501 | 499 |
|
502 | 500 | // Heavy on testing React implementation details.
|
503 | 501 | // Assertions may change often but what needs to be checked on change is if styles are needlessly duplicated in Flight data
|
504 | 502 | // There are 3 matches, one for the rendered <link> (HTML), one for Float preload (Flight) and one for the <link> inside Flight payload.
|
505 | 503 | // And there is one match for the not found style
|
506 |
| - if (isPPREnabledByDefault) { |
507 |
| - expect(matches).toEqual([ |
508 |
| - // may be split across chunks when we bump React |
509 |
| - '/_next/static/css/app/css/css-duplicate-2/layout.css', |
510 |
| - '/_next/static/css/app/css/css-duplicate-2/layout.css', |
511 |
| - '/_next/static/css/app/css/css-duplicate-2/layout.css', |
512 |
| - '/_next/static/css/app/css/layout.css', |
513 |
| - '/_next/static/css/app/css/layout.css', |
514 |
| - '/_next/static/css/app/css/layout.css', |
515 |
| - '/_next/static/css/app/layout.css', |
516 |
| - '/_next/static/css/app/layout.css', |
517 |
| - '/_next/static/css/app/layout.css', |
518 |
| - '/_next/static/css/app/not-found.css', |
519 |
| - ]) |
520 |
| - } else { |
521 |
| - expect(matches).toEqual([ |
522 |
| - '/_next/static/css/app/css/css-duplicate-2/layout.css', |
523 |
| - '/_next/static/css/app/css/css-duplicate-2/layout.css', |
524 |
| - '/_next/static/css/app/css/css-duplicate-2/layout.css', |
525 |
| - '/_next/static/css/app/css/layout.css', |
526 |
| - '/_next/static/css/app/css/layout.css', |
527 |
| - '/_next/static/css/app/css/layout.css', |
528 |
| - '/_next/static/css/app/layout.css', |
529 |
| - '/_next/static/css/app/layout.css', |
530 |
| - '/_next/static/css/app/layout.css', |
531 |
| - '/_next/static/css/app/not-found.css', |
532 |
| - ]) |
533 |
| - } |
| 504 | + expect(matches).toEqual([ |
| 505 | + '/_next/static/css/app/css/css-duplicate-2/layout.css', |
| 506 | + '/_next/static/css/app/css/css-duplicate-2/layout.css', |
| 507 | + '/_next/static/css/app/css/css-duplicate-2/layout.css', |
| 508 | + '/_next/static/css/app/css/layout.css', |
| 509 | + '/_next/static/css/app/css/layout.css', |
| 510 | + '/_next/static/css/app/css/layout.css', |
| 511 | + '/_next/static/css/app/layout.css', |
| 512 | + '/_next/static/css/app/layout.css', |
| 513 | + '/_next/static/css/app/layout.css', |
| 514 | + '/_next/static/css/app/not-found.css', |
| 515 | + ]) |
534 | 516 | }
|
535 | 517 | })
|
536 | 518 |
|
|
0 commit comments