18 Commits

Author SHA1 Message Date
Robin Malfait
d2fdf9eb09
Allow returning parallel variants from addVariant or matchVariant callback functions (#8455)
* allow to return an array of format strings from matchVariant or
addVariant

* add parallel variant with function test

* upgrade test to use a function call

* allow to return parallel variants from variant function

Caveat: this now belongs to the same plugin and is not registered as
separate variants which means that sort order can differ.

* prevent crash if `.toMatchFormattedCss()` receives undefined

* update changelog

* ensure that we use a local list of variant functions

Now that a variant function can return a list of variant functions from
within the plugin, we have to make sure to executed and register those
functions as well.

However, we need to make sure that this list is local for the variant
and not "globally" registered otherwise we keep add a dynamic function
to the global list which results in duplicate output becaus multiple
duplicate variants will be registered.

* add little warning regarding potential clashes

* Update CHANGELOG.md
2022-05-31 15:03:06 +02:00
Jordan Pittman
30538b363f
Update integration tests (#8386)
* Add content glob integration tests

* Use tagged version in parcel integration tests

* Upgrade postcss-cli integration tests

* upgrade integration test deps

* Fix CS

* Fix tests

* Update lockfile

* Fix vite test in CI
2022-05-19 16:44:20 -04:00
Adam Wathan
fe27356680
JIT: Optimize universal selector usage by inlining only the relevant selectors (#4850)
* WIP

* run prettier

* drop new lines in custom matcher

Drop all newlines, let prettier handle everything for us.

* add cache for the selector parser

* add `@apply` tests for the universal optimizer

* drop comments

* initial replacements

* WIP

* WIP

* MAKE IT WORK

* Rename to resolveDefaultsAtRules

* Update tests + defaults identifiers

* Don't add @defaults in AOT mode

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2021-07-01 06:33:37 -04:00
Robin Malfait
63a67cb8ef
improve integration tests (#4572)
* remove unused file

using syntax.js instead

* add a way to remove files that are generated from the tests

Essentially setting the restore cache contents to `null` as a special
value.

* combine the stdout and stderr output

* add jest-diff instead of relying on it existing *somewhere*

This also came with a small API change.

* add `--runInBand` to the test script

* add dedicated cli tests for the new Tailwind CLI
2021-06-07 13:50:53 -04:00
Robin Malfait
7565099c1f
Integrations setup (#4354)
* add integration test tools

* setup jest in the integrations folder

* add `test:integrations` script

The default `npm test` script will ignore all the tests in the
`integrations` folder.

* add integration tests with `webpack 5`

* add integration tests with `postcss-cli`

* add `npm run install:integrations` script

This script will run `npm install` in every integration, and in the
integrations folder itself (to setup Jest for example).

* add `toIncludeCss` custom matcher

* increate Jest timeout for integration tests

* add integration tests with `vite`

* add integration tests with `webpack 4`

* add isomorphic fetch

* add the ability to wait for specific stdout/stderr output

* write vite tests, assert using API calls

We will wait for the correct stdout/stderr output, once we know that we
can request the fresh css, we will fetch it and make assertions
accordingly.

Port is currently hardcoded, maybe we should use a packaage to ensure
that we use a free port.

* add integration tests with `rollup`

* add integration tests with `parcel`

* run all integration tests in band

* add .gitignore in integrations folder
2021-05-18 11:21:35 -04:00
Adam Wathan
b242fb70b5 Unify test suites 2021-04-02 14:34:50 -04:00
Stefan Fisk
1e0fc09e0a
Fix !important on multiple selectors #2823 (#2824)
* Add failing test for #2823

* cleanup string literals

* use prettier for toMatchCSS diffs

* make sure that importants are applied correctly

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2020-11-26 14:53:58 +01:00
Adam Wathan
3259608813 Add 2xl breakpoint by default 2020-10-18 15:43:50 -04:00
Adam Wathan
38b4eeb288 Prettier likes parens a lot now
git blame is now broken forever.
2020-10-16 15:39:44 -04:00
Adam Wathan
e3ed12782f Update prettier 2020-10-16 13:30:06 -04:00
Adam Wathan
b299b6fbe1
Support new presets key + extending core plugins config (#2474)
* WIP

* Support array for Tailwind config

* Drop array format for `presets` key instead

* Update changelog
2020-10-08 11:21:39 -04:00
Robin Malfait
ad7fec482b improve custom toMatchCss matcher 2020-08-28 08:50:13 -04:00
Adam Wathan
2cbc8e90af Add tests for all the new scenarios @apply now supports 2020-08-13 20:46:27 -04:00
Jarek Radosz
11dfbdeaa8 Use process.env.JEST_WORKER_ID 2019-05-09 13:29:48 +02:00
Jarek Radosz
ec4294d124 Avoid test collisions by using different directories in runInTempDirectory 2019-05-08 21:47:52 +02:00
mattstypa
26e4007428 Few CLI tweaks 2019-03-20 08:17:56 -05:00
Adam Wathan
ebb8633809 Fix tests and style 2017-11-23 09:58:25 -05:00
Adam Wathan
37b06c8dc9 Generate focus variants as separate declarations 2017-11-22 15:52:32 -05:00