tailwindcss/packages
Philipp Spiess bfcc144798
Reduce precision of oklab() arguments in test snapshots (#15210)
After the changes in #15201, our Windows CI started to fail. The problem
is that lightningcss now needs to convert `oklch` colors into the
`oklab` space to inline some `color-mix()` functions.

The problem, though, is that this calculation seems to have rounding
differences between macOS, Linux, and Windows. Since we still want to
_define the default color space in `oklch`_ and _use lightningcss as a
post-processor in our unit tests so we have a better coverage of the
output_, this PR attempts to fix the issue by adding a custom vitest
serializer. It will find usages of the `oklab()` function with arguments
that have lots of decimal places (at least 6 decimal places). What it
then does is simply cut off any excess decimal places to truncate the
output to 5 places. E.g.:

```diff
- oklab(62.7955% .224863 .125846 / .75);
+ oklab(62.7955% .22486 .12584 / .75);
```

## Test Plan

I updated the CI workflow file to make all three builds run in CI and
observed that they are now all green again.

<img width="609" alt="Screenshot 2024-11-27 at 14 54 52"
src="https://github.com/user-attachments/assets/73fe6da5-30e3-4fd4-83ea-115b1f1602a6">
2024-11-27 11:06:19 -05:00
..
@tailwindcss-cli Set browser targets for iOS Safari, Firefox, and Chrome (#15166) 2024-11-26 11:22:12 +00:00
@tailwindcss-node Prepare v4.0.0-beta.2 release (#15104) 2024-11-22 11:17:21 -05:00
@tailwindcss-postcss Use oklab instead of oklch for color-mix(…) and gradients (#15201) 2024-11-27 06:18:31 -05:00
@tailwindcss-standalone Prepare v4.0.0-beta.2 release (#15104) 2024-11-22 11:17:21 -05:00
@tailwindcss-upgrade Update tree-sitter 0.22.0 → 0.22.1 (minor) (#15130) 2024-11-26 14:06:25 +01:00
@tailwindcss-vite Set browser targets for iOS Safari, Firefox, and Chrome (#15166) 2024-11-26 11:22:12 +00:00
internal-example-plugin Prefix internal modules with internal-* (#14074) 2024-07-29 10:58:07 -04:00
tailwindcss Reduce precision of oklab() arguments in test snapshots (#15210) 2024-11-27 11:06:19 -05:00
tsconfig.base.json introduce v4 codebase 2024-03-05 14:29:15 +01:00