|
1 |
| -import { expect, test } from 'vitest' |
| 1 | +import { expect, test, TestOptions } from 'vitest' |
2 | 2 | import * as path from 'node:path'
|
3 | 3 | import { ProjectLocator } from './project-locator'
|
4 | 4 | import { URL, fileURLToPath } from 'url'
|
5 | 5 | import { Settings } from '@tailwindcss/language-service/src/util/state'
|
6 | 6 | import { createResolver } from './resolver'
|
7 |
| -import { css, defineTest, js, json, scss, Storage, TestUtils } from './testing' |
| 7 | +import { css, defineTest, html, js, json, scss, Storage, TestUtils } from './testing' |
8 | 8 |
|
9 | 9 | let settings: Settings = {
|
10 | 10 | tailwindCSS: {
|
@@ -279,23 +279,78 @@ testLocator({
|
279 | 279 | ],
|
280 | 280 | })
|
281 | 281 |
|
| 282 | +testLocator({ |
| 283 | + options: { only: true }, |
| 284 | + |
| 285 | + // Don't exclude any files when searching |
| 286 | + settings: { |
| 287 | + tailwindCSS: { files: { exclude: [] } } as any, |
| 288 | + }, |
| 289 | + |
| 290 | + name: 'wip', |
| 291 | + fs: { |
| 292 | + 'packages/a/package.json': json` |
| 293 | + { |
| 294 | + "dependencies": { |
| 295 | + "tailwindcss": "4.0.0" |
| 296 | + } |
| 297 | + } |
| 298 | + `, |
| 299 | + 'packages/a/styles.css': css` |
| 300 | + @import 'tailwindcss'; |
| 301 | + @theme { |
| 302 | + --color-primary: #c0ffee; |
| 303 | + } |
| 304 | + `, |
| 305 | + 'packages/a/index.html': html` <div class="underline"></div> `, |
| 306 | + 'packages/b/package.json': json` |
| 307 | + { |
| 308 | + "dependencies": { |
| 309 | + "tailwindcss": "3.4.17" |
| 310 | + } |
| 311 | + } |
| 312 | + `, |
| 313 | + 'packages/b/styles.css': css` |
| 314 | + @tailwind base; |
| 315 | + @tailwind utilities; |
| 316 | + @tailwind components; |
| 317 | + `, |
| 318 | + 'packages/b/index.html': html` <div class="underline"></div> `, |
| 319 | + }, |
| 320 | + expected: [ |
| 321 | + { |
| 322 | + version: '4.0.0', |
| 323 | + config: '/packages/a/node_modules/tailwindcss/utilities.css', |
| 324 | + content: [], |
| 325 | + }, |
| 326 | + { |
| 327 | + version: '4.0.0', |
| 328 | + config: '/packages/a/styles.css', |
| 329 | + content: [], |
| 330 | + }, |
| 331 | + ], |
| 332 | +}) |
| 333 | + |
282 | 334 | // ---
|
283 | 335 |
|
284 | 336 | function testLocator({
|
285 | 337 | name,
|
286 | 338 | fs,
|
287 | 339 | expected,
|
288 | 340 | settings,
|
| 341 | + options, |
289 | 342 | }: {
|
290 | 343 | name: string
|
291 | 344 | fs: Storage
|
292 | 345 | settings?: Partial<Settings>
|
| 346 | + options?: TestOptions |
293 | 347 | expected: any[]
|
294 | 348 | }) {
|
295 | 349 | defineTest({
|
296 | 350 | name,
|
297 | 351 | fs,
|
298 | 352 | prepare,
|
| 353 | + options, |
299 | 354 | async handle({ search }) {
|
300 | 355 | let projects = await search(settings)
|
301 | 356 |
|
|
0 commit comments