Skip to content

Commit 30538b3

Browse files
Update integration tests (tailwindlabs#8386)
* Add content glob integration tests * Use tagged version in parcel integration tests * Upgrade postcss-cli integration tests * upgrade integration test deps * Fix CS * Fix tests * Update lockfile * Fix vite test in CI
1 parent fc25299 commit 30538b3

40 files changed

+8975
-38168
lines changed

integrations/package-lock.json

+1,107-1,540
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integrations/parcel/package-lock.json

+3,023-24,729
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integrations/parcel/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
]
1616
},
1717
"devDependencies": {
18-
"parcel": "nightly"
18+
"parcel": "^2.5.0"
1919
}
2020
}
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<link rel="stylesheet" href="./index.css">
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
11+
</body>
12+
</html>

integrations/parcel/tailwind.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
content: ['./src/index.html'],
2+
content: ['./src/index.html', './src/glob/*.{js,html}'],
33
theme: {
44
extend: {},
55
},

integrations/parcel/tests/integration.test.js

+61-11
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('static build', () => {
3333
})
3434
})
3535

36-
describe.skip('watcher', () => {
36+
describe('watcher', () => {
3737
test('classes are generated when the html file changes', async () => {
3838
await writeInputFile(
3939
'index.html',
@@ -92,6 +92,60 @@ describe.skip('watcher', () => {
9292
return runningProcess.stop()
9393
})
9494

95+
test.skip('classes are generated when globbed files change', async () => {
96+
await writeInputFile('index.html', html` <link rel="stylesheet" href="./index.css" /> `)
97+
98+
await writeInputFile('glob/index.html', html` <div class="font-bold"></div> `)
99+
100+
let runningProcess = $('parcel watch ./src/index.html --no-cache')
101+
102+
await waitForOutputFileCreation(/index\.\w+\.css$/)
103+
104+
expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss(
105+
css`
106+
.font-bold {
107+
font-weight: 700;
108+
}
109+
`
110+
)
111+
112+
await waitForOutputFileChange(/index\.\w+\.css$/, async () => {
113+
await appendToInputFile('glob/index.html', html`<div class="font-normal"></div>`)
114+
})
115+
116+
expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss(
117+
css`
118+
.font-bold {
119+
font-weight: 700;
120+
}
121+
.font-normal {
122+
font-weight: 400;
123+
}
124+
`
125+
)
126+
127+
await waitForOutputFileChange(/index\.\w+\.css$/, async () => {
128+
await appendToInputFile('glob/index.html', html`<div class="bg-red-500"></div>`)
129+
})
130+
131+
expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss(
132+
css`
133+
.bg-red-500 {
134+
--tw-bg-opacity: 1;
135+
background-color: rgb(239 68 68 / var(--tw-bg-opacity));
136+
}
137+
.font-bold {
138+
font-weight: 700;
139+
}
140+
.font-normal {
141+
font-weight: 400;
142+
}
143+
`
144+
)
145+
146+
return runningProcess.stop()
147+
})
148+
95149
test('classes are generated when the tailwind.config.js file changes', async () => {
96150
await writeInputFile(
97151
'index.html',
@@ -199,12 +253,10 @@ describe.skip('watcher', () => {
199253

200254
expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss(
201255
css`
256+
/* prettier-ignore */
202257
.btn {
203-
border-radius: 0.25rem;
204-
padding-left: 0.5rem;
205-
padding-right: 0.5rem;
206-
padding-top: 0.25rem;
207-
padding-bottom: 0.25rem;
258+
border-radius: .25rem;
259+
padding: .25rem .5rem;
208260
}
209261
.font-bold {
210262
font-weight: 700;
@@ -231,14 +283,12 @@ describe.skip('watcher', () => {
231283

232284
expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss(
233285
css`
286+
/* prettier-ignore */
234287
.btn {
235-
border-radius: 0.25rem;
236288
--tw-bg-opacity: 1;
237289
background-color: rgb(239 68 68 / var(--tw-bg-opacity));
238-
padding-left: 0.5rem;
239-
padding-right: 0.5rem;
240-
padding-top: 0.25rem;
241-
padding-bottom: 0.25rem;
290+
border-radius: .25rem;
291+
padding: .25rem .5rem;
242292
}
243293
.font-bold {
244294
font-weight: 700;

0 commit comments

Comments
 (0)