
Product
Introducing Custom Tabs for Org Alerts
Create and share saved alert views with custom tabs on the org alerts page, making it easier for teams to return to consistent, named filter sets.
@csstools/pack-test
Advanced tools
Verify that the published contents of your node package will pass a basic smoke test.
Verify that the published contents of your node package will pass a basic smoke test.
This tests creates a pack of your node modules just like npm publish and tries to import it.
Why do static analysis when you can brute force it?
See test/_tape.mjs in the base plugin for a minimal example.
npm install @csstools/pack-test --save-dev
Create a test directory in your project.
Write some CSS that will be processed by your plugin.
/* test/basic.css */
.foo {
color: oklch(40% 0.268735435 34.568626);
}
/* test/_tape.mjs */
import { postcssTape } from '@csstools/pack-test';
import plugin from '<your plugin package name>';
postcssTape(plugin)({
basic: {
message: "supports basic usage",
},
'basic:color': {
message: "supports { color: '<a color>' }",
options: {
color: 'purple'
}
},
});
# See https://nodejs.org/docs/latest/api/test.html for more usage details.
node --test
{
"scripts": {
"test": "node --test"
}
}
Browse the source code and tests here or see tests in plugins for more usage details.
[!NOTE] We use
test/_tape.mjsfor our tests, but you can use any file name you want.
We like to group things in atestdirectory and we use a leading underscore to sort it before the css files.
Test source files and test case names are related.
The test case name is expected to be the relative file path with the .css extension removed.
Test variants (with different plugin options) are separated by a colon :.
All test files are expected to be in a test directory in the current working directory.
| test case name | file name | result file name | notes |
|---|---|---|---|
basic | test/basic.css | test/basic.result.css | |
basic:color | test/basic.css | test/basic.color.result.css | A variant test for basic. Everything after : is ignored. |
foo/bar | test/foo/bar.css | test/foo/bar.result.css | A test file in a directory |
.gitignoreWe recommend adding *.result.css to your .gitignore file.
This is not functionally required, but it will reduce noise in your git history.
expect.css files.Set env variable REWRITE_EXPECTS to true to update all expect.css files.
example :
{
"scripts": {
"test": "node --test",
"test:rewrite-expects": "REWRITE_EXPECTS=true node --test"
}
}
FAQs
Verify that the published contents of your node package will pass a basic smoke test.
The npm package @csstools/pack-test receives a total of 97 weekly downloads. As such, @csstools/pack-test popularity was classified as not popular.
We found that @csstools/pack-test demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Create and share saved alert views with custom tabs on the org alerts page, making it easier for teams to return to consistent, named filter sets.

Product
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.

Security News
Chrome 144 introduces the Temporal API, a modern approach to date and time handling designed to fix long-standing issues with JavaScript’s Date object.