Skip to content

Commit

Permalink
test: layer at-rule (#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait authored Feb 27, 2024
1 parent afcd292 commit 2ce7dc0
Show file tree
Hide file tree
Showing 8 changed files with 1,228 additions and 952 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ jobs:
- name: Security audit
run: npm run security

- name: Check commit message
uses: wagoid/commitlint-github-action@v5
- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose

test:
name: Test - ${{ matrix.os }} - Node v${{ matrix.node-version }}, Webpack ${{ matrix.webpack-version }}
Expand Down
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit $1
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install lint-staged
2,139 changes: 1,204 additions & 935 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
"pretest": "npm run lint",
"test": "npm run test:coverage",
"prepare": "husky install && npm run build",
"prepare": "husky && npm run build",
"release": "standard-version"
},
"files": [
Expand Down Expand Up @@ -80,8 +80,8 @@
"@babel/cli": "^7.23.9",
"@babel/core": "^7.23.9",
"@babel/preset-env": "^7.23.9",
"@commitlint/cli": "^18.6.1",
"@commitlint/config-conventional": "^18.6.2",
"@commitlint/cli": "^19.0.0",
"@commitlint/config-conventional": "^19.0.0",
"@parcel/css": "^1.8.3",
"@swc/css": "^0.0.28",
"@types/clean-css": "^4.2.11",
Expand All @@ -99,11 +99,11 @@
"csso": "^5.0.3",
"del": "^6.1.0",
"del-cli": "^5.1.0",
"esbuild": "^0.19.12",
"esbuild": "^0.20.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"husky": "^8.0.3",
"husky": "^9.0.11",
"jest": "^29.7.0",
"lightningcss": "^1.23.0",
"lint-staged": "^15.2.2",
Expand Down
4 changes: 2 additions & 2 deletions test/__snapshots__/minimizerOptions-option.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ exports[`when applied with "minimizerOptions" option matches snapshot for "disca

exports[`when applied with "minimizerOptions" option matches snapshot for "discardComments" option (enable, with "removeAll" option): entry.css 1`] = `"body{color:red}"`;

exports[`when applied with "minimizerOptions" option matches snapshot for "discardEmpty" option (disable): entry.css 1`] = `"body{color:red}a{}"`;
exports[`when applied with "minimizerOptions" option matches snapshot for "discardEmpty" option (disable): entry.css 1`] = `"@layer ui-components, foo-bar;body{color:red}a{}.foo{color:#000;& .class{color:#fff}}@layer ui-components{}"`;

exports[`when applied with "minimizerOptions" option matches snapshot for "discardEmpty" option (enable [default]): entry.css 1`] = `"body{color:red}"`;
exports[`when applied with "minimizerOptions" option matches snapshot for "discardEmpty" option (enable [default]): entry.css 1`] = `"@layer ui-components, foo-bar;body{color:red}.foo{color:#000;& .class{color:#fff}}@layer ui-components{}"`;

exports[`when applied with "minimizerOptions" option matches snapshot for "mergeRules" option (disable): entry.css 1`] = `"body{color:red}body{font-weight:700}"`;

Expand Down
15 changes: 14 additions & 1 deletion test/fixtures/minimizerOptions/discardEmpty.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
@layer ui-components, foo-bar;

body {
color: red;
}

a {
}
}

.foo {
color: black;

& .class {
color: white;
}
}

@layer ui-components {
}

0 comments on commit 2ce7dc0

Please sign in to comment.