@@ -319,6 +319,46 @@ describe('Init command', () => {
319
319
// multiple keys in `theme` exists. However it loads `tailwindcss/colors`
320
320
// which doesn't exists in this context.
321
321
expect ( ( await readOutputFile ( '../full.config.js' ) ) . split ( '\n' ) . length ) . toBeGreaterThan ( 50 )
322
+
323
+ expect ( await readOutputFile ( '../full.config.js' ) ) . not . toContain (
324
+ `/** @type {import('tailwindcss/types').Config} */`
325
+ )
326
+ } )
327
+
328
+ test ( '--types' , async ( ) => {
329
+ cleanupFile ( 'simple.config.js' )
330
+
331
+ let { combined } = await $ ( `${ EXECUTABLE } init simple.config.js --types` )
332
+
333
+ expect ( combined ) . toMatchInlineSnapshot ( `
334
+ "
335
+ Created Tailwind CSS config file: simple.config.js
336
+ "
337
+ ` )
338
+
339
+ expect ( await readOutputFile ( '../simple.config.js' ) ) . toContain (
340
+ `/** @type {import('tailwindcss/types').Config} */`
341
+ )
342
+ } )
343
+
344
+ test ( '--full --types' , async ( ) => {
345
+ cleanupFile ( 'full.config.js' )
346
+
347
+ let { combined } = await $ ( `${ EXECUTABLE } init full.config.js --full --types` )
348
+
349
+ expect ( combined ) . toMatchInlineSnapshot ( `
350
+ "
351
+ Created Tailwind CSS config file: full.config.js
352
+ "
353
+ ` )
354
+
355
+ // Not a clean way to test this. We could require the file and verify that
356
+ // multiple keys in `theme` exists. However it loads `tailwindcss/colors`
357
+ // which doesn't exists in this context.
358
+ expect ( ( await readOutputFile ( '../full.config.js' ) ) . split ( '\n' ) . length ) . toBeGreaterThan ( 50 )
359
+ expect ( await readOutputFile ( '../full.config.js' ) ) . toContain (
360
+ `/** @type {import('tailwindcss/types').Config} */`
361
+ )
322
362
} )
323
363
324
364
test ( '--postcss' , async ( ) => {
@@ -351,6 +391,7 @@ describe('Init command', () => {
351
391
Options:
352
392
-f, --full Initialize a full \`tailwind.config.js\` file
353
393
-p, --postcss Initialize a \`postcss.config.js\` file
394
+ --types Add TypeScript types for the \`tailwind.config.js\` file
354
395
-h, --help Display usage information
355
396
` )
356
397
)
0 commit comments