Skip to content

Commit

Permalink
Update Vite; fix test regex (#12994)
Browse files Browse the repository at this point in the history
Vite is generating files like "index--T9oO-MP.css", which required relaxing the regex used in tests.
  • Loading branch information
KrisBraun committed Feb 21, 2024
1 parent 86e3890 commit e3c5c11
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 1,858 deletions.
7 changes: 4 additions & 3 deletions integrations/vite/tests/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ let { readOutputFile, appendToInputFile, writeInputFile, removeFile } = require(
})

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

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

expect(await readOutputFile(/index.\w+\.css$/)).toIncludeCss(
expect(await readOutputFile(OUTPUT_REGEX)).toIncludeCss(
css`
.font-bold {
font-weight: 700;
Expand Down Expand Up @@ -74,7 +75,7 @@ describe('static build', () => {
env: { NODE_ENV: 'production', NO_COLOR: '1' },
})

expect(await readOutputFile(/index.\w+\.css$/)).toIncludeCss(
expect(await readOutputFile(OUTPUT_REGEX)).toIncludeCss(
css`
.z-primary {
z-index: 0;
Expand Down Expand Up @@ -117,7 +118,7 @@ describe('static build', () => {
env: { NODE_ENV: 'production', NO_COLOR: '1' },
})

expect(await readOutputFile(/index.\w+\.css$/)).toIncludeCss(
expect(await readOutputFile(OUTPUT_REGEX)).toIncludeCss(
css`
.z-primary {
z-index: 0;
Expand Down

0 comments on commit e3c5c11

Please sign in to comment.