Skip to content

Remove duplicate tests and restore their intended inputs - #20751

Open
figueiredoluiz wants to merge 1 commit into
tailwindlabs:mainfrom
figueiredoluiz:test/dedupe-duplicate-tests
Open

figueiredoluiz wants to merge 1 commit into
tailwindlabs:mainfrom
figueiredoluiz:test/dedupe-duplicate-tests

Conversation

@figueiredoluiz

Copy link
Copy Markdown

Summary

A few tests in packages/tailwindcss have the same body as a neighbouring test, so they ran the same check twice. Each pair went that way for a different reason:

  • candidate.test.ts: "implicit variable" tests. These used to cover the automatic var(…) injection syntax (bg-[--value]). When that syntax was removed in Remove automatic var(…) injection #13657, their inputs were changed to bg-[var(--value)], which is exactly what the "explicit variable" tests below them check. The implicit syntax is now the parens shorthand (bg-(--value)), so:
    • The non-important "implicit" tests are removed. bg-(--my-color) and bg-red-500/(--value) are already covered by should parse a utility with an arbitrary value with parens and should parse a utility with an implicit variable as the modifier using the shorthand.
    • The two !important "implicit" tests now use bg-(--value)! and bg-red-500/(--value)!. Those inputs had no coverage yet.
  • css-functions.test.ts: theme("--color-red-500"). Its CSS has used the unquoted theme(--color-red-500) since it was added, so it repeated the test above it. It now uses the quoted form (theme('--color-red-500')), which nothing else tested. The title uses single quotes to match what Prettier writes in the CSS and the other quoted theme('colors.red.500') tests.
  • replace-shadow-colors.test.ts: should handle box-shadow with intensity. When the it.each table was split into separate tests in Improve compatibility with Safari 15 #17435, the one 1px 1px var(--my-color) intensity row became two identical tests. One of them is removed.

The duplicates were found with vitest-dedup (duplicate-test rule) and checked by hand against git log/git blame.

There are no source changes. No changelog entry, because this only touches tests.

Test plan

# the three changed files: 1556 tests on main, 1553 with this change (the 3 removed duplicates)
cd packages/tailwindcss && pnpm vitest run src/candidate.test.ts src/css-functions.test.ts src/utils/replace-shadow-colors.test.ts

# whole tailwindcss package: 45 files, 5493 passed, 1 skipped
pnpm vitest run

# formatting of the changed files (from the repository root)
pnpm prettier --check packages/tailwindcss/src/candidate.test.ts packages/tailwindcss/src/css-functions.test.ts packages/tailwindcss/src/utils/replace-shadow-colors.test.ts

To confirm the quoted theme('--color-red-500') test now covers unquoting, I disabled eventuallyUnquote(path) in css-functions.ts. That made this test fail while the unquoted one still passed. I then reverted the change.

Some tests in packages/tailwindcss had the same body as another test:

- candidate.test.ts: the "implicit variable" tests became copies of the
  "explicit variable" tests when automatic var() injection was removed
  (tailwindlabs#13657). Remove the non-important ones, which the parens shorthand
  tests already cover, and switch the important ones to the shorthand
  syntax (`bg-(--value)!`, `bg-red-500/(--value)!`).
- css-functions.test.ts: the quoted theme() test used the unquoted
  syntax. Use `theme('--color-red-500')` so it covers unquoting.
- replace-shadow-colors.test.ts: remove a copy of the intensity test
  that came from splitting the it.each table (tailwindlabs#17435).
@figueiredoluiz
figueiredoluiz requested a review from a team as a code owner November 23, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant