From 6eb4a65711f5fe22ab171ad02977f8d4765be56c Mon Sep 17 00:00:00 2001 From: GiveMe-A-Name Date: Wed, 4 Dec 2024 14:14:22 +0800 Subject: [PATCH 1/2] test: create issues for failed webpack test - remove test.filter.js for passed webpack test - create issues for failed webpack test --- .../configCases/clean/ignore-fn/test.filter.js | 3 +-- .../configCases/clean/ignore-hook/test.filter.js | 3 +-- .../configCases/clean/ignore-rx/test.filter.js | 3 +-- .../code-generation/require-context-id/test.filter.js | 3 ++- .../configCases/code-generation/use-strict/index.js | 11 +++++++++-- .../code-generation/use-strict/test.filter.js | 2 -- .../split-chunk-entry-module/test.filter.js | 2 -- .../split-chunk-entry-module/webpack.config.js | 2 +- .../configCases/contenthash/assets/test.filter.js | 3 +-- .../configCases/contenthash/assets/webpack.config.js | 4 +--- .../contenthash/include-chunk-id/test.filter.js | 3 +-- .../context-exclusion/simple/test.filter.js | 3 ++- .../context-replacement/c/node_modules/d.js | 1 + .../configCases/context-replacement/c/test.filter.js | 2 -- .../configCases/context-replacement/d/test.filter.js | 2 +- 15 files changed, 22 insertions(+), 25 deletions(-) delete mode 100644 tests/webpack-test/configCases/code-generation/use-strict/test.filter.js delete mode 100644 tests/webpack-test/configCases/concatenate-modules/split-chunk-entry-module/test.filter.js create mode 100644 tests/webpack-test/configCases/context-replacement/c/node_modules/d.js delete mode 100644 tests/webpack-test/configCases/context-replacement/c/test.filter.js diff --git a/tests/webpack-test/configCases/clean/ignore-fn/test.filter.js b/tests/webpack-test/configCases/clean/ignore-fn/test.filter.js index 042493e42a5..892c43e975f 100644 --- a/tests/webpack-test/configCases/clean/ignore-fn/test.filter.js +++ b/tests/webpack-test/configCases/clean/ignore-fn/test.filter.js @@ -1,2 +1 @@ -// TODO: Should create a issue for this test -module.exports = () => { return false } +module.exports = () => { return 'https://github.com/web-infra-dev/rspack/issues/7822' } diff --git a/tests/webpack-test/configCases/clean/ignore-hook/test.filter.js b/tests/webpack-test/configCases/clean/ignore-hook/test.filter.js index 042493e42a5..d2a68859d83 100644 --- a/tests/webpack-test/configCases/clean/ignore-hook/test.filter.js +++ b/tests/webpack-test/configCases/clean/ignore-hook/test.filter.js @@ -1,2 +1 @@ -// TODO: Should create a issue for this test -module.exports = () => { return false } +module.exports = () => { return 'https://github.com/web-infra-dev/rspack/issues/8603' } diff --git a/tests/webpack-test/configCases/clean/ignore-rx/test.filter.js b/tests/webpack-test/configCases/clean/ignore-rx/test.filter.js index 042493e42a5..892c43e975f 100644 --- a/tests/webpack-test/configCases/clean/ignore-rx/test.filter.js +++ b/tests/webpack-test/configCases/clean/ignore-rx/test.filter.js @@ -1,2 +1 @@ -// TODO: Should create a issue for this test -module.exports = () => { return false } +module.exports = () => { return 'https://github.com/web-infra-dev/rspack/issues/7822' } diff --git a/tests/webpack-test/configCases/code-generation/require-context-id/test.filter.js b/tests/webpack-test/configCases/code-generation/require-context-id/test.filter.js index 042493e42a5..a005dfd5641 100644 --- a/tests/webpack-test/configCases/code-generation/require-context-id/test.filter.js +++ b/tests/webpack-test/configCases/code-generation/require-context-id/test.filter.js @@ -1,2 +1,3 @@ -// TODO: Should create a issue for this test +// `optimization.moduleIds = "hashed"` is deprecated in webpack. +// So we do not have to implement in Rspack. module.exports = () => { return false } diff --git a/tests/webpack-test/configCases/code-generation/use-strict/index.js b/tests/webpack-test/configCases/code-generation/use-strict/index.js index f5d77f70844..86aac3ddab3 100644 --- a/tests/webpack-test/configCases/code-generation/use-strict/index.js +++ b/tests/webpack-test/configCases/code-generation/use-strict/index.js @@ -1,5 +1,5 @@ "use strict"; -it("should include only one use strict per module", function() { +it("should include only one use strict per module", function () { require("./harmony-with-strict"); require("./harmony-without-strict"); require("./harmony-with-strict2"); @@ -17,5 +17,12 @@ it("should include only one use strict per module", function() { matches.sort(); - expect(matches).toEqual(["/******/ var __webpack_modules__ = ({"]); + // expect(matches).toEqual(["/******/ var __webpack_modules__ = ({"]); + // In Rspack, the output is: `var __webpack_modules__ = ({` + // In webpack, the output is: `/******/ var __webpack_modules__ = ({` + // + // It is only output format difference between Rspack and webpack. + + expect(matches).toEqual(["var __webpack_modules__ = ({"]); + }); diff --git a/tests/webpack-test/configCases/code-generation/use-strict/test.filter.js b/tests/webpack-test/configCases/code-generation/use-strict/test.filter.js deleted file mode 100644 index 042493e42a5..00000000000 --- a/tests/webpack-test/configCases/code-generation/use-strict/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// TODO: Should create a issue for this test -module.exports = () => { return false } diff --git a/tests/webpack-test/configCases/concatenate-modules/split-chunk-entry-module/test.filter.js b/tests/webpack-test/configCases/concatenate-modules/split-chunk-entry-module/test.filter.js deleted file mode 100644 index 042493e42a5..00000000000 --- a/tests/webpack-test/configCases/concatenate-modules/split-chunk-entry-module/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// TODO: Should create a issue for this test -module.exports = () => { return false } diff --git a/tests/webpack-test/configCases/concatenate-modules/split-chunk-entry-module/webpack.config.js b/tests/webpack-test/configCases/concatenate-modules/split-chunk-entry-module/webpack.config.js index 04a1514b501..20928b1300f 100644 --- a/tests/webpack-test/configCases/concatenate-modules/split-chunk-entry-module/webpack.config.js +++ b/tests/webpack-test/configCases/concatenate-modules/split-chunk-entry-module/webpack.config.js @@ -20,5 +20,5 @@ module.exports = { } } } - } + }, }; diff --git a/tests/webpack-test/configCases/contenthash/assets/test.filter.js b/tests/webpack-test/configCases/contenthash/assets/test.filter.js index d0539b037dd..609df5e487f 100644 --- a/tests/webpack-test/configCases/contenthash/assets/test.filter.js +++ b/tests/webpack-test/configCases/contenthash/assets/test.filter.js @@ -1,3 +1,2 @@ // blocked by https://github.com/web-infra-dev/rspack/issues/3465 -// TODO: Should create a issue for this test -module.exports = () => { return false } +module.exports = () => { return 'https://github.com/web-infra-dev/rspack/issues/8604' } diff --git a/tests/webpack-test/configCases/contenthash/assets/webpack.config.js b/tests/webpack-test/configCases/contenthash/assets/webpack.config.js index 6c6240dacea..c791b2b99b8 100644 --- a/tests/webpack-test/configCases/contenthash/assets/webpack.config.js +++ b/tests/webpack-test/configCases/contenthash/assets/webpack.config.js @@ -109,9 +109,7 @@ module.exports = [ type: "asset/resource", generator: { // should result in same hash as bundle2 - // TODO: function type is not supported for now - // publicPath: () => "/public/" - publicPath: "/public/" + publicPath: () => "/public/" } } ] diff --git a/tests/webpack-test/configCases/contenthash/include-chunk-id/test.filter.js b/tests/webpack-test/configCases/contenthash/include-chunk-id/test.filter.js index 4f680a31cb8..2a9dadde238 100644 --- a/tests/webpack-test/configCases/contenthash/include-chunk-id/test.filter.js +++ b/tests/webpack-test/configCases/contenthash/include-chunk-id/test.filter.js @@ -1,3 +1,2 @@ // blocked by chunkIds -// TODO: Should create a issue for this test -module.exports = () => { return false } +module.exports = () => { return 'https://github.com/web-infra-dev/rspack/issues/8605' } diff --git a/tests/webpack-test/configCases/context-exclusion/simple/test.filter.js b/tests/webpack-test/configCases/context-exclusion/simple/test.filter.js index 042493e42a5..940f9498ab1 100644 --- a/tests/webpack-test/configCases/context-exclusion/simple/test.filter.js +++ b/tests/webpack-test/configCases/context-exclusion/simple/test.filter.js @@ -1,2 +1,3 @@ -// TODO: Should create a issue for this test +// rspack don't have ContextExclusionPlugin. +// skip it, because ContextExclusionPlugin already instead of IgnorePlugin. module.exports = () => { return false } diff --git a/tests/webpack-test/configCases/context-replacement/c/node_modules/d.js b/tests/webpack-test/configCases/context-replacement/c/node_modules/d.js new file mode 100644 index 00000000000..0a281018ca1 --- /dev/null +++ b/tests/webpack-test/configCases/context-replacement/c/node_modules/d.js @@ -0,0 +1 @@ +module.exports = "d"; diff --git a/tests/webpack-test/configCases/context-replacement/c/test.filter.js b/tests/webpack-test/configCases/context-replacement/c/test.filter.js deleted file mode 100644 index 042493e42a5..00000000000 --- a/tests/webpack-test/configCases/context-replacement/c/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// TODO: Should create a issue for this test -module.exports = () => { return false } diff --git a/tests/webpack-test/configCases/context-replacement/d/test.filter.js b/tests/webpack-test/configCases/context-replacement/d/test.filter.js index 042493e42a5..07682cd5032 100644 --- a/tests/webpack-test/configCases/context-replacement/d/test.filter.js +++ b/tests/webpack-test/configCases/context-replacement/d/test.filter.js @@ -1,2 +1,2 @@ // TODO: Should create a issue for this test -module.exports = () => { return false } +module.exports = () => { return true } From 069b045f2b3fc572d7c425706bd63585f076149a Mon Sep 17 00:00:00 2001 From: GiveMe-A-Name Date: Wed, 4 Dec 2024 14:17:07 +0800 Subject: [PATCH 2/2] fix: context-replacement test should be filter --- .../configCases/context-replacement/d/test.filter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/webpack-test/configCases/context-replacement/d/test.filter.js b/tests/webpack-test/configCases/context-replacement/d/test.filter.js index 07682cd5032..042493e42a5 100644 --- a/tests/webpack-test/configCases/context-replacement/d/test.filter.js +++ b/tests/webpack-test/configCases/context-replacement/d/test.filter.js @@ -1,2 +1,2 @@ // TODO: Should create a issue for this test -module.exports = () => { return true } +module.exports = () => { return false }