Skip to content

Commit 165718a

Browse files
committed
update test
1 parent 7b45b77 commit 165718a

File tree

1 file changed

+56
-4
lines changed

1 file changed

+56
-4
lines changed

integrations/cli/index.test.ts

+56-4
Original file line numberDiff line numberDiff line change
@@ -285,18 +285,33 @@ describe.only('@source', () => {
285285
/* {my-lib-1,my-lib-2}: expand */
286286
/* *.html: only look for .html */
287287
@source '../node_modules/{my-lib-1,my-lib-2}/src/**/*.html';
288-
@source './logo.{jpg,png}'; /* Don't worry about it */
288+
289+
/* We typically ignore these extensions, but now include them explicitly */
290+
@source './logo.{jpg,png}';
291+
292+
/* Project C should apply auto source detection */
293+
@source '../../project-c';
289294
`,
295+
296+
// Project A is the current folder, but we explicitly configured
297+
// `source(project-b)`, therefore project-a should not be included in
298+
// the output.
290299
'project-a/src/index.html': html`
291300
<div
292301
class="content-['SHOULD-NOT-EXIST-IN-OUTPUT'] content-['project-a/src/index.html']"
293302
></div>
294303
`,
304+
305+
// Project A explicitly includes an extension we usually ignore,
306+
// therefore it should be included in the output.
295307
'project-a/src/logo.jpg': html`
296308
<div
297309
class="content-['project-a/src/logo.jpg']"
298310
></div>
299311
`,
312+
313+
// Project A explicitly includes node_modules/{my-lib-1,my-lib-2},
314+
// therefore these files should be included in the output.
300315
'project-a/node_modules/my-lib-1/src/index.html': html`
301316
<div
302317
class="content-['project-a/node_modules/my-lib-1/src/index.html']"
@@ -307,22 +322,55 @@ describe.only('@source', () => {
307322
class="content-['project-a/node_modules/my-lib-2/src/index.html']"
308323
></div>
309324
`,
325+
326+
// Project B is the configured `source(…)`, therefore auto source
327+
// detection should include known extensions and folders in the output.
310328
'project-b/src/index.html': html`
311329
<div
312330
class="content-['project-b/src/index.html']"
313331
></div>
314332
`,
333+
334+
// Project B is the configured `source(…)`, therefore auto source
335+
// detection should apply and node_modules should not be included in the
336+
// output.
315337
'project-b/node_modules/my-lib-3/src/index.html': html`
316338
<div
317339
class="content-['SHOULD-NOT-EXIST-IN-OUTPUT'] content-['project-b/node_modules/my-lib-3/src/index.html']"
318340
></div>
319341
`,
342+
343+
// Project C should apply auto source detection, therefore known
344+
// extensions and folders should be included in the output.
345+
'project-c/src/index.html': html`
346+
<div
347+
class="content-['project-c/src/index.html']"
348+
></div>
349+
`,
350+
351+
// Project C should apply auto source detection, therefore known ignored
352+
// extensions should not be included in the output.
353+
'project-c/src/logo.jpg': html`
354+
<div
355+
class="content-['SHOULD-NOT-EXIST-IN-OUTPUT'] content-['project-c/src/logo.jpg']"
356+
></div>
357+
`,
358+
359+
// Project C should apply auto source detection, therefore node_modules
360+
// should not be included in the output.
361+
'project-c/node_modules/my-lib-1/src/index.html': html`
362+
<div
363+
class="content-['SHOULD-NOT-EXIST-IN-OUTPUT'] content-['project-c/node_modules/my-lib-1/src/index.html']"
364+
></div>
365+
`,
320366
},
321367
},
322368
async ({ fs, exec, root }) => {
323-
await exec('pnpm tailwindcss --input src/index.css --output dist/out.css', {
324-
cwd: path.join(root, 'project-a'),
325-
})
369+
console.log(
370+
await exec('pnpm tailwindcss --input src/index.css --output dist/out.css', {
371+
cwd: path.join(root, 'project-a'),
372+
}),
373+
)
326374

327375
expect(await fs.dumpFiles('./project-a/dist/*.css')).toMatchInlineSnapshot(`
328376
"
@@ -344,6 +392,10 @@ describe.only('@source', () => {
344392
--tw-content: 'project-b/src/index.html';
345393
content: var(--tw-content);
346394
}
395+
.content-\\[\\'project-c\\/src\\/index\\.html\\'\\] {
396+
--tw-content: 'project-c/src/index.html';
397+
content: var(--tw-content);
398+
}
347399
}
348400
@supports (-moz-orient: inline) {
349401
@layer base {

0 commit comments

Comments
 (0)