From 4c6f90b276e01408d9f1b79f4246bcfebcd11f38 Mon Sep 17 00:00:00 2001 From: "alexander.akait" Date: Wed, 24 Jan 2024 16:16:30 +0300 Subject: [PATCH 1/4] fix: set `unmanagedPaths` in defaults --- lib/config/defaults.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/config/defaults.js b/lib/config/defaults.js index 6ad22ad0a..2b8292e52 100644 --- a/lib/config/defaults.js +++ b/lib/config/defaults.js @@ -472,6 +472,7 @@ const applySnapshotDefaults = (snapshot, { production, futureDefaults }) => { } return []; }); + F(snapshot, "unmanagedPaths", () => []); A(snapshot, "immutablePaths", () => { if (process.versions.pnp === "1") { const match = From 16d68e73d18dda8a0a637ed40e0ccb576a077fbd Mon Sep 17 00:00:00 2001 From: "alexander.akait" Date: Wed, 24 Jan 2024 16:22:41 +0300 Subject: [PATCH 2/4] chore: refactor jest configuration --- jest.config.js | 54 +++++++++ package.json | 57 +-------- test/Defaults.unittest.js | 247 +++++++++++++++++++------------------- yarn.lock | 10 +- 4 files changed, 186 insertions(+), 182 deletions(-) create mode 100644 jest.config.js diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 000000000..2cc6d151b --- /dev/null +++ b/jest.config.js @@ -0,0 +1,54 @@ +/** @type {import('jest').Config} */ +const config = { + prettierPath: require.resolve("prettier-2"), + forceExit: true, + setupFilesAfterEnv: ["/test/setupTestFramework.js"], + testMatch: [ + "/test/*.test.js", + "/test/*.basictest.js", + "/test/*.longtest.js", + "/test/*.unittest.js" + ], + watchPathIgnorePatterns: [ + "/.git", + "/node_modules", + "/test/js", + "/test/browsertest/js", + "/test/fixtures/temp-cache-fixture", + "/test/fixtures/temp-", + "/benchmark", + "/assembly", + "/tooling", + "/examples/*/dist", + "/coverage", + "/.eslintcache" + ], + modulePathIgnorePatterns: [ + "/.git", + "/node_modules/webpack/node_modules", + "/test/js", + "/test/browsertest/js", + "/test/fixtures/temp-cache-fixture", + "/test/fixtures/temp-", + "/benchmark", + "/examples/*/dist", + "/coverage", + "/.eslintcache" + ], + transformIgnorePatterns: [""], + coverageDirectory: "/coverage", + coveragePathIgnorePatterns: [ + "\\.runtime\\.js$", + "/test", + "/schemas", + "/node_modules" + ], + testEnvironment: "./test/patch-node-env.js", + coverageReporters: ["json"], + snapshotFormat: { + escapeString: true, + printBasicPrototype: true + } +}; + +module.exports = config; diff --git a/package.json b/package.json index b26628f3d..91d8cceb9 100644 --- a/package.json +++ b/package.json @@ -85,6 +85,7 @@ "nyc": "^15.1.0", "open-cli": "^7.2.0", "prettier": "^3.2.1", + "prettier-2": "npm:prettier@^2", "pretty-format": "^29.5.0", "pug": "^3.0.0", "pug-loader": "^2.4.0", @@ -186,61 +187,5 @@ "*.md|{.github,benchmark,bin,examples,hot,lib,schemas,setup,tooling}/**/*.{md,yml,yaml,js,json}": [ "cspell" ] - }, - "jest": { - "forceExit": true, - "setupFilesAfterEnv": [ - "/test/setupTestFramework.js" - ], - "testMatch": [ - "/test/*.test.js", - "/test/*.basictest.js", - "/test/*.longtest.js", - "/test/*.unittest.js" - ], - "watchPathIgnorePatterns": [ - "/.git", - "/node_modules", - "/test/js", - "/test/browsertest/js", - "/test/fixtures/temp-cache-fixture", - "/test/fixtures/temp-", - "/benchmark", - "/assembly", - "/tooling", - "/examples/*/dist", - "/coverage", - "/.eslintcache" - ], - "modulePathIgnorePatterns": [ - "/.git", - "/node_modules/webpack/node_modules", - "/test/js", - "/test/browsertest/js", - "/test/fixtures/temp-cache-fixture", - "/test/fixtures/temp-", - "/benchmark", - "/examples/*/dist", - "/coverage", - "/.eslintcache" - ], - "transformIgnorePatterns": [ - "" - ], - "coverageDirectory": "/coverage", - "coveragePathIgnorePatterns": [ - "\\.runtime\\.js$", - "/test", - "/schemas", - "/node_modules" - ], - "testEnvironment": "./test/patch-node-env.js", - "coverageReporters": [ - "json" - ], - "snapshotFormat": { - "escapeString": true, - "printBasicPrototype": true - } } } diff --git a/test/Defaults.unittest.js b/test/Defaults.unittest.js index ca6becb24..ab5922345 100644 --- a/test/Defaults.unittest.js +++ b/test/Defaults.unittest.js @@ -642,6 +642,7 @@ describe("snapshots", () => { "hash": true, "timestamp": true, }, + "unmanagedPaths": Array [], }, "stats": Object {}, "target": "web", @@ -2197,125 +2198,127 @@ describe("snapshots", () => { }, e => e.toMatchInlineSnapshot(` -- Expected -+ Received + - Expected + + Received -@@ ... @@ -- "asyncWebAssembly": false, -- "backCompat": true, -+ "asyncWebAssembly": true, -+ "backCompat": false, -@@ ... @@ -- "cacheUnaffected": false, -- "css": undefined, -- "futureDefaults": false, -+ "cacheUnaffected": true, -+ "css": true, -+ "futureDefaults": true, -@@ ... @@ -+ }, -+ Object { -+ "rules": Array [ -+ Object { -+ "descriptionData": Object { -+ "type": "module", -+ }, -+ "resolve": Object { -+ "fullySpecified": true, -+ }, -+ }, -+ ], -+ "test": /\\.wasm$/i, -+ "type": "webassembly/async", -+ }, -+ Object { -+ "mimetype": "application/wasm", -+ "rules": Array [ -+ Object { -+ "descriptionData": Object { -+ "type": "module", -+ }, -+ "resolve": Object { -+ "fullySpecified": true, -+ }, -+ }, -+ ], -+ "type": "webassembly/async", -+ }, -+ Object { -+ "resolve": Object { -+ "fullySpecified": true, -+ "preferRelative": true, -@@ ... @@ -+ "test": /\\.css$/i, -+ "type": "css/auto", -+ }, -@@ ... @@ -+ "mimetype": "text/css+module", -+ "resolve": Object { -+ "fullySpecified": true, -+ "preferRelative": true, -+ }, -+ "type": "css/module", -+ }, -+ Object { -+ "mimetype": "text/css", -+ "resolve": Object { -+ "fullySpecified": true, -+ "preferRelative": true, -+ }, -+ "type": "css", -+ }, -+ Object { -@@ ... @@ -- "generator": Object {}, -+ "generator": Object { -+ "css": Object { -+ "exportsOnly": false, -+ }, -+ }, -@@ ... @@ -+ }, -+ "css": Object { -+ "namedExports": true, -@@ ... @@ -+ "exportsPresence": "error", -@@ ... @@ -- "__dirname": "mock", -- "__filename": "mock", -- "global": true, -+ "__dirname": "warn-mock", -+ "__filename": "warn-mock", -+ "global": "warn", -@@ ... @@ -+ "css", -@@ ... @@ -- "hashDigestLength": 20, -- "hashFunction": "md4", -+ "hashDigestLength": 16, -+ "hashFunction": "xxhash64", -@@ ... @@ -+ "...", -+ ], -+ }, -+ "css-import": Object { -+ "conditionNames": Array [ -+ "webpack", -+ "production", -+ "style", -+ ], -+ "extensions": Array [ -+ ".css", -+ ], -+ "mainFields": Array [ -+ "style", -@@ ... @@ -+ "mainFiles": Array [], -+ "preferRelative": true, -@@ ... @@ -- "/node_modules/", -+ /^(.+?[\\\\/]node_modules[\\\\/])/, -`) + @@ ... @@ + - "asyncWebAssembly": false, + - "backCompat": true, + + "asyncWebAssembly": true, + + "backCompat": false, + @@ ... @@ + - "cacheUnaffected": false, + - "css": undefined, + - "futureDefaults": false, + + "cacheUnaffected": true, + + "css": true, + + "futureDefaults": true, + @@ ... @@ + + }, + + Object { + + "rules": Array [ + + Object { + + "descriptionData": Object { + + "type": "module", + + }, + + "resolve": Object { + + "fullySpecified": true, + + }, + + }, + + ], + + "test": /\\.wasm$/i, + + "type": "webassembly/async", + + }, + + Object { + + "mimetype": "application/wasm", + + "rules": Array [ + + Object { + + "descriptionData": Object { + + "type": "module", + + }, + + "resolve": Object { + + "fullySpecified": true, + + }, + + }, + + ], + + "type": "webassembly/async", + + }, + + Object { + + "resolve": Object { + + "fullySpecified": true, + + "preferRelative": true, + + }, + + "test": /\\.css$/i, + + "type": "css/auto", + + }, + + Object { + + "mimetype": "text/css+module", + + "resolve": Object { + + "fullySpecified": true, + + "preferRelative": true, + @@ ... @@ + + "type": "css/module", + + }, + + Object { + + "mimetype": "text/css", + + "resolve": Object { + + "fullySpecified": true, + + "preferRelative": true, + + }, + + "type": "css", + + }, + @@ ... @@ + - "generator": Object {}, + + "generator": Object { + + "css": Object { + + "exportsOnly": false, + + }, + + }, + @@ ... @@ + + }, + @@ ... @@ + + "css": Object { + + "namedExports": true, + @@ ... @@ + + "exportsPresence": "error", + @@ ... @@ + - "__dirname": "mock", + - "__filename": "mock", + - "global": true, + + "__dirname": "warn-mock", + + "__filename": "warn-mock", + + "global": "warn", + @@ ... @@ + + "css", + @@ ... @@ + - "hashDigestLength": 20, + - "hashFunction": "md4", + + "hashDigestLength": 16, + + "hashFunction": "xxhash64", + @@ ... @@ + + "...", + + ], + + }, + + "css-import": Object { + + "conditionNames": Array [ + + "webpack", + + "production", + + "style", + + ], + + "extensions": Array [ + + ".css", + + ], + + "mainFields": Array [ + + "style", + @@ ... @@ + + "mainFiles": Array [], + + "preferRelative": true, + @@ ... @@ + - "/node_modules/", + + /^(.+?[\\\\/]node_modules[\\\\/])/, + @@ ... @@ + - "unmanagedPaths": Array [], + `) ); test( @@ -2344,9 +2347,10 @@ describe("snapshots", () => { + "css": false, + "futureDefaults": true, @@ ... @@ + + }, + Object { + "rules": Array [ - @@ ... @@ + + Object { + "descriptionData": Object { + "type": "module", + }, @@ -2367,12 +2371,11 @@ describe("snapshots", () => { + }, + "resolve": Object { + "fullySpecified": true, - + }, + @@ ... @@ + }, + ], + "type": "webassembly/async", + }, - + Object { @@ ... @@ + "exportsPresence": "error", @@ ... @@ @@ -2390,6 +2393,8 @@ describe("snapshots", () => { @@ ... @@ - "/node_modules/", + /^(.+?[\\\\/]node_modules[\\\\/])/, + @@ ... @@ + - "unmanagedPaths": Array [], `) ); }); diff --git a/yarn.lock b/yarn.lock index 19ffc9239..e6fdf3d19 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5131,6 +5131,11 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w== +"prettier-2@npm:prettier@^2", prettier@^2.0.5: + version "2.8.8" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" + integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== + prettier-linter-helpers@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" @@ -5138,11 +5143,6 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@^2.0.5: - version "2.8.8" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" - integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== - prettier@^3.2.1: version "3.2.3" resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.3.tgz#98501d99141a9a10d5ceaf74cf39c8b7cbddd380" From 75d9094922fdac7d2c68c3c444e7cb9876625a07 Mon Sep 17 00:00:00 2001 From: "alexander.akait" Date: Fri, 26 Jan 2024 15:59:08 +0300 Subject: [PATCH 3/4] chore: fix lint command --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 91d8cceb9..ad98ce4d1 100644 --- a/package.json +++ b/package.json @@ -84,8 +84,8 @@ "mini-svg-data-uri": "^1.2.3", "nyc": "^15.1.0", "open-cli": "^7.2.0", - "prettier": "^3.2.1", "prettier-2": "npm:prettier@^2", + "prettier": "^3.2.1", "pretty-format": "^29.5.0", "pug": "^3.0.0", "pug-loader": "^2.4.0", @@ -159,7 +159,7 @@ "special-lint-fix": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-schemas --write && node tooling/generate-runtime-code.js --write && node tooling/generate-wasm-code.js --write && node node_modules/tooling/format-file-header --write && node node_modules/tooling/compile-to-definitions --write && node node_modules/tooling/precompile-schemas --write && node node_modules/tooling/generate-types --no-template-literals --write", "fix": "yarn code-lint --fix && yarn special-lint-fix && yarn pretty-lint-fix", "prepare": "husky install", - "pretty-lint-base": "prettier --cache .", + "pretty-lint-base": "node node_modules/prettier/bin/prettier.cjs --cache .", "pretty-lint-fix": "yarn pretty-lint-base --loglevel warn --write", "pretty-lint": "yarn pretty-lint-base --check", "yarn-lint": "yarn-deduplicate --fail --list -s highest yarn.lock", From 0815696084951875592f0a49a8fc73c137864581 Mon Sep 17 00:00:00 2001 From: "alexander.akait" Date: Fri, 26 Jan 2024 16:17:11 +0300 Subject: [PATCH 4/4] chore: fix cspell --- cspell.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cspell.json b/cspell.json index 180091c67..f93f32eb5 100644 --- a/cspell.json +++ b/cspell.json @@ -27,6 +27,7 @@ "browserified", "browserslist", "browserslistrc", + "browsertest", "Brumme", "bugfix", "bugfixes", @@ -129,6 +130,7 @@ "loadername", "loglevel", "longnameforexport", + "longtest", "mangleable", "MCEP", "mebibytes",