diff --git a/integrations/tailwindcss-cli/tests/cli.test.js b/integrations/tailwindcss-cli/tests/cli.test.js index 644ebf2267cd..8289e65d027d 100644 --- a/integrations/tailwindcss-cli/tests/cli.test.js +++ b/integrations/tailwindcss-cli/tests/cli.test.js @@ -319,6 +319,46 @@ describe('Init command', () => { // multiple keys in `theme` exists. However it loads `tailwindcss/colors` // which doesn't exists in this context. expect((await readOutputFile('../full.config.js')).split('\n').length).toBeGreaterThan(50) + + expect(await readOutputFile('../full.config.js')).not.toContain( + `/** @type {import('tailwindcss/types').Config} */` + ) + }) + + test('--types', async () => { + cleanupFile('simple.config.js') + + let { combined } = await $(`${EXECUTABLE} init simple.config.js --types`) + + expect(combined).toMatchInlineSnapshot(` + " + Created Tailwind CSS config file: simple.config.js + " + `) + + expect(await readOutputFile('../simple.config.js')).toContain( + `/** @type {import('tailwindcss/types').Config} */` + ) + }) + + test('--full --types', async () => { + cleanupFile('full.config.js') + + let { combined } = await $(`${EXECUTABLE} init full.config.js --full --types`) + + expect(combined).toMatchInlineSnapshot(` + " + Created Tailwind CSS config file: full.config.js + " + `) + + // Not a clean way to test this. We could require the file and verify that + // multiple keys in `theme` exists. However it loads `tailwindcss/colors` + // which doesn't exists in this context. + expect((await readOutputFile('../full.config.js')).split('\n').length).toBeGreaterThan(50) + expect(await readOutputFile('../full.config.js')).toContain( + `/** @type {import('tailwindcss/types').Config} */` + ) }) test('--postcss', async () => { @@ -351,6 +391,7 @@ describe('Init command', () => { Options: -f, --full Initialize a full \`tailwind.config.js\` file -p, --postcss Initialize a \`postcss.config.js\` file + --types Add TypeScript types for the \`tailwind.config.js\` file -h, --help Display usage information `) )