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 23, 2024
1 parent 89f0f54 commit bda18e3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions integrations/vite/tests/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,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 @@ -34,7 +35,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 @@ -76,7 +77,7 @@ describe('static build', () => {
})

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

if (env.ENGINE === 'oxide') {
expect(await readOutputFile(/index.\w+\.css$/)).toIncludeCss(
expect(await readOutputFile(OUTPUT_REGEX)).toIncludeCss(
css`
.bg-primary {
background-color: black;
Expand Down Expand Up @@ -132,7 +133,7 @@ describe('static build', () => {
})

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

if (env.ENGINE === 'oxide') {
expect(await readOutputFile(/index.\w+\.css$/)).toIncludeCss(
expect(await readOutputFile(OUTPUT_REGEX)).toIncludeCss(
css`
.bg-primary {
background-color: black;
Expand Down

0 comments on commit bda18e3

Please sign in to comment.