diff --git a/.changeset/bump-minimum-node-version.md b/.changeset/bump-minimum-node-version.md new file mode 100644 index 00000000..c4f15547 --- /dev/null +++ b/.changeset/bump-minimum-node-version.md @@ -0,0 +1,5 @@ +--- +"less-loader": major +--- + +Minimum supported Node.js version is now `>= 22.11.0`. diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index fce6cc12..735b28a9 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -61,7 +61,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - node-version: [18.x, 20.x, 22.x, 24.x] + node-version: [22.x, 24.x, 26.x] webpack-version: [latest] runs-on: ${{ matrix.os }} @@ -91,7 +91,7 @@ jobs: run: npm i webpack@${{ matrix.webpack-version }} - name: Run tests for webpack version ${{ matrix.webpack-version }} - run: npm run test:coverage -- --ci + run: npm run test:coverage - name: Submit coverage data to codecov uses: codecov/codecov-action@v5 diff --git a/babel.config.js b/babel.config.js index b65dedb2..9f4b672c 100644 --- a/babel.config.js +++ b/babel.config.js @@ -10,7 +10,7 @@ module.exports = (api) => { "@babel/preset-env", { targets: { - node: "18.12.0", + node: "22.11.0", }, }, ], diff --git a/eslint.config.mjs b/eslint.config.mjs index c2279752..7b91d34a 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,8 +1,36 @@ +import path from "node:path"; +import { fileURLToPath } from "node:url"; + import { defineConfig } from "eslint/config"; import configs from "eslint-config-webpack/configs.js"; +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + export default defineConfig([ { extends: [configs["recommended-dirty"]], }, + { + files: ["test/**/*.{js,cjs,mjs}"], + settings: { + n: { version: ">=22.11.0" }, + node: { version: ">=22.11.0" }, + }, + rules: { + "import/no-extraneous-dependencies": [ + "error", + { + devDependencies: true, + peerDependencies: true, + packageDir: __dirname, + }, + ], + }, + }, + { + files: ["test/setup-snapshots.js"], + rules: { + "n/no-unsupported-features/node-builtins": "off", + }, + }, ]); diff --git a/package-lock.json b/package-lock.json index c6af572b..2863f9b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,6 @@ "@changesets/get-github-info": "^0.8.0", "@commitlint/cli": "^18.6.1", "@commitlint/config-conventional": "^18.6.2", - "babel-jest": "^30.0.0", "cross-env": "^7.0.3", "cspell": "^8.10.0", "del": "^7.1.0", @@ -24,7 +23,6 @@ "eslint": "^9.32.0", "eslint-config-webpack": "^4.5.1", "husky": "^9.1.3", - "jest": "^30.0.0", "less": "^4.6.3", "less-plugin-glob": "^3.0.0", "lint-staged": "^15.2.7", @@ -552,6 +550,8 @@ "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -565,6 +565,8 @@ "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -578,6 +580,8 @@ "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.12.13" }, @@ -591,6 +595,8 @@ "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.14.5" }, @@ -639,6 +645,8 @@ "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.10.4" }, @@ -652,6 +660,8 @@ "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -665,6 +675,8 @@ "integrity": "sha512-wgEmr06G6sIpqr8YDwA2dSRTE3bJ+V0IfpzfSY3Lfgd7YWOaAdlykvJi13ZKBt8cZHfgH1IXN+CL656W3uUa4w==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, @@ -681,6 +693,8 @@ "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.10.4" }, @@ -694,6 +708,8 @@ "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -707,6 +723,8 @@ "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.10.4" }, @@ -720,6 +738,8 @@ "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -733,6 +753,8 @@ "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -746,6 +768,8 @@ "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -759,6 +783,8 @@ "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.14.5" }, @@ -775,6 +801,8 @@ "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.14.5" }, @@ -791,6 +819,8 @@ "integrity": "sha512-+nDNmQye7nlnuuHDboPbGm00Vqg3oO8niRRL27/4LYHUsHYh0zJ1xWOz0uRwNFmM1Avzk8wZbc6rdiYhomzv/A==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.28.6" }, @@ -1837,7 +1867,9 @@ "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/@changesets/apply-release-plan": { "version": "7.1.1", @@ -3097,6 +3129,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "dependencies": { "@emnapi/wasi-threads": "1.1.0", "tslib": "^2.4.0" @@ -3109,6 +3142,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "dependencies": { "tslib": "^2.4.0" } @@ -3120,6 +3154,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "dependencies": { "tslib": "^2.4.0" } @@ -3460,6 +3495,8 @@ "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", @@ -3478,6 +3515,8 @@ "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=12" }, @@ -3490,7 +3529,9 @@ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/@isaacs/cliui/node_modules/string-width": { "version": "5.1.2", @@ -3498,6 +3539,8 @@ "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", @@ -3516,6 +3559,8 @@ "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", @@ -3534,6 +3579,8 @@ "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "camelcase": "^5.3.1", "find-up": "^4.1.0", @@ -3551,6 +3598,8 @@ "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" @@ -3565,6 +3614,8 @@ "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "p-locate": "^4.1.0" }, @@ -3578,6 +3629,8 @@ "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "p-try": "^2.0.0" }, @@ -3594,6 +3647,8 @@ "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "p-limit": "^2.2.0" }, @@ -3607,6 +3662,8 @@ "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -3617,6 +3674,8 @@ "integrity": "sha512-PAwCvFJ4696XP2qZj+LAn1BWjZaJ6RjG6c7/lkMaUJnkyMS34ucuIsfqYvfskVNvUI27R/u4P1HMYFnlVXG/Ww==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", @@ -3635,6 +3694,8 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -3645,6 +3706,8 @@ "integrity": "sha512-U5mVPsBxLSO6xYbf+tgkymLx+iAhvZX43/xI1+ej2ZOPnPdkdO1CzDmFKh2mZBn2s4XZixszHeQnzp1gm/DIxw==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/console": "30.3.0", "@jest/pattern": "30.0.1", @@ -3692,6 +3755,8 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -3702,6 +3767,8 @@ "integrity": "sha512-cG51MVnLq1ecVUaQ3fr6YuuAOitHK1S4WUJHnsPFE/quQr33ADUx1FfrTCpMCRxvy0Yr9BThKpDjSlcTi91tMA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } @@ -3712,6 +3779,8 @@ "integrity": "sha512-SlLSF4Be735yQXyh2+mctBOzNDx5s5uLv88/j8Qn1wH679PDcwy67+YdADn8NJnGjzlXtN62asGH/T4vWOkfaw==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/fake-timers": "30.3.0", "@jest/types": "30.3.0", @@ -3728,6 +3797,8 @@ "integrity": "sha512-76Nlh4xJxk2D/9URCn3wFi98d2hb19uWE1idLsTt2ywhvdOldbw3S570hBgn25P4ICUZ/cBjybrBex2g17IDbg==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "expect": "30.3.0", "jest-snapshot": "30.3.0" @@ -3742,6 +3813,8 @@ "integrity": "sha512-j0+W5iQQ8hBh7tHZkTQv3q2Fh/M7Je72cIsYqC4OaktgtO7v1So9UTjp6uPBHIaB6beoF/RRsCgMJKvti0wADA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/get-type": "30.1.0" }, @@ -3755,6 +3828,8 @@ "integrity": "sha512-WUQDs8SOP9URStX1DzhD425CqbN/HxUYCTwVrT8sTVBfMvFqYt/s61EK5T05qnHu0po6RitXIvP9otZxYDzTGQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/types": "30.3.0", "@sinonjs/fake-timers": "^15.0.0", @@ -3773,6 +3848,8 @@ "integrity": "sha512-eMbZE2hUnx1WV0pmURZY9XoXPkUYjpc55mb0CrhtdWLtzMQPFvu/rZkTLZFTsdaVQa+Tr4eWAteqcUzoawq/uA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } @@ -3783,6 +3860,8 @@ "integrity": "sha512-+owLCBBdfpgL3HU+BD5etr1SvbXpSitJK0is1kiYjJxAAJggYMRQz5hSdd5pq1sSggfxPbw2ld71pt4x5wwViA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/environment": "30.3.0", "@jest/expect": "30.3.0", @@ -3799,6 +3878,8 @@ "integrity": "sha512-gWp7NfQW27LaBQz3TITS8L7ZCQ0TLvtmI//4OwlQRx4rnWxcPNIYjxZpDcN4+UlGxgm3jS5QPz8IPTCkb59wZA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@types/node": "*", "jest-regex-util": "30.0.1" @@ -3813,6 +3894,8 @@ "integrity": "sha512-a09z89S+PkQnL055bVj8+pe2Caed2PBOaczHcXCykW5ngxX9EWx/1uAwncxc/HiU0oZqfwseMjyhxgRjS49qPw==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@bcoe/v8-coverage": "^0.2.3", "@jest/console": "30.3.0", @@ -3856,6 +3939,8 @@ "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "balanced-match": "^1.0.0" } @@ -3867,6 +3952,8 @@ "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", @@ -3888,6 +3975,8 @@ "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "brace-expansion": "^2.0.2" }, @@ -3904,6 +3993,8 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -3914,6 +4005,8 @@ "integrity": "sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@sinclair/typebox": "^0.34.0" }, @@ -3927,6 +4020,8 @@ "integrity": "sha512-ORbRN9sf5PP82v3FXNSwmO1OTDR2vzR2YTaR+E3VkSBZ8zadQE6IqYdYEeFH1NIkeB2HIGdF02dapb6K0Mj05g==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/types": "30.3.0", "chalk": "^4.1.2", @@ -3943,6 +4038,8 @@ "integrity": "sha512-MIRWMUUR3sdbP36oyNyhbThLHyJ2eEDClPCiHVbrYAe5g3CHRArIVpBw7cdSB5fr+ofSfIb2Tnsw8iEHL0PYQg==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jridgewell/trace-mapping": "^0.3.25", "callsites": "^3.1.0", @@ -3958,6 +4055,8 @@ "integrity": "sha512-e/52nJGuD74AKTSe0P4y5wFRlaXP0qmrS17rqOMHeSwm278VyNyXE3gFO/4DTGF9w+65ra3lo3VKj0LBrzmgdQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/console": "30.3.0", "@jest/types": "30.3.0", @@ -3974,6 +4073,8 @@ "integrity": "sha512-dgbWy9b8QDlQeRZcv7LNF+/jFiiYHTKho1xirauZ7kVwY7avjFF6uTT0RqlgudB5OuIPagFdVtfFMosjVbk1eA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/test-result": "30.3.0", "graceful-fs": "^4.2.11", @@ -3990,6 +4091,8 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -4000,6 +4103,8 @@ "integrity": "sha512-TLKY33fSLVd/lKB2YI1pH69ijyUblO/BQvCj566YvnwuzoTNr648iE0j22vRvVNk2HsPwByPxATg3MleS3gf5A==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/core": "^7.27.4", "@jest/types": "30.3.0", @@ -4026,6 +4131,8 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -4036,6 +4143,8 @@ "integrity": "sha512-JHm87k7bA33hpBngtU8h6UBub/fqqA9uXfw+21j5Hmk7ooPHlboRNxHq0JcMtC+n8VJGP1mcfnD3Mk+XKe1oSw==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/pattern": "30.0.1", "@jest/schemas": "30.0.5", @@ -4737,6 +4846,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "dependencies": { "@emnapi/core": "^1.4.3", "@emnapi/runtime": "^1.4.3", @@ -4796,6 +4906,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "engines": { "node": ">=14" } @@ -4825,7 +4936,9 @@ "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.48.tgz", "integrity": "sha512-kKJTNuK3AQOrgjjotVxMrCn1sUJwM76wMszfq1kdU4uYVJjvEWuFQ6HgvLt4Xz3fSmZlTOxJ/Ie13KnIcWQXFA==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/@sindresorhus/base62": { "version": "1.0.0", @@ -4846,6 +4959,8 @@ "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", "dev": true, "license": "BSD-3-Clause", + "optional": true, + "peer": true, "dependencies": { "type-detect": "4.0.8" } @@ -4856,6 +4971,8 @@ "integrity": "sha512-cO5W33JgAPbOh07tvZjUOJ7oWhtaqGHiZw+11DPbyqh2kHTBc3eF/CjJDeQ4205RLQsX6rxCuYOroFQwl7JDRw==", "dev": true, "license": "BSD-3-Clause", + "optional": true, + "peer": true, "dependencies": { "@sinonjs/commons": "^3.0.1" } @@ -4901,6 +5018,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "dependencies": { "tslib": "^2.4.0" } @@ -4911,6 +5029,8 @@ "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/parser": "^7.20.7", "@babel/types": "^7.20.7", @@ -4925,6 +5045,8 @@ "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/types": "^7.0.0" } @@ -4935,6 +5057,8 @@ "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/parser": "^7.1.0", "@babel/types": "^7.0.0" @@ -4946,6 +5070,8 @@ "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/types": "^7.28.2" } @@ -4994,7 +5120,9 @@ "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/@types/istanbul-lib-report": { "version": "3.0.3", @@ -5002,6 +5130,8 @@ "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@types/istanbul-lib-coverage": "*" } @@ -5012,6 +5142,8 @@ "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@types/istanbul-lib-report": "*" } @@ -5076,7 +5208,9 @@ "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/@types/unist": { "version": "3.0.3", @@ -5091,6 +5225,8 @@ "integrity": "sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@types/yargs-parser": "*" } @@ -5100,7 +5236,9 @@ "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "8.57.0", @@ -5402,7 +5540,9 @@ "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", "dev": true, - "license": "ISC" + "license": "ISC", + "optional": true, + "peer": true }, "node_modules/@unrs/resolver-binding-android-arm-eabi": { "version": "1.11.1", @@ -5416,7 +5556,8 @@ "optional": true, "os": [ "android" - ] + ], + "peer": true }, "node_modules/@unrs/resolver-binding-android-arm64": { "version": "1.11.1", @@ -5430,7 +5571,8 @@ "optional": true, "os": [ "android" - ] + ], + "peer": true }, "node_modules/@unrs/resolver-binding-darwin-arm64": { "version": "1.11.1", @@ -5444,7 +5586,8 @@ "optional": true, "os": [ "darwin" - ] + ], + "peer": true }, "node_modules/@unrs/resolver-binding-darwin-x64": { "version": "1.11.1", @@ -5458,7 +5601,8 @@ "optional": true, "os": [ "darwin" - ] + ], + "peer": true }, "node_modules/@unrs/resolver-binding-freebsd-x64": { "version": "1.11.1", @@ -5472,7 +5616,8 @@ "optional": true, "os": [ "freebsd" - ] + ], + "peer": true }, "node_modules/@unrs/resolver-binding-linux-arm-gnueabihf": { "version": "1.11.1", @@ -5486,7 +5631,8 @@ "optional": true, "os": [ "linux" - ] + ], + "peer": true }, "node_modules/@unrs/resolver-binding-linux-arm-musleabihf": { "version": "1.11.1", @@ -5500,7 +5646,8 @@ "optional": true, "os": [ "linux" - ] + ], + "peer": true }, "node_modules/@unrs/resolver-binding-linux-arm64-gnu": { "version": "1.11.1", @@ -5514,7 +5661,8 @@ "optional": true, "os": [ "linux" - ] + ], + "peer": true }, "node_modules/@unrs/resolver-binding-linux-arm64-musl": { "version": "1.11.1", @@ -5528,7 +5676,8 @@ "optional": true, "os": [ "linux" - ] + ], + "peer": true }, "node_modules/@unrs/resolver-binding-linux-ppc64-gnu": { "version": "1.11.1", @@ -5542,7 +5691,8 @@ "optional": true, "os": [ "linux" - ] + ], + "peer": true }, "node_modules/@unrs/resolver-binding-linux-riscv64-gnu": { "version": "1.11.1", @@ -5556,7 +5706,8 @@ "optional": true, "os": [ "linux" - ] + ], + "peer": true }, "node_modules/@unrs/resolver-binding-linux-riscv64-musl": { "version": "1.11.1", @@ -5570,7 +5721,8 @@ "optional": true, "os": [ "linux" - ] + ], + "peer": true }, "node_modules/@unrs/resolver-binding-linux-s390x-gnu": { "version": "1.11.1", @@ -5584,7 +5736,8 @@ "optional": true, "os": [ "linux" - ] + ], + "peer": true }, "node_modules/@unrs/resolver-binding-linux-x64-gnu": { "version": "1.11.1", @@ -5598,7 +5751,8 @@ "optional": true, "os": [ "linux" - ] + ], + "peer": true }, "node_modules/@unrs/resolver-binding-linux-x64-musl": { "version": "1.11.1", @@ -5612,7 +5766,8 @@ "optional": true, "os": [ "linux" - ] + ], + "peer": true }, "node_modules/@unrs/resolver-binding-wasm32-wasi": { "version": "1.11.1", @@ -5624,6 +5779,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "dependencies": { "@napi-rs/wasm-runtime": "^0.2.11" }, @@ -5643,7 +5799,8 @@ "optional": true, "os": [ "win32" - ] + ], + "peer": true }, "node_modules/@unrs/resolver-binding-win32-ia32-msvc": { "version": "1.11.1", @@ -5657,7 +5814,8 @@ "optional": true, "os": [ "win32" - ] + ], + "peer": true }, "node_modules/@unrs/resolver-binding-win32-x64-msvc": { "version": "1.11.1", @@ -5671,7 +5829,8 @@ "optional": true, "os": [ "win32" - ] + ], + "peer": true }, "node_modules/@webassemblyjs/ast": { "version": "1.14.1", @@ -5965,6 +6124,8 @@ "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "type-fest": "^0.21.3" }, @@ -6010,6 +6171,7 @@ "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", "dev": true, "license": "ISC", + "optional": true, "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -6034,6 +6196,8 @@ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "sprintf-js": "~1.0.2" } @@ -6340,6 +6504,8 @@ "integrity": "sha512-gRpauEU2KRrCox5Z296aeVHR4jQ98BCnu0IO332D/xpHNOsIH/bgSRk9k6GbKIbBw8vFeN6ctuu6tV8WOyVfYQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/transform": "30.3.0", "@types/babel__core": "^7.20.5", @@ -6362,6 +6528,8 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -6372,6 +6540,8 @@ "integrity": "sha512-D8Z6Qm8jCvVXtIRkBnqNHX0zJ37rQcFJ9u8WOS6tkYOsRdHBzypCstaxWiu5ZIlqQtviRYbgnRLSoCEvjqcqbA==", "dev": true, "license": "BSD-3-Clause", + "optional": true, + "peer": true, "workspaces": [ "test/babel-8" ], @@ -6392,6 +6562,8 @@ "integrity": "sha512-+TRkByhsws6sfPjVaitzadk1I0F5sPvOVUH5tyTSzhePpsGIVrdeunHSw/C36QeocS95OOk8lunc4rlu5Anwsg==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@types/babel__core": "^7.20.5" }, @@ -6447,6 +6619,8 @@ "integrity": "sha512-E/VlAEzRrsLEb2+dv8yp3bo4scof3l9nR4lrld+Iy5NyVqgVYUJnDAmunkhPMisRI32Qc4iRiz425d8vM++2fg==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/plugin-syntax-async-generators": "^7.8.4", "@babel/plugin-syntax-bigint": "^7.8.3", @@ -6474,6 +6648,8 @@ "integrity": "sha512-6ZcUbWHC+dMz2vfzdNwi87Z1gQsLNK2uLuK1Q89R11xdvejcivlYYwDlEv0FHX3VwEXpbBQ9uufB/MUNpZGfhQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "babel-plugin-jest-hoist": "30.3.0", "babel-preset-current-node-syntax": "^1.2.0" @@ -6628,6 +6804,8 @@ "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", "dev": true, "license": "Apache-2.0", + "optional": true, + "peer": true, "dependencies": { "node-int64": "^0.4.0" } @@ -6859,6 +7037,8 @@ "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=10" } @@ -6938,7 +7118,9 @@ "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-2.2.0.tgz", "integrity": "sha512-4bHTS2YuzUvtoLjdy+98ykbNB5jS0+07EvFNXerqZQJ89F7DI6ET7OQo/HJuW6K0aVsKA9hj9/RVb2kQVOrPDQ==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/class-utils": { "version": "0.3.6", @@ -7179,6 +7361,8 @@ "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "iojs": ">= 1.0.0", "node": ">= 0.12.0" @@ -7189,7 +7373,9 @@ "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.3.tgz", "integrity": "sha512-1L5aqIkwPfiodaMgQunkF1zRhNqifHBmtbbbxcr6yVxxBnliw4TDOW6NxpO8DJLgJ16OT+Y4ztZqP6p/FtXnAw==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/collection-visit": { "version": "1.0.0", @@ -7871,6 +8057,8 @@ "integrity": "sha512-WzMx3mW98SN+zn3hgemf4OzdmyNhhhKz5Ay0pUfQiMQ3e1g+xmTJWp/pKdwKVXhdSkAEGIIzqeuWrL3mV/AXbA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "peerDependencies": { "babel-plugin-macros": "^3.1.0" }, @@ -7893,6 +8081,8 @@ "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=0.10.0" } @@ -8347,7 +8537,9 @@ "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/electron-to-chromium": { "version": "1.5.307", @@ -8362,6 +8554,8 @@ "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=12" }, @@ -9516,6 +9710,8 @@ "integrity": "sha512-+I6B/IkJc1o/2tiURyz/ivu/O0nKNEArIUB5O7zBrlDVJr22SCLH3xTeEry428LvFhRzIA1g8izguxJ/gbNcVQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">= 0.8.0" } @@ -9612,6 +9808,8 @@ "integrity": "sha512-1zQrciTiQfRdo7qJM1uG4navm8DayFa2TgCSRlzUyNkhcJ6XUZF3hjnpkyr3VhAqPH7i/9GkG7Tv5abz6fqz0Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/expect-utils": "30.3.0", "@jest/get-type": "30.1.0", @@ -9803,6 +10001,8 @@ "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", "dev": true, "license": "Apache-2.0", + "optional": true, + "peer": true, "dependencies": { "bser": "2.1.1" } @@ -9916,6 +10116,8 @@ "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "cross-spawn": "^7.0.6", "signal-exit": "^4.0.1" @@ -9933,6 +10135,8 @@ "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "engines": { "node": ">=14" }, @@ -10131,6 +10335,8 @@ "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8.0.0" } @@ -10905,7 +11111,9 @@ "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/human-id": { "version": "4.1.3", @@ -11037,6 +11245,8 @@ "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "pkg-dir": "^4.2.0", "resolve-cwd": "^3.0.0" @@ -11406,6 +11616,8 @@ "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=6" } @@ -11795,6 +12007,8 @@ "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", "dev": true, "license": "BSD-3-Clause", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -11805,6 +12019,8 @@ "integrity": "sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==", "dev": true, "license": "BSD-3-Clause", + "optional": true, + "peer": true, "dependencies": { "@babel/core": "^7.23.9", "@babel/parser": "^7.23.9", @@ -11822,6 +12038,8 @@ "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "bin": { "semver": "bin/semver.js" }, @@ -11835,6 +12053,8 @@ "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", "dev": true, "license": "BSD-3-Clause", + "optional": true, + "peer": true, "dependencies": { "istanbul-lib-coverage": "^3.0.0", "make-dir": "^4.0.0", @@ -11850,6 +12070,8 @@ "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "semver": "^7.5.3" }, @@ -11866,6 +12088,8 @@ "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "bin": { "semver": "bin/semver.js" }, @@ -11879,6 +12103,8 @@ "integrity": "sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A==", "dev": true, "license": "BSD-3-Clause", + "optional": true, + "peer": true, "dependencies": { "@jridgewell/trace-mapping": "^0.3.23", "debug": "^4.1.1", @@ -11894,6 +12120,8 @@ "integrity": "sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==", "dev": true, "license": "BSD-3-Clause", + "optional": true, + "peer": true, "dependencies": { "html-escaper": "^2.0.0", "istanbul-lib-report": "^3.0.0" @@ -11926,6 +12154,8 @@ "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", "dev": true, "license": "BlueOak-1.0.0", + "optional": true, + "peer": true, "dependencies": { "@isaacs/cliui": "^8.0.2" }, @@ -11942,6 +12172,8 @@ "integrity": "sha512-AkXIIFcaazymvey2i/+F94XRnM6TsVLZDhBMLsd1Sf/W0wzsvvpjeyUrCZD6HGG4SDYPgDJDBKeiJTBb10WzMg==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/core": "30.3.0", "@jest/types": "30.3.0", @@ -11969,6 +12201,8 @@ "integrity": "sha512-B/7Cny6cV5At6M25EWDgf9S617lHivamL8vl6KEpJqkStauzcG4e+WPfDgMMF+H4FVH4A2PLRyvgDJan4441QA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "execa": "^5.1.1", "jest-util": "30.3.0", @@ -11984,6 +12218,8 @@ "integrity": "sha512-PyXq5szeSfR/4f1lYqCmmQjh0vqDkURUYi9N6whnHjlRz4IUQfMcXkGLeEoiJtxtyPqgUaUUfyQlApXWBSN1RA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/environment": "30.3.0", "@jest/expect": "30.3.0", @@ -12016,6 +12252,8 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -12026,6 +12264,8 @@ "integrity": "sha512-l6Tqx+j1fDXJEW5bqYykDQQ7mQg+9mhWXtnj+tQZrTWYHyHoi6Be8HPumDSA+UiX2/2buEgjA58iJzdj146uCw==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/core": "30.3.0", "@jest/test-result": "30.3.0", @@ -12059,6 +12299,8 @@ "integrity": "sha512-WPMAkMAtNDY9P/oKObtsRG/6KTrhtgPJoBTmk20uDn4Uy6/3EJnnaZJre/FMT1KVRx8cve1r7/FlMIOfRVWL4w==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/core": "^7.27.4", "@jest/get-type": "30.1.0", @@ -12110,6 +12352,8 @@ "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "balanced-match": "^1.0.0" } @@ -12121,6 +12365,8 @@ "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", @@ -12142,6 +12388,8 @@ "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "brace-expansion": "^2.0.2" }, @@ -12158,6 +12406,8 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -12168,6 +12418,8 @@ "integrity": "sha512-n3q4PDQjS4LrKxfWB3Z5KNk1XjXtZTBwQp71OP0Jo03Z6V60x++K5L8k6ZrW8MY8pOFylZvHM0zsjS1RqlHJZQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/diff-sequences": "30.3.0", "@jest/get-type": "30.1.0", @@ -12184,6 +12436,8 @@ "integrity": "sha512-tR/FFgZKS1CXluOQzZvNH3+0z9jXr3ldGSD8bhyuxvlVUwbeLOGynkunvlTMxchC5urrKndYiwCFC0DLVjpOCA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "detect-newline": "^3.1.0" }, @@ -12197,6 +12451,8 @@ "integrity": "sha512-V8eMndg/aZ+3LnCJgSm13IxS5XSBM22QSZc9BtPK8Dek6pm+hfUNfwBdvsB3d342bo1q7wnSkC38zjX259qZNA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/get-type": "30.1.0", "@jest/types": "30.3.0", @@ -12214,6 +12470,8 @@ "integrity": "sha512-4i6HItw/JSiJVsC5q0hnKIe/hbYfZLVG9YJ/0pU9Hz2n/9qZe3Rhn5s5CUZA5ORZlcdT/vmAXRMyONXJwPrmYQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/environment": "30.3.0", "@jest/fake-timers": "30.3.0", @@ -12233,6 +12491,8 @@ "integrity": "sha512-mMi2oqG4KRU0R9QEtscl87JzMXfUhbKaFqOxmjb2CKcbHcUGFrJCBWHmnTiUqi6JcnzoBlO4rWfpdl2k/RfLCA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", @@ -12258,6 +12518,8 @@ "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=12" }, @@ -12271,6 +12533,8 @@ "integrity": "sha512-cuKmUUGIjfXZAiGJ7TbEMx0bcqNdPPI6P1V+7aF+m/FUJqFDxkFR4JqkTu8ZOiU5AaX/x0hZ20KaaIPXQzbMGQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/get-type": "30.1.0", "pretty-format": "30.3.0" @@ -12285,6 +12549,8 @@ "integrity": "sha512-HEtc9uFQgaUHkC7nLSlQL3Tph4Pjxt/yiPvkIrrDCt9jhoLIgxaubo1G+CFOnmHYMxHwwdaSN7mkIFs6ZK8OhA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/get-type": "30.1.0", "chalk": "^4.1.2", @@ -12301,6 +12567,8 @@ "integrity": "sha512-Z/j4Bo+4ySJ+JPJN3b2Qbl9hDq3VrXmnjjGEWD/x0BCXeOXPTV1iZYYzl2X8c1MaCOL+ewMyNBcm88sboE6YWw==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/code-frame": "^7.27.1", "@jest/types": "30.3.0", @@ -12322,6 +12590,8 @@ "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=12" }, @@ -12335,6 +12605,8 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -12345,6 +12617,8 @@ "integrity": "sha512-OTzICK8CpE+t4ndhKrwlIdbM6Pn8j00lvmSmq5ejiO+KxukbLjgOflKWMn3KE34EZdQm5RqTuKj+5RIEniYhog==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", @@ -12360,6 +12634,8 @@ "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=6" }, @@ -12378,6 +12654,8 @@ "integrity": "sha512-jHEQgBXAgc+Gh4g0p3bCevgRCVRkB4VB70zhoAE48gxeSr1hfUOsM/C2WoJgVL7Eyg//hudYENbm3Ne+/dRVVA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } @@ -12388,6 +12666,8 @@ "integrity": "sha512-NRtTAHQlpd15F9rUR36jqwelbrDV/dY4vzNte3S2kxCKUJRYNd5/6nTSbYiak1VX5g8IoFF23Uj5TURkUW8O5g==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "chalk": "^4.1.2", "graceful-fs": "^4.2.11", @@ -12408,6 +12688,8 @@ "integrity": "sha512-9ev8s3YN6Hsyz9LV75XUwkCVFlwPbaFn6Wp75qnI0wzAINYWY8Fb3+6y59Rwd3QaS3kKXffHXsZMziMavfz/nw==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "jest-regex-util": "30.0.1", "jest-snapshot": "30.3.0" @@ -12422,6 +12704,8 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -12432,6 +12716,8 @@ "integrity": "sha512-gDv6C9LGKWDPLia9TSzZwf4h3kMQCqyTpq+95PODnTRDO0g9os48XIYYkS6D236vjpBir2fF63YmJFtqkS5Duw==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/console": "30.3.0", "@jest/environment": "30.3.0", @@ -12466,6 +12752,8 @@ "integrity": "sha512-CgC+hIBJbuh78HEffkhNKcbXAytQViplcl8xupqeIWyKQF50kCQA8J7GeJCkjisC6hpnC9Muf8jV5RdtdFbGng==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/environment": "30.3.0", "@jest/fake-timers": "30.3.0", @@ -12500,6 +12788,8 @@ "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "balanced-match": "^1.0.0" } @@ -12511,6 +12801,8 @@ "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", @@ -12532,6 +12824,8 @@ "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "brace-expansion": "^2.0.2" }, @@ -12548,6 +12842,8 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -12558,6 +12854,8 @@ "integrity": "sha512-f14c7atpb4O2DeNhwcvS810Y63wEn8O1HqK/luJ4F6M4NjvxmAKQwBUWjbExUtMxWJQ0wVgmCKymeJK6NZMnfQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@babel/core": "^7.27.4", "@babel/generator": "^7.27.5", @@ -12591,6 +12889,8 @@ "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "bin": { "semver": "bin/semver.js" }, @@ -12604,6 +12904,8 @@ "integrity": "sha512-/jZDa00a3Sz7rdyu55NLrQCIrbyIkbBxareejQI315f/i8HjYN+ZWsDLLpoQSiUIEIyZF/R8fDg3BmB8AtHttg==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/types": "30.3.0", "@types/node": "*", @@ -12622,6 +12924,8 @@ "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=12" }, @@ -12635,6 +12939,8 @@ "integrity": "sha512-I/xzC8h5G+SHCb2P2gWkJYrNiTbeL47KvKeW5EzplkyxzBRBw1ssSHlI/jXec0ukH2q7x2zAWQm7015iusg62Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/get-type": "30.1.0", "@jest/types": "30.3.0", @@ -12653,6 +12959,8 @@ "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=10" }, @@ -12666,6 +12974,8 @@ "integrity": "sha512-PJ1d9ThtTR8aMiBWUdcownq9mDdLXsQzJayTk4kmaBRHKvwNQn+ANveuhEBUyNI2hR1TVhvQ8D5kHubbzBHR/w==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/test-result": "30.3.0", "@jest/types": "30.3.0", @@ -12686,6 +12996,8 @@ "integrity": "sha512-DrCKkaQwHexjRUFTmPzs7sHQe0TSj9nvDALKGdwmK5mW9v7j90BudWirKAJHt3QQ9Dhrg1F7DogPzhChppkJpQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@types/node": "*", "@ungap/structured-clone": "^1.3.0", @@ -12703,6 +13015,8 @@ "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "has-flag": "^4.0.0" }, @@ -12736,6 +13050,8 @@ "integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -13257,6 +13573,8 @@ "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=6" } @@ -13818,6 +14136,8 @@ "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", "dev": true, "license": "BSD-3-Clause", + "optional": true, + "peer": true, "dependencies": { "tmpl": "1.0.5" } @@ -14939,6 +15259,8 @@ "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", "dev": true, "license": "BlueOak-1.0.0", + "optional": true, + "peer": true, "engines": { "node": ">=16 || 14 >=14.17" } @@ -15003,6 +15325,8 @@ "integrity": "sha512-PHI5f1O0EP5xJ9gQmFGMS6IZcrVvTjpXjz7Na41gTE7eE2hK11lg04CECCYEEjdc17EV4DO+fkGEtt7TpTaTiQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "bin": { "napi-postinstall": "lib/cli.js" }, @@ -15097,7 +15421,9 @@ "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/node-releases": { "version": "2.0.36", @@ -15135,6 +15461,7 @@ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true, "license": "MIT", + "optional": true, "engines": { "node": ">=0.10.0" } @@ -15708,7 +16035,9 @@ "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", "dev": true, - "license": "BlueOak-1.0.0" + "license": "BlueOak-1.0.0", + "optional": true, + "peer": true }, "node_modules/package-manager-detector": { "version": "0.2.11", @@ -15839,6 +16168,8 @@ "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", "dev": true, "license": "BlueOak-1.0.0", + "optional": true, + "peer": true, "dependencies": { "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" @@ -15855,7 +16186,9 @@ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", "dev": true, - "license": "ISC" + "license": "ISC", + "optional": true, + "peer": true }, "node_modules/path-type": { "version": "4.0.0", @@ -15916,6 +16249,8 @@ "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">= 6" } @@ -15926,6 +16261,8 @@ "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "find-up": "^4.0.0" }, @@ -15939,6 +16276,8 @@ "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" @@ -15953,6 +16292,8 @@ "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "p-locate": "^4.1.0" }, @@ -15966,6 +16307,8 @@ "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "p-try": "^2.0.0" }, @@ -15982,6 +16325,8 @@ "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "p-limit": "^2.2.0" }, @@ -16064,6 +16409,8 @@ "integrity": "sha512-oG4T3wCbfeuvljnyAzhBvpN45E8iOTXCU/TD3zXW80HA3dQ4ahdqMkWGiPWZvjpQwlbyHrPTWUAqUzGzv4l1JQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@jest/schemas": "30.0.5", "ansi-styles": "^5.2.0", @@ -16079,6 +16426,8 @@ "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=10" }, @@ -16138,7 +16487,9 @@ "url": "https://opencollective.com/fast-check" } ], - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/quansync": { "version": "0.2.11", @@ -16193,7 +16544,9 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/read-pkg": { "version": "3.0.0", @@ -16531,6 +16884,8 @@ "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "resolve-from": "^5.0.0" }, @@ -17312,6 +17667,8 @@ "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -17424,7 +17781,9 @@ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true, - "license": "BSD-3-Clause" + "license": "BSD-3-Clause", + "optional": true, + "peer": true }, "node_modules/stack-utils": { "version": "2.0.6", @@ -17432,6 +17791,8 @@ "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "escape-string-regexp": "^2.0.0" }, @@ -17445,6 +17806,8 @@ "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -17530,6 +17893,8 @@ "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "char-regex": "^1.0.2", "strip-ansi": "^6.0.0" @@ -17544,6 +17909,8 @@ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -17554,6 +17921,8 @@ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -17586,6 +17955,8 @@ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -17601,6 +17972,8 @@ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -17610,7 +17983,9 @@ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/string-width-cjs/node_modules/is-fullwidth-code-point": { "version": "3.0.0", @@ -17618,6 +17993,8 @@ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -17628,6 +18005,8 @@ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -17775,6 +18154,8 @@ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -17788,6 +18169,8 @@ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -17798,6 +18181,8 @@ "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -18015,6 +18400,8 @@ "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "@istanbuljs/schema": "^0.1.2", "glob": "^7.1.4", @@ -18124,7 +18511,9 @@ "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", "dev": true, - "license": "BSD-3-Clause" + "license": "BSD-3-Clause", + "optional": true, + "peer": true }, "node_modules/to-object-path": { "version": "0.3.0", @@ -18343,6 +18732,8 @@ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=4" } @@ -18353,6 +18744,8 @@ "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", "dev": true, "license": "(MIT OR CC0-1.0)", + "optional": true, + "peer": true, "engines": { "node": ">=10" }, @@ -18649,6 +19042,8 @@ "dev": true, "hasInstallScript": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "napi-postinstall": "^0.3.0" }, @@ -18808,6 +19203,8 @@ "integrity": "sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "@jridgewell/trace-mapping": "^0.3.12", "@types/istanbul-lib-coverage": "^2.0.1", @@ -18859,6 +19256,8 @@ "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", "dev": true, "license": "Apache-2.0", + "optional": true, + "peer": true, "dependencies": { "makeerror": "1.0.12" } @@ -19118,6 +19517,8 @@ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -19136,6 +19537,8 @@ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -19145,7 +19548,9 @@ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/wrap-ansi-cjs/node_modules/is-fullwidth-code-point": { "version": "3.0.0", @@ -19153,6 +19558,8 @@ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -19163,6 +19570,8 @@ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -19178,6 +19587,8 @@ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -19211,6 +19622,8 @@ "integrity": "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^4.0.1" @@ -19225,6 +19638,8 @@ "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "engines": { "node": ">=14" }, diff --git a/package.json b/package.json index 900944ba..4c6c4608 100644 --- a/package.json +++ b/package.json @@ -38,11 +38,11 @@ "fix:js": "npm run lint:js -- --fix", "fix:prettier": "npm run lint:prettier -- --write", "fix": "npm-run-all -l fix:js fix:prettier", - "test:only": "cross-env NODE_ENV=test jest", - "test:watch": "npm run test:only -- --watch", - "test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage", - "pretest": "npm run lint", - "test": "npm run test:coverage", + "test:base": "node --import ./test/setup-snapshots.js --test --test-force-exit --test-reporter=spec --test-reporter-destination=stdout \"test/**/*.test.js\"", + "test:watch": "npm run test:base -- --watch", + "test:coverage": "npm run test:base -- --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage.lcov --test-coverage-include=\"src/**/*.js\"", + "pretest": "npm-run-all -l lint build", + "test": "npm run test:base", "prepare": "husky && npm run build", "version": "changeset version", "release": "npm run build && changeset publish" @@ -55,7 +55,6 @@ "@changesets/get-github-info": "^0.8.0", "@commitlint/cli": "^18.6.1", "@commitlint/config-conventional": "^18.6.2", - "babel-jest": "^30.0.0", "cross-env": "^7.0.3", "cspell": "^8.10.0", "del": "^7.1.0", @@ -63,7 +62,6 @@ "eslint": "^9.32.0", "eslint-config-webpack": "^4.5.1", "husky": "^9.1.3", - "jest": "^30.0.0", "less": "^4.6.3", "less-plugin-glob": "^3.0.0", "lint-staged": "^15.2.7", @@ -87,6 +85,6 @@ } }, "engines": { - "node": ">= 18.12.0" + "node": ">= 22.11.0" } } diff --git a/test/__snapshots__/additionalData-option.test.js.snap b/test/__snapshots__/additionalData-option.test.js.snap index 99428e36..743cf781 100644 --- a/test/__snapshots__/additionalData-option.test.js.snap +++ b/test/__snapshots__/additionalData-option.test.js.snap @@ -1,42 +1,35 @@ -// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing - -exports[`"additionalData" option should as function: css 1`] = ` -"/* RelativePath: additional-data.less; */ -.background { - color: coral; -} -.custom-class { - color: red; -} -" +exports[`\"additionalData\" option > should as function 1`] = ` +"/* RelativePath: additional-data.less; */\\n.background {\\n color: coral;\\n}\\n.custom-class {\\n color: red;\\n}\\n" `; -exports[`"additionalData" option should as function: errors 1`] = `[]`; +exports[`\"additionalData\" option > should as function 2`] = ` +[] +`; -exports[`"additionalData" option should as function: warnings 1`] = `[]`; +exports[`\"additionalData\" option > should as function 3`] = ` +[] +`; -exports[`"additionalData" option should work as async function: css 1`] = ` -"/* RelativePath: additional-data.less; */ -.background { - color: coral; -} -.custom-class { - color: red; -} -" +exports[`\"additionalData\" option > should work as async function 1`] = ` +"/* RelativePath: additional-data.less; */\\n.background {\\n color: coral;\\n}\\n.custom-class {\\n color: red;\\n}\\n" `; -exports[`"additionalData" option should work as async function: errors 1`] = `[]`; +exports[`\"additionalData\" option > should work as async function 2`] = ` +[] +`; -exports[`"additionalData" option should work as async function: warnings 1`] = `[]`; +exports[`\"additionalData\" option > should work as async function 3`] = ` +[] +`; -exports[`"additionalData" option should work as string: css 1`] = ` -".background { - color: coral; -} -" +exports[`\"additionalData\" option > should work as string 1`] = ` +".background {\\n color: coral;\\n}\\n" `; -exports[`"additionalData" option should work as string: errors 1`] = `[]`; +exports[`\"additionalData\" option > should work as string 2`] = ` +[] +`; -exports[`"additionalData" option should work as string: warnings 1`] = `[]`; +exports[`\"additionalData\" option > should work as string 3`] = ` +[] +`; diff --git a/test/__snapshots__/implementation.test.js.snap b/test/__snapshots__/implementation.test.js.snap index 7eb58285..3ea60a1a 100644 --- a/test/__snapshots__/implementation.test.js.snap +++ b/test/__snapshots__/implementation.test.js.snap @@ -1,53 +1,43 @@ -// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing +exports[`\"implementation\" option > should throw error when implementation has error 1`] = ` +[] +`; -exports[`"implementation" option should throw error when implementation has error: errors 1`] = ` +exports[`\"implementation\" option > should throw error when implementation has error 2`] = ` [ - "ModuleBuildError: Module build failed (from \`replaced original path\`): -Error: The Less implementation "/test/fixtures/implementation-error.js" not found", + "ModuleBuildError: Module build failed (from \`replaced original path\`):\\nError: The Less implementation \\"/test/fixtures/implementation-error.cjs\\" not found" ] `; -exports[`"implementation" option should throw error when implementation has error: warnings 1`] = `[]`; +exports[`\"implementation\" option > should throw error when unresolved package 1`] = ` +[] +`; -exports[`"implementation" option should throw error when unresolved package: errors 1`] = ` +exports[`\"implementation\" option > should throw error when unresolved package 2`] = ` [ - "ModuleBuildError: Module build failed (from \`replaced original path\`): -NonErrorEmittedError: (Emitted value instead of an instance of Error) Error: Cannot find module 'unresolved' from 'src/utils.js'", + "ModuleBuildError: Module build failed (from \`replaced original path\`):\\nError: Cannot find module 'unresolved'" ] `; -exports[`"implementation" option should throw error when unresolved package: warnings 1`] = `[]`; - -exports[`"implementation" option should work when implementation option is string: css 1`] = ` -".box { - color: #fe33ac; - border-color: #fdcdea; - background: url(box.png); -} -.box div { - -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); - box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); -} -" +exports[`\"implementation\" option > should work 1`] = ` +".box {\\n color: #fe33ac;\\n border-color: #fdcdea;\\n background: url(box.png);\\n}\\n.box div {\\n -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n}\\n" `; -exports[`"implementation" option should work when implementation option is string: errors 1`] = `[]`; +exports[`\"implementation\" option > should work 2`] = ` +[] +`; -exports[`"implementation" option should work when implementation option is string: warnings 1`] = `[]`; +exports[`\"implementation\" option > should work 3`] = ` +[] +`; -exports[`"implementation" option should work: css 1`] = ` -".box { - color: #fe33ac; - border-color: #fdcdea; - background: url(box.png); -} -.box div { - -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); - box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); -} -" +exports[`\"implementation\" option > should work when implementation option is string 1`] = ` +".box {\\n color: #fe33ac;\\n border-color: #fdcdea;\\n background: url(box.png);\\n}\\n.box div {\\n -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n}\\n" `; -exports[`"implementation" option should work: errors 1`] = `[]`; +exports[`\"implementation\" option > should work when implementation option is string 2`] = ` +[] +`; -exports[`"implementation" option should work: warnings 1`] = `[]`; +exports[`\"implementation\" option > should work when implementation option is string 3`] = ` +[] +`; diff --git a/test/__snapshots__/loader.test.js.snap b/test/__snapshots__/loader.test.js.snap index c57f6488..a9a8d1dc 100644 --- a/test/__snapshots__/loader.test.js.snap +++ b/test/__snapshots__/loader.test.js.snap @@ -1,691 +1,586 @@ -// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing +exports[`loader > should add a file with an error as dependency so that the watcher is triggered when the error is fixed 1`] = ` +[] +`; -exports[`loader should add a file with an error as dependency so that the watcher is triggered when the error is fixed: errors 1`] = ` +exports[`loader > should add a file with an error as dependency so that the watcher is triggered when the error is fixed 2`] = ` [ - "ModuleBuildError: Module build failed (from \`replaced original path\`): -", + "ModuleBuildError: Module build failed (from \`replaced original path\`):\\n" ] `; -exports[`loader should add a file with an error as dependency so that the watcher is triggered when the error is fixed: warnings 1`] = `[]`; +exports[`loader > should add all resolved imports as dependencies 1`] = ` +[] +`; -exports[`loader should add all resolved imports as dependencies, including aliased ones: errors 1`] = `[]`; +exports[`loader > should add all resolved imports as dependencies 2`] = ` +[] +`; -exports[`loader should add all resolved imports as dependencies, including aliased ones: warnings 1`] = `[]`; +exports[`loader > should add all resolved imports as dependencies, including aliased ones 1`] = ` +[] +`; -exports[`loader should add all resolved imports as dependencies, including node_modules: errors 1`] = `[]`; +exports[`loader > should add all resolved imports as dependencies, including aliased ones 2`] = ` +[] +`; -exports[`loader should add all resolved imports as dependencies, including node_modules: warnings 1`] = `[]`; +exports[`loader > should add all resolved imports as dependencies, including node_modules 1`] = ` +[] +`; -exports[`loader should add all resolved imports as dependencies, including those from the Less resolver: errors 1`] = `[]`; +exports[`loader > should add all resolved imports as dependencies, including node_modules 2`] = ` +[] +`; -exports[`loader should add all resolved imports as dependencies, including those from the Less resolver: warnings 1`] = `[]`; +exports[`loader > should add all resolved imports as dependencies, including those from the Less resolver 1`] = ` +[] +`; -exports[`loader should add all resolved imports as dependencies: errors 1`] = `[]`; +exports[`loader > should add all resolved imports as dependencies, including those from the Less resolver 2`] = ` +[] +`; -exports[`loader should add all resolved imports as dependencies: warnings 1`] = `[]`; +exports[`loader > should add path to dependencies 1`] = ` +".box {\\n color: #fe33ac;\\n border-color: #fdcdea;\\n background: url(box.png);\\n}\\n.box div {\\n -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n}\\n" +`; -exports[`loader should add path to dependencies: css 1`] = ` -".box { - color: #fe33ac; - border-color: #fdcdea; - background: url(box.png); -} -.box div { - -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); - box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); -} -" +exports[`loader > should add path to dependencies 2`] = ` +[] `; -exports[`loader should add path to dependencies: errors 1`] = `[]`; +exports[`loader > should add path to dependencies 3`] = ` +[] +`; -exports[`loader should add path to dependencies: warnings 1`] = `[]`; +exports[`loader > should allow to import non-less files 1`] = ` +".some-file {\\n background: hotpink;\\n}\\n" +`; -exports[`loader should allow to import non-less files: css 1`] = ` -".some-file { - background: hotpink; -} -" +exports[`loader > should allow to import non-less files 2`] = ` +[] `; -exports[`loader should allow to import non-less files: errors 1`] = `[]`; +exports[`loader > should allow to import non-less files 3`] = ` +[] +`; -exports[`loader should allow to import non-less files: warnings 1`] = `[]`; +exports[`loader > should be able to import a file with an absolute path 1`] = ` +".it-works {\\n color: yellow;\\n}\\n" +`; -exports[`loader should be able to import a file with an absolute path: css 1`] = ` -".it-works { - color: yellow; -} -" +exports[`loader > should be able to import a file with an absolute path 2`] = ` +[] `; -exports[`loader should be able to import a file with an absolute path: errors 1`] = `[]`; +exports[`loader > should be able to import a file with an absolute path 3`] = ` +[] +`; -exports[`loader should be able to import a file with an absolute path: warnings 1`] = `[]`; +exports[`loader > should compile data-uri function 1`] = ` +".img {\\n background: url(\\"data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2240%22%20height%3D%2240%22%3E%0A%20%20%20%20%3Ccircle%20cx%3D%2220%22%20cy%3D%2220%22%20r%3D%2210%22%2F%3E%0A%3C%2Fsvg%3E\\");\\n}\\n" +`; -exports[`loader should compile data-uri function: css 1`] = ` -".img { - background: url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2240%22%20height%3D%2240%22%3E%0A%20%20%20%20%3Ccircle%20cx%3D%2220%22%20cy%3D%2220%22%20r%3D%2210%22%2F%3E%0A%3C%2Fsvg%3E"); -} -" +exports[`loader > should compile data-uri function 2`] = ` +[] `; -exports[`loader should compile data-uri function: errors 1`] = `[]`; +exports[`loader > should compile data-uri function 3`] = ` +[] +`; -exports[`loader should compile data-uri function: warnings 1`] = `[]`; +exports[`loader > should emit an error 1`] = ` +[] +`; -exports[`loader should emit an error: errors 1`] = ` +exports[`loader > should emit an error 2`] = ` [ - "ModuleBuildError: Module build failed (from \`replaced original path\`): -", + "ModuleBuildError: Module build failed (from \`replaced original path\`):\\n" ] `; -exports[`loader should emit an error: warnings 1`] = `[]`; - -exports[`loader should emit less warning as webpack warning: css 1`] = `""`; - -exports[`loader should emit less warning as webpack warning: errors 1`] = `[]`; +exports[`loader > should emit less warning as webpack warning 1`] = ` +"" +`; -exports[`loader should emit less warning as webpack warning: warnings 1`] = ` +exports[`loader > should emit less warning as webpack warning 2`] = ` [ - "ModuleWarning: Module Warning (from \`replaced original path\`): -WARNING: extend ' .body1' has no matches", + "ModuleWarning: Module Warning (from \`replaced original path\`):\\nWARNING: extend ' .body1' has no matches" ] `; -exports[`loader should get absolute path relative rootContext: css 1`] = ` -".box { - color: #fe33ac; - border-color: #fdcdea; - background: url(box.png); -} -.box div { - -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); - box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); -} -" +exports[`loader > should emit less warning as webpack warning 3`] = ` +[] `; -exports[`loader should get absolute path relative rootContext: errors 1`] = `[]`; +exports[`loader > should get absolute path relative rootContext 1`] = ` +".box {\\n color: #fe33ac;\\n border-color: #fdcdea;\\n background: url(box.png);\\n}\\n.box div {\\n -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n}\\n" +`; -exports[`loader should get absolute path relative rootContext: warnings 1`] = `[]`; +exports[`loader > should get absolute path relative rootContext 2`] = ` +[] +`; -exports[`loader should import from glob expressions: css 1`] = ` -".a { - color: red; -} -" +exports[`loader > should get absolute path relative rootContext 3`] = ` +[] `; -exports[`loader should import from glob expressions: errors 1`] = `[]`; +exports[`loader > should import from glob expressions 1`] = ` +".a {\\n color: red;\\n}\\n" +`; -exports[`loader should import from glob expressions: warnings 1`] = `[]`; +exports[`loader > should import from glob expressions 2`] = ` +[] +`; -exports[`loader should import from plugins: css 1`] = ` -".imported-class { - color: coral; -} -" +exports[`loader > should import from glob expressions 3`] = ` +[] `; -exports[`loader should import from plugins: errors 1`] = `[]`; +exports[`loader > should import from plugins 1`] = ` +".imported-class {\\n color: coral;\\n}\\n" +`; -exports[`loader should import from plugins: warnings 1`] = `[]`; +exports[`loader > should import from plugins 2`] = ` +[] +`; -exports[`loader should install plugins: errors 1`] = `[]`; +exports[`loader > should import from plugins 3`] = ` +[] +`; + +exports[`loader > should install plugins 1`] = ` +[] +`; + +exports[`loader > should install plugins 2`] = ` +[] +`; -exports[`loader should install plugins: warnings 1`] = `[]`; +exports[`loader > should not alter the original options object 1`] = ` +[] +`; -exports[`loader should not alter the original options object: errors 1`] = `[]`; +exports[`loader > should not alter the original options object 2`] = ` +[] +`; -exports[`loader should not alter the original options object: warnings 1`] = `[]`; +exports[`loader > should not to disable webpack's resolver by passing an empty paths array 1`] = ` +".img {\\n background: url(some/img.jpg);\\n}\\n.img2 {\\n background: url(../img.jpg);\\n}\\n.box {\\n color: #fe33ac;\\n border-color: #fdcdea;\\n background: url(box.png);\\n}\\n.box div {\\n -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n}\\nbody {\\n background: url(assets/resources/circle.svg);\\n}\\n.abs {\\n background: url(assets/resources/circle.svg);\\n}\\n" +`; -exports[`loader should not to disable webpack's resolver by passing an empty paths array: css 1`] = ` -".img { - background: url(some/img.jpg); -} -.img2 { - background: url(../img.jpg); -} -.box { - color: #fe33ac; - border-color: #fdcdea; - background: url(box.png); -} -.box div { - -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); - box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); -} -body { - background: url(assets/resources/circle.svg); -} -.abs { - background: url(assets/resources/circle.svg); -} -" +exports[`loader > should not to disable webpack's resolver by passing an empty paths array 2`] = ` +[] `; -exports[`loader should not to disable webpack's resolver by passing an empty paths array: errors 1`] = `[]`; +exports[`loader > should not to disable webpack's resolver by passing an empty paths array 3`] = ` +[] +`; -exports[`loader should not to disable webpack's resolver by passing an empty paths array: warnings 1`] = `[]`; +exports[`loader > should not try to resolve CSS imports with URLs 1`] = ` +"@import url(\\"http://fonts.googleapis.com/css?family=Roboto:300,400,500\\");\\n@import url(\\"https://fonts.googleapis.com/css?family=Roboto:300,400,500\\");\\n@import url(\\"//fonts.googleapis.com/css?family=Roboto:300,400,500\\");\\n" +`; -exports[`loader should not try to resolve CSS imports with URLs: css 1`] = ` -"@import url("http://fonts.googleapis.com/css?family=Roboto:300,400,500"); -@import url("https://fonts.googleapis.com/css?family=Roboto:300,400,500"); -@import url("//fonts.googleapis.com/css?family=Roboto:300,400,500"); -" +exports[`loader > should not try to resolve CSS imports with URLs 2`] = ` +[] `; -exports[`loader should not try to resolve CSS imports with URLs: errors 1`] = `[]`; +exports[`loader > should not try to resolve CSS imports with URLs 3`] = ` +[] +`; -exports[`loader should not try to resolve CSS imports with URLs: warnings 1`] = `[]`; +exports[`loader > should prefer-relative imports correctly 1`] = ` +".prefer-relative-import {\\n background: red;\\n}\\n.relative {\\n color: coral;\\n}\\n" +`; -exports[`loader should prefer-relative imports correctly: css 1`] = ` -".prefer-relative-import { - background: red; -} -.relative { - color: coral; -} -" +exports[`loader > should prefer-relative imports correctly 2`] = ` +[] `; -exports[`loader should prefer-relative imports correctly: errors 1`] = `[]`; +exports[`loader > should prefer-relative imports correctly 3`] = ` +[] +`; -exports[`loader should prefer-relative imports correctly: warnings 1`] = `[]`; +exports[`loader > should provide a useful error message if the import could not be found 1`] = ` +[] +`; -exports[`loader should provide a useful error message if the import could not be found: errors 1`] = ` +exports[`loader > should provide a useful error message if the import could not be found 2`] = ` [ - "ModuleBuildError: Module build failed (from \`replaced original path\`): -", + "ModuleBuildError: Module build failed (from \`replaced original path\`):\\n" ] `; -exports[`loader should provide a useful error message if the import could not be found: warnings 1`] = `[]`; +exports[`loader > should provide a useful error message if there was a syntax error 1`] = ` +[] +`; -exports[`loader should provide a useful error message if there was a syntax error: errors 1`] = ` +exports[`loader > should provide a useful error message if there was a syntax error 2`] = ` [ - "ModuleBuildError: Module build failed (from \`replaced original path\`): -", + "ModuleBuildError: Module build failed (from \`replaced original path\`):\\n" ] `; -exports[`loader should provide a useful error message if there was a syntax error: warnings 1`] = `[]`; +exports[`loader > should resolve \"@import\" with \"css\" extension 1`] = ` +"@import \\"css.css\\";\\n" +`; + +exports[`loader > should resolve \"@import\" with \"css\" extension 2`] = ` +[] +`; + +exports[`loader > should resolve \"@import\" with \"css\" extension 3`] = ` +[] +`; + +exports[`loader > should resolve \"@import\" with \"less\" extension 1`] = ` +".box {\\n color: #fe33ac;\\n border-color: #fdcdea;\\n background: url(box.png);\\n}\\n.box div {\\n -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n}\\n" +`; + +exports[`loader > should resolve \"@import\" with \"less\" extension 2`] = ` +[] +`; + +exports[`loader > should resolve \"@import\" with \"less\" extension 3`] = ` +[] +`; + +exports[`loader > should resolve \"@import\" with \"php\" extension 1`] = ` +"a {\\n color: red;\\n}\\n" +`; + +exports[`loader > should resolve \"@import\" with \"php\" extension 2`] = ` +[] +`; + +exports[`loader > should resolve \"@import\" with \"php\" extension 3`] = ` +[] +`; + +exports[`loader > should resolve \"@import\" without \"less\" extension 1`] = ` +".box {\\n color: #fe33ac;\\n border-color: #fdcdea;\\n background: url(box.png);\\n}\\n.box div {\\n -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n}\\n" +`; + +exports[`loader > should resolve \"@import\" without \"less\" extension 2`] = ` +[] +`; + +exports[`loader > should resolve \"@import\" without \"less\" extension 3`] = ` +[] +`; + +exports[`loader > should resolve absolute path 1`] = ` +".box {\\n color: #fe33ac;\\n border-color: #fdcdea;\\n background: url(box.png);\\n}\\n.box div {\\n -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n}\\n" +`; + +exports[`loader > should resolve absolute path 2`] = ` +[] +`; + +exports[`loader > should resolve absolute path 3`] = ` +[] +`; -exports[`loader should resolve "@import" with "css" extension: css 1`] = ` -"@import "css.css"; -" +exports[`loader > should resolve absolute path with alias 1`] = ` +".box {\\n color: #fe33ac;\\n border-color: #fdcdea;\\n background: url(box.png);\\n}\\n.box div {\\n -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n}\\n" `; -exports[`loader should resolve "@import" with "css" extension: errors 1`] = `[]`; +exports[`loader > should resolve absolute path with alias 2`] = ` +[] +`; -exports[`loader should resolve "@import" with "css" extension: warnings 1`] = `[]`; - -exports[`loader should resolve "@import" with "less" extension: css 1`] = ` -".box { - color: #fe33ac; - border-color: #fdcdea; - background: url(box.png); -} -.box div { - -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); - box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); -} -" +exports[`loader > should resolve absolute path with alias 3`] = ` +[] `; -exports[`loader should resolve "@import" with "less" extension: errors 1`] = `[]`; - -exports[`loader should resolve "@import" with "less" extension: warnings 1`] = `[]`; - -exports[`loader should resolve "@import" with "php" extension: css 1`] = ` -"a { - color: red; -} -" -`; - -exports[`loader should resolve "@import" with "php" extension: errors 1`] = `[]`; +exports[`loader > should resolve aliases in different variants 1`] = ` +".img {\\n background: url(some/img.jpg);\\n}\\n.img2 {\\n background: url(../img.jpg);\\n}\\n.box {\\n color: #fe33ac;\\n border-color: #fdcdea;\\n background: url(box.png);\\n}\\n.box div {\\n -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n}\\nbody {\\n background: url(assets/resources/circle.svg);\\n}\\n.abs {\\n background: url(assets/resources/circle.svg);\\n}\\n" +`; + +exports[`loader > should resolve aliases in different variants 2`] = ` +[] +`; + +exports[`loader > should resolve aliases in different variants 3`] = ` +[] +`; + +exports[`loader > should resolve all imports 1`] = ` +"@import \\"css.css\\";\\n@import \\"css.css\\";\\n.classical-css,\\n#it-works {\\n background: hotpink;\\n}\\n.box,\\n#it-works {\\n color: #fe33ac;\\n border-color: #fdcdea;\\n background: url(box.png);\\n}\\n.box div {\\n -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n}\\n#it-works {\\n margin: 10px;\\n}\\n" +`; -exports[`loader should resolve "@import" with "php" extension: warnings 1`] = `[]`; +exports[`loader > should resolve all imports 2`] = ` +[] +`; -exports[`loader should resolve "@import" without "less" extension: css 1`] = ` -".box { - color: #fe33ac; - border-color: #fdcdea; - background: url(box.png); -} -.box div { - -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); - box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); -} -" +exports[`loader > should resolve all imports 3`] = ` +[] `; -exports[`loader should resolve "@import" without "less" extension: errors 1`] = `[]`; +exports[`loader > should resolve all imports from node_modules using webpack's resolver 1`] = ` +"@import \\"some/css.css\\";\\n@import \\"some/css.css\\";\\n#it-works {\\n color: hotpink;\\n}\\n.modules-dir-some-module,\\n#it-works {\\n background: hotpink;\\n}\\n#it-works {\\n margin: 10px;\\n}\\n" +`; -exports[`loader should resolve "@import" without "less" extension: warnings 1`] = `[]`; +exports[`loader > should resolve all imports from node_modules using webpack's resolver 2`] = ` +[] +`; -exports[`loader should resolve absolute path with alias: css 1`] = ` -".box { - color: #fe33ac; - border-color: #fdcdea; - background: url(box.png); -} -.box div { - -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); - box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); -} -" -`; - -exports[`loader should resolve absolute path with alias: errors 1`] = `[]`; - -exports[`loader should resolve absolute path with alias: warnings 1`] = `[]`; - -exports[`loader should resolve absolute path: css 1`] = ` -".box { - color: #fe33ac; - border-color: #fdcdea; - background: url(box.png); -} -.box div { - -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); - box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); -} -" -`; - -exports[`loader should resolve absolute path: errors 1`] = `[]`; - -exports[`loader should resolve absolute path: warnings 1`] = `[]`; - -exports[`loader should resolve aliases in different variants: css 1`] = ` -".img { - background: url(some/img.jpg); -} -.img2 { - background: url(../img.jpg); -} -.box { - color: #fe33ac; - border-color: #fdcdea; - background: url(box.png); -} -.box div { - -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); - box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); -} -body { - background: url(assets/resources/circle.svg); -} -.abs { - background: url(assets/resources/circle.svg); -} -" -`; - -exports[`loader should resolve aliases in different variants: errors 1`] = `[]`; - -exports[`loader should resolve aliases in different variants: warnings 1`] = `[]`; - -exports[`loader should resolve all imports from node_modules using webpack's resolver: css 1`] = ` -"@import "some/css.css"; -@import "some/css.css"; -#it-works { - color: hotpink; -} -.modules-dir-some-module, -#it-works { - background: hotpink; -} -#it-works { - margin: 10px; -} -" -`; - -exports[`loader should resolve all imports from node_modules using webpack's resolver: errors 1`] = `[]`; - -exports[`loader should resolve all imports from node_modules using webpack's resolver: warnings 1`] = `[]`; - -exports[`loader should resolve all imports from the given paths using Less resolver: css 1`] = ` -".modules-dir-some-module { - color: hotpink; -} -" -`; - -exports[`loader should resolve all imports from the given paths using Less resolver: errors 1`] = `[]`; - -exports[`loader should resolve all imports from the given paths using Less resolver: warnings 1`] = `[]`; - -exports[`loader should resolve all imports: css 1`] = ` -"@import "css.css"; -@import "css.css"; -.classical-css, -#it-works { - background: hotpink; -} -.box, -#it-works { - color: #fe33ac; - border-color: #fdcdea; - background: url(box.png); -} -.box div { - -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); - box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); -} -#it-works { - margin: 10px; -} -" -`; - -exports[`loader should resolve all imports: errors 1`] = `[]`; - -exports[`loader should resolve all imports: warnings 1`] = `[]`; - -exports[`loader should resolve in working directory: css 1`] = ` -".test { - color: red; -} -a { - color: red; -} -body { - margin: 0; -} -" -`; - -exports[`loader should resolve in working directory: errors 1`] = `[]`; - -exports[`loader should resolve in working directory: warnings 1`] = `[]`; - -exports[`loader should resolve nested imports: css 1`] = ` -".top-import { - background: red; -} -.nested-import { - background: coral; -} -" +exports[`loader > should resolve all imports from node_modules using webpack's resolver 3`] = ` +[] `; -exports[`loader should resolve nested imports: errors 1`] = `[]`; +exports[`loader > should resolve all imports from the given paths using Less resolver 1`] = ` +".modules-dir-some-module {\\n color: hotpink;\\n}\\n" +`; -exports[`loader should resolve nested imports: warnings 1`] = `[]`; +exports[`loader > should resolve all imports from the given paths using Less resolver 2`] = ` +[] +`; -exports[`loader should resolve nested package #2: css 1`] = ` -".less-package-1-nested { - background: red; -} -.less-package-2 { - background: red; -} -.top { - color: red; -} -" +exports[`loader > should resolve all imports from the given paths using Less resolver 3`] = ` +[] `; -exports[`loader should resolve nested package #2: errors 1`] = `[]`; +exports[`loader > should resolve in working directory 1`] = ` +".test {\\n color: red;\\n}\\na {\\n color: red;\\n}\\nbody {\\n margin: 0;\\n}\\n" +`; -exports[`loader should resolve nested package #2: warnings 1`] = `[]`; +exports[`loader > should resolve in working directory 2`] = ` +[] +`; -exports[`loader should resolve nested package: css 1`] = ` -".less-package-1-nested { - background: red; -} -.less-package-2 { - background: red; -} -" +exports[`loader > should resolve in working directory 3`] = ` +[] `; -exports[`loader should resolve nested package: errors 1`] = `[]`; +exports[`loader > should resolve nested imports 1`] = ` +".top-import {\\n background: red;\\n}\\n.nested-import {\\n background: coral;\\n}\\n" +`; -exports[`loader should resolve nested package: warnings 1`] = `[]`; +exports[`loader > should resolve nested imports 2`] = ` +[] +`; -exports[`loader should resolve non-less import with alias: css 1`] = ` -".some-file { - background: hotpink; -} -" +exports[`loader > should resolve nested imports 3`] = ` +[] `; -exports[`loader should resolve non-less import with alias: errors 1`] = `[]`; +exports[`loader > should resolve nested package #2 1`] = ` +".less-package-1-nested {\\n background: red;\\n}\\n.less-package-2 {\\n background: red;\\n}\\n.top {\\n color: red;\\n}\\n" +`; + +exports[`loader > should resolve nested package #2 2`] = ` +[] +`; + +exports[`loader > should resolve nested package #2 3`] = ` +[] +`; + +exports[`loader > should resolve nested package 1`] = ` +".less-package-1-nested {\\n background: red;\\n}\\n.less-package-2 {\\n background: red;\\n}\\n" +`; + +exports[`loader > should resolve nested package 2`] = ` +[] +`; + +exports[`loader > should resolve nested package 3`] = ` +[] +`; + +exports[`loader > should resolve non-less import with alias 1`] = ` +".some-file {\\n background: hotpink;\\n}\\n" +`; + +exports[`loader > should resolve non-less import with alias 2`] = ` +[] +`; + +exports[`loader > should resolve non-less import with alias 3`] = ` +[] +`; -exports[`loader should resolve non-less import with alias: warnings 1`] = `[]`; +exports[`loader > should resolve the \"less\" field from the \"exports\" field from \"package.json\" 1`] = ` +".load-me {\\n color: red;\\n}\\n" +`; -exports[`loader should resolve the "less" field from the "exports" field from "package.json": css 1`] = ` -".load-me { - color: red; -} -" +exports[`loader > should resolve the \"less\" field from the \"exports\" field from \"package.json\" 2`] = ` +[] `; -exports[`loader should resolve the "less" field from the "exports" field from "package.json": errors 1`] = `[]`; +exports[`loader > should resolve the \"less\" field from the \"exports\" field from \"package.json\" 3`] = ` +[] +`; -exports[`loader should resolve the "less" field from the "exports" field from "package.json": warnings 1`] = `[]`; +exports[`loader > should resolve unresolved url with alias 1`] = ` +".box {\\n color: #fe33ac;\\n border-color: #fdcdea;\\n background: url(box.png);\\n}\\n.box div {\\n -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n}\\n" +`; -exports[`loader should resolve unresolved url with alias: css 1`] = ` -".box { - color: #fe33ac; - border-color: #fdcdea; - background: url(box.png); -} -.box div { - -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); - box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); -} -" +exports[`loader > should resolve unresolved url with alias 2`] = ` +[] `; -exports[`loader should resolve unresolved url with alias: errors 1`] = `[]`; +exports[`loader > should resolve unresolved url with alias 3`] = ` +[] +`; -exports[`loader should resolve unresolved url with alias: warnings 1`] = `[]`; +exports[`loader > should throw an error 1`] = ` +[] +`; -exports[`loader should throw an error: errors 1`] = ` +exports[`loader > should throw an error 2`] = ` [ - "ModuleBuildError: Module build failed (from \`replaced original path\`): -", + "ModuleBuildError: Module build failed (from \`replaced original path\`):\\n" ] `; -exports[`loader should throw an error: warnings 1`] = `[]`; +exports[`loader > should transform urls 1`] = ` +".img4 {\\n background: url(folder/img.jpg);\\n}\\n.img5 {\\n background: url(folder/some/img.jpg);\\n}\\n.img6 {\\n background: url(./img.jpg);\\n}\\n.img1 {\\n background: url(img.jpg);\\n}\\n.img2 {\\n background: url(some/img.jpg);\\n}\\n.img3 {\\n background: url(../img.jpg);\\n}\\n" +`; + +exports[`loader > should transform urls 2`] = ` +[] +`; -exports[`loader should transform urls: css 1`] = ` -".img4 { - background: url(folder/img.jpg); -} -.img5 { - background: url(folder/some/img.jpg); -} -.img6 { - background: url(./img.jpg); -} -.img1 { - background: url(img.jpg); -} -.img2 { - background: url(some/img.jpg); -} -.img3 { - background: url(../img.jpg); -} -" +exports[`loader > should transform urls 3`] = ` +[] `; -exports[`loader should transform urls: errors 1`] = `[]`; +exports[`loader > should watch imports correctly 1`] = ` +"a {\\n color: red;\\n}\\n" +`; -exports[`loader should transform urls: warnings 1`] = `[]`; +exports[`loader > should watch imports correctly 2`] = ` +[] +`; -exports[`loader should watch imports correctly: css 1`] = ` -"a { - color: red; -} -" +exports[`loader > should watch imports correctly 3`] = ` +[] `; -exports[`loader should watch imports correctly: errors 1`] = `[]`; +exports[`loader > should work 1`] = ` +".box {\\n color: #fe33ac;\\n border-color: #fdcdea;\\n background: url(box.png);\\n}\\n.box div {\\n -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n}\\n" +`; -exports[`loader should watch imports correctly: warnings 1`] = `[]`; +exports[`loader > should work 2`] = ` +[] +`; -exports[`loader should work and have loaderContext in less plugins: css 1`] = ` -".webpackLoaderContext { - isDefined: true; -} -" +exports[`loader > should work 3`] = ` +[] `; -exports[`loader should work and have loaderContext in less plugins: errors 1`] = `[]`; +exports[`loader > should work and have loaderContext in less plugins 1`] = ` +".webpackLoaderContext {\\n isDefined: true;\\n}\\n" +`; -exports[`loader should work and have loaderContext in less plugins: warnings 1`] = `[]`; +exports[`loader > should work and have loaderContext in less plugins 2`] = ` +[] +`; -exports[`loader should work and logging: css 1`] = ` -"nav ul { - background: blue; -} -" +exports[`loader > should work and have loaderContext in less plugins 3`] = ` +[] `; -exports[`loader should work and logging: errors 1`] = `[]`; +exports[`loader > should work and logging 1`] = ` +"nav ul {\\n background: blue;\\n}\\n" +`; -exports[`loader should work and logging: logs 1`] = ` +exports[`loader > should work and logging 2`] = ` [ [ { - "args": [ - "WARNING: extend ' .inline' has no matches", - ], "type": "warn", + "args": [ + "WARNING: extend ' .inline' has no matches" + ] }, { - "args": [ - "The file undefined was skipped because it was not found and the import was marked optional.", - ], "type": "log", - }, - ], + "args": [ + "The file undefined was skipped because it was not found and the import was marked optional." + ] + } + ] ] `; -exports[`loader should work and logging: warnings 1`] = `[]`; - -exports[`loader should work and respect the 'resolve.byDependency.less' option: css 1`] = ` -".a { - color: red; -} -.b { - color: red; -} -" +exports[`loader > should work and logging 3`] = ` +[] `; -exports[`loader should work and respect the 'resolve.byDependency.less' option: errors 1`] = `[]`; - -exports[`loader should work and respect the 'resolve.byDependency.less' option: warnings 1`] = `[]`; +exports[`loader > should work and logging 4`] = ` +[] +`; -exports[`loader should work lessOptions.relativeUrls is false: css 1`] = ` -".top-import { - background: red; -} -.img4 { - background: url(img.jpg); -} -.img5 { - background: url(some/img.jpg); -} -.img6 { - background: url(../img.jpg); -} -" +exports[`loader > should work and respect the 'resolve.byDependency.less' option 1`] = ` +".a {\\n color: red;\\n}\\n.b {\\n color: red;\\n}\\n" `; -exports[`loader should work lessOptions.relativeUrls is false: errors 1`] = `[]`; +exports[`loader > should work and respect the 'resolve.byDependency.less' option 2`] = ` +[] +`; -exports[`loader should work lessOptions.relativeUrls is false: warnings 1`] = `[]`; +exports[`loader > should work and respect the 'resolve.byDependency.less' option 3`] = ` +[] +`; -exports[`loader should work lessOptions.relativeUrls is true: css 1`] = ` -".top-import { - background: red; -} -.img4 { - background: url(folder/img.jpg); -} -.img5 { - background: url(folder/some/img.jpg); -} -.img6 { - background: url(./img.jpg); -} -" +exports[`loader > should work lessOptions.relativeUrls is false 1`] = ` +".top-import {\\n background: red;\\n}\\n.img4 {\\n background: url(img.jpg);\\n}\\n.img5 {\\n background: url(some/img.jpg);\\n}\\n.img6 {\\n background: url(../img.jpg);\\n}\\n" `; -exports[`loader should work lessOptions.relativeUrls is true: errors 1`] = `[]`; +exports[`loader > should work lessOptions.relativeUrls is false 2`] = ` +[] +`; -exports[`loader should work lessOptions.relativeUrls is true: warnings 1`] = `[]`; +exports[`loader > should work lessOptions.relativeUrls is false 3`] = ` +[] +`; -exports[`loader should work third-party plugins as fileLoader: css 1`] = ` -".file-loader { - background: coral; -} -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 500; - src: url(https://fonts.gstatic.com/s/roboto/v29/KFOlCnqEu92Fr1MmEU9fBBc9.ttf) format('truetype'); -} -.modules-dir-scope-module { - color: hotpink; -} -" +exports[`loader > should work lessOptions.relativeUrls is true 1`] = ` +".top-import {\\n background: red;\\n}\\n.img4 {\\n background: url(folder/img.jpg);\\n}\\n.img5 {\\n background: url(folder/some/img.jpg);\\n}\\n.img6 {\\n background: url(./img.jpg);\\n}\\n" `; -exports[`loader should work third-party plugins as fileLoader: errors 1`] = `[]`; +exports[`loader > should work lessOptions.relativeUrls is true 2`] = ` +[] +`; -exports[`loader should work third-party plugins as fileLoader: warnings 1`] = `[]`; +exports[`loader > should work lessOptions.relativeUrls is true 3`] = ` +[] +`; -exports[`loader should work with a package with "sass" and "exports" fields and a custom condition (theme1): css 1`] = ` -".load-me { - color: red; -} -" +exports[`loader > should work third-party plugins as fileLoader 1`] = ` +".file-loader {\\n background: coral;\\n}\\n@font-face {\\n font-family: 'Roboto';\\n font-style: normal;\\n font-weight: 500;\\n src: url(https://fonts.gstatic.com/s/roboto/v29/KFOlCnqEu92Fr1MmEU9fBBc9.ttf) format('truetype');\\n}\\n.modules-dir-scope-module {\\n color: hotpink;\\n}\\n" `; -exports[`loader should work with a package with "sass" and "exports" fields and a custom condition (theme1): errors 1`] = `[]`; +exports[`loader > should work third-party plugins as fileLoader 2`] = ` +[] +`; -exports[`loader should work with a package with "sass" and "exports" fields and a custom condition (theme1): warnings 1`] = `[]`; +exports[`loader > should work third-party plugins as fileLoader 3`] = ` +[] +`; -exports[`loader should work with a package with "sass" and "exports" fields and a custom condition (theme2): css 1`] = ` -".load-me { - color: blue; -} -" +exports[`loader > should work with a package with \"sass\" and \"exports\" fields and a custom condition (theme1) 1`] = ` +".load-me {\\n color: red;\\n}\\n" `; -exports[`loader should work with a package with "sass" and "exports" fields and a custom condition (theme2): errors 1`] = `[]`; +exports[`loader > should work with a package with \"sass\" and \"exports\" fields and a custom condition (theme1) 2`] = ` +[] +`; -exports[`loader should work with a package with "sass" and "exports" fields and a custom condition (theme2): warnings 1`] = `[]`; +exports[`loader > should work with a package with \"sass\" and \"exports\" fields and a custom condition (theme1) 3`] = ` +[] +`; -exports[`loader should work: css 1`] = ` -".box { - color: #fe33ac; - border-color: #fdcdea; - background: url(box.png); -} -.box div { - -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); - box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); -} -" +exports[`loader > should work with a package with \"sass\" and \"exports\" fields and a custom condition (theme2) 1`] = ` +".load-me {\\n color: blue;\\n}\\n" `; -exports[`loader should work: errors 1`] = `[]`; +exports[`loader > should work with a package with \"sass\" and \"exports\" fields and a custom condition (theme2) 2`] = ` +[] +`; -exports[`loader should work: warnings 1`] = `[]`; +exports[`loader > should work with a package with \"sass\" and \"exports\" fields and a custom condition (theme2) 3`] = ` +[] +`; diff --git a/test/__snapshots__/sourceMap-options.test.js.snap b/test/__snapshots__/sourceMap-options.test.js.snap index e7e039ca..2a42c66b 100644 --- a/test/__snapshots__/sourceMap-options.test.js.snap +++ b/test/__snapshots__/sourceMap-options.test.js.snap @@ -1,247 +1,181 @@ -// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing - -exports[`"sourceMap" options should generate source maps when the "devtool" value is "source-map": css 1`] = ` -".modules-dir-some-module, -#it-works { - color: hotpink; -} -#it-works { - margin: 10px; -} -" +exports[`\"sourceMap\" options > should generate source maps when the \"devtool\" value is \"source-map\" 1`] = ` +".modules-dir-some-module,\\n#it-works {\\n color: hotpink;\\n}\\n#it-works {\\n margin: 10px;\\n}\\n" `; -exports[`"sourceMap" options should generate source maps when the "devtool" value is "source-map": errors 1`] = `[]`; - -exports[`"sourceMap" options should generate source maps when the "devtool" value is "source-map": source map 1`] = ` +exports[`\"sourceMap\" options > should generate source maps when the \"devtool\" value is \"source-map\" 2`] = ` { - "mappings": "AAAA;ACEA;EDDC,cAAA;;ACCD;EACE,YAAA", - "names": [], - "sourceRoot": "", + "version": 3, "sources": [ "test/fixtures/node_modules/some/module.less", - "test/fixtures/source-map.less", + "test/fixtures/source-map.less" ], + "names": [], + "mappings": "AAAA;ACEA;EDDC,cAAA;;ACCD;EACE,YAAA", "sourcesContent": [ - ".modules-dir-some-module { - color: hotpink; -} -", - "@import "some/module"; - -#it-works:extend(.modules-dir-some-module) { - margin: 10px; -} -", + ".modules-dir-some-module {\\n\\tcolor: hotpink;\\n}\\n", + "@import \\"some/module\\";\\n\\n#it-works:extend(.modules-dir-some-module) {\\n margin: 10px;\\n}\\n" ], - "version": 3, + "sourceRoot": "" } `; -exports[`"sourceMap" options should generate source maps when the "devtool" value is "source-map": warnings 1`] = `[]`; +exports[`\"sourceMap\" options > should generate source maps when the \"devtool\" value is \"source-map\" 3`] = ` +[] +`; -exports[`"sourceMap" options should generate source maps when value has "false" value, but the "lessOptions.sourceMap.outputSourceFiles" is "true": css 1`] = ` -".modules-dir-some-module, -#it-works { - color: hotpink; -} -#it-works { - margin: 10px; -} -/*# sourceMappingURL=source-map.css.map */" +exports[`\"sourceMap\" options > should generate source maps when the \"devtool\" value is \"source-map\" 4`] = ` +[] `; -exports[`"sourceMap" options should generate source maps when value has "false" value, but the "lessOptions.sourceMap.outputSourceFiles" is "true": errors 1`] = `[]`; +exports[`\"sourceMap\" options > should generate source maps when value has \"false\" value, but the \"lessOptions.sourceMap.outputSourceFiles\" is \"true\" 1`] = ` +".modules-dir-some-module,\\n#it-works {\\n color: hotpink;\\n}\\n#it-works {\\n margin: 10px;\\n}\\n/*# sourceMappingURL=source-map.css.map */" +`; -exports[`"sourceMap" options should generate source maps when value has "false" value, but the "lessOptions.sourceMap.outputSourceFiles" is "true": source map 1`] = ` +exports[`\"sourceMap\" options > should generate source maps when value has \"false\" value, but the \"lessOptions.sourceMap.outputSourceFiles\" is \"true\" 2`] = ` { - "file": "source-map.css", - "mappings": "AAAA;ACEA;EDDC,cAAA;;ACCD;EACE,YAAA", - "names": [], - "sourceRoot": "", + "version": 3, "sources": [ "node_modules/some/module.less", - "source-map.less", + "source-map.less" ], + "names": [], + "mappings": "AAAA;ACEA;EDDC,cAAA;;ACCD;EACE,YAAA", + "file": "source-map.css", "sourcesContent": [ - ".modules-dir-some-module { - color: hotpink; -} -", - "@import "some/module"; - -#it-works:extend(.modules-dir-some-module) { - margin: 10px; -} -", + ".modules-dir-some-module {\\n\\tcolor: hotpink;\\n}\\n", + "@import \\"some/module\\";\\n\\n#it-works:extend(.modules-dir-some-module) {\\n margin: 10px;\\n}\\n" ], - "version": 3, + "sourceRoot": "" } `; -exports[`"sourceMap" options should generate source maps when value has "false" value, but the "lessOptions.sourceMap.outputSourceFiles" is "true": warnings 1`] = `[]`; +exports[`\"sourceMap\" options > should generate source maps when value has \"false\" value, but the \"lessOptions.sourceMap.outputSourceFiles\" is \"true\" 3`] = ` +[] +`; -exports[`"sourceMap" options should generate source maps when value is "true" and the "devtool" value is "false": css 1`] = ` -".modules-dir-some-module, -#it-works { - color: hotpink; -} -#it-works { - margin: 10px; -} -" +exports[`\"sourceMap\" options > should generate source maps when value has \"false\" value, but the \"lessOptions.sourceMap.outputSourceFiles\" is \"true\" 4`] = ` +[] `; -exports[`"sourceMap" options should generate source maps when value is "true" and the "devtool" value is "false": errors 1`] = `[]`; +exports[`\"sourceMap\" options > should generate source maps when value is \"true\" 1`] = ` +".modules-dir-some-module,\\n#it-works {\\n color: hotpink;\\n}\\n#it-works {\\n margin: 10px;\\n}\\n" +`; -exports[`"sourceMap" options should generate source maps when value is "true" and the "devtool" value is "false": source map 1`] = ` +exports[`\"sourceMap\" options > should generate source maps when value is \"true\" 2`] = ` { - "mappings": "AAAA;ACEA;EDDC,cAAA;;ACCD;EACE,YAAA", - "names": [], - "sourceRoot": "", + "version": 3, "sources": [ "test/fixtures/node_modules/some/module.less", - "test/fixtures/source-map.less", + "test/fixtures/source-map.less" ], + "names": [], + "mappings": "AAAA;ACEA;EDDC,cAAA;;ACCD;EACE,YAAA", "sourcesContent": [ - ".modules-dir-some-module { - color: hotpink; -} -", - "@import "some/module"; - -#it-works:extend(.modules-dir-some-module) { - margin: 10px; -} -", + ".modules-dir-some-module {\\n\\tcolor: hotpink;\\n}\\n", + "@import \\"some/module\\";\\n\\n#it-works:extend(.modules-dir-some-module) {\\n margin: 10px;\\n}\\n" ], - "version": 3, + "sourceRoot": "" } `; -exports[`"sourceMap" options should generate source maps when value is "true" and the "devtool" value is "false": warnings 1`] = `[]`; +exports[`\"sourceMap\" options > should generate source maps when value is \"true\" 3`] = ` +[] +`; -exports[`"sourceMap" options should generate source maps when value is "true": css 1`] = ` -".modules-dir-some-module, -#it-works { - color: hotpink; -} -#it-works { - margin: 10px; -} -" +exports[`\"sourceMap\" options > should generate source maps when value is \"true\" 4`] = ` +[] `; -exports[`"sourceMap" options should generate source maps when value is "true": errors 1`] = `[]`; +exports[`\"sourceMap\" options > should generate source maps when value is \"true\" and the \"devtool\" value is \"false\" 1`] = ` +".modules-dir-some-module,\\n#it-works {\\n color: hotpink;\\n}\\n#it-works {\\n margin: 10px;\\n}\\n" +`; -exports[`"sourceMap" options should generate source maps when value is "true": source map 1`] = ` +exports[`\"sourceMap\" options > should generate source maps when value is \"true\" and the \"devtool\" value is \"false\" 2`] = ` { - "mappings": "AAAA;ACEA;EDDC,cAAA;;ACCD;EACE,YAAA", - "names": [], - "sourceRoot": "", + "version": 3, "sources": [ "test/fixtures/node_modules/some/module.less", - "test/fixtures/source-map.less", + "test/fixtures/source-map.less" ], + "names": [], + "mappings": "AAAA;ACEA;EDDC,cAAA;;ACCD;EACE,YAAA", "sourcesContent": [ - ".modules-dir-some-module { - color: hotpink; -} -", - "@import "some/module"; - -#it-works:extend(.modules-dir-some-module) { - margin: 10px; -} -", + ".modules-dir-some-module {\\n\\tcolor: hotpink;\\n}\\n", + "@import \\"some/module\\";\\n\\n#it-works:extend(.modules-dir-some-module) {\\n margin: 10px;\\n}\\n" ], - "version": 3, + "sourceRoot": "" } `; -exports[`"sourceMap" options should generate source maps when value is "true": warnings 1`] = `[]`; +exports[`\"sourceMap\" options > should generate source maps when value is \"true\" and the \"devtool\" value is \"false\" 3`] = ` +[] +`; -exports[`"sourceMap" options should not generate source maps when the "devtool" value is "false": css 1`] = ` -".modules-dir-some-module, -#it-works { - color: hotpink; -} -#it-works { - margin: 10px; -} -" +exports[`\"sourceMap\" options > should generate source maps when value is \"true\" and the \"devtool\" value is \"false\" 4`] = ` +[] `; -exports[`"sourceMap" options should not generate source maps when the "devtool" value is "false": errors 1`] = `[]`; +exports[`\"sourceMap\" options > should not generate source maps when the \"devtool\" value is \"false\" 1`] = ` +".modules-dir-some-module,\\n#it-works {\\n color: hotpink;\\n}\\n#it-works {\\n margin: 10px;\\n}\\n" +`; -exports[`"sourceMap" options should not generate source maps when the "devtool" value is "false": warnings 1`] = `[]`; +exports[`\"sourceMap\" options > should not generate source maps when the \"devtool\" value is \"false\" 2`] = ` +[] +`; -exports[`"sourceMap" options should not generate source maps when value is "false" and the "devtool" value is "source-map": css 1`] = ` -".modules-dir-some-module, -#it-works { - color: hotpink; -} -#it-works { - margin: 10px; -} -" +exports[`\"sourceMap\" options > should not generate source maps when the \"devtool\" value is \"false\" 3`] = ` +[] `; -exports[`"sourceMap" options should not generate source maps when value is "false" and the "devtool" value is "source-map": errors 1`] = `[]`; +exports[`\"sourceMap\" options > should not generate source maps when value is \"false\" 1`] = ` +".modules-dir-some-module,\\n#it-works {\\n color: hotpink;\\n}\\n#it-works {\\n margin: 10px;\\n}\\n" +`; -exports[`"sourceMap" options should not generate source maps when value is "false" and the "devtool" value is "source-map": warnings 1`] = `[]`; +exports[`\"sourceMap\" options > should not generate source maps when value is \"false\" 2`] = ` +[] +`; -exports[`"sourceMap" options should not generate source maps when value is "false": css 1`] = ` -".modules-dir-some-module, -#it-works { - color: hotpink; -} -#it-works { - margin: 10px; -} -" +exports[`\"sourceMap\" options > should not generate source maps when value is \"false\" 3`] = ` +[] `; -exports[`"sourceMap" options should not generate source maps when value is "false": errors 1`] = `[]`; +exports[`\"sourceMap\" options > should not generate source maps when value is \"false\" and the \"devtool\" value is \"source-map\" 1`] = ` +".modules-dir-some-module,\\n#it-works {\\n color: hotpink;\\n}\\n#it-works {\\n margin: 10px;\\n}\\n" +`; -exports[`"sourceMap" options should not generate source maps when value is "false": warnings 1`] = `[]`; +exports[`\"sourceMap\" options > should not generate source maps when value is \"false\" and the \"devtool\" value is \"source-map\" 2`] = ` +[] +`; -exports[`"sourceMap" options should work and generate custom source maps: css 1`] = ` -".modules-dir-some-module, -#it-works { - color: hotpink; -} -#it-works { - margin: 10px; -} -/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9zb21lL21vZHVsZS5sZXNzIiwic291cmNlLW1hcC5sZXNzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0FDRUE7RUREQyxjQUFBOztBQ0NEO0VBQ0UsWUFBQSIsImZpbGUiOiJzb3VyY2UtbWFwLmNzcyIsInNvdXJjZXNDb250ZW50IjpbIi5tb2R1bGVzLWRpci1zb21lLW1vZHVsZSB7XG5cdGNvbG9yOiBob3RwaW5rO1xufVxuIiwiQGltcG9ydCBcInNvbWUvbW9kdWxlXCI7XG5cbiNpdC13b3JrczpleHRlbmQoLm1vZHVsZXMtZGlyLXNvbWUtbW9kdWxlKSB7XG4gIG1hcmdpbjogMTBweDtcbn1cbiJdfQ== */" +exports[`\"sourceMap\" options > should not generate source maps when value is \"false\" and the \"devtool\" value is \"source-map\" 3`] = ` +[] `; -exports[`"sourceMap" options should work and generate custom source maps: errors 1`] = `[]`; +exports[`\"sourceMap\" options > should work and generate custom source maps 1`] = ` +".modules-dir-some-module,\\n#it-works {\\n color: hotpink;\\n}\\n#it-works {\\n margin: 10px;\\n}\\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9zb21lL21vZHVsZS5sZXNzIiwic291cmNlLW1hcC5sZXNzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0FDRUE7RUREQyxjQUFBOztBQ0NEO0VBQ0UsWUFBQSIsImZpbGUiOiJzb3VyY2UtbWFwLmNzcyIsInNvdXJjZXNDb250ZW50IjpbIi5tb2R1bGVzLWRpci1zb21lLW1vZHVsZSB7XG5cdGNvbG9yOiBob3RwaW5rO1xufVxuIiwiQGltcG9ydCBcInNvbWUvbW9kdWxlXCI7XG5cbiNpdC13b3JrczpleHRlbmQoLm1vZHVsZXMtZGlyLXNvbWUtbW9kdWxlKSB7XG4gIG1hcmdpbjogMTBweDtcbn1cbiJdfQ== */" +`; -exports[`"sourceMap" options should work and generate custom source maps: source map 1`] = ` +exports[`\"sourceMap\" options > should work and generate custom source maps 2`] = ` { - "file": "source-map.css", - "mappings": "AAAA;ACEA;EDDC,cAAA;;ACCD;EACE,YAAA", - "names": [], + "version": 3, "sources": [ "node_modules/some/module.less", - "source-map.less", + "source-map.less" ], + "names": [], + "mappings": "AAAA;ACEA;EDDC,cAAA;;ACCD;EACE,YAAA", + "file": "source-map.css", "sourcesContent": [ - ".modules-dir-some-module { - color: hotpink; + ".modules-dir-some-module {\\n\\tcolor: hotpink;\\n}\\n", + "@import \\"some/module\\";\\n\\n#it-works:extend(.modules-dir-some-module) {\\n margin: 10px;\\n}\\n" + ] } -", - "@import "some/module"; +`; -#it-works:extend(.modules-dir-some-module) { - margin: 10px; -} -", - ], - "version": 3, -} +exports[`\"sourceMap\" options > should work and generate custom source maps 3`] = ` +[] `; -exports[`"sourceMap" options should work and generate custom source maps: warnings 1`] = `[]`; +exports[`\"sourceMap\" options > should work and generate custom source maps 4`] = ` +[] +`; diff --git a/test/__snapshots__/validate-options.test.js.snap b/test/__snapshots__/validate-options.test.js.snap index 68d64fb8..d70a0eb2 100644 --- a/test/__snapshots__/validate-options.test.js.snap +++ b/test/__snapshots__/validate-options.test.js.snap @@ -1,248 +1,103 @@ -// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing - -exports[`validate options should throw an error on the "additionalData" option with "/test/" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options.additionalData should be one of these: - string | function - -> Prepends/Appends \`Less\` code to the actual entry file. - -> Read more at https://github.com/webpack/less-loader#additionalData - Details: - * options.additionalData should be a string. - * options.additionalData should be an instance of function." -`; - -exports[`validate options should throw an error on the "additionalData" option with "[]" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options.additionalData should be one of these: - string | function - -> Prepends/Appends \`Less\` code to the actual entry file. - -> Read more at https://github.com/webpack/less-loader#additionalData - Details: - * options.additionalData should be a string. - * options.additionalData should be an instance of function." -`; - -exports[`validate options should throw an error on the "additionalData" option with "{}" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options.additionalData should be one of these: - string | function - -> Prepends/Appends \`Less\` code to the actual entry file. - -> Read more at https://github.com/webpack/less-loader#additionalData - Details: - * options.additionalData should be a string. - * options.additionalData should be an instance of function." -`; - -exports[`validate options should throw an error on the "additionalData" option with "1" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options.additionalData should be one of these: - string | function - -> Prepends/Appends \`Less\` code to the actual entry file. - -> Read more at https://github.com/webpack/less-loader#additionalData - Details: - * options.additionalData should be a string. - * options.additionalData should be an instance of function." -`; - -exports[`validate options should throw an error on the "additionalData" option with "false" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options.additionalData should be one of these: - string | function - -> Prepends/Appends \`Less\` code to the actual entry file. - -> Read more at https://github.com/webpack/less-loader#additionalData - Details: - * options.additionalData should be a string. - * options.additionalData should be an instance of function." -`; - -exports[`validate options should throw an error on the "additionalData" option with "true" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options.additionalData should be one of these: - string | function - -> Prepends/Appends \`Less\` code to the actual entry file. - -> Read more at https://github.com/webpack/less-loader#additionalData - Details: - * options.additionalData should be a string. - * options.additionalData should be an instance of function." -`; - -exports[`validate options should throw an error on the "implementation" option with "() => {}" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options.implementation should be one of these: - string | object { … } - -> The implementation of the \`Less\` to be used. - -> Read more at https://github.com/webpack/less-loader#implementation - Details: - * options.implementation should be a string. - * options.implementation should be an object: - object { … }" -`; - -exports[`validate options should throw an error on the "implementation" option with "[]" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options.implementation should be one of these: - string | object { … } - -> The implementation of the \`Less\` to be used. - -> Read more at https://github.com/webpack/less-loader#implementation - Details: - * options.implementation should be a string. - * options.implementation should be an object: - object { … }" -`; - -exports[`validate options should throw an error on the "implementation" option with "false" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options.implementation should be one of these: - string | object { … } - -> The implementation of the \`Less\` to be used. - -> Read more at https://github.com/webpack/less-loader#implementation - Details: - * options.implementation should be a string. - * options.implementation should be an object: - object { … }" -`; - -exports[`validate options should throw an error on the "implementation" option with "true" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options.implementation should be one of these: - string | object { … } - -> The implementation of the \`Less\` to be used. - -> Read more at https://github.com/webpack/less-loader#implementation - Details: - * options.implementation should be a string. - * options.implementation should be an object: - object { … }" -`; - -exports[`validate options should throw an error on the "lessLogAsWarnOrErr" option with "string" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options.lessLogAsWarnOrErr should be a boolean. - -> Less warnings and errors will be webpack warnings or errors. - -> Read more at https://github.com/webpack/less-loader#lesslogaswarnorerr" -`; - -exports[`validate options should throw an error on the "lessOptions" option with "[]" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options.lessOptions should be one of these: - object { … } | function - -> Options to pass through to \`Less\`. - -> Read more at https://github.com/webpack/less-loader#lessoptions - Details: - * options.lessOptions should be an object: - object { … } - * options.lessOptions should be an instance of function." -`; - -exports[`validate options should throw an error on the "lessOptions" option with "1" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options.lessOptions should be one of these: - object { … } | function - -> Options to pass through to \`Less\`. - -> Read more at https://github.com/webpack/less-loader#lessoptions - Details: - * options.lessOptions should be an object: - object { … } - * options.lessOptions should be an instance of function." -`; - -exports[`validate options should throw an error on the "lessOptions" option with "false" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options.lessOptions should be one of these: - object { … } | function - -> Options to pass through to \`Less\`. - -> Read more at https://github.com/webpack/less-loader#lessoptions - Details: - * options.lessOptions should be an object: - object { … } - * options.lessOptions should be an instance of function." -`; - -exports[`validate options should throw an error on the "lessOptions" option with "test" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options.lessOptions should be one of these: - object { … } | function - -> Options to pass through to \`Less\`. - -> Read more at https://github.com/webpack/less-loader#lessoptions - Details: - * options.lessOptions should be an object: - object { … } - * options.lessOptions should be an instance of function." -`; - -exports[`validate options should throw an error on the "lessOptions" option with "true" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options.lessOptions should be one of these: - object { … } | function - -> Options to pass through to \`Less\`. - -> Read more at https://github.com/webpack/less-loader#lessoptions - Details: - * options.lessOptions should be an object: - object { … } - * options.lessOptions should be an instance of function." -`; - -exports[`validate options should throw an error on the "sourceMap" option with "string" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options.sourceMap should be a boolean. - -> Enables/Disables generation of source maps. - -> Read more at https://github.com/webpack/less-loader#sourcemap" -`; - -exports[`validate options should throw an error on the "unknown" option with "/test/" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options has an unknown property 'unknown'. These properties are valid: - object { lessOptions?, additionalData?, sourceMap?, webpackImporter?, implementation?, lessLogAsWarnOrErr? }" -`; - -exports[`validate options should throw an error on the "unknown" option with "[]" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options has an unknown property 'unknown'. These properties are valid: - object { lessOptions?, additionalData?, sourceMap?, webpackImporter?, implementation?, lessLogAsWarnOrErr? }" -`; - -exports[`validate options should throw an error on the "unknown" option with "{"foo":"bar"}" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options has an unknown property 'unknown'. These properties are valid: - object { lessOptions?, additionalData?, sourceMap?, webpackImporter?, implementation?, lessLogAsWarnOrErr? }" -`; - -exports[`validate options should throw an error on the "unknown" option with "{}" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options has an unknown property 'unknown'. These properties are valid: - object { lessOptions?, additionalData?, sourceMap?, webpackImporter?, implementation?, lessLogAsWarnOrErr? }" -`; - -exports[`validate options should throw an error on the "unknown" option with "1" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options has an unknown property 'unknown'. These properties are valid: - object { lessOptions?, additionalData?, sourceMap?, webpackImporter?, implementation?, lessLogAsWarnOrErr? }" -`; - -exports[`validate options should throw an error on the "unknown" option with "false" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options has an unknown property 'unknown'. These properties are valid: - object { lessOptions?, additionalData?, sourceMap?, webpackImporter?, implementation?, lessLogAsWarnOrErr? }" -`; - -exports[`validate options should throw an error on the "unknown" option with "test" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options has an unknown property 'unknown'. These properties are valid: - object { lessOptions?, additionalData?, sourceMap?, webpackImporter?, implementation?, lessLogAsWarnOrErr? }" -`; - -exports[`validate options should throw an error on the "unknown" option with "true" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options has an unknown property 'unknown'. These properties are valid: - object { lessOptions?, additionalData?, sourceMap?, webpackImporter?, implementation?, lessLogAsWarnOrErr? }" -`; - -exports[`validate options should throw an error on the "webpackImporter" option with "string" value 1`] = ` -"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema. - - options.webpackImporter should be one of these: - boolean | "only" - -> Enables/Disables default \`webpack\` importer. - -> Read more at https://github.com/webpack/less-loader#webpackimporter - Details: - * options.webpackImporter should be a boolean. - * options.webpackImporter should be "only"." +exports[`validate options > should throw an error on the \"additionalData\" option with \"/test/\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options.additionalData should be one of these:\\n string | function\\n -> Prepends/Appends \`Less\` code to the actual entry file.\\n -> Read more at https://github.com/webpack/less-loader#additionalData\\n Details:\\n * options.additionalData should be a string.\\n * options.additionalData should be an instance of function." +`; + +exports[`validate options > should throw an error on the \"additionalData\" option with \"1\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options.additionalData should be one of these:\\n string | function\\n -> Prepends/Appends \`Less\` code to the actual entry file.\\n -> Read more at https://github.com/webpack/less-loader#additionalData\\n Details:\\n * options.additionalData should be a string.\\n * options.additionalData should be an instance of function." +`; + +exports[`validate options > should throw an error on the \"additionalData\" option with \"[]\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options.additionalData should be one of these:\\n string | function\\n -> Prepends/Appends \`Less\` code to the actual entry file.\\n -> Read more at https://github.com/webpack/less-loader#additionalData\\n Details:\\n * options.additionalData should be a string.\\n * options.additionalData should be an instance of function." +`; + +exports[`validate options > should throw an error on the \"additionalData\" option with \"false\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options.additionalData should be one of these:\\n string | function\\n -> Prepends/Appends \`Less\` code to the actual entry file.\\n -> Read more at https://github.com/webpack/less-loader#additionalData\\n Details:\\n * options.additionalData should be a string.\\n * options.additionalData should be an instance of function." +`; + +exports[`validate options > should throw an error on the \"additionalData\" option with \"true\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options.additionalData should be one of these:\\n string | function\\n -> Prepends/Appends \`Less\` code to the actual entry file.\\n -> Read more at https://github.com/webpack/less-loader#additionalData\\n Details:\\n * options.additionalData should be a string.\\n * options.additionalData should be an instance of function." +`; + +exports[`validate options > should throw an error on the \"additionalData\" option with \"{}\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options.additionalData should be one of these:\\n string | function\\n -> Prepends/Appends \`Less\` code to the actual entry file.\\n -> Read more at https://github.com/webpack/less-loader#additionalData\\n Details:\\n * options.additionalData should be a string.\\n * options.additionalData should be an instance of function." +`; + +exports[`validate options > should throw an error on the \"implementation\" option with \"() => {}\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options.implementation should be one of these:\\n string | object { … }\\n -> The implementation of the \`Less\` to be used.\\n -> Read more at https://github.com/webpack/less-loader#implementation\\n Details:\\n * options.implementation should be a string.\\n * options.implementation should be an object:\\n object { … }" +`; + +exports[`validate options > should throw an error on the \"implementation\" option with \"[]\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options.implementation should be one of these:\\n string | object { … }\\n -> The implementation of the \`Less\` to be used.\\n -> Read more at https://github.com/webpack/less-loader#implementation\\n Details:\\n * options.implementation should be a string.\\n * options.implementation should be an object:\\n object { … }" +`; + +exports[`validate options > should throw an error on the \"implementation\" option with \"false\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options.implementation should be one of these:\\n string | object { … }\\n -> The implementation of the \`Less\` to be used.\\n -> Read more at https://github.com/webpack/less-loader#implementation\\n Details:\\n * options.implementation should be a string.\\n * options.implementation should be an object:\\n object { … }" +`; + +exports[`validate options > should throw an error on the \"implementation\" option with \"true\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options.implementation should be one of these:\\n string | object { … }\\n -> The implementation of the \`Less\` to be used.\\n -> Read more at https://github.com/webpack/less-loader#implementation\\n Details:\\n * options.implementation should be a string.\\n * options.implementation should be an object:\\n object { … }" +`; + +exports[`validate options > should throw an error on the \"lessLogAsWarnOrErr\" option with \"string\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options.lessLogAsWarnOrErr should be a boolean.\\n -> Less warnings and errors will be webpack warnings or errors.\\n -> Read more at https://github.com/webpack/less-loader#lesslogaswarnorerr" +`; + +exports[`validate options > should throw an error on the \"lessOptions\" option with \"1\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options.lessOptions should be one of these:\\n object { … } | function\\n -> Options to pass through to \`Less\`.\\n -> Read more at https://github.com/webpack/less-loader#lessoptions\\n Details:\\n * options.lessOptions should be an object:\\n object { … }\\n * options.lessOptions should be an instance of function." +`; + +exports[`validate options > should throw an error on the \"lessOptions\" option with \"[]\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options.lessOptions should be one of these:\\n object { … } | function\\n -> Options to pass through to \`Less\`.\\n -> Read more at https://github.com/webpack/less-loader#lessoptions\\n Details:\\n * options.lessOptions should be an object:\\n object { … }\\n * options.lessOptions should be an instance of function." +`; + +exports[`validate options > should throw an error on the \"lessOptions\" option with \"false\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options.lessOptions should be one of these:\\n object { … } | function\\n -> Options to pass through to \`Less\`.\\n -> Read more at https://github.com/webpack/less-loader#lessoptions\\n Details:\\n * options.lessOptions should be an object:\\n object { … }\\n * options.lessOptions should be an instance of function." +`; + +exports[`validate options > should throw an error on the \"lessOptions\" option with \"test\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options.lessOptions should be one of these:\\n object { … } | function\\n -> Options to pass through to \`Less\`.\\n -> Read more at https://github.com/webpack/less-loader#lessoptions\\n Details:\\n * options.lessOptions should be an object:\\n object { … }\\n * options.lessOptions should be an instance of function." +`; + +exports[`validate options > should throw an error on the \"lessOptions\" option with \"true\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options.lessOptions should be one of these:\\n object { … } | function\\n -> Options to pass through to \`Less\`.\\n -> Read more at https://github.com/webpack/less-loader#lessoptions\\n Details:\\n * options.lessOptions should be an object:\\n object { … }\\n * options.lessOptions should be an instance of function." +`; + +exports[`validate options > should throw an error on the \"sourceMap\" option with \"string\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options.sourceMap should be a boolean.\\n -> Enables/Disables generation of source maps.\\n -> Read more at https://github.com/webpack/less-loader#sourcemap" +`; + +exports[`validate options > should throw an error on the \"unknown\" option with \"/test/\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options has an unknown property 'unknown'. These properties are valid:\\n object { lessOptions?, additionalData?, sourceMap?, webpackImporter?, implementation?, lessLogAsWarnOrErr? }" +`; + +exports[`validate options > should throw an error on the \"unknown\" option with \"1\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options has an unknown property 'unknown'. These properties are valid:\\n object { lessOptions?, additionalData?, sourceMap?, webpackImporter?, implementation?, lessLogAsWarnOrErr? }" +`; + +exports[`validate options > should throw an error on the \"unknown\" option with \"[]\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options has an unknown property 'unknown'. These properties are valid:\\n object { lessOptions?, additionalData?, sourceMap?, webpackImporter?, implementation?, lessLogAsWarnOrErr? }" +`; + +exports[`validate options > should throw an error on the \"unknown\" option with \"false\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options has an unknown property 'unknown'. These properties are valid:\\n object { lessOptions?, additionalData?, sourceMap?, webpackImporter?, implementation?, lessLogAsWarnOrErr? }" +`; + +exports[`validate options > should throw an error on the \"unknown\" option with \"test\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options has an unknown property 'unknown'. These properties are valid:\\n object { lessOptions?, additionalData?, sourceMap?, webpackImporter?, implementation?, lessLogAsWarnOrErr? }" +`; + +exports[`validate options > should throw an error on the \"unknown\" option with \"true\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options has an unknown property 'unknown'. These properties are valid:\\n object { lessOptions?, additionalData?, sourceMap?, webpackImporter?, implementation?, lessLogAsWarnOrErr? }" +`; + +exports[`validate options > should throw an error on the \"unknown\" option with \"{\"foo\":\"bar\"}\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options has an unknown property 'unknown'. These properties are valid:\\n object { lessOptions?, additionalData?, sourceMap?, webpackImporter?, implementation?, lessLogAsWarnOrErr? }" +`; + +exports[`validate options > should throw an error on the \"unknown\" option with \"{}\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options has an unknown property 'unknown'. These properties are valid:\\n object { lessOptions?, additionalData?, sourceMap?, webpackImporter?, implementation?, lessLogAsWarnOrErr? }" +`; + +exports[`validate options > should throw an error on the \"webpackImporter\" option with \"string\" value 1`] = ` +"Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.\\n - options.webpackImporter should be one of these:\\n boolean | \\"only\\"\\n -> Enables/Disables default \`webpack\` importer.\\n -> Read more at https://github.com/webpack/less-loader#webpackimporter\\n Details:\\n * options.webpackImporter should be a boolean.\\n * options.webpackImporter should be \\"only\\"." `; diff --git a/test/__snapshots__/webpackImporter-options.test.js.snap b/test/__snapshots__/webpackImporter-options.test.js.snap index 0360ad35..83d5d2bf 100644 --- a/test/__snapshots__/webpackImporter-options.test.js.snap +++ b/test/__snapshots__/webpackImporter-options.test.js.snap @@ -1,97 +1,57 @@ -// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing +exports[`\"webpackImporter\" option > should throw an error on webpack import when value is \"false\" 1`] = ` +[] +`; -exports[`"webpackImporter" option should throw an error on webpack import when value is "false": errors 1`] = ` +exports[`\"webpackImporter\" option > should throw an error on webpack import when value is \"false\" 2`] = ` [ - "ModuleBuildError: Module build failed (from \`replaced original path\`): -", + "ModuleBuildError: Module build failed (from \`replaced original path\`):\\n" ] `; -exports[`"webpackImporter" option should throw an error on webpack import when value is "false": warnings 1`] = `[]`; - -exports[`"webpackImporter" option should work when value is "false": css 1`] = ` -"@import "css.css"; -@import "css.css"; -.classical-css, -#it-works { - background: hotpink; -} -.box, -#it-works { - color: #fe33ac; - border-color: #fdcdea; - background: url(box.png); -} -.box div { - -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); - box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); -} -#it-works { - margin: 10px; -} -" +exports[`\"webpackImporter\" option > should work when value is \"false\" 1`] = ` +"@import \\"css.css\\";\\n@import \\"css.css\\";\\n.classical-css,\\n#it-works {\\n background: hotpink;\\n}\\n.box,\\n#it-works {\\n color: #fe33ac;\\n border-color: #fdcdea;\\n background: url(box.png);\\n}\\n.box div {\\n -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);\\n}\\n#it-works {\\n margin: 10px;\\n}\\n" `; -exports[`"webpackImporter" option should work when value is "false": errors 1`] = `[]`; +exports[`\"webpackImporter\" option > should work when value is \"false\" 2`] = ` +[] +`; -exports[`"webpackImporter" option should work when value is "false": warnings 1`] = `[]`; +exports[`\"webpackImporter\" option > should work when value is \"false\" 3`] = ` +[] +`; -exports[`"webpackImporter" option should work when value is "only": css 1`] = ` -"@import "some/css.css"; -@import "some/css.css"; -#it-works { - color: hotpink; -} -.modules-dir-some-module, -#it-works { - background: hotpink; -} -#it-works { - margin: 10px; -} -" +exports[`\"webpackImporter\" option > should work when value is \"only\" 1`] = ` +"@import \\"some/css.css\\";\\n@import \\"some/css.css\\";\\n#it-works {\\n color: hotpink;\\n}\\n.modules-dir-some-module,\\n#it-works {\\n background: hotpink;\\n}\\n#it-works {\\n margin: 10px;\\n}\\n" `; -exports[`"webpackImporter" option should work when value is "only": errors 1`] = `[]`; +exports[`\"webpackImporter\" option > should work when value is \"only\" 2`] = ` +[] +`; -exports[`"webpackImporter" option should work when value is "only": warnings 1`] = `[]`; +exports[`\"webpackImporter\" option > should work when value is \"only\" 3`] = ` +[] +`; -exports[`"webpackImporter" option should work when value is "true": css 1`] = ` -"@import "some/css.css"; -@import "some/css.css"; -#it-works { - color: hotpink; -} -.modules-dir-some-module, -#it-works { - background: hotpink; -} -#it-works { - margin: 10px; -} -" +exports[`\"webpackImporter\" option > should work when value is \"true\" 1`] = ` +"@import \\"some/css.css\\";\\n@import \\"some/css.css\\";\\n#it-works {\\n color: hotpink;\\n}\\n.modules-dir-some-module,\\n#it-works {\\n background: hotpink;\\n}\\n#it-works {\\n margin: 10px;\\n}\\n" `; -exports[`"webpackImporter" option should work when value is "true": errors 1`] = `[]`; +exports[`\"webpackImporter\" option > should work when value is \"true\" 2`] = ` +[] +`; -exports[`"webpackImporter" option should work when value is "true": warnings 1`] = `[]`; +exports[`\"webpackImporter\" option > should work when value is \"true\" 3`] = ` +[] +`; -exports[`"webpackImporter" option should work when value is not specify: css 1`] = ` -"@import "some/css.css"; -@import "some/css.css"; -#it-works { - color: hotpink; -} -.modules-dir-some-module, -#it-works { - background: hotpink; -} -#it-works { - margin: 10px; -} -" +exports[`\"webpackImporter\" option > should work when value is not specify 1`] = ` +"@import \\"some/css.css\\";\\n@import \\"some/css.css\\";\\n#it-works {\\n color: hotpink;\\n}\\n.modules-dir-some-module,\\n#it-works {\\n background: hotpink;\\n}\\n#it-works {\\n margin: 10px;\\n}\\n" `; -exports[`"webpackImporter" option should work when value is not specify: errors 1`] = `[]`; +exports[`\"webpackImporter\" option > should work when value is not specify 2`] = ` +[] +`; -exports[`"webpackImporter" option should work when value is not specify: warnings 1`] = `[]`; +exports[`\"webpackImporter\" option > should work when value is not specify 3`] = ` +[] +`; diff --git a/test/additionalData-option.test.js b/test/additionalData-option.test.js index b4055a2e..f08eb6b7 100644 --- a/test/additionalData-option.test.js +++ b/test/additionalData-option.test.js @@ -1,3 +1,7 @@ +import assert from "node:assert"; +import path from "node:path"; +import { describe, it } from "node:test"; + import { compile, getCodeFromBundle, @@ -5,10 +9,10 @@ import { getCompiler, getErrors, getWarnings, -} from "./helpers"; +} from "./helpers/index.js"; describe('"additionalData" option', () => { - it("should work as string", async () => { + it("should work as string", async (t) => { const testId = "./additional-data.less"; const additionalData = "@background: coral;"; const compiler = getCompiler(testId, { additionalData }); @@ -16,21 +20,18 @@ describe('"additionalData" option', () => { const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId, { additionalData }); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should as function", async () => { + it("should as function", async (t) => { const testId = "./additional-data.less"; const additionalData = (content, loaderContext) => { const { resourcePath, rootContext } = loaderContext; - const relativePath = require("node:path").relative( - rootContext, - resourcePath, - ); + const relativePath = path.relative(rootContext, resourcePath); return ` /* RelativePath: ${relativePath}; */ @@ -45,21 +46,18 @@ describe('"additionalData" option', () => { const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId, { additionalData }); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should work as async function", async () => { + it("should work as async function", async (t) => { const testId = "./additional-data.less"; const additionalData = async (content, loaderContext) => { const { resourcePath, rootContext } = loaderContext; - const relativePath = require("node:path").relative( - rootContext, - resourcePath, - ); + const relativePath = path.relative(rootContext, resourcePath); return ` /* RelativePath: ${relativePath}; */ @@ -74,9 +72,9 @@ describe('"additionalData" option', () => { const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId, { additionalData }); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); }); diff --git a/test/cjs.test.js b/test/cjs.test.js index dc8321a3..83c3a33e 100644 --- a/test/cjs.test.js +++ b/test/cjs.test.js @@ -1,8 +1,14 @@ -import src from "../src"; -import cjs from "../src/cjs"; +import assert from "node:assert"; +import { createRequire } from "node:module"; +import { describe, it } from "node:test"; + +const require = createRequire(import.meta.url); + +const cjs = require("../dist/cjs.js"); +const src = require("../dist/index.js"); describe("cjs", () => { it("should exported", () => { - expect(cjs).toEqual(src); + assert.strictEqual(cjs, src.default); }); }); diff --git a/test/fixtures/folder/customFileLoaderPlugin.js b/test/fixtures/folder/customFileLoaderPlugin.cjs similarity index 53% rename from test/fixtures/folder/customFileLoaderPlugin.js rename to test/fixtures/folder/customFileLoaderPlugin.cjs index a5889ccf..e2402fcf 100644 --- a/test/fixtures/folder/customFileLoaderPlugin.js +++ b/test/fixtures/folder/customFileLoaderPlugin.cjs @@ -1,12 +1,12 @@ -import path from "path"; -import less from "less"; +const path = require("node:path"); +const less = require("less"); class Plugin extends less.FileManager { supports(filename) { - if (filename === 'forFileLoaderPluginResolve.less') { + if (filename === "forFileLoaderPluginResolve.less") { return true; } - + if (filename === "https://fonts.googleapis.com/css?family=Roboto:500") { return true; } @@ -16,15 +16,17 @@ class Plugin extends less.FileManager { loadFile(filename, ...args) { let result; - - if (filename === 'forFileLoaderPluginResolve.less') { - result = path.resolve(__dirname, '../', 'file-load-replacement.less'); - } else if (filename === "https://fonts.googleapis.com/css?family=Roboto:500") { - result = path.resolve(__dirname, '../', 'mock-fonts.less'); + + if (filename === "forFileLoaderPluginResolve.less") { + result = path.resolve(__dirname, "../", "file-load-replacement.less"); + } else if ( + filename === "https://fonts.googleapis.com/css?family=Roboto:500" + ) { + result = path.resolve(__dirname, "../", "mock-fonts.less"); } return super.loadFile(result, ...args); - }; + } } class CustomFileLoaderPlugin { diff --git a/test/fixtures/folder/customImportPlugin.js b/test/fixtures/folder/customImportPlugin.cjs similarity index 100% rename from test/fixtures/folder/customImportPlugin.js rename to test/fixtures/folder/customImportPlugin.cjs diff --git a/test/fixtures/implementation-error.js b/test/fixtures/implementation-error.cjs similarity index 100% rename from test/fixtures/implementation-error.js rename to test/fixtures/implementation-error.cjs diff --git a/test/helpers/execute.js b/test/helpers/execute.js index a98c15c6..1e3cb835 100644 --- a/test/helpers/execute.js +++ b/test/helpers/execute.js @@ -1,18 +1,17 @@ import Module from "node:module"; import path from "node:path"; +import { fileURLToPath } from "node:url"; -const parentModule = module; +const __dirname = path.dirname(fileURLToPath(import.meta.url)); export default (code) => { const resource = "test.js"; - const module = new Module(resource, parentModule); + const m = new Module(resource); - module.paths = Module._nodeModulePaths( - path.resolve(__dirname, "../fixtures"), - ); - module.filename = resource; + m.paths = Module._nodeModulePaths(path.resolve(__dirname, "../fixtures")); + m.filename = resource; - module._compile(code, resource); + m._compile(code, resource); - return module.exports; + return m.exports; }; diff --git a/test/helpers/getCodeFromBundle.js b/test/helpers/getCodeFromBundle.js index bfac7a9d..ee3ac3bd 100644 --- a/test/helpers/getCodeFromBundle.js +++ b/test/helpers/getCodeFromBundle.js @@ -1,6 +1,6 @@ import vm from "node:vm"; -import readAsset from "./readAsset"; +import readAsset from "./readAsset.js"; function getCodeFromBundle(stats, compiler, asset) { let code = null; diff --git a/test/helpers/getCodeFromLess.js b/test/helpers/getCodeFromLess.js index c5e7c784..0d855b45 100644 --- a/test/helpers/getCodeFromLess.js +++ b/test/helpers/getCodeFromLess.js @@ -1,8 +1,11 @@ import fs from "node:fs"; import path from "node:path"; +import { fileURLToPath } from "node:url"; import less from "less"; +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + const pathMap = { "some/css.css": path.resolve( __dirname, diff --git a/test/helpers/getCompiler.js b/test/helpers/getCompiler.js index fe37eaa6..c8507dec 100644 --- a/test/helpers/getCompiler.js +++ b/test/helpers/getCompiler.js @@ -1,8 +1,13 @@ +import { createRequire } from "node:module"; import path from "node:path"; +import { fileURLToPath } from "node:url"; import { Volume, createFsFromVolume } from "memfs"; import webpack from "webpack"; +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const require = createRequire(import.meta.url); + export default (fixture, loaderOptions = {}, config = {}) => { const fullConfig = { mode: "development", @@ -21,10 +26,10 @@ export default (fixture, loaderOptions = {}, config = {}) => { test: /\.less$/i, rules: [ { - loader: require.resolve("./testLoader"), + loader: require.resolve("./testLoader.cjs"), }, { - loader: path.resolve(__dirname, "../../src"), + loader: path.resolve(__dirname, "../../dist/cjs.js"), options: loaderOptions || {}, }, ], diff --git a/test/helpers/getErrors.js b/test/helpers/getErrors.js index 6ca84f41..c39961d1 100644 --- a/test/helpers/getErrors.js +++ b/test/helpers/getErrors.js @@ -1,3 +1,3 @@ -import normalizeErrors from "./normalizeErrors"; +import normalizeErrors from "./normalizeErrors.js"; -export default (stats) => normalizeErrors(stats.compilation.errors.sort()); +export default (stats) => normalizeErrors(stats.compilation.errors.toSorted()); diff --git a/test/helpers/getWarnings.js b/test/helpers/getWarnings.js index 456c588d..22b3a32b 100644 --- a/test/helpers/getWarnings.js +++ b/test/helpers/getWarnings.js @@ -1,3 +1,4 @@ -import normalizeErrors from "./normalizeErrors"; +import normalizeErrors from "./normalizeErrors.js"; -export default (stats) => normalizeErrors(stats.compilation.warnings.sort()); +export default (stats) => + normalizeErrors(stats.compilation.warnings.toSorted()); diff --git a/test/helpers/index.js b/test/helpers/index.js index 48bf2624..d3df30f2 100644 --- a/test/helpers/index.js +++ b/test/helpers/index.js @@ -1,11 +1,11 @@ -export { default as compile } from "./compile"; -export { default as getCodeFromBundle } from "./getCodeFromBundle"; -export { default as execute } from "./execute"; -export { default as getCompiler } from "./getCompiler"; -export { default as getCodeFromLess } from "./getCodeFromLess"; -export { default as getWarnings } from "./getWarnings"; -export { default as getErrors } from "./getErrors"; -export { default as readAsset } from "./readAsset"; -export { default as normalizeErrors } from "./normalizeErrors"; -export { default as validateDependencies } from "./validateDependencies"; -export { default as readsAssets } from "./readAssets"; +export { default as compile } from "./compile.js"; +export { default as getCodeFromBundle } from "./getCodeFromBundle.js"; +export { default as execute } from "./execute.js"; +export { default as getCompiler } from "./getCompiler.js"; +export { default as getCodeFromLess } from "./getCodeFromLess.js"; +export { default as getWarnings } from "./getWarnings.js"; +export { default as getErrors } from "./getErrors.js"; +export { default as readAsset } from "./readAsset.js"; +export { default as normalizeErrors } from "./normalizeErrors.js"; +export { default as validateDependencies } from "./validateDependencies.js"; +export { default as readsAssets } from "./readAssets.js"; diff --git a/test/helpers/readAssets.js b/test/helpers/readAssets.js index 4d6393e3..b98b7a99 100644 --- a/test/helpers/readAssets.js +++ b/test/helpers/readAssets.js @@ -1,4 +1,4 @@ -import readAsset from "./readAsset"; +import readAsset from "./readAsset.js"; export default function readAssets(compiler, stats) { const assets = {}; diff --git a/test/helpers/testLoader.js b/test/helpers/testLoader.cjs similarity index 93% rename from test/helpers/testLoader.js rename to test/helpers/testLoader.cjs index d2a696cb..982591e6 100644 --- a/test/helpers/testLoader.js +++ b/test/helpers/testLoader.cjs @@ -1,3 +1,5 @@ +"use strict"; + function testLoader(content, sourceMap) { const result = { css: content }; diff --git a/test/implementation.test.js b/test/implementation.test.js index 02a43b09..fa343bea 100644 --- a/test/implementation.test.js +++ b/test/implementation.test.js @@ -1,3 +1,7 @@ +import assert from "node:assert"; +import { createRequire } from "node:module"; +import { describe, it } from "node:test"; + import { compile, getCodeFromBundle, @@ -5,10 +9,12 @@ import { getCompiler, getErrors, getWarnings, -} from "./helpers"; +} from "./helpers/index.js"; + +const require = createRequire(import.meta.url); describe('"implementation" option', () => { - it("should work", async () => { + it("should work", async (t) => { const testId = "./basic.less"; const compiler = getCompiler(testId, { implementation: require("less"), @@ -17,13 +23,13 @@ describe('"implementation" option', () => { const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should work when implementation option is string", async () => { + it("should work when implementation option is string", async (t) => { const testId = "./basic.less"; const compiler = getCompiler(testId, { implementation: require.resolve("less"), @@ -32,31 +38,31 @@ describe('"implementation" option', () => { const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should throw error when unresolved package", async () => { + it("should throw error when unresolved package", async (t) => { const testId = "./basic.less"; const compiler = getCompiler(testId, { implementation: "unresolved", }); const stats = await compile(compiler); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should throw error when implementation has error", async () => { + it("should throw error when implementation has error", async (t) => { const testId = "./basic.less"; const compiler = getCompiler(testId, { - implementation: require.resolve("./fixtures/implementation-error.js"), + implementation: require.resolve("./fixtures/implementation-error.cjs"), }); const stats = await compile(compiler); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); }); diff --git a/test/loader.test.js b/test/loader.test.js index 20397618..8b00b9d3 100644 --- a/test/loader.test.js +++ b/test/loader.test.js @@ -1,8 +1,11 @@ +import assert from "node:assert"; import fs from "node:fs"; +import { createRequire } from "node:module"; import path from "node:path"; +import { describe, it } from "node:test"; +import { fileURLToPath } from "node:url"; import lessPluginGlob from "less-plugin-glob"; -import CustomImportPlugin from "./fixtures/folder/customImportPlugin"; import { compile, @@ -12,55 +15,57 @@ import { getErrors, getWarnings, validateDependencies, -} from "./helpers"; +} from "./helpers/index.js"; -const CustomFileLoaderPlugin = require("./fixtures/folder/customFileLoaderPlugin"); +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const require = createRequire(import.meta.url); -const nodeModulesPath = path.resolve(__dirname, "fixtures", "node_modules"); +const CustomFileLoaderPlugin = require("./fixtures/folder/customFileLoaderPlugin.cjs"); +const CustomImportPlugin = require("./fixtures/folder/customImportPlugin.cjs"); -jest.setTimeout(30000); +const nodeModulesPath = path.resolve(__dirname, "fixtures", "node_modules"); -describe("loader", () => { - it("should work", async () => { +describe("loader", { timeout: 30000 }, () => { + it("should work", async (t) => { const testId = "./basic.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should compile data-uri function", async () => { + it("should compile data-uri function", async (t) => { const testId = "./data-uri.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should transform urls", async () => { + it("should transform urls", async (t) => { const testId = "./url-path.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should install plugins", async () => { + it("should install plugins", async (t) => { let pluginInstalled = false; // Using prototype inheritance here since Less plugins are usually instances of classes // See https://github.com/webpack/less-loader/issues/181#issuecomment-288220113 @@ -78,14 +83,14 @@ describe("loader", () => { }); const stats = await compile(compiler); - expect(plugins).toHaveLength(1); - expect(sourceMap).toEqual({ outputSourceFiles: false }); - expect(pluginInstalled).toBe(true); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(plugins.length, 1); + assert.deepStrictEqual(sourceMap, { outputSourceFiles: false }); + assert.strictEqual(pluginInstalled, true); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should import from plugins", async () => { + it("should import from plugins", async (t) => { const testId = "./empty.less"; const compiler = getCompiler(testId, { lessOptions: { @@ -100,13 +105,13 @@ describe("loader", () => { }, }); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should work third-party plugins as fileLoader", async () => { + it("should work third-party plugins as fileLoader", async (t) => { const testId = "./file-load.less"; const compiler = getCompiler(testId, { lessOptions: { @@ -121,13 +126,13 @@ describe("loader", () => { }, }); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should not alter the original options object", async () => { + it("should not alter the original options object", async (t) => { const options = { lessOptions: { plugins: [] } }; const copiedOptions = { ...options }; @@ -135,38 +140,38 @@ describe("loader", () => { const compiler = getCompiler(testId, options); const stats = await compile(compiler); - expect(copiedOptions).toEqual(options); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.deepStrictEqual(copiedOptions, options); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should resolve all imports", async () => { + it("should resolve all imports", async (t) => { const testId = "./import.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should resolve nested imports", async () => { + it("should resolve nested imports", async (t) => { const testId = "./import-nested.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should work lessOptions.relativeUrls is true", async () => { + it("should work lessOptions.relativeUrls is true", async (t) => { const testId = "./import-relative.less"; const compiler = getCompiler(testId, { lessOptions: { @@ -181,13 +186,13 @@ describe("loader", () => { }, }); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should work lessOptions.relativeUrls is false", async () => { + it("should work lessOptions.relativeUrls is false", async (t) => { const testId = "./import-relative.less"; const compiler = getCompiler(testId, { lessOptions: { @@ -202,26 +207,26 @@ describe("loader", () => { }, }); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should resolve all imports from node_modules using webpack's resolver", async () => { + it("should resolve all imports from node_modules using webpack's resolver", async (t) => { const testId = "./import-webpack.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should resolve aliases in different variants", async () => { + it("should resolve aliases in different variants", async (t) => { const testId = "./import-webpack-aliases.less"; const compiler = getCompiler( testId, @@ -239,13 +244,13 @@ describe("loader", () => { const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should resolve all imports from the given paths using Less resolver", async () => { + it("should resolve all imports from the given paths using Less resolver", async (t) => { const testId = "./import-paths.less"; const compiler = getCompiler(testId, { lessOptions: { @@ -256,13 +261,13 @@ describe("loader", () => { const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should not to disable webpack's resolver by passing an empty paths array", async () => { + it("should not to disable webpack's resolver by passing an empty paths array", async (t) => { const testId = "./import-webpack-aliases.less"; const compiler = getCompiler( testId, @@ -284,13 +289,13 @@ describe("loader", () => { const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should prefer-relative imports correctly", async () => { + it("should prefer-relative imports correctly", async (t) => { const testId = "./import-prefer-relative.less"; const compiler = getCompiler( testId, @@ -307,71 +312,57 @@ describe("loader", () => { const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should not try to resolve CSS imports with URLs", async () => { + it("should not try to resolve CSS imports with URLs", async (t) => { const testId = "./import-url.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - // eslint-disable-next-line jest/no-commented-out-tests - // it('should delegate resolving (LESS) imports with URLs to "less" package', async () => { - // const testId = "./import-keyword-url.less"; - // const compiler = getCompiler(testId); - // const stats = await compile(compiler); - // const codeFromBundle = getCodeFromBundle(stats, compiler); - // const codeFromLess = await getCodeFromLess(testId); - // - // expect(codeFromBundle.css).toBe(codeFromLess.css); - // expect(codeFromBundle.css).toMatchSnapshot("css"); - // expect(getWarnings(stats)).toMatchSnapshot("warnings"); - // expect(getErrors(stats)).toMatchSnapshot("errors"); - // }); - - it("should allow to import non-less files", async () => { + it("should allow to import non-less files", async (t) => { const testId = "./import-non-less.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should provide a useful error message if the import could not be found", async () => { + it("should provide a useful error message if the import could not be found", async (t) => { const testId = "./error-import-not-existing.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should provide a useful error message if there was a syntax error", async () => { + it("should provide a useful error message if there was a syntax error", async (t) => { const testId = "./error-syntax.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should be able to import a file with an absolute path", async () => { + it("should be able to import a file with an absolute path", async (t) => { const importedFilePath = path.resolve( __dirname, "fixtures", @@ -389,12 +380,12 @@ describe("loader", () => { const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should add all resolved imports as dependencies", async () => { + it("should add all resolved imports as dependencies", async (t) => { const testId = "./import.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); @@ -409,13 +400,13 @@ describe("loader", () => { ]; for (const fixture of fixtures) { - expect(fileDependencies.has(fixture)).toBe(true); + assert.strictEqual(fileDependencies.has(fixture), true); } - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should add all resolved imports as dependencies, including aliased ones", async () => { + it("should add all resolved imports as dependencies, including aliased ones", async (t) => { const testId = "./import-webpack-alias.less"; const compiler = getCompiler( testId, @@ -445,13 +436,13 @@ describe("loader", () => { ]; for (const fixture of fixtures) { - expect(fileDependencies.has(fixture)).toBe(true); + assert.strictEqual(fileDependencies.has(fixture), true); } - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should add all resolved imports as dependencies, including those from the Less resolver", async () => { + it("should add all resolved imports as dependencies, including those from the Less resolver", async (t) => { const testId = "./import-dependency.less"; const compiler = getCompiler(testId, { lessOptions: { @@ -475,13 +466,13 @@ describe("loader", () => { ]; for (const fixture of fixtures) { - expect(fileDependencies.has(fixture)).toBe(true); + assert.strictEqual(fileDependencies.has(fixture), true); } - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should add a file with an error as dependency so that the watcher is triggered when the error is fixed", async () => { + it("should add a file with an error as dependency so that the watcher is triggered when the error is fixed", async (t) => { const testId = "./error-import-file-with-error.less"; const compiler = getCompiler(testId, { lessOptions: { @@ -499,13 +490,13 @@ describe("loader", () => { ]; for (const fixture of fixtures) { - expect(fileDependencies.has(fixture)).toBe(true); + assert.strictEqual(fileDependencies.has(fixture), true); } - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should add all resolved imports as dependencies, including node_modules", async () => { + it("should add all resolved imports as dependencies, including node_modules", async (t) => { const testId = "./import-webpack.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); @@ -525,13 +516,13 @@ describe("loader", () => { ]; for (const fixture of fixtures) { - expect(fileDependencies.has(fixture)).toBe(true); + assert.strictEqual(fileDependencies.has(fixture), true); } - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should watch imports correctly", async () => { + it("should watch imports correctly", async (t) => { const testId = "./watch.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); @@ -553,16 +544,16 @@ describe("loader", () => { ]; for (const fixture of fixtures) { - expect(fileDependencies.has(fixture)).toBe(true); + assert.strictEqual(fileDependencies.has(fixture), true); } - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should get absolute path relative rootContext", async () => { + it("should get absolute path relative rootContext", async (t) => { const testId = "./import-absolute-2.less"; const compiler = getCompiler( testId, @@ -576,12 +567,12 @@ describe("loader", () => { const codeFromBundle = getCodeFromBundle(stats, compiler); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should resolve unresolved url with alias", async () => { + it("should resolve unresolved url with alias", async (t) => { const testId = "./import-absolute-3.less"; const compiler = getCompiler( testId, @@ -602,13 +593,13 @@ describe("loader", () => { const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should resolve absolute path", async () => { + it("should resolve absolute path", async (t) => { // Create the file with absolute path const file = path.resolve(__dirname, "fixtures", "generated-1.less"); const absolutePath = path.resolve(__dirname, "fixtures", "basic.less"); @@ -621,13 +612,13 @@ describe("loader", () => { const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should resolve absolute path with alias", async () => { + it("should resolve absolute path with alias", async (t) => { // Create the file with absolute path const file = path.resolve(__dirname, "fixtures", "generated-2.less"); const absolutePath = path.resolve(__dirname, "fixtures", "unresolved.less"); @@ -648,12 +639,12 @@ describe("loader", () => { const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should resolve non-less import with alias", async () => { + it("should resolve non-less import with alias", async (t) => { const testId = "./import-non-less-2.less"; const compiler = getCompiler( testId, @@ -675,36 +666,13 @@ describe("loader", () => { const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - // eslint-disable-next-line jest/no-commented-out-tests - // it("should not add to dependencies imports with URLs", async () => { - // const testId = "./import-url-deps.less"; - // const compiler = getCompiler(testId); - // const stats = await compile(compiler); - // const codeFromBundle = getCodeFromBundle(stats, compiler); - // const codeFromLess = await getCodeFromLess(testId); - // const { fileDependencies } = stats.compilation; - // - // validateDependencies(fileDependencies); - // - // Array.from(fileDependencies).forEach((item) => { - // ["http", "https"].forEach((protocol) => { - // expect(item.includes(protocol)).toBe(false); - // }); - // }); - // - // expect(codeFromBundle.css).toBe(codeFromLess.css); - // expect(codeFromBundle.css).toMatchSnapshot("css"); - // expect(getWarnings(stats)).toMatchSnapshot("warnings"); - // expect(getErrors(stats)).toMatchSnapshot("errors"); - // }); - - it("should add path to dependencies", async () => { + it("should add path to dependencies", async (t) => { // Create the file with absolute path const file = path.resolve(__dirname, "fixtures", "generated-3.less"); const absolutePath = path.resolve(__dirname, "fixtures", "basic.less"); @@ -727,83 +695,85 @@ describe("loader", () => { } } - expect(isAddedToDependencies).toBe(true); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(isAddedToDependencies, true); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it('should resolve the "less" field from the "exports" field from "package.json"', async () => { + it('should resolve the "less" field from the "exports" field from "package.json"', async (t) => { const testId = "./import-package-with-exports.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it('should resolve "@import" without "less" extension', async () => { + it('should resolve "@import" without "less" extension', async (t) => { const testId = "./import-without-extension.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it('should resolve "@import" with "less" extension', async () => { + it('should resolve "@import" with "less" extension', async (t) => { const testId = "./import-without-extension.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it('should resolve "@import" with "css" extension', async () => { + it('should resolve "@import" with "css" extension', async (t) => { const testId = "./import-with-css-extension.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it('should resolve "@import" with "php" extension', async () => { + it('should resolve "@import" with "php" extension', async (t) => { const testId = "./import-with-php-extension.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should work and have loaderContext in less plugins", async () => { + it("should work and have loaderContext in less plugins", async (t) => { let contextInClass = false; let contextInObject = false; - class Plugin extends require("less").FileManager { - constructor(less, pluginManager) { + const less = require("less"); + + class Plugin extends less.FileManager { + constructor(lessInstance, pluginManager) { super(); if (typeof pluginManager.webpackLoaderContext !== "undefined") { @@ -813,13 +783,13 @@ describe("loader", () => { } class CustomClassPlugin { - install(less, pluginManager) { - pluginManager.addFileManager(new Plugin(less, pluginManager)); + install(lessInstance, pluginManager) { + pluginManager.addFileManager(new Plugin(lessInstance, pluginManager)); } } const customObjectPlugin = { - install(less, packageManager) { + install(lessInstance, packageManager) { if (typeof packageManager.webpackLoaderContext !== "undefined") { contextInObject = true; } @@ -835,40 +805,40 @@ describe("loader", () => { const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); - expect(contextInClass).toBe(true); - expect(contextInObject).toBe(true); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(contextInClass, true); + assert.strictEqual(contextInObject, true); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should resolve nested package", async () => { + it("should resolve nested package", async (t) => { const testId = "./node_modules/less-package-2/index.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should resolve nested package #2", async () => { + it("should resolve nested package #2", async (t) => { const testId = "./less-package.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should resolve in working directory", async () => { + it("should resolve in working directory", async (t) => { const oldCwd = process.cwd(); process.chdir(path.resolve(__dirname, "fixtures")); @@ -879,15 +849,15 @@ describe("loader", () => { const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); process.chdir(oldCwd); }); - it("should work and respect the 'resolve.byDependency.less' option", async () => { + it("should work and respect the 'resolve.byDependency.less' option", async (t) => { const testId = "./by-dependency.less"; const compiler = getCompiler( testId, @@ -906,13 +876,13 @@ describe("loader", () => { const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should import from glob expressions", async () => { + it("should import from glob expressions", async (t) => { const testId = "./glob.less"; const compiler = getCompiler(testId, { lessOptions: { @@ -927,22 +897,22 @@ describe("loader", () => { }, }); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should emit an error", async () => { + it("should emit an error", async (t) => { const testId = "./error.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should work and logging", async () => { + it("should work and logging", async (t) => { const testId = "./logging.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); @@ -961,14 +931,14 @@ describe("loader", () => { } } - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(logs).toMatchSnapshot("logs"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(logs); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it('should work with a package with "sass" and "exports" fields and a custom condition (theme1)', async () => { + it('should work with a package with "sass" and "exports" fields and a custom condition (theme1)', async (t) => { const testId = "./import-package-with-exports-and-custom-condition.less"; const compiler = getCompiler( testId, @@ -989,13 +959,13 @@ describe("loader", () => { }, ); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it('should work with a package with "sass" and "exports" fields and a custom condition (theme2)', async () => { + it('should work with a package with "sass" and "exports" fields and a custom condition (theme2)', async (t) => { const testId = "./import-package-with-exports-and-custom-condition.less"; const compiler = getCompiler( testId, @@ -1016,22 +986,22 @@ describe("loader", () => { }, ); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should throw an error", async () => { + it("should throw an error", async (t) => { const testId = "./broken.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should emit less warning as webpack warning", async () => { + it("should emit less warning as webpack warning", async (t) => { const testId = "./warn.less"; const compiler = getCompiler(testId, { lessLogAsWarnOrErr: true, @@ -1039,8 +1009,8 @@ describe("loader", () => { const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); }); diff --git a/test/package.json b/test/package.json new file mode 100644 index 00000000..b6b5f2a7 --- /dev/null +++ b/test/package.json @@ -0,0 +1,6 @@ +{ + "type": "module", + "engines": { + "node": ">= 22.11.0" + } +} diff --git a/test/setup-snapshots.js b/test/setup-snapshots.js new file mode 100644 index 00000000..44a0b5a1 --- /dev/null +++ b/test/setup-snapshots.js @@ -0,0 +1,9 @@ +import path from "node:path"; +import { snapshot } from "node:test"; + +snapshot.setResolveSnapshotPath((testFilePath) => { + const dir = path.dirname(testFilePath); + const file = path.basename(testFilePath); + + return path.join(dir, "__snapshots__", `${file}.snap`); +}); diff --git a/test/sourceMap-options.test.js b/test/sourceMap-options.test.js index 097b96ad..f2bab54f 100644 --- a/test/sourceMap-options.test.js +++ b/test/sourceMap-options.test.js @@ -1,5 +1,8 @@ +import assert from "node:assert"; import fs from "node:fs"; import path from "node:path"; +import { describe, it } from "node:test"; +import { fileURLToPath } from "node:url"; import { compile, @@ -8,10 +11,12 @@ import { getCompiler, getErrors, getWarnings, -} from "./helpers"; +} from "./helpers/index.js"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); describe('"sourceMap" options', () => { - it('should generate source maps when value is "true"', async () => { + it('should generate source maps when value is "true"', async (t) => { const testId = "./source-map.less"; const compiler = getCompiler(testId, { sourceMap: true, @@ -23,23 +28,26 @@ describe('"sourceMap" options', () => { map.sourceRoot = ""; map.sources = map.sources.map((source) => { - expect(path.isAbsolute(source)).toBe(true); - expect(source).toBe(path.normalize(source)); - expect(fs.existsSync(path.resolve(map.sourceRoot, source))).toBe(true); + assert.strictEqual(path.isAbsolute(source), true); + assert.strictEqual(source, path.normalize(source)); + assert.strictEqual( + fs.existsSync(path.resolve(map.sourceRoot, source)), + true, + ); return path .relative(path.resolve(__dirname, ".."), source) .replaceAll("\\", "/"); }); - expect(css).toBe(codeFromLess.css); - expect(css).toMatchSnapshot("css"); - expect(map).toMatchSnapshot("source map"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(css, codeFromLess.css); + t.assert.snapshot(css); + t.assert.snapshot(map); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it('should generate source maps when the "devtool" value is "source-map"', async () => { + it('should generate source maps when the "devtool" value is "source-map"', async (t) => { const testId = "./source-map.less"; const compiler = getCompiler( testId, @@ -55,23 +63,26 @@ describe('"sourceMap" options', () => { map.sourceRoot = ""; map.sources = map.sources.map((source) => { - expect(path.isAbsolute(source)).toBe(true); - expect(source).toBe(path.normalize(source)); - expect(fs.existsSync(path.resolve(map.sourceRoot, source))).toBe(true); + assert.strictEqual(path.isAbsolute(source), true); + assert.strictEqual(source, path.normalize(source)); + assert.strictEqual( + fs.existsSync(path.resolve(map.sourceRoot, source)), + true, + ); return path .relative(path.resolve(__dirname, ".."), source) .replaceAll("\\", "/"); }); - expect(css).toBe(codeFromLess.css); - expect(css).toMatchSnapshot("css"); - expect(map).toMatchSnapshot("source map"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(css, codeFromLess.css); + t.assert.snapshot(css); + t.assert.snapshot(map); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it('should generate source maps when value is "true" and the "devtool" value is "false"', async () => { + it('should generate source maps when value is "true" and the "devtool" value is "false"', async (t) => { const testId = "./source-map.less"; const compiler = getCompiler( testId, @@ -89,23 +100,26 @@ describe('"sourceMap" options', () => { map.sourceRoot = ""; map.sources = map.sources.map((source) => { - expect(path.isAbsolute(source)).toBe(true); - expect(source).toBe(path.normalize(source)); - expect(fs.existsSync(path.resolve(map.sourceRoot, source))).toBe(true); + assert.strictEqual(path.isAbsolute(source), true); + assert.strictEqual(source, path.normalize(source)); + assert.strictEqual( + fs.existsSync(path.resolve(map.sourceRoot, source)), + true, + ); return path .relative(path.resolve(__dirname, ".."), source) .replaceAll("\\", "/"); }); - expect(css).toBe(codeFromLess.css); - expect(css).toMatchSnapshot("css"); - expect(map).toMatchSnapshot("source map"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(css, codeFromLess.css); + t.assert.snapshot(css); + t.assert.snapshot(map); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it('should generate source maps when value has "false" value, but the "lessOptions.sourceMap.outputSourceFiles" is "true"', async () => { + it('should generate source maps when value has "false" value, but the "lessOptions.sourceMap.outputSourceFiles" is "true"', async (t) => { const testId = "./source-map.less"; const compiler = getCompiler(testId, { sourceMap: false, @@ -122,13 +136,13 @@ describe('"sourceMap" options', () => { path.normalize(source).replaceAll("\\", "/"), ); - expect(css).toMatchSnapshot("css"); - expect(map).toMatchSnapshot("source map"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + t.assert.snapshot(css); + t.assert.snapshot(map); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it('should not generate source maps when value is "false"', async () => { + it('should not generate source maps when value is "false"', async (t) => { const testId = "./source-map.less"; const compiler = getCompiler(testId, { sourceMap: false, @@ -138,14 +152,14 @@ describe('"sourceMap" options', () => { const codeFromLess = await getCodeFromLess(testId); const { css, map } = codeFromBundle; - expect(css).toBe(codeFromLess.css); - expect(css).toMatchSnapshot("css"); - expect(map).toBeUndefined(); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(css, codeFromLess.css); + t.assert.snapshot(css); + assert.strictEqual(map, undefined); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it('should not generate source maps when the "devtool" value is "false"', async () => { + it('should not generate source maps when the "devtool" value is "false"', async (t) => { const testId = "./source-map.less"; const compiler = getCompiler( testId, @@ -159,14 +173,14 @@ describe('"sourceMap" options', () => { const codeFromLess = await getCodeFromLess(testId); const { css, map } = codeFromBundle; - expect(css).toBe(codeFromLess.css); - expect(css).toMatchSnapshot("css"); - expect(map).toBeUndefined(); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(css, codeFromLess.css); + t.assert.snapshot(css); + assert.strictEqual(map, undefined); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it('should not generate source maps when value is "false" and the "devtool" value is "source-map"', async () => { + it('should not generate source maps when value is "false" and the "devtool" value is "source-map"', async (t) => { const testId = "./source-map.less"; const compiler = getCompiler( testId, @@ -182,14 +196,14 @@ describe('"sourceMap" options', () => { const codeFromLess = await getCodeFromLess(testId); const { css, map } = codeFromBundle; - expect(css).toBe(codeFromLess.css); - expect(css).toMatchSnapshot("css"); - expect(map).toBeUndefined(); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(css, codeFromLess.css); + t.assert.snapshot(css); + assert.strictEqual(map, undefined); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it("should work and generate custom source maps", async () => { + it("should work and generate custom source maps", async (t) => { const testId = "./source-map.less"; const lessOptions = { sourceMap: { @@ -206,10 +220,10 @@ describe('"sourceMap" options', () => { const codeFromLess = await getCodeFromLess(testId, options); const { css, map } = codeFromBundle; - expect(css).toBe(codeFromLess.css); - expect(css).toMatchSnapshot("css"); - expect(map).toMatchSnapshot("source map"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(css, codeFromLess.css); + t.assert.snapshot(css); + t.assert.snapshot(map); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); }); diff --git a/test/validate-options.test.js b/test/validate-options.test.js index 80311bd1..6218e0dd 100644 --- a/test/validate-options.test.js +++ b/test/validate-options.test.js @@ -1,4 +1,10 @@ -import { compile, getCompiler } from "./helpers/index"; +import assert from "node:assert"; +import { createRequire } from "node:module"; +import { describe, it } from "node:test"; + +import { compile, getCompiler } from "./helpers/index.js"; + +const require = createRequire(import.meta.url); describe("validate options", () => { const tests = { @@ -48,10 +54,10 @@ describe("validate options", () => { return value; } - async function createTestCase(key, value, type) { + function createTestCase(key, value, type) { it(`should ${ type === "success" ? "successfully validate" : "throw an error on" - } the "${key}" option with "${stringifyValue(value)}" value`, async () => { + } the "${key}" option with "${stringifyValue(value)}" value`, async (t) => { const compiler = getCompiler("./basic.less", { [key]: value, }); @@ -61,16 +67,14 @@ describe("validate options", () => { stats = await compile(compiler); } finally { if (type === "success") { - expect(stats.hasErrors()).toBe(false); + assert.strictEqual(stats.hasErrors(), false); } else if (type === "failure") { const { compilation: { errors }, } = stats; - expect(errors).toHaveLength(1); - expect(() => { - throw new Error(errors[0].error.message); - }).toThrowErrorMatchingSnapshot(); + assert.strictEqual(errors.length, 1); + t.assert.snapshot(errors[0].error.message); } } }); diff --git a/test/webpackImporter-options.test.js b/test/webpackImporter-options.test.js index b090a546..95a8fe6b 100644 --- a/test/webpackImporter-options.test.js +++ b/test/webpackImporter-options.test.js @@ -1,3 +1,6 @@ +import assert from "node:assert"; +import { describe, it } from "node:test"; + import { compile, getCodeFromBundle, @@ -5,23 +8,23 @@ import { getCompiler, getErrors, getWarnings, -} from "./helpers"; +} from "./helpers/index.js"; describe('"webpackImporter" option', () => { - it("should work when value is not specify", async () => { + it("should work when value is not specify", async (t) => { const testId = "./import-webpack.less"; const compiler = getCompiler(testId); const stats = await compile(compiler); const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it('should work when value is "true"', async () => { + it('should work when value is "true"', async (t) => { const testId = "./import-webpack.less"; const compiler = getCompiler(testId, { webpackImporter: true, @@ -30,13 +33,13 @@ describe('"webpackImporter" option', () => { const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it('should work when value is "only"', async () => { + it('should work when value is "only"', async (t) => { const testId = "./import-webpack.less"; const compiler = getCompiler(testId, { webpackImporter: "only", @@ -45,13 +48,13 @@ describe('"webpackImporter" option', () => { const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it('should work when value is "false"', async () => { + it('should work when value is "false"', async (t) => { const testId = "./import.less"; const compiler = getCompiler(testId, { webpackImporter: false, @@ -60,20 +63,20 @@ describe('"webpackImporter" option', () => { const codeFromBundle = getCodeFromBundle(stats, compiler); const codeFromLess = await getCodeFromLess(testId); - expect(codeFromBundle.css).toBe(codeFromLess.css); - expect(codeFromBundle.css).toMatchSnapshot("css"); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + assert.strictEqual(codeFromBundle.css, codeFromLess.css); + t.assert.snapshot(codeFromBundle.css); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); - it('should throw an error on webpack import when value is "false"', async () => { + it('should throw an error on webpack import when value is "false"', async (t) => { const testId = "./import-webpack.less"; const compiler = getCompiler(testId, { webpackImporter: false, }); const stats = await compile(compiler); - expect(getWarnings(stats)).toMatchSnapshot("warnings"); - expect(getErrors(stats)).toMatchSnapshot("errors"); + t.assert.snapshot(getWarnings(stats)); + t.assert.snapshot(getErrors(stats)); }); });