Skip to content

Commit bda18e3

Browse files
committed
Update Vite; fix test regex (#12994)
Vite is generating files like "index--T9oO-MP.css", which required relaxing the regex used in tests.
1 parent 89f0f54 commit bda18e3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Diff for: integrations/vite/tests/integration.test.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ let { readOutputFile, appendToInputFile, writeInputFile, removeFile } = require(
1010
})
1111

1212
let PORT = 1337
13+
let OUTPUT_REGEX = /index[.-][\w-]+\.css$/
1314

1415
async function fetchCSS() {
1516
let response = await fetch(`http://localhost:${PORT}/index.css`, {
@@ -34,7 +35,7 @@ describe('static build', () => {
3435
env: { NODE_ENV: 'production', NO_COLOR: '1' },
3536
})
3637

37-
expect(await readOutputFile(/index.\w+\.css$/)).toIncludeCss(
38+
expect(await readOutputFile(OUTPUT_REGEX)).toIncludeCss(
3839
css`
3940
.font-bold {
4041
font-weight: 700;
@@ -76,7 +77,7 @@ describe('static build', () => {
7677
})
7778

7879
if (env.ENGINE === 'stable') {
79-
expect(await readOutputFile(/index.\w+\.css$/)).toIncludeCss(
80+
expect(await readOutputFile(OUTPUT_REGEX)).toIncludeCss(
8081
css`
8182
.bg-primary {
8283
--tw-bg-opacity: 1;
@@ -87,7 +88,7 @@ describe('static build', () => {
8788
}
8889

8990
if (env.ENGINE === 'oxide') {
90-
expect(await readOutputFile(/index.\w+\.css$/)).toIncludeCss(
91+
expect(await readOutputFile(OUTPUT_REGEX)).toIncludeCss(
9192
css`
9293
.bg-primary {
9394
background-color: black;
@@ -132,7 +133,7 @@ describe('static build', () => {
132133
})
133134

134135
if (env.ENGINE === 'stable') {
135-
expect(await readOutputFile(/index.\w+\.css$/)).toIncludeCss(
136+
expect(await readOutputFile(OUTPUT_REGEX)).toIncludeCss(
136137
css`
137138
.bg-primary {
138139
--tw-bg-opacity: 1;
@@ -143,7 +144,7 @@ describe('static build', () => {
143144
}
144145

145146
if (env.ENGINE === 'oxide') {
146-
expect(await readOutputFile(/index.\w+\.css$/)).toIncludeCss(
147+
expect(await readOutputFile(OUTPUT_REGEX)).toIncludeCss(
147148
css`
148149
.bg-primary {
149150
background-color: black;

0 commit comments

Comments
 (0)