Skip to content

feat: add reduceCalc for usage without PostCSS - #304

Merged
ludofischer merged 3 commits into
postcss:masterfrom
phuoccss:usage-without-postcss
Sep 2, 2026
Merged

feat: add reduceCalc for usage without PostCSS#304
ludofischer merged 3 commits into
postcss:masterfrom
phuoccss:usage-without-postcss

Conversation

@phuoccss

@phuoccss phuoccss commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Fixes #298

@ludofischer ludofischer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test that exercises the API you would like to use? So that we don't change it inadvertently in the future.

@phuoccss
phuoccss requested a review from ludofischer September 1, 2026 19:49
@phuoccss

phuoccss commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Added. I mostly mirrored cases from plugin unit test.

@ludofischer ludofischer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check you did not add too many redundant tests?

});

// --- Bare math functions (issue #189) -----------------------------------
describe('reduceCalc: bare math functions', () => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't tests starting from here a to the end of the file a bit redundant? It understand testing option combinations as they might differ from the postcss plugin and they were touched by the change, but these tests below seem almost duplicates of existing ones.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you think they are redundant? Those seems to be non-PostCSS edge cases that the new, lower-level function have to cover.

What do you think if we remove those tests in the plugin suite instead? That means the plugin suite is to ensure that the source css is processed correctly given different plugin option combinations. There's no need to cover all edge cases etc.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's better to understand why tests are failing first.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was a typo.

@ludofischer
ludofischer merged commit b89da0d into postcss:master Sep 2, 2026
3 checks passed
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.

[Feature Request]: Usage without postcss

2 participants