Skip to content

Commit 7175dca

Browse files
Add tests for empty path case
1 parent 3d0fe1d commit 7175dca

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

packages/tailwindcss/src/index.test.ts

+32
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,38 @@ describe('Parsing themes values from CSS', () => {
12951295
})
12961296

12971297
describe('plugins', () => {
1298+
test('@plugin need a path', () =>
1299+
expect(
1300+
compile(
1301+
css`
1302+
@plugin;
1303+
`,
1304+
{
1305+
loadPlugin: async () => {
1306+
return ({ addVariant }: PluginAPI) => {
1307+
addVariant('hocus', '&:hover, &:focus')
1308+
}
1309+
},
1310+
},
1311+
),
1312+
).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: \`@plugin\` must have a path.]`))
1313+
1314+
test('@plugin can not have an empty path', () =>
1315+
expect(
1316+
compile(
1317+
css`
1318+
@plugin '';
1319+
`,
1320+
{
1321+
loadPlugin: async () => {
1322+
return ({ addVariant }: PluginAPI) => {
1323+
addVariant('hocus', '&:hover, &:focus')
1324+
}
1325+
},
1326+
},
1327+
),
1328+
).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: \`@plugin\` must have a path.]`))
1329+
12981330
test('@plugin cannot be nested.', () =>
12991331
expect(
13001332
compile(

0 commit comments

Comments
 (0)