Skip to content

Commit 3ffb291

Browse files
committed
Update the CSS test to work with the new filename chunks on client transition.
1 parent 080aea1 commit 3ffb291

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

package-lock.json

+13-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-server-integration-tests/src/__tests__/css/CssSpec.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ describe("A CSS page", () => {
1010

1111
describe("can apply a css class", () => {
1212
helper.testWithDocument("/css", (document) => {
13-
expect(document.querySelector("head link[rel=stylesheet]").href).toMatch(/route0\.css/);
13+
// The way Webpack is chunking the CSS files, the client transition might look for 0.css while
14+
// the server side looks for route0.css
15+
expect(document.querySelector("head link[rel=stylesheet]").href).toMatch(/(?:route)?0\.css/);
1416
});
1517
});
1618

@@ -26,9 +28,11 @@ describe("A CSS page with assets", () => {
2628

2729
describe("can apply a css class", () => {
2830
helper.testWithDocument("/cssWithAssets", (document) => {
29-
// this test is really just to make sure that react-server-cli doesn't explode
30-
// when compiling CSS that includes images and fonts.
31-
expect(document.querySelector("head link[rel=stylesheet]").href).toMatch(/route0\.css/);
31+
// this test is really just to make sure that react-server-cli doesn't explode
32+
// when compiling CSS that includes images and fonts.
33+
// The way Webpack is chunking the CSS files, the client transition might look for 0.css while
34+
// the server side looks for route0.css
35+
expect(document.querySelector("head link[rel=stylesheet]").href).toMatch(/(?:route)?0\.css/);
3236
});
3337
});
3438

0 commit comments

Comments
 (0)