Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce quickPluginTest and quickVariantPluginTest snapshot size #12170

Merged
merged 4 commits into from
Oct 9, 2023

Conversation

RobinMalfait
Copy link
Member

@RobinMalfait RobinMalfait commented Oct 9, 2023

This PR reduces the output of the quick test helpers.

The quick test helpers generate all the possible combinations based on the default config for a given plugin. However, this can result in very large diffs if a relatively simple change is made to the default config.

For example, this can be observed in Adam's PR (#11832) where adding 6 opacity values resulted in 200k lines added. This happened because we have a dozen plugins that use the opacity values for each color in the configuration.

This PR will still use the default configuration as much as possible, but for certain tests this is reduced to a much simpler set of color values to prevent the state explosion.

We technically don't test the default values for those colors anymore in the quick tests, but it still tests a few scenario's.

This PR also updates all the quickPluginTest and quickVariantPluginTest helpers to use toMatchSnapshot(). While this introduced many snapshot files, it will and should also make it easier in the future to update them in case we add a new value to the default config.

By default we use the default config when creating the quick tests for a
given plugin. However, this can result in _a lot_ of changes. For
example, when you update the opacity values, then these values will be
generated for each color, and for each plugin that uses that color.

You can see that behaviour in Adam's PR (#11832).
He added 6 values to the opacity configuration. This resulted in a diff
that looked like this:
```
+219,436 −9
```

This reduces the amount of examples for plugins that generate _a lot_ of
output otherwise.
This way all the `quickPluginTest` and `quickVariantPluginTest`
implementations are the same. This also allows us to update tests after
config changes in an easier way because they use snapshot tests right
now.
This will make it a tiny bit easier to debug what's going on if we need
it in the future since it's using the same values as the real colors.
@RobinMalfait RobinMalfait changed the title Reduce quick test snapshot size Reduce quickPluginTest and quickVariantPluginTest snapshot size Oct 9, 2023
@RobinMalfait RobinMalfait merged commit 31a80b1 into master Oct 9, 2023
10 checks passed
@RobinMalfait RobinMalfait deleted the fix/reduce-snapshots branch October 9, 2023 14:49
RobinMalfait added a commit to lukewarlow/tailwindcss that referenced this pull request Oct 9, 2023
RobinMalfait added a commit to lukewarlow/tailwindcss that referenced this pull request Oct 9, 2023
RobinMalfait added a commit to nix6839/tailwindcss that referenced this pull request Oct 9, 2023
RobinMalfait added a commit to lukewarlow/tailwindcss that referenced this pull request Oct 9, 2023
RobinMalfait added a commit to lukewarlow/tailwindcss that referenced this pull request Oct 9, 2023
RobinMalfait added a commit to lukewarlow/tailwindcss that referenced this pull request Oct 9, 2023
RobinMalfait added a commit to lukewarlow/tailwindcss that referenced this pull request Oct 9, 2023
RobinMalfait added a commit to lukewarlow/tailwindcss that referenced this pull request Oct 9, 2023
RobinMalfait added a commit to lukewarlow/tailwindcss that referenced this pull request Oct 9, 2023
RobinMalfait added a commit to lukewarlow/tailwindcss that referenced this pull request Oct 9, 2023
RobinMalfait added a commit to lukewarlow/tailwindcss that referenced this pull request Nov 2, 2023
RobinMalfait added a commit to lukewarlow/tailwindcss that referenced this pull request Nov 2, 2023
RobinMalfait added a commit that referenced this pull request Nov 2, 2023
* Add forced-colors-adjust utilities

* Update forcedColorsAdjust.test.js

* use `toMatchSnapshot` instead of `toMatchFormattedCss`

More info: #12170

* rename `forced-colors-adjust` -> `forced-color-adjust`

Dropped the `s` in `colors`.

* update changelog

* fix typo

* use full `forced-color-adjust-auto` and `forced-color-adjust-none` names

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
RobinMalfait added a commit to lukewarlow/tailwindcss that referenced this pull request Nov 2, 2023
RobinMalfait added a commit that referenced this pull request Nov 2, 2023
* Add forced-colors variant

Also add a contrast-custom variant to match custom contrast preferences

* use `toMatchSnapshot` instead of `toMatchFormattedCss`

More info: #12170

* remove `contrast-custom` variant

* move `forcedColorsVariants` next to `prefersContrastVariants`

* update changelog

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
lukewarlow pushed a commit to lukewarlow/tailwindcss that referenced this pull request Nov 7, 2023
lukewarlow pushed a commit to lukewarlow/tailwindcss that referenced this pull request Nov 7, 2023
lukewarlow pushed a commit to lukewarlow/tailwindcss that referenced this pull request Nov 7, 2023
lukewarlow pushed a commit to lukewarlow/tailwindcss that referenced this pull request Nov 7, 2023
thecrypticace pushed a commit that referenced this pull request Dec 4, 2023
* Add forced-colors-adjust utilities

* Update forcedColorsAdjust.test.js

* use `toMatchSnapshot` instead of `toMatchFormattedCss`

More info: #12170

* rename `forced-colors-adjust` -> `forced-color-adjust`

Dropped the `s` in `colors`.

* update changelog

* fix typo

* use full `forced-color-adjust-auto` and `forced-color-adjust-none` names

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
thecrypticace pushed a commit that referenced this pull request Dec 4, 2023
* Add forced-colors variant

Also add a contrast-custom variant to match custom contrast preferences

* use `toMatchSnapshot` instead of `toMatchFormattedCss`

More info: #12170

* remove `contrast-custom` variant

* move `forcedColorsVariants` next to `prefersContrastVariants`

* update changelog

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
thecrypticace pushed a commit that referenced this pull request Dec 5, 2023
* Add forced-colors-adjust utilities

* Update forcedColorsAdjust.test.js

* use `toMatchSnapshot` instead of `toMatchFormattedCss`

More info: #12170

* rename `forced-colors-adjust` -> `forced-color-adjust`

Dropped the `s` in `colors`.

* update changelog

* fix typo

* use full `forced-color-adjust-auto` and `forced-color-adjust-none` names

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
thecrypticace pushed a commit that referenced this pull request Dec 5, 2023
* Add forced-colors variant

Also add a contrast-custom variant to match custom contrast preferences

* use `toMatchSnapshot` instead of `toMatchFormattedCss`

More info: #12170

* remove `contrast-custom` variant

* move `forcedColorsVariants` next to `prefersContrastVariants`

* update changelog

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
thecrypticace pushed a commit that referenced this pull request Dec 18, 2023
* Add forced-colors-adjust utilities

* Update forcedColorsAdjust.test.js

* use `toMatchSnapshot` instead of `toMatchFormattedCss`

More info: #12170

* rename `forced-colors-adjust` -> `forced-color-adjust`

Dropped the `s` in `colors`.

* update changelog

* fix typo

* use full `forced-color-adjust-auto` and `forced-color-adjust-none` names

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
thecrypticace pushed a commit that referenced this pull request Dec 18, 2023
* Add forced-colors variant

Also add a contrast-custom variant to match custom contrast preferences

* use `toMatchSnapshot` instead of `toMatchFormattedCss`

More info: #12170

* remove `contrast-custom` variant

* move `forcedColorsVariants` next to `prefersContrastVariants`

* update changelog

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
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