Skip to content
Prev Previous commit
Next Next commit
add circular dependency test with multiple levels
  • Loading branch information
RobinMalfait committed Jan 7, 2025
commit b2fbe0e126d7dd4ddc249af4508b63ae406912d3
29 changes: 29 additions & 0 deletions packages/tailwindcss/src/utilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17409,4 +17409,33 @@ describe('custom utilities', () => {
`[Error: You cannot \`@apply\` the \`hover:bar\` utility here because it creates a circular dependency.]`,
)
})

test('custom utilities with `@apply` causing circular dependencies should error (multiple levels)', async () => {
await expect(() =>
compileCss(
css`
body {
@apply foo;
}

@utility foo {
@apply flex-wrap hover:bar;
}

@utility bar {
@apply flex dark:baz;
}

@utility baz {
@apply flex-wrap hover:foo;
}

@tailwind utilities;
`,
['foo', 'bar'],
),
).rejects.toThrowErrorMatchingInlineSnapshot(
`[Error: You cannot \`@apply\` the \`hover:bar\` utility here because it creates a circular dependency.]`,
)
})
})