diff --git a/.eslintignore b/.eslintignore index 7598b88d953d..2a163cf431f0 100644 --- a/.eslintignore +++ b/.eslintignore @@ -9,3 +9,4 @@ webpack-examples webpack-test examples diffcases +diff.js diff --git a/diff.js b/diff.js new file mode 100644 index 000000000000..28eec01e763e --- /dev/null +++ b/diff.js @@ -0,0 +1,341 @@ +const path = require("path"); +const fs = require("fs"); + +const RSPACK_TEST = "packages/rspack/tests"; +const WEBPACK_TEST = "webpack-test"; + +function getCommon(baseA, baseB, result = new Set(), difference = new Set()) { + const a = fs.readdirSync(baseA, { + withFileTypes: true + }); + const b = fs.readdirSync(baseB, { + withFileTypes: true + }); + + let set = new Set(); + let ap = a.map(item => item.name); + let bp = b.map(item => item.name); + for (let i = 0; i < a.length; i++) { + if (bp.includes(a[i].name)) { + set.add(a[i].name); + } + } + for (let i = 0; i < b.length; i++) { + if (ap.includes(b[i].name)) { + set.add(b[i].name); + } + } + + set.forEach(item => { + let old = path.join(__dirname, "./packages/rspack/tests"); + let nextA = path.join(baseA, item); + let nextB = path.join(baseB, item); + if (fs.lstatSync(nextA).isFile() && fs.lstatSync(nextB).isFile()) { + let p = path.relative(old, nextA); + let withoutEnd = p.split(path.sep).slice(0, -1).join(path.sep); + let a = fs.readFileSync(nextA); + let b = fs.readFileSync(nextB); + + if (isBinaryPath(p)) { + bufferCompare(); + } else { + trimAndCompare(); + } + + function trimAndCompare() { + let s = a.toString().trim(); + let ss = b.toString().trim(); + if (s !== ss) { + difference.add(p); + } else { + result.add(withoutEnd); + } + } + + function bufferCompare() { + if (!a.equals(b)) { + difference.add(p); + } else { + result.add(withoutEnd); + } + } + } else { + getCommon(nextA, nextB, result, difference); + } + }); +} + +function isBinaryPath(p) { + const ext = [ + "3dm", + "3ds", + "3g2", + "3gp", + "7z", + "a", + "aac", + "adp", + "ai", + "aif", + "aiff", + "alz", + "ape", + "apk", + "appimage", + "ar", + "arj", + "asf", + "au", + "avi", + "bak", + "baml", + "bh", + "bin", + "bk", + "bmp", + "btif", + "bz2", + "bzip2", + "cab", + "caf", + "cgm", + "class", + "cmx", + "cpio", + "cr2", + "cur", + "dat", + "dcm", + "deb", + "dex", + "djvu", + "dll", + "dmg", + "dng", + "doc", + "docm", + "docx", + "dot", + "dotm", + "dra", + "DS_Store", + "dsk", + "dts", + "dtshd", + "dvb", + "dwg", + "dxf", + "ecelp4800", + "ecelp7470", + "ecelp9600", + "egg", + "eol", + "eot", + "epub", + "exe", + "f4v", + "fbs", + "fh", + "fla", + "flac", + "flatpak", + "fli", + "flv", + "fpx", + "fst", + "fvt", + "g3", + "gh", + "gif", + "graffle", + "gz", + "gzip", + "h261", + "h263", + "h264", + "icns", + "ico", + "ief", + "img", + "ipa", + "iso", + "jar", + "jpeg", + "jpg", + "jpgv", + "jpm", + "jxr", + "key", + "ktx", + "lha", + "lib", + "lvp", + "lz", + "lzh", + "lzma", + "lzo", + "m3u", + "m4a", + "m4v", + "mar", + "mdi", + "mht", + "mid", + "midi", + "mj2", + "mka", + "mkv", + "mmr", + "mng", + "mobi", + "mov", + "movie", + "mp3", + "mp4", + "mp4a", + "mpeg", + "mpg", + "mpga", + "mxu", + "nef", + "npx", + "numbers", + "nupkg", + "o", + "odp", + "ods", + "odt", + "oga", + "ogg", + "ogv", + "otf", + "ott", + "pages", + "pbm", + "pcx", + "pdb", + "pdf", + "pea", + "pgm", + "pic", + "png", + "pnm", + "pot", + "potm", + "potx", + "ppa", + "ppam", + "ppm", + "pps", + "ppsm", + "ppsx", + "ppt", + "pptm", + "pptx", + "psd", + "pya", + "pyc", + "pyo", + "pyv", + "qt", + "rar", + "ras", + "raw", + "resources", + "rgb", + "rip", + "rlc", + "rmf", + "rmvb", + "rpm", + "rtf", + "rz", + "s3m", + "s7z", + "scpt", + "sgi", + "shar", + "snap", + "sil", + "sketch", + "slk", + "smv", + "snk", + "so", + "stl", + "suo", + "sub", + "swf", + "tar", + "tbz", + "tbz2", + "tga", + "tgz", + "thmx", + "tif", + "tiff", + "tlz", + "ttc", + "ttf", + "txz", + "udf", + "uvh", + "uvi", + "uvm", + "uvp", + "uvs", + "uvu", + "viv", + "vob", + "war", + "wav", + "wax", + "wbmp", + "wdp", + "weba", + "webm", + "webp", + "whl", + "wim", + "wm", + "wma", + "wmv", + "wmx", + "woff", + "woff2", + "wrm", + "wvx", + "xbm", + "xif", + "xla", + "xlam", + "xls", + "xlsb", + "xlsm", + "xlsx", + "xlt", + "xltm", + "xltx", + "xm", + "xmind", + "xpi", + "xpm", + "xwd", + "xz", + "z", + "zip", + "zipx" + ]; + return ext.includes(path.extname(p).slice(1)); +} + +let set = new Set(); +let set2 = new Set(); +getCommon( + path.join(__dirname, RSPACK_TEST), + path.join(__dirname, WEBPACK_TEST), + set, + set2 +); +// console.log(set); +console.log(set2); diff --git a/packages/rspack/tests/cases/chunks/context-weak/dir/four.js b/packages/rspack/tests/cases/chunks/context-weak/dir/four.js deleted file mode 100644 index a9bbdd80578e..000000000000 --- a/packages/rspack/tests/cases/chunks/context-weak/dir/four.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 4; diff --git a/packages/rspack/tests/cases/chunks/context-weak/index.js b/packages/rspack/tests/cases/chunks/context-weak/index.js deleted file mode 100644 index 06babd562833..000000000000 --- a/packages/rspack/tests/cases/chunks/context-weak/index.js +++ /dev/null @@ -1,29 +0,0 @@ -it("should not bundle context requires with asyncMode === 'weak'", function () { - var contextRequire = require.context(".", false, /two/, "weak"); - expect(function () { - contextRequire("./two"); - }).toThrowError(/not available/); -}); - -it("should not bundle context requires with asyncMode === 'weak' using import.meta.webpackContext", function () { - const contextRequire = import.meta.webpackContext(".", { - recursive: false, - regExp: /two/, - mode: "weak" - }); - expect(function () { - contextRequire("./two"); - }).toThrowError(/not available/); -}); - -it("should find module with asyncMode === 'weak' when required elsewhere", function () { - var contextRequire = require.context(".", false, /.+/, "weak"); - expect(contextRequire("./three")).toBe(3); - require("./three"); // in a real app would be served as a separate chunk -}); - -it("should find module with asyncMode === 'weak' when required elsewhere (recursive)", function () { - var contextRequire = require.context(".", true, /.+/, "weak"); - expect(contextRequire("./dir/four")).toBe(4); - require("./dir/four"); // in a real app would be served as a separate chunk -}); diff --git a/packages/rspack/tests/cases/chunks/context-weak/three.js b/packages/rspack/tests/cases/chunks/context-weak/three.js deleted file mode 100644 index 690aad34a46d..000000000000 --- a/packages/rspack/tests/cases/chunks/context-weak/three.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 3; diff --git a/packages/rspack/tests/cases/chunks/context-weak/two.js b/packages/rspack/tests/cases/chunks/context-weak/two.js deleted file mode 100644 index 4bbffde10442..000000000000 --- a/packages/rspack/tests/cases/chunks/context-weak/two.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 2; diff --git a/packages/rspack/tests/cases/cjs-interop/non-existing-export/esModule.js b/packages/rspack/tests/cases/cjs-interop/non-existing-export/esModule.js deleted file mode 100644 index 37190c689782..000000000000 --- a/packages/rspack/tests/cases/cjs-interop/non-existing-export/esModule.js +++ /dev/null @@ -1,2 +0,0 @@ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = "default"; diff --git a/packages/rspack/tests/cases/cjs-interop/non-existing-export/index.js b/packages/rspack/tests/cases/cjs-interop/non-existing-export/index.js deleted file mode 100644 index d210326c3463..000000000000 --- a/packages/rspack/tests/cases/cjs-interop/non-existing-export/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import { named } from "./module"; -import { named as named2 } from "./esModule"; - -it("should emit errors", () => { - expect(named).toBe(undefined); - expect(named2).toBe(undefined); -}); diff --git a/packages/rspack/tests/cases/cjs-interop/non-existing-export/module.js b/packages/rspack/tests/cases/cjs-interop/non-existing-export/module.js deleted file mode 100644 index 0a5b24b98b34..000000000000 --- a/packages/rspack/tests/cases/cjs-interop/non-existing-export/module.js +++ /dev/null @@ -1 +0,0 @@ -exports.default = "default"; diff --git a/packages/rspack/tests/cases/cjs-interop/non-existing-export/warnings.js b/packages/rspack/tests/cases/cjs-interop/non-existing-export/warnings.js deleted file mode 100644 index 5a805e159a60..000000000000 --- a/packages/rspack/tests/cases/cjs-interop/non-existing-export/warnings.js +++ /dev/null @@ -1,9 +0,0 @@ -// Blocked by https://github.com/web-infra-dev/rspack/issues/4323 -module.exports = [ - // [ - // /export 'named' \(imported as 'named'\) was not found in '\.\/module' \(possible exports: default\)/ - // ], - // [ - // /export 'named' \(imported as 'named2'\) was not found in '\.\/esModule' \(possible exports: __esModule, default\)/ - // ] -]; diff --git a/packages/rspack/tests/cases/context/import-meta-webpack-context/dir/four.js b/packages/rspack/tests/cases/context/import-meta-webpack-context/dir/four.js deleted file mode 100644 index a9bbdd80578e..000000000000 --- a/packages/rspack/tests/cases/context/import-meta-webpack-context/dir/four.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 4; diff --git a/packages/rspack/tests/cases/context/import-meta-webpack-context/index.js b/packages/rspack/tests/cases/context/import-meta-webpack-context/index.js deleted file mode 100644 index c8ed6960821a..000000000000 --- a/packages/rspack/tests/cases/context/import-meta-webpack-context/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// it("should allow prefetch/preload", function() { -// const contextRequire = import.meta.webpackContext("./dir", { -// prefetch: true, -// preload: 1 -// }); -// expect(contextRequire("./four")).toBe(4); -// }); - -// it("should allow include/exclude", function() { -// const contextRequire = import.meta.webpackContext(".", { -// recursive: false, -// regExp: /two/, -// mode: "weak", -// exclude: /three/ -// }); -// expect(function() { -// contextRequire("./two-three") -// }).toThrowError(/Cannot find module/); -// }); - -// it("should allow chunkName", function() { -// const contextRequire = import.meta.webpackContext(".", { -// regExp: /two-three/, -// chunkName: "chunk012" -// }); -// expect(contextRequire("./two-three")).toBe(3); -// }); diff --git a/packages/rspack/tests/cases/context/import-meta-webpack-context/two-three.js b/packages/rspack/tests/cases/context/import-meta-webpack-context/two-three.js deleted file mode 100644 index 690aad34a46d..000000000000 --- a/packages/rspack/tests/cases/context/import-meta-webpack-context/two-three.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 3; diff --git a/packages/rspack/tests/cases/context/import-meta-webpack-context/two.js b/packages/rspack/tests/cases/context/import-meta-webpack-context/two.js deleted file mode 100644 index 4bbffde10442..000000000000 --- a/packages/rspack/tests/cases/context/import-meta-webpack-context/two.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 2; diff --git a/packages/rspack/tests/cases/context/issue-10969/folder/file1.js b/packages/rspack/tests/cases/context/issue-10969/folder/file1.js deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/packages/rspack/tests/cases/context/issue-10969/index.js b/packages/rspack/tests/cases/context/issue-10969/index.js deleted file mode 100644 index af0b9b6a1cab..000000000000 --- a/packages/rspack/tests/cases/context/issue-10969/index.js +++ /dev/null @@ -1,13 +0,0 @@ -// rust regex library is not support look-around -// it("should replace ! with %21 in the module id string of the context module", function () { -// const moduleId = require.context( -// "./folder", -// true, -// /^(?!file1\.js$).*$/i, -// "lazy" -// ).id; -// if (typeof moduleId !== "number") -// expect(moduleId).toBe( -// "./context/issue-10969/folder lazy recursive ^(?%21file1\\.js$).*$/" -// ); -// }); diff --git a/packages/rspack/tests/cases/context/issue-1769/folder/0.js b/packages/rspack/tests/cases/context/issue-1769/folder/0.js deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/packages/rspack/tests/cases/context/issue-1769/index.js b/packages/rspack/tests/cases/context/issue-1769/index.js deleted file mode 100644 index b2fbbe3012de..000000000000 --- a/packages/rspack/tests/cases/context/issue-1769/index.js +++ /dev/null @@ -1,11 +0,0 @@ -it("should be able the catch a incorrect import", function (done) { - var expr = "1"; - import("./folder/" + expr) - .then(function () { - done(new Error("should not be called")); - }) - .catch(function (err) { - expect(err).toBeInstanceOf(Error); - done(); - }); -}); diff --git a/packages/rspack/tests/cases/context/issue-3873/index.js b/packages/rspack/tests/cases/context/issue-3873/index.js deleted file mode 100644 index cb971d319473..000000000000 --- a/packages/rspack/tests/cases/context/issue-3873/index.js +++ /dev/null @@ -1,7 +0,0 @@ -function get(name) { - return require("./" + name); -} - -it("should automatically infer the index.js file", function () { - expect(get("module")).toBe("module"); -}); diff --git a/packages/rspack/tests/cases/context/issue-3873/module/index.js b/packages/rspack/tests/cases/context/issue-3873/module/index.js deleted file mode 100644 index d6df8480e226..000000000000 --- a/packages/rspack/tests/cases/context/issue-3873/module/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = "module"; diff --git a/packages/rspack/tests/cases/context/issue-524/index.js b/packages/rspack/tests/cases/context/issue-524/index.js deleted file mode 100644 index 6d6a7b9a32d7..000000000000 --- a/packages/rspack/tests/cases/context/issue-524/index.js +++ /dev/null @@ -1,11 +0,0 @@ -it("should support an empty context", function () { - var c = require.context(".", true, /^nothing$/); - expect(typeof c.id === "number" || typeof c.id === "string").toBeTruthy(); - expect(function () { - c.resolve(""); - }).toThrowError(); - expect(function () { - c(""); - }).toThrowError(); - expect(c.keys()).toEqual([]); -}); diff --git a/packages/rspack/tests/cases/context/issue-5750/folder/a b/packages/rspack/tests/cases/context/issue-5750/folder/a deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/packages/rspack/tests/cases/context/issue-5750/index.js b/packages/rspack/tests/cases/context/issue-5750/index.js deleted file mode 100644 index d849da1ce4af..000000000000 --- a/packages/rspack/tests/cases/context/issue-5750/index.js +++ /dev/null @@ -1,5 +0,0 @@ -it("should not use regexps with the g flag", function () { - expect(require.context("./folder", true, /a/).keys().length).toBe(1); - expect(require.context("./folder", true, /a/g).keys().length).toBe(0); - expect(require.context("./folder", true, /a/y).keys().length).toBe(0); -}); diff --git a/packages/rspack/tests/cases/context/issue-5750/warnings.js b/packages/rspack/tests/cases/context/issue-5750/warnings.js deleted file mode 100644 index 9ade48ea2032..000000000000 --- a/packages/rspack/tests/cases/context/issue-5750/warnings.js +++ /dev/null @@ -1,4 +0,0 @@ -// Blocked by: https://github.com/web-infra-dev/rspack/issues/4328 -module.exports = [ - // [/Critical dependency: Contexts can't use RegExps with the 'g' or 'y' flags/] -]; diff --git a/packages/rspack/tests/cases/context/issue-801/folder/file.js b/packages/rspack/tests/cases/context/issue-801/folder/file.js deleted file mode 100644 index bf68ed20bc5d..000000000000 --- a/packages/rspack/tests/cases/context/issue-801/folder/file.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = function (arg) { - try { - var a = require(arg + ".js"); - } catch (e) {} - try { - var b = require("" + arg + ".js"); - } catch (e) {} - try { - var c = require("./" + arg + ".js"); - } catch (e) {} - try { - var d = require("./" + arg); - } catch (e) {} - return { - a: typeof a === "function", - b: typeof b === "function", - c: typeof c === "function", - d: typeof d === "function" - }; -}; diff --git a/packages/rspack/tests/cases/context/issue-801/index.js b/packages/rspack/tests/cases/context/issue-801/index.js deleted file mode 100644 index 07bdf7b06286..000000000000 --- a/packages/rspack/tests/cases/context/issue-801/index.js +++ /dev/null @@ -1,7 +0,0 @@ -it("should emit valid code for dynamic require string with expr", function () { - var test = require("./folder/file"); - expect(test("file")).toEqual({ a: false, b: false, c: true, d: true }); - expect(test("file.js")).toEqual({ a: false, b: false, c: false, d: true }); - expect(test("./file")).toEqual({ a: true, b: true, c: false, d: false }); - expect(test("./file.js")).toEqual({ a: false, b: false, c: false, d: false }); -}); diff --git a/packages/rspack/tests/cases/json/data/a.json b/packages/rspack/tests/cases/json/data/a.json deleted file mode 100644 index 19765bd501b6..000000000000 --- a/packages/rspack/tests/cases/json/data/a.json +++ /dev/null @@ -1 +0,0 @@ -null diff --git a/packages/rspack/tests/cases/json/data/b.json b/packages/rspack/tests/cases/json/data/b.json deleted file mode 100644 index 190a18037c64..000000000000 --- a/packages/rspack/tests/cases/json/data/b.json +++ /dev/null @@ -1 +0,0 @@ -123 diff --git a/packages/rspack/tests/cases/json/data/c.json b/packages/rspack/tests/cases/json/data/c.json deleted file mode 100644 index 12bae17cf72d..000000000000 --- a/packages/rspack/tests/cases/json/data/c.json +++ /dev/null @@ -1 +0,0 @@ -[1, 2, 3, 4] diff --git a/packages/rspack/tests/cases/json/data/d.json b/packages/rspack/tests/cases/json/data/d.json deleted file mode 100644 index 0967ef424bce..000000000000 --- a/packages/rspack/tests/cases/json/data/d.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/packages/rspack/tests/cases/json/data/e.json b/packages/rspack/tests/cases/json/data/e.json deleted file mode 100644 index 3cebd09f51b3..000000000000 --- a/packages/rspack/tests/cases/json/data/e.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "1": "x", - "bb": 2, - "aa": 1 -} diff --git a/packages/rspack/tests/cases/json/data/f.json b/packages/rspack/tests/cases/json/data/f.json deleted file mode 100644 index 3cc1d0220710..000000000000 --- a/packages/rspack/tests/cases/json/data/f.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "named": "named", - "default": "default", - "__esModule": true -} diff --git a/packages/rspack/tests/cases/json/data/g.json b/packages/rspack/tests/cases/json/data/g.json deleted file mode 100644 index 15e8d0ff8369..000000000000 --- a/packages/rspack/tests/cases/json/data/g.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "named": {} -} diff --git a/packages/rspack/tests/cases/json/data/index.js b/packages/rspack/tests/cases/json/data/index.js deleted file mode 100644 index 66d59a405d9e..000000000000 --- a/packages/rspack/tests/cases/json/data/index.js +++ /dev/null @@ -1,12 +0,0 @@ -it("should require json via require", function () { - expect({ data: require("./a.json") }).toEqual({ data: null }); - expect({ data: require("./b.json") }).toEqual({ data: 123 }); - expect({ data: require("./c.json") }).toEqual({ data: [1, 2, 3, 4] }); - expect({ data: require("./e.json") }).toEqual({ - data: { - aa: 1, - bb: 2, - 1: "x" - } - }); -}); diff --git a/packages/rspack/tests/cases/json/data/poison b/packages/rspack/tests/cases/json/data/poison deleted file mode 100644 index 84d53767a2e4..000000000000 --- a/packages/rspack/tests/cases/json/data/poison +++ /dev/null @@ -1 +0,0 @@ -throw new Error("imported") diff --git a/packages/rspack/tests/cases/json/data/unknown b/packages/rspack/tests/cases/json/data/unknown deleted file mode 100644 index 12bae17cf72d..000000000000 --- a/packages/rspack/tests/cases/json/data/unknown +++ /dev/null @@ -1 +0,0 @@ -[1, 2, 3, 4] diff --git a/packages/rspack/tests/cases/mjs/cjs-import-default/cjs.js b/packages/rspack/tests/cases/mjs/cjs-import-default/cjs.js deleted file mode 100644 index 2c3ee027387a..000000000000 --- a/packages/rspack/tests/cases/mjs/cjs-import-default/cjs.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - data: "ok", - default: "default" -}; diff --git a/packages/rspack/tests/cases/mjs/cjs-import-default/data.json b/packages/rspack/tests/cases/mjs/cjs-import-default/data.json deleted file mode 100644 index b3593ddae904..000000000000 --- a/packages/rspack/tests/cases/mjs/cjs-import-default/data.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "__esModule": true, - "data": "ok", - "default": "default" -} diff --git a/packages/rspack/tests/cases/mjs/cjs-import-default/dynamic.js b/packages/rspack/tests/cases/mjs/cjs-import-default/dynamic.js deleted file mode 100644 index 1be682508306..000000000000 --- a/packages/rspack/tests/cases/mjs/cjs-import-default/dynamic.js +++ /dev/null @@ -1,3 +0,0 @@ -exports.__esModule = Math.random() < -1; -exports.data = "ok"; -exports.default = "default"; diff --git a/packages/rspack/tests/cases/mjs/cjs-import-default/dynamicFlagged.js b/packages/rspack/tests/cases/mjs/cjs-import-default/dynamicFlagged.js deleted file mode 100644 index 7afccbd5dde1..000000000000 --- a/packages/rspack/tests/cases/mjs/cjs-import-default/dynamicFlagged.js +++ /dev/null @@ -1,3 +0,0 @@ -exports.__esModule = Math.random() > -1; -exports.data = "ok"; -exports.default = "default"; diff --git a/packages/rspack/tests/cases/mjs/cjs-import-default/flagged.js b/packages/rspack/tests/cases/mjs/cjs-import-default/flagged.js deleted file mode 100644 index 500d0fe9d9d9..000000000000 --- a/packages/rspack/tests/cases/mjs/cjs-import-default/flagged.js +++ /dev/null @@ -1,3 +0,0 @@ -exports.__esModule = true; -exports.data = "ok"; -exports.default = "default"; diff --git a/packages/rspack/tests/cases/mjs/cjs-import-default/index.mjs b/packages/rspack/tests/cases/mjs/cjs-import-default/index.mjs index 0111762a699e..0861ea588bb7 100644 --- a/packages/rspack/tests/cases/mjs/cjs-import-default/index.mjs +++ b/packages/rspack/tests/cases/mjs/cjs-import-default/index.mjs @@ -1,303 +1,38 @@ -import { data } from './cjs.js' -import * as star from './cjs.js' -import def from './cjs.js' +import { umdData } from "./umd.js"; +import * as umdStar from "./umd.js"; +import umdDef from "./umd.js"; -import { umdData } from './umd.js' -import * as umdStar from './umd.js' -import umdDef from './umd.js' - -import { ns, default as def1, def as def2, data as data2 } from './reexport.mjs' -import * as reexport from './reexport.mjs' - -import { data as dynamicData } from './dynamic.js' -import * as dynamicStar from './dynamic.js' -import dynamicDef from './dynamic.js' - -import { data as flaggedData } from './flagged.js' -import * as flaggedStar from './flagged.js' -import flaggedDef from './flagged.js' - -import { data as dynamicFlaggedData } from './dynamicFlagged.js' -import * as dynamicFlaggedStar from './dynamicFlagged.js' -import dynamicFlaggedDef from './dynamicFlagged.js' - -import * as jsonStar from './data.json' -import jsonDef from './data.json' - -it('should get correct values when importing named exports from a umd module from mjs', function () { - expect(typeof data).toBe('string') - expect({ data }).toEqual({ data: 'ok' }) +it("should get correct values when importing named exports from a umd module from mjs", function () { expect(umdDef).toEqual({ - data: 'ok', - default: 'default' - }) + data: "ok", + default: "default" + }); expect({ umdDef }).toEqual({ umdDef: { - data: 'ok', - default: 'default' + data: "ok", + default: "default" } - }) + }); expect(umdStar).toEqual( nsObj({ default: { - data: 'ok', - default: 'default' + data: "ok", + default: "default" }, - data: 'ok' + data: "ok" }) - ) + ); expect({ umdStar }).toEqual({ umdStar: nsObj({ default: { - data: 'ok', - default: 'default' + data: "ok", + default: "default" }, - data: 'ok' + data: "ok" }) - }) + }); expect(umdStar.default).toEqual({ - data: 'ok', - default: 'default' - }) -}) - -it('should get correct values when importing named exports from a CommonJs module from mjs', function () { - expect(typeof data).toBe('string') - expect({ data }).toEqual({ data: 'ok' }) - expect(def).toEqual({ - data: 'ok', - default: 'default' - }) - expect({ def }).toEqual({ - def: { - data: 'ok', - default: 'default' - } - }) - expect(star).toEqual( - nsObj({ - default: { - data: 'ok', - default: 'default' - }, - data: 'ok' - }) - ) - expect({ star }).toEqual({ - star: nsObj({ - default: { - data: 'ok', - default: 'default' - }, - data: 'ok' - }) - }) - expect(star.default).toEqual({ - data: 'ok', - default: 'default' - }) - expect(ns).toEqual( - nsObj({ - default: { - data: 'ok', - default: 'default' - }, - data: 'ok' - }) - ) - expect(def1).toEqual({ - data: 'ok', - default: 'default' - }) - expect(def2).toEqual({ - data: 'ok', - default: 'default' - }) - expect(typeof data2).toBe('string') - expect({ data2 }).toEqual({ data2: 'ok' }) - expect(reexport).toEqual( - nsObj({ - ns: nsObj({ - default: { - data: 'ok', - default: 'default' - }, - data: 'ok' - }), - default: { - data: 'ok', - default: 'default' - }, - def: { - data: 'ok', - default: 'default' - }, - data: 'ok' - }) - ) -}) - -it('should get correct values when importing named exports from a flagged module from mjs', function () { - expect(typeof flaggedData).toBe('string') - expect({ flaggedData }).toEqual({ flaggedData: 'ok' }) - expect(flaggedDef).toEqual({ - __esModule: true, - data: 'ok', - default: 'default' - }) - expect({ flaggedDef }).toEqual({ - flaggedDef: { - __esModule: true, - data: 'ok', - default: 'default' - } - }) - expect(flaggedStar).toEqual( - nsObj({ - default: { - __esModule: true, - data: 'ok', - default: 'default' - }, - data: 'ok' - }) - ) - expect({ flaggedStar }).toEqual({ - flaggedStar: nsObj({ - default: { - __esModule: true, - data: 'ok', - default: 'default' - }, - data: 'ok' - }) - }) - expect(flaggedStar.default).toEqual({ - __esModule: true, - data: 'ok', - default: 'default' - }) -}) - -it('should get correct values when importing named exports from a dynamic (non-flagged) module from mjs', function () { - expect(typeof dynamicData).toBe('string') - expect({ dynamicData }).toEqual({ dynamicData: 'ok' }) - expect(dynamicDef).toEqual({ - __esModule: false, - data: 'ok', - default: 'default' - }) - expect({ dynamicDef }).toEqual({ - dynamicDef: { - __esModule: false, - data: 'ok', - default: 'default' - } - }) - expect(dynamicStar).toEqual( - nsObj({ - default: { - __esModule: false, - data: 'ok', - default: 'default' - }, - data: 'ok' - }) - ) - expect(dynamicStar.data).toEqual('ok') - expect({ dynamicStar }).toEqual({ - dynamicStar: nsObj({ - default: { - __esModule: false, - data: 'ok', - default: 'default' - }, - data: 'ok' - }) - }) - expect(dynamicStar.default).toEqual({ - __esModule: false, - data: 'ok', - default: 'default' - }) -}) - -it('should get correct values when importing named exports from a dynamic (flagged) module from mjs', function () { - expect(typeof dynamicFlaggedData).toBe('string') - expect({ dynamicFlaggedData }).toEqual({ dynamicFlaggedData: 'ok' }) - expect(dynamicFlaggedDef).toEqual({ - __esModule: true, - data: 'ok', - default: 'default' - }) - expect({ dynamicFlaggedDef }).toEqual({ - dynamicFlaggedDef: { - __esModule: true, - data: 'ok', - default: 'default' - } - }) - expect(dynamicFlaggedStar).toEqual( - nsObj({ - default: { - __esModule: true, - data: 'ok', - default: 'default' - }, - data: 'ok' - }) - ) - expect({ dynamicFlaggedStar }).toEqual({ - dynamicFlaggedStar: nsObj({ - default: { - __esModule: true, - data: 'ok', - default: 'default' - }, - data: 'ok' - }) - }) - expect(dynamicFlaggedStar.default).toEqual({ - __esModule: true, - data: 'ok', - default: 'default' - }) -}) - -it('should get correct values when importing named exports from a default-only module from mjs', function () { - expect(jsonDef).toEqual({ - __esModule: true, - data: 'ok', - default: 'default' - }) - expect({ jsonDef }).toEqual({ - jsonDef: { - __esModule: true, - data: 'ok', - default: 'default' - } - }) - expect(jsonStar).toEqual( - nsObj({ - default: { - __esModule: true, - data: 'ok', - default: 'default' - } - }) - ) - expect({ jsonStar }).toEqual({ - jsonStar: nsObj({ - default: { - __esModule: true, - data: 'ok', - default: 'default' - } - }) - }) - expect(jsonStar.default).toEqual({ - __esModule: true, - data: 'ok', - default: 'default' - }) -}) + data: "ok", + default: "default" + }); +}); diff --git a/packages/rspack/tests/cases/mjs/cjs-import-default/reexport.mjs b/packages/rspack/tests/cases/mjs/cjs-import-default/reexport.mjs deleted file mode 100644 index 1b07e112d013..000000000000 --- a/packages/rspack/tests/cases/mjs/cjs-import-default/reexport.mjs +++ /dev/null @@ -1,5 +0,0 @@ -import * as ns from "./cjs.js"; -export { ns }; -export { default } from "./cjs.js"; -export { default as def } from "./cjs.js"; -export { data as data } from "./cjs.js"; diff --git a/packages/rspack/tests/cases/mjs/esm-by-default/index.js b/packages/rspack/tests/cases/mjs/esm-by-default/index.js deleted file mode 100644 index 883c2f8d7f76..000000000000 --- a/packages/rspack/tests/cases/mjs/esm-by-default/index.js +++ /dev/null @@ -1 +0,0 @@ -require("./index.mjs").setOk(); diff --git a/packages/rspack/tests/cases/mjs/esm-by-default/index.mjs b/packages/rspack/tests/cases/mjs/esm-by-default/index.mjs deleted file mode 100644 index 682660672ec2..000000000000 --- a/packages/rspack/tests/cases/mjs/esm-by-default/index.mjs +++ /dev/null @@ -1,20 +0,0 @@ -let ok = false; - -it("should not use mjs extension by default", () => { - expect(ok).toBe(true); -}); - -it("should not have commonjs stuff available", function () { - if (typeof module !== "undefined") { - // If module is available - // expect(module).toHaveProperty("webpackTestSuiteModule"); // it must be the node.js module - } - if (typeof require !== "undefined") { - // If require is available - // expect(require).toHaveProperty("webpackTestSuiteRequire"); // it must be the node.js require - } -}); - -export function setOk() { - ok = true; -} diff --git a/packages/rspack/tests/cases/mjs/type-module/index.js b/packages/rspack/tests/cases/mjs/type-module/index.js index 47b5485facb6..bb9e287d1059 100644 --- a/packages/rspack/tests/cases/mjs/type-module/index.js +++ b/packages/rspack/tests/cases/mjs/type-module/index.js @@ -1,9 +1,3 @@ it("should not have access to require, module and define", () => { - // expect( - // typeof require === "undefined" || require.webpackTestSuiteRequire - // ).toBe(true); - // expect(typeof module === "undefined" || module.webpackTestSuiteModule).toBe( - // true - // ); expect(typeof define).toBe("undefined"); }); diff --git a/packages/rspack/tests/cases/parsing/harmony-commonjs-mix/index.js b/packages/rspack/tests/cases/parsing/harmony-commonjs-mix/index.js deleted file mode 100644 index 9205132f80aa..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-commonjs-mix/index.js +++ /dev/null @@ -1,8 +0,0 @@ -it("should result in a warning when using module.exports in harmony module", function () { - var x = require("./module1"); - expect(x).toEqual( - nsObj({ - default: 1234 - }) - ); -}); diff --git a/packages/rspack/tests/cases/parsing/harmony-commonjs-mix/module.js b/packages/rspack/tests/cases/parsing/harmony-commonjs-mix/module.js deleted file mode 100644 index aef22247d752..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-commonjs-mix/module.js +++ /dev/null @@ -1 +0,0 @@ -export default 1; diff --git a/packages/rspack/tests/cases/parsing/harmony-commonjs-mix/module1.js b/packages/rspack/tests/cases/parsing/harmony-commonjs-mix/module1.js deleted file mode 100644 index 20f28775de82..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-commonjs-mix/module1.js +++ /dev/null @@ -1,19 +0,0 @@ -import "./module"; - -expect(function () { - module.exports = 1; -}).toThrowError(); - -expect(typeof module.exports).toBe("undefined"); - -// expect((typeof define)).toBe("undefined"); -// expect(function() { -// define(function() {}) -// }).toThrowError(/define is not defined/); - -export default 1234; - -// if(eval("typeof exports !== \"undefined\"")) { -// // exports is node.js exports and not webpack's -// expect(Object.keys(exports)).toEqual([]); -// } diff --git a/packages/rspack/tests/cases/parsing/harmony-commonjs/a.js b/packages/rspack/tests/cases/parsing/harmony-commonjs/a.js deleted file mode 100644 index 5883f27007ba..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-commonjs/a.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function test() { - return "OK"; -} diff --git a/packages/rspack/tests/cases/parsing/harmony-commonjs/b.js b/packages/rspack/tests/cases/parsing/harmony-commonjs/b.js deleted file mode 100644 index afcce96db4f1..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-commonjs/b.js +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./c"; -export * from "./c2"; diff --git a/packages/rspack/tests/cases/parsing/harmony-commonjs/c.js b/packages/rspack/tests/cases/parsing/harmony-commonjs/c.js deleted file mode 100644 index bc242872058a..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-commonjs/c.js +++ /dev/null @@ -1 +0,0 @@ -export * from "./d"; diff --git a/packages/rspack/tests/cases/parsing/harmony-commonjs/c2.js b/packages/rspack/tests/cases/parsing/harmony-commonjs/c2.js deleted file mode 100644 index 9ccc5b64360f..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-commonjs/c2.js +++ /dev/null @@ -1 +0,0 @@ -export var x = "x"; diff --git a/packages/rspack/tests/cases/parsing/harmony-commonjs/d.js b/packages/rspack/tests/cases/parsing/harmony-commonjs/d.js deleted file mode 100644 index 80babf32dbb7..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-commonjs/d.js +++ /dev/null @@ -1 +0,0 @@ -exports.y = "y"; diff --git a/packages/rspack/tests/cases/parsing/harmony-commonjs/e.js b/packages/rspack/tests/cases/parsing/harmony-commonjs/e.js deleted file mode 100644 index ed128290b82c..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-commonjs/e.js +++ /dev/null @@ -1,2 +0,0 @@ -exports.a = "a"; -exports.b = "b"; diff --git a/packages/rspack/tests/cases/parsing/harmony-commonjs/index.js b/packages/rspack/tests/cases/parsing/harmony-commonjs/index.js deleted file mode 100644 index cf50de313a7c..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-commonjs/index.js +++ /dev/null @@ -1,31 +0,0 @@ -import { x, y } from "./b"; - -it("should pass when required by CommonJS module", function () { - var test1 = require("./a").default; - expect(test1()).toBe("OK"); -}); - -it("should pass when use babeljs transpiler", function () { - //the following are generated code by use babeljs. - // use it this way will save trouble to setup babel-loader - // the babeljs transpiled code depends on the __esModule to be set - var _test = require("./a"); - var _test2 = _interopRequireDefault(_test); - function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { default: obj }; - } - var test2 = (0, _test2.default)(); - expect(test2).toBe("OK"); -}); - -it("should double reexport from non-harmony modules correctly", function () { - expect(y).toBe("y"); - expect(x).toBe("x"); -}); - -import { a, b } from "./reexport"; - -it("should be possible to reexport a module with unknown exports", function () { - expect(a).toBe("a"); - expect(b).toBe("b"); -}); diff --git a/packages/rspack/tests/cases/parsing/harmony-commonjs/reexport.js b/packages/rspack/tests/cases/parsing/harmony-commonjs/reexport.js deleted file mode 100644 index fc214ad03d21..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-commonjs/reexport.js +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./e"; -import "./e"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/1.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/1.js deleted file mode 100644 index 8ccaaf745aa1..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/1.js +++ /dev/null @@ -1,2 +0,0 @@ -export var x = "1"; -export * from "./a?1"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/2.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/2.js deleted file mode 100644 index bc9d41caa28d..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/2.js +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./a?2"; -export var x = "1"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/3.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/3.js deleted file mode 100644 index 65823b0e15fc..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/3.js +++ /dev/null @@ -1,3 +0,0 @@ -// This leads to an error -export * from "./a?3"; -export * from "./b?3"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/4.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/4.js deleted file mode 100644 index db6e0a979c27..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/4.js +++ /dev/null @@ -1,3 +0,0 @@ -// This leads to an error -export * from "./b?4"; -export * from "./a?4"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/5.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/5.js deleted file mode 100644 index df097aff566d..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/5.js +++ /dev/null @@ -1,4 +0,0 @@ -// Theoretically this should lead to an error -// but in this dynamic case it's impossible to detect it -export * from "./c?5"; -export * from "./d?5"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/6.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/6.js deleted file mode 100644 index c84c770c0b72..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/6.js +++ /dev/null @@ -1,5 +0,0 @@ -// This leads to an error -export * from "./a?6"; -export * from "./b?6"; -export * from "./c?6"; -export * from "./d?6"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/7.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/7.js deleted file mode 100644 index a81671f523f1..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/7.js +++ /dev/null @@ -1,5 +0,0 @@ -// This leads to an error -export * from "./d?7"; -export * from "./b?7"; -export * from "./c?7"; -export * from "./a?7"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/a.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/a.js deleted file mode 100644 index 07f3fc98275e..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/a.js +++ /dev/null @@ -1 +0,0 @@ -export var x = "a"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/b.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/b.js deleted file mode 100644 index 72991cf5b480..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/b.js +++ /dev/null @@ -1 +0,0 @@ -export var x = "b"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/c.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/c.js deleted file mode 100644 index 1124f369a67f..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/c.js +++ /dev/null @@ -1 +0,0 @@ -Object(exports).x = "c"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/1.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/1.js deleted file mode 100644 index 8ccaaf745aa1..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/1.js +++ /dev/null @@ -1,2 +0,0 @@ -export var x = "1"; -export * from "./a?1"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/2.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/2.js deleted file mode 100644 index bc9d41caa28d..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/2.js +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./a?2"; -export var x = "1"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/3.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/3.js deleted file mode 100644 index 65823b0e15fc..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/3.js +++ /dev/null @@ -1,3 +0,0 @@ -// This leads to an error -export * from "./a?3"; -export * from "./b?3"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/4.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/4.js deleted file mode 100644 index db6e0a979c27..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/4.js +++ /dev/null @@ -1,3 +0,0 @@ -// This leads to an error -export * from "./b?4"; -export * from "./a?4"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/5.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/5.js deleted file mode 100644 index df097aff566d..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/5.js +++ /dev/null @@ -1,4 +0,0 @@ -// Theoretically this should lead to an error -// but in this dynamic case it's impossible to detect it -export * from "./c?5"; -export * from "./d?5"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/6.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/6.js deleted file mode 100644 index c84c770c0b72..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/6.js +++ /dev/null @@ -1,5 +0,0 @@ -// This leads to an error -export * from "./a?6"; -export * from "./b?6"; -export * from "./c?6"; -export * from "./d?6"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/7.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/7.js deleted file mode 100644 index a81671f523f1..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/7.js +++ /dev/null @@ -1,5 +0,0 @@ -// This leads to an error -export * from "./d?7"; -export * from "./b?7"; -export * from "./c?7"; -export * from "./a?7"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/a.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/a.js deleted file mode 100644 index 07f3fc98275e..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/a.js +++ /dev/null @@ -1 +0,0 @@ -export var x = "a"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/b.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/b.js deleted file mode 100644 index 72991cf5b480..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/b.js +++ /dev/null @@ -1 +0,0 @@ -export var x = "b"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/c.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/c.js deleted file mode 100644 index 1124f369a67f..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/c.js +++ /dev/null @@ -1 +0,0 @@ -Object(exports).x = "c"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/d.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/d.js deleted file mode 100644 index 2d8cec1df49d..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/cjs/d.js +++ /dev/null @@ -1 +0,0 @@ -Object(exports).x = "d"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/d.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/d.js deleted file mode 100644 index 2d8cec1df49d..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/d.js +++ /dev/null @@ -1 +0,0 @@ -Object(exports).x = "d"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/index.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/index.js deleted file mode 100644 index b3f64c68bbd4..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/index.js +++ /dev/null @@ -1,37 +0,0 @@ -import { x as x1 } from "./1"; -import { x as x2 } from "./2"; -import { x as x3 } from "./3"; -import { x as x4 } from "./4"; -import { x as x5 } from "./5"; -import { x as x6 } from "./6"; -import { x as x7 } from "./7"; - -var y1 = require("./cjs/1").x; -var y2 = require("./cjs/2").x; -var y3 = require("./cjs/3").x; -var y4 = require("./cjs/4").x; -var y5 = require("./cjs/5").x; -var y6 = require("./cjs/6").x; -var y7 = require("./cjs/7").x; - -it("should not overwrite when using star export (known exports)", function () { - expect(x1).toBe("1"); - expect(x2).toBe("1"); - expect(x3).toBe("a"); - expect(x4).toBe("b"); - expect(x5).toBe("c"); - expect(x6).toBe("a"); - // TODO - // expect(x7).toBe("b"); // Looks wrong, but is irrelevant as this is an error anyway -}); - -it("should not overwrite when using star export (unknown exports)", function () { - expect(y1).toBe("1"); - expect(y2).toBe("1"); - expect(y3).toBe("a"); - expect(y4).toBe("b"); - expect(y5).toBe("c"); - expect(y6).toBe("a"); - // TODO - // expect(y7).toBe("b"); // Looks wrong, but is irrelevant as this is an error anyway -}); diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/reexport.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/reexport.js deleted file mode 100644 index 378dcf843c41..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/reexport.js +++ /dev/null @@ -1 +0,0 @@ -export * from "./a"; diff --git a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/warnings.js b/packages/rspack/tests/cases/parsing/harmony-duplicate-export/warnings.js deleted file mode 100644 index 23dd2a4dee5d..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-duplicate-export/warnings.js +++ /dev/null @@ -1,11 +0,0 @@ -// Blocked by: https://github.com/web-infra-dev/rspack/issues/4323 -module.exports = [ - // [/name 'x'/, /\.\/a\?3/, /\.\/b\?3/], - // [/name 'x'/, /\.\/a\?4/, /\.\/b\?4/], - // [/name 'x'/, /\.\/a\?6/, /\.\/b\?6/], - // [/name 'x'/, /\.\/a\?7/, /\.\/b\?7/], - // [/name 'x'/, /\.\/a\?3/, /\.\/b\?3/], - // [/name 'x'/, /\.\/a\?4/, /\.\/b\?4/], - // [/name 'x'/, /\.\/a\?6/, /\.\/b\?6/], - // [/name 'x'/, /\.\/a\?7/, /\.\/b\?7/] -]; diff --git a/packages/rspack/tests/cases/parsing/harmony-edge-cases/a.js b/packages/rspack/tests/cases/parsing/harmony-edge-cases/a.js deleted file mode 100644 index 0b0e5bde313f..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-edge-cases/a.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function test() { - return "ok"; -} - -var a = test(); - -export { a }; diff --git a/packages/rspack/tests/cases/parsing/harmony-edge-cases/b.js b/packages/rspack/tests/cases/parsing/harmony-edge-cases/b.js deleted file mode 100644 index 9f1cc4b5338c..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-edge-cases/b.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function test() { - return "ok"; -} - -var b = test(); - -export { b }; diff --git a/packages/rspack/tests/cases/parsing/harmony-edge-cases/c.js b/packages/rspack/tests/cases/parsing/harmony-edge-cases/c.js deleted file mode 100644 index 059a1a18343e..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-edge-cases/c.js +++ /dev/null @@ -1 +0,0 @@ -export var c = "ok"; diff --git a/packages/rspack/tests/cases/parsing/harmony-edge-cases/d.js b/packages/rspack/tests/cases/parsing/harmony-edge-cases/d.js deleted file mode 100644 index 5c6b89abfc84..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-edge-cases/d.js +++ /dev/null @@ -1 +0,0 @@ -export default "ok"; diff --git a/packages/rspack/tests/cases/parsing/harmony-edge-cases/fake-reexport.js b/packages/rspack/tests/cases/parsing/harmony-edge-cases/fake-reexport.js deleted file mode 100644 index 9a9cde9fc75e..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-edge-cases/fake-reexport.js +++ /dev/null @@ -1,5 +0,0 @@ -import { c } from "./c"; - -import d from "./d"; - -export { c, d }; diff --git a/packages/rspack/tests/cases/parsing/harmony-edge-cases/index.js b/packages/rspack/tests/cases/parsing/harmony-edge-cases/index.js deleted file mode 100644 index ab5c356804ba..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-edge-cases/index.js +++ /dev/null @@ -1,11 +0,0 @@ -import { a } from "./a"; -import x, { b } from "./b"; -import { c, d } from "./fake-reexport"; - -it("should be able to use exported function", function () { - expect(a).toBe("ok"); - expect(b).toBe("ok"); - expect(x()).toBe("ok"); - expect(c).toBe("ok"); - expect(d).toBe("ok"); -}); diff --git a/packages/rspack/tests/cases/parsing/harmony-export-precedence/a.js b/packages/rspack/tests/cases/parsing/harmony-export-precedence/a.js deleted file mode 100644 index d6c1b49ae222..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-export-precedence/a.js +++ /dev/null @@ -1,7 +0,0 @@ -export function a() { - return "a1"; -} -export { b } from "./b"; -export * from "./c"; -export { d } from "./b"; -export var e = "e1"; diff --git a/packages/rspack/tests/cases/parsing/harmony-export-precedence/b.js b/packages/rspack/tests/cases/parsing/harmony-export-precedence/b.js deleted file mode 100644 index c535f6229e1d..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-export-precedence/b.js +++ /dev/null @@ -1,5 +0,0 @@ -export var a = "a2"; -export var b = "b2"; -export var c = "c2"; -export var d = "d2"; -export var e = "e2"; diff --git a/packages/rspack/tests/cases/parsing/harmony-export-precedence/c.js b/packages/rspack/tests/cases/parsing/harmony-export-precedence/c.js deleted file mode 100644 index d0daea56a0c2..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-export-precedence/c.js +++ /dev/null @@ -1,6 +0,0 @@ -export var a = "a3"; -export var b = "b3"; -export var c = "c3"; -export var e = "e3"; -export var f = "f3"; -export default "default"; diff --git a/packages/rspack/tests/cases/parsing/harmony-export-precedence/d.js b/packages/rspack/tests/cases/parsing/harmony-export-precedence/d.js deleted file mode 100644 index 17e060e96f9f..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-export-precedence/d.js +++ /dev/null @@ -1 +0,0 @@ -export default "default"; diff --git a/packages/rspack/tests/cases/parsing/harmony-export-precedence/index.js b/packages/rspack/tests/cases/parsing/harmony-export-precedence/index.js deleted file mode 100644 index 56d92be1c724..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-export-precedence/index.js +++ /dev/null @@ -1,21 +0,0 @@ -import { a, b, c, d, e } from "./a"; - -import defaultImport from "./a"; - -it("should prefer local exports", function () { - expect(a()).toBe("a1"); - expect(e).toBe("e1"); -}); - -it("should prefer indirect exports over star exports", function () { - expect(b).toBe("b2"); - expect(d).toBe("d2"); -}); - -it("should use star exports", function () { - expect(c).toBe("c3"); -}); - -it("should not export default via star export", function () { - expect(typeof defaultImport).toBe("undefined"); -}); diff --git a/packages/rspack/tests/cases/parsing/harmony-export-precedence/warnings.js b/packages/rspack/tests/cases/parsing/harmony-export-precedence/warnings.js deleted file mode 100644 index 26023703f5cd..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-export-precedence/warnings.js +++ /dev/null @@ -1,6 +0,0 @@ -// Blocked by: https://github.com/web-infra-dev/rspack/issues/4323 -module.exports = [ - // [ - // /export 'default' \(imported as 'defaultImport'\) was not found in '.\/a' \(possible exports: a, b, c, d, e, f\)/ - // ] -]; diff --git a/packages/rspack/tests/cases/parsing/harmony-import-export-order/a.js b/packages/rspack/tests/cases/parsing/harmony-import-export-order/a.js deleted file mode 100644 index ea913a8ffd55..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-import-export-order/a.js +++ /dev/null @@ -1,3 +0,0 @@ -import { add } from "./tracker"; -add("a"); -export var ax = "ax"; diff --git a/packages/rspack/tests/cases/parsing/harmony-import-export-order/b.js b/packages/rspack/tests/cases/parsing/harmony-import-export-order/b.js deleted file mode 100644 index bc5e65c6b054..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-import-export-order/b.js +++ /dev/null @@ -1,4 +0,0 @@ -import { ax } from "./c"; -import { add } from "./tracker"; -add("b"); -export var bx = ax; diff --git a/packages/rspack/tests/cases/parsing/harmony-import-export-order/c.js b/packages/rspack/tests/cases/parsing/harmony-import-export-order/c.js deleted file mode 100644 index 840228f5fe70..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-import-export-order/c.js +++ /dev/null @@ -1,6 +0,0 @@ -export * from "./a"; -export * from "./b"; -import { bx } from "./b"; -export { bx as cx }; -import { add } from "./tracker"; -add("c"); diff --git a/packages/rspack/tests/cases/parsing/harmony-import-export-order/index.js b/packages/rspack/tests/cases/parsing/harmony-import-export-order/index.js deleted file mode 100644 index efa6265ce866..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-import-export-order/index.js +++ /dev/null @@ -1,10 +0,0 @@ -it("should process imports of star exports in the correct order", function () { - var tracker = require("./tracker"); - tracker.list.length = 0; - delete require.cache[require.resolve("./c")]; - var c = require("./c"); - expect(tracker.list).toEqual(["a", "b", "c"]); - expect(c.ax).toBe("ax"); - expect(c.bx).toBe("ax"); - expect(c.cx).toBe("ax"); -}); diff --git a/packages/rspack/tests/cases/parsing/harmony-import-export-order/tracker.js b/packages/rspack/tests/cases/parsing/harmony-import-export-order/tracker.js deleted file mode 100644 index 863bfc1fc34d..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-import-export-order/tracker.js +++ /dev/null @@ -1,4 +0,0 @@ -export var list = []; -export function add(str) { - list.push(str); -} diff --git a/packages/rspack/tests/cases/parsing/harmony-import-targets/index.js b/packages/rspack/tests/cases/parsing/harmony-import-targets/index.js deleted file mode 100644 index c44004cacdcb..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-import-targets/index.js +++ /dev/null @@ -1,33 +0,0 @@ -import { x, f } from "./x"; - -it("should import into object literal", function () { - expect({ x: x }).toEqual({ x: 1 }); - var obj = { x: x }; - expect(obj).toEqual({ x: 1 }); -}); - -function func(z) { - return z; -} - -it("should import into function argument", function () { - expect(func(x)).toBe(1); - expect(f(x)).toBe(1); - expect(func({ x: x })).toEqual({ x: 1 }); - expect(f({ x: x })).toEqual({ x: 1 }); - var y = f(x); - expect(y).toBe(1); - y = function () { - return x; - }; - expect(y()).toBe(1); -}); - -it("should import into array literal", function () { - expect([x, f(2)]).toEqual([1, 2]); - expect([ - { - value: x - } - ]).toEqual([{ value: x }]); -}); diff --git a/packages/rspack/tests/cases/parsing/harmony-import-targets/x.js b/packages/rspack/tests/cases/parsing/harmony-import-targets/x.js deleted file mode 100644 index ece5f19af017..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-import-targets/x.js +++ /dev/null @@ -1,4 +0,0 @@ -export var x = 1; -export function f(x) { - return x; -} diff --git a/packages/rspack/tests/cases/parsing/harmony-info/commonjs.js b/packages/rspack/tests/cases/parsing/harmony-info/commonjs.js deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/packages/rspack/tests/cases/parsing/harmony-info/index.js b/packages/rspack/tests/cases/parsing/harmony-info/index.js deleted file mode 100644 index f66dc44a3fdf..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-info/index.js +++ /dev/null @@ -1,6 +0,0 @@ -import def, { a as aa, b, c, d, e } from "./module"; -import f, { g } from "./commonjs"; - -it("should emit the correct warnings", function () { - def, aa, b, c, d, e, f, g; -}); diff --git a/packages/rspack/tests/cases/parsing/harmony-info/module.js b/packages/rspack/tests/cases/parsing/harmony-info/module.js deleted file mode 100644 index 6ee6fc7f7912..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-info/module.js +++ /dev/null @@ -1,7 +0,0 @@ -function b() {} - -export { b }; - -export var c = 123; - -export function d() {} diff --git a/packages/rspack/tests/cases/parsing/harmony-info/warnings.js b/packages/rspack/tests/cases/parsing/harmony-info/warnings.js deleted file mode 100644 index 6b9ab5952fc8..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-info/warnings.js +++ /dev/null @@ -1,12 +0,0 @@ -// Blocked by https://github.com/web-infra-dev/rspack/issues/4323 -module.exports = [ - // [ - // /export 'default' \(imported as 'def'\) was not found in '\.\/module' \(possible exports: b, c, d\)/ - // ], - // [ - // /export 'a' \(imported as 'aa'\) was not found in '\.\/module' \(possible exports: b, c, d\)/ - // ], - // [ - // /export 'e' \(imported as 'e'\) was not found in '\.\/module' \(possible exports: b, c, d\)/ - // ] -]; diff --git a/packages/rspack/tests/cases/parsing/harmony-module-optimization/index.js b/packages/rspack/tests/cases/parsing/harmony-module-optimization/index.js deleted file mode 100644 index d0860faa1d7e..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-module-optimization/index.js +++ /dev/null @@ -1,8 +0,0 @@ -import { value as v1, check as c1 } from "./module"; -import { value as v2, check as c2 } from "./module-normal"; - -it("should allow to optimize exports in modules using 'module'", () => { - expect(v1).toBe(42); - expect(v2).toBe(42); - // expect(c1).toBe(c2); -}); diff --git a/packages/rspack/tests/cases/parsing/harmony-module-optimization/module-normal.js b/packages/rspack/tests/cases/parsing/harmony-module-optimization/module-normal.js deleted file mode 100644 index 3bb292712a23..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-module-optimization/module-normal.js +++ /dev/null @@ -1,3 +0,0 @@ -export const value = 42; -export const unusedValue = 42; -// export const check = __webpack_exports_info__.unusedValue.used; diff --git a/packages/rspack/tests/cases/parsing/harmony-module-optimization/module.js b/packages/rspack/tests/cases/parsing/harmony-module-optimization/module.js deleted file mode 100644 index 2c1b40862000..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-module-optimization/module.js +++ /dev/null @@ -1,5 +0,0 @@ -export const value = 42; -export const unusedValue = 42; -// export const check = __webpack_exports_info__.unusedValue.used; - -if (Math.random() < 0) console.log(module.exports); diff --git a/packages/rspack/tests/cases/parsing/harmony-spec/eval.js b/packages/rspack/tests/cases/parsing/harmony-spec/eval.js deleted file mode 100644 index eb50bc5c3be1..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-spec/eval.js +++ /dev/null @@ -1,4 +0,0 @@ -export var value = 0; -export function evalInModule(x) { - eval(x); -} diff --git a/packages/rspack/tests/cases/parsing/harmony-spec/export-cycle-a.js b/packages/rspack/tests/cases/parsing/harmony-spec/export-cycle-a.js deleted file mode 100644 index 8f77402a24c6..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-spec/export-cycle-a.js +++ /dev/null @@ -1,9 +0,0 @@ -function fun() { - return true; -} - -import { callFun } from "./export-cycle-b"; - -export default callFun(); - -export { fun }; diff --git a/packages/rspack/tests/cases/parsing/harmony-spec/export-cycle-b.js b/packages/rspack/tests/cases/parsing/harmony-spec/export-cycle-b.js deleted file mode 100644 index 4f90690a2afd..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-spec/export-cycle-b.js +++ /dev/null @@ -1,5 +0,0 @@ -import { fun } from "./export-cycle-a"; - -export function callFun() { - return fun(); -} diff --git a/packages/rspack/tests/cases/parsing/harmony-spec/index.js b/packages/rspack/tests/cases/parsing/harmony-spec/index.js deleted file mode 100644 index 3272de05a7de..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-spec/index.js +++ /dev/null @@ -1,38 +0,0 @@ -import { value, add } from "./live"; -import { value as value2, add as add2 } from "./live-es5"; -import { getLog } from "./order-tracker"; -import "./order-c"; -import cycleValue from "./export-cycle-a"; -import { data } from "./self-cycle"; - -it("should establish live binding of values", function () { - expect(value).toBe(0); - add(2); - expect(value).toBe(2); -}); - -it("should establish live binding of values with transpiled es5 module", function () { - expect(value2).toBe(0); - add2(5); - expect(value2).toBe(5); -}); - -it("should allow to use eval with exports", function () { - expect(valueEval).toBe(0); - evalInModule("value = 5"); - expect(valueEval).toBe(5); -}); - -it("should execute modules in the correct order", function () { - expect(getLog()).toEqual(["a", "b", "c"]); -}); - -it("should bind exports before the module executes", function () { - expect(cycleValue).toBe(true); -}); - -it("should allow to import live variables from itself", function () { - expect(data).toEqual([undefined, 1, 2]); -}); - -import { value as valueEval, evalInModule } from "./eval"; diff --git a/packages/rspack/tests/cases/parsing/harmony-spec/live-es5.js b/packages/rspack/tests/cases/parsing/harmony-spec/live-es5.js deleted file mode 100644 index d9deef353de1..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-spec/live-es5.js +++ /dev/null @@ -1,5 +0,0 @@ -exports.__esModule = true; -exports.value = 0; -exports.add = function add(x) { - exports.value += x; -}; diff --git a/packages/rspack/tests/cases/parsing/harmony-spec/live.js b/packages/rspack/tests/cases/parsing/harmony-spec/live.js deleted file mode 100644 index 5a2c91469ac2..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-spec/live.js +++ /dev/null @@ -1,4 +0,0 @@ -export var value = 0; -export function add(x) { - value += x; -} diff --git a/packages/rspack/tests/cases/parsing/harmony-spec/order-a.js b/packages/rspack/tests/cases/parsing/harmony-spec/order-a.js deleted file mode 100644 index 27cf8fb3410f..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-spec/order-a.js +++ /dev/null @@ -1,2 +0,0 @@ -import { log } from "./order-tracker"; -log("a"); diff --git a/packages/rspack/tests/cases/parsing/harmony-spec/order-b.js b/packages/rspack/tests/cases/parsing/harmony-spec/order-b.js deleted file mode 100644 index e68fd11b53e4..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-spec/order-b.js +++ /dev/null @@ -1,2 +0,0 @@ -import { log } from "./order-tracker"; -log("b"); diff --git a/packages/rspack/tests/cases/parsing/harmony-spec/order-c.js b/packages/rspack/tests/cases/parsing/harmony-spec/order-c.js deleted file mode 100644 index 88875963f4f4..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-spec/order-c.js +++ /dev/null @@ -1,4 +0,0 @@ -import { log } from "./order-tracker"; -import "./order-a"; -log("c"); -import "./order-b"; diff --git a/packages/rspack/tests/cases/parsing/harmony-spec/order-tracker.js b/packages/rspack/tests/cases/parsing/harmony-spec/order-tracker.js deleted file mode 100644 index 6e32ca5db35b..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-spec/order-tracker.js +++ /dev/null @@ -1,7 +0,0 @@ -var data = []; -export function log(x) { - data.push(x); -} -export function getLog() { - return data; -} diff --git a/packages/rspack/tests/cases/parsing/harmony-spec/self-cycle.js b/packages/rspack/tests/cases/parsing/harmony-spec/self-cycle.js deleted file mode 100644 index abcb18a553ed..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-spec/self-cycle.js +++ /dev/null @@ -1,10 +0,0 @@ -import { a as b } from "./self-cycle"; - -var data = []; - -data.push(b); -var a = 1; -data.push(b); -a = 2; -data.push(b); -export { a, data }; diff --git a/packages/rspack/tests/cases/parsing/harmony-star-conflict/index.js b/packages/rspack/tests/cases/parsing/harmony-star-conflict/index.js deleted file mode 100644 index b3d2c53fb647..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-star-conflict/index.js +++ /dev/null @@ -1,41 +0,0 @@ -import { - named1, - named2, - named3, - named4, - named5, - named6 -} from "./named-with-namespace"; - -it("should point out conflicts from named to namespace", () => { - expect(named1).toBe(1); - expect(named2).toBe(2); - expect(named3).toBe(2); - expect(named4).toMatchObject({ - named1: 1, - named2: 2 - }); - expect(named5).toBe(5); - expect(named6).toBe(1); -}); - -import { - named1 as snamed1, - named2 as snamed2, - named3 as snamed3, - named4 as snamed4, - named5 as snamed5, - named6 as snamed6 -} from "./named-with-namespace-no-side"; - -it("should point out conflicts from named to namespace (without side effects)", () => { - expect(snamed1).toBe(1); - expect(snamed2).toBe(2); - expect(snamed3).toBe(2); - expect(snamed4).toMatchObject({ - named1: 1, - named2: 2 - }); - expect(snamed5).toBe(5); - expect(snamed6).toBe(1); -}); diff --git a/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace-no-side/a.js b/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace-no-side/a.js deleted file mode 100644 index 9ef3ca2f0b67..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace-no-side/a.js +++ /dev/null @@ -1,6 +0,0 @@ -export const named1 = 1; -export const named2 = 2; -export { named2 as named3 } from "./a.js"; -export * as named4 from "./a.js"; -export const named5 = 5; -export { named1 as named6 } from "./a.js"; diff --git a/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace-no-side/b.js b/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace-no-side/b.js deleted file mode 100644 index 813c9f37cd1c..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace-no-side/b.js +++ /dev/null @@ -1,6 +0,0 @@ -export * as named1 from "./a.js"; -export { named1 as named2 } from "./a.js"; -export { named1 as named3 } from "./a.js"; -export * as named4 from "./a.js"; -export { named5 } from "./a.js"; -export { named1 as named6 } from "./a.js"; diff --git a/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace-no-side/index.js b/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace-no-side/index.js deleted file mode 100644 index 240b21dc43f9..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace-no-side/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./a.js"; -export * from "./b.js"; diff --git a/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace-no-side/package.json b/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace-no-side/package.json deleted file mode 100644 index 43c38c1bb03f..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace-no-side/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "sideEffects": false -} diff --git a/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace/a.js b/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace/a.js deleted file mode 100644 index 9ef3ca2f0b67..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace/a.js +++ /dev/null @@ -1,6 +0,0 @@ -export const named1 = 1; -export const named2 = 2; -export { named2 as named3 } from "./a.js"; -export * as named4 from "./a.js"; -export const named5 = 5; -export { named1 as named6 } from "./a.js"; diff --git a/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace/b.js b/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace/b.js deleted file mode 100644 index 813c9f37cd1c..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace/b.js +++ /dev/null @@ -1,6 +0,0 @@ -export * as named1 from "./a.js"; -export { named1 as named2 } from "./a.js"; -export { named1 as named3 } from "./a.js"; -export * as named4 from "./a.js"; -export { named5 } from "./a.js"; -export { named1 as named6 } from "./a.js"; diff --git a/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace/index.js b/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace/index.js deleted file mode 100644 index 240b21dc43f9..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-star-conflict/named-with-namespace/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./a.js"; -export * from "./b.js"; diff --git a/packages/rspack/tests/cases/parsing/harmony-star-conflict/warnings.js b/packages/rspack/tests/cases/parsing/harmony-star-conflict/warnings.js deleted file mode 100644 index 5dd0e82ccc9a..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-star-conflict/warnings.js +++ /dev/null @@ -1,15 +0,0 @@ -// Blocked by: "https://github.com/web-infra-dev/rspack/issues/4118, https://github.com/web-infra-dev/rspack/issues/4323" -module.exports = [ - // [ - // /conflicting star exports/, - // /names 'named1', 'named2', 'named3' /, - // /\.\/a\.js/, - // /\.\/b\.js/ - // ], - // [ - // /conflicting star exports/, - // /names 'named1', 'named2', 'named3' /, - // /\.\/a\.js/, - // /\.\/b\.js/ - // ] -]; diff --git a/packages/rspack/tests/cases/parsing/harmony-tdz/index.js b/packages/rspack/tests/cases/parsing/harmony-tdz/index.js deleted file mode 100644 index 5459cb4216ec..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-tdz/index.js +++ /dev/null @@ -1,10 +0,0 @@ -import value, { exception } from "./module"; - -it("should have a TDZ for exported const values", () => { - expect(typeof exception).toBe("object"); - expect(exception).toBeInstanceOf(Error); - expect(exception.message).toMatch( - / is not defined$|^Cannot access '.+?' before initialization$/ - ); - expect(value).toBe("value"); -}); diff --git a/packages/rspack/tests/cases/parsing/harmony-tdz/module.js b/packages/rspack/tests/cases/parsing/harmony-tdz/module.js deleted file mode 100644 index 7f3b24950cf1..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-tdz/module.js +++ /dev/null @@ -1,13 +0,0 @@ -import { f } from "./module2"; - -export let exception; - -try { - f(); -} catch (e) { - exception = e; -} - -export const value = "value"; - -export default f(); diff --git a/packages/rspack/tests/cases/parsing/harmony-tdz/module2.js b/packages/rspack/tests/cases/parsing/harmony-tdz/module2.js deleted file mode 100644 index 4acf8894a057..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-tdz/module2.js +++ /dev/null @@ -1,5 +0,0 @@ -import { value } from "./module"; - -export function f() { - return value; -} diff --git a/packages/rspack/tests/cases/parsing/harmony-this/abc.js b/packages/rspack/tests/cases/parsing/harmony-this/abc.js deleted file mode 100644 index 5fb1b87da748..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-this/abc.js +++ /dev/null @@ -1,11 +0,0 @@ -function returnThis() { - if (typeof this === "undefined") return expect("undefined"); - return expect(this); -} - -var a = returnThis; -var b = returnThis; - -export { a, b }; - -export default returnThis; diff --git a/packages/rspack/tests/cases/parsing/harmony-this/index.js b/packages/rspack/tests/cases/parsing/harmony-this/index.js deleted file mode 100644 index b7eda5c799a1..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-this/index.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -import d, { a, b as B } from "./abc"; - -import * as abc from "./abc"; - -function x() { - throw new Error("should not be executed"); -} -it("should have this = undefined on imported non-strict functions", function () { - if (true) x; - d().toBe("undefined"); - x; - a().toBe("undefined"); - x; - B().toBe("undefined"); -}); - -import C2, { C } from "./new"; - -import * as New from "./new"; - -it("should be possible to use new correctly", function () { - x; - new C().ok.toEqual(true); - x; - new C2().ok.toEqual(true); - x; - new New.C().ok.toEqual(true); -}); diff --git a/packages/rspack/tests/cases/parsing/harmony-this/new.js b/packages/rspack/tests/cases/parsing/harmony-this/new.js deleted file mode 100644 index 42027c3e1dd9..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony-this/new.js +++ /dev/null @@ -1,8 +0,0 @@ -function C() { - this.ok = expect(this.pok); -} - -C.prototype.pok = true; - -export default C; -export { C }; diff --git a/packages/rspack/tests/cases/parsing/harmony/index.js b/packages/rspack/tests/cases/parsing/harmony/index.js deleted file mode 100644 index 394f28afc8df..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony/index.js +++ /dev/null @@ -1,130 +0,0 @@ -import { a, b as B } from "abc"; - -import * as abc from "abc"; - -import { fn } from "exportKinds"; - -import { one, two } from "exportKinds"; - -import { test1, test2 } from "exportKinds"; - -import { - a as rea, - b as reb, - c as rec, - o as reo, - two as retwo, - def as Thing3 -} from "reexport"; -import { a as rea2 } from "reexport2"; - -import threeIsOdd, { even } from "circularEven"; - -import { specA, specB } from "exports-specifier"; - -import Thing, { Other } from "commonjs"; -import * as commonjs from "commonjs"; -import Thing2, { Other as Other2 } from "commonjs-trans"; -import * as commonjsTrans from "commonjs-trans"; - -import defaultExport from "def"; - -import "unused"; - -it("should import a default export from a module", function () { - expect(defaultExport).toBe("def"); -}); - -it("should import an identifier from a module", function () { - expect(a).toBe("a"); - expect(B).toBe("b"); -}); - -it("should import a whole module", function () { - expect(abc.a).toBe("a"); - expect(abc.b).toBe("b"); - expect(abc.c).toBe("c"); - expect(abc.d.c).toBe("c"); - expect(abc.e).toBe("c"); - var copy = (function (a) { - return a; - })(abc); - expect(copy.a).toBe("a"); - expect(copy.b).toBe("b"); - expect(copy.c).toBe("c"); - expect(copy.d.c).toBe("c"); - expect(copy.e).toBe("c"); - expect(typeof abc).toBe("object"); - // TODO algin to __webpack_require__.r - // expect("" + abc).toBe("[object Module]"); -}); - -it("should export functions", function () { - expect(typeof fn).toBe("function"); - expect(fn()).toBe("fn"); - expect(fn === fn).toBe(true); -}); - -it("should multiple variables with one statement", function () { - expect(one).toBe("one"); - expect(two).toBe("two"); -}); - -it("should still be able to use exported stuff", function () { - expect(test1).toBe("fn"); - expect(test2).toBe("two"); -}); - -it("should reexport a module", function () { - expect(rea).toBe("a"); - expect(reb).toBe("b"); - expect(rec).toBe("c"); - expect(reo).toBe("one"); - expect(retwo).toBe("two"); - expect(rea2).toBe("a"); -}); - -it("should support circular dependencies", function () { - expect(threeIsOdd).toBe(true); - expect(even(4)).toBe(true); -}); - -it("should support export specifier", function () { - expect(specA).toBe(1); - expect(specB).toBe(2); -}); - -it("should be able to import commonjs", function () { - function x() { - throw new Error("should not be executed"); - } - // next line doesn't end with semicolon - x; - Thing; - expect(typeof Thing).toBe("function"); - x; - Thing(); - expect(Thing()).toBe("thing"); - x; - Other; - expect(Other).toBe("other"); - - expect(typeof Thing2).toBe("function"); - expect(new Thing2().value).toBe("thing"); - expect(Other2).toBe("other"); - expect(Thing3()).toBe("thing"); -}); - -// TODO should align to webpack -// it("should be able to import commonjs with star import", function() { -// var copyOfCommonjs = commonjs; -// expect(commonjs()).toBe("thing"); -// expect(commonjs.Other).toBe("other"); -// expect(copyOfCommonjs()).toBe("thing"); -// expect(copyOfCommonjs.Other).toBe("other"); -// var copyOfCommonjsTrans = commonjsTrans; -// expect(new commonjsTrans.default().value).toBe("thing"); -// expect(commonjsTrans.Other).toBe("other"); -// expect(new copyOfCommonjsTrans.default().value).toBe("thing"); -// expect(copyOfCommonjsTrans.Other).toBe("other"); -// }); diff --git a/packages/rspack/tests/cases/parsing/harmony/node_modules/abc.js b/packages/rspack/tests/cases/parsing/harmony/node_modules/abc.js deleted file mode 100644 index ed95cb1b9b85..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony/node_modules/abc.js +++ /dev/null @@ -1,9 +0,0 @@ -export var a = "a"; -export var b = "b"; -export {c} from "./abc_c"; - -import * as temp from "./abc_c"; -export {temp as d}; - -import {c} from "./abc_c"; -export {c as e}; diff --git a/packages/rspack/tests/cases/parsing/harmony/node_modules/abc_c.js b/packages/rspack/tests/cases/parsing/harmony/node_modules/abc_c.js deleted file mode 100644 index 3cd46f04f1e8..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony/node_modules/abc_c.js +++ /dev/null @@ -1 +0,0 @@ -export var c = "c"; diff --git a/packages/rspack/tests/cases/parsing/harmony/node_modules/circularEven.js b/packages/rspack/tests/cases/parsing/harmony/node_modules/circularEven.js deleted file mode 100644 index 89f74ec887b7..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony/node_modules/circularEven.js +++ /dev/null @@ -1,8 +0,0 @@ -import { odd } from "circularOdd"; - -export default odd(3); - -export function even(n) { - if(n == 0) return true; - return odd(n - 1); -} diff --git a/packages/rspack/tests/cases/parsing/harmony/node_modules/circularOdd.js b/packages/rspack/tests/cases/parsing/harmony/node_modules/circularOdd.js deleted file mode 100644 index 09e869c359fe..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony/node_modules/circularOdd.js +++ /dev/null @@ -1,6 +0,0 @@ -import { even } from "circularEven"; - -export function odd(n) { - if(n == 0) return false; - return even(n - 1); -} diff --git a/packages/rspack/tests/cases/parsing/harmony/node_modules/commonjs-trans.js b/packages/rspack/tests/cases/parsing/harmony/node_modules/commonjs-trans.js deleted file mode 100644 index 148ade17b7b7..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony/node_modules/commonjs-trans.js +++ /dev/null @@ -1,7 +0,0 @@ -exports.__esModule = true; - -exports.default = function Thing() { - this.value = "thing"; -}; - -exports.Other = "other"; diff --git a/packages/rspack/tests/cases/parsing/harmony/node_modules/commonjs.js b/packages/rspack/tests/cases/parsing/harmony/node_modules/commonjs.js deleted file mode 100644 index f6c1082b2e4d..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony/node_modules/commonjs.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = function Thing() { - return "thing"; -} - -module.exports.Other = "other"; \ No newline at end of file diff --git a/packages/rspack/tests/cases/parsing/harmony/node_modules/def.js b/packages/rspack/tests/cases/parsing/harmony/node_modules/def.js deleted file mode 100644 index f79530f9d063..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony/node_modules/def.js +++ /dev/null @@ -1 +0,0 @@ -export default "def"; \ No newline at end of file diff --git a/packages/rspack/tests/cases/parsing/harmony/node_modules/exportKinds.js b/packages/rspack/tests/cases/parsing/harmony/node_modules/exportKinds.js deleted file mode 100644 index 31825175e2a9..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony/node_modules/exportKinds.js +++ /dev/null @@ -1,7 +0,0 @@ -export function fn() { - return "fn"; -} -export var one = "one", two = "two"; - -export var test1 = fn(); -export var test2 = two; diff --git a/packages/rspack/tests/cases/parsing/harmony/node_modules/exports-specifier.js b/packages/rspack/tests/cases/parsing/harmony/node_modules/exports-specifier.js deleted file mode 100644 index 29a20f915e3d..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony/node_modules/exports-specifier.js +++ /dev/null @@ -1,2 +0,0 @@ -var specA = 1, b = 2; -export { specA, b as specB } diff --git a/packages/rspack/tests/cases/parsing/harmony/node_modules/reexport.js b/packages/rspack/tests/cases/parsing/harmony/node_modules/reexport.js deleted file mode 100644 index 2eb2b94ccdd9..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony/node_modules/reexport.js +++ /dev/null @@ -1,3 +0,0 @@ -export * from "abc"; -export { one as o, two } from "exportKinds"; -export { default as def } from "commonjs"; \ No newline at end of file diff --git a/packages/rspack/tests/cases/parsing/harmony/node_modules/reexport2.js b/packages/rspack/tests/cases/parsing/harmony/node_modules/reexport2.js deleted file mode 100644 index f18bc7439aec..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony/node_modules/reexport2.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -export * from "abc"; \ No newline at end of file diff --git a/packages/rspack/tests/cases/parsing/harmony/node_modules/unused.js b/packages/rspack/tests/cases/parsing/harmony/node_modules/unused.js deleted file mode 100644 index 04d619151ce0..000000000000 --- a/packages/rspack/tests/cases/parsing/harmony/node_modules/unused.js +++ /dev/null @@ -1,5 +0,0 @@ -export var a = "a"; -var b = "b"; -export {b as d}; -export {c as e} from "./abc_c"; -export * from "./abc"; diff --git a/packages/rspack/tests/cases/parsing/issue-1600/file.js b/packages/rspack/tests/cases/parsing/issue-1600/file.js deleted file mode 100644 index df6e42851091..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-1600/file.js +++ /dev/null @@ -1,4 +0,0 @@ -// module.js -export default (function () { - return 1; -}); diff --git a/packages/rspack/tests/cases/parsing/issue-1600/index.js b/packages/rspack/tests/cases/parsing/issue-1600/index.js deleted file mode 100644 index 7d493f762174..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-1600/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import fn from "./file"; - -it("should compile correctly", function () { - expect(fn()).toBe(1); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-2019/file.js b/packages/rspack/tests/cases/parsing/issue-2019/file.js deleted file mode 100644 index 750f0d532fa4..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2019/file.js +++ /dev/null @@ -1,4 +0,0 @@ -var CONSTANT = "const"; -var def = "default"; -export default def; -export { CONSTANT }; diff --git a/packages/rspack/tests/cases/parsing/issue-2019/index.js b/packages/rspack/tests/cases/parsing/issue-2019/index.js deleted file mode 100644 index b8885a87b398..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2019/index.js +++ /dev/null @@ -1,4 +0,0 @@ -it("should not fail on default export before export", function () { - expect(require("./file").default).toBe("default"); - expect(require("./file").CONSTANT).toBe("const"); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-2050/a.js b/packages/rspack/tests/cases/parsing/issue-2050/a.js deleted file mode 100644 index e922656310c9..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2050/a.js +++ /dev/null @@ -1,2 +0,0 @@ -var xa = "a"; -export { xa }; diff --git a/packages/rspack/tests/cases/parsing/issue-2050/b.js b/packages/rspack/tests/cases/parsing/issue-2050/b.js deleted file mode 100644 index 36add9cab3ec..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2050/b.js +++ /dev/null @@ -1,2 +0,0 @@ -var xb = "b"; -export { xb }; diff --git a/packages/rspack/tests/cases/parsing/issue-2050/c.js b/packages/rspack/tests/cases/parsing/issue-2050/c.js deleted file mode 100644 index 4f9ceaa2e338..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2050/c.js +++ /dev/null @@ -1,2 +0,0 @@ -var xc = "c"; -export { xc }; diff --git a/packages/rspack/tests/cases/parsing/issue-2050/d.js b/packages/rspack/tests/cases/parsing/issue-2050/d.js deleted file mode 100644 index 54bf34f83021..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2050/d.js +++ /dev/null @@ -1,2 +0,0 @@ -var xd = "d"; -exports.xd = xd; diff --git a/packages/rspack/tests/cases/parsing/issue-2050/index.js b/packages/rspack/tests/cases/parsing/issue-2050/index.js deleted file mode 100644 index 420c54b86864..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2050/index.js +++ /dev/null @@ -1,10 +0,0 @@ -it("should support multiple reexports", function () { - expect(require("./x")).toEqual( - nsObj({ - xa: "a", - xb: "b", - xc: "c", - xd: "d" - }) - ); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-2050/module.js b/packages/rspack/tests/cases/parsing/issue-2050/module.js deleted file mode 100644 index e25b35cef4a3..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2050/module.js +++ /dev/null @@ -1,4 +0,0 @@ -export * from "./a"; -export * from "./b"; -export * from "./c"; -export * from "./d"; diff --git a/packages/rspack/tests/cases/parsing/issue-2050/x.js b/packages/rspack/tests/cases/parsing/issue-2050/x.js deleted file mode 100644 index 92af470f50d2..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2050/x.js +++ /dev/null @@ -1,3 +0,0 @@ -import { xa, xb, xc, xd } from "./module"; - -export { xa, xb, xc as xc, xd as xd }; diff --git a/packages/rspack/tests/cases/parsing/issue-2349/a.js b/packages/rspack/tests/cases/parsing/issue-2349/a.js deleted file mode 100644 index 2c96ced2a564..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2349/a.js +++ /dev/null @@ -1,2 +0,0 @@ -export var x = 1; // named export -export default 0; // default export diff --git a/packages/rspack/tests/cases/parsing/issue-2349/index.js b/packages/rspack/tests/cases/parsing/issue-2349/index.js deleted file mode 100644 index d2bf0bbd8d53..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2349/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import { x } from "./a"; // named imported cases an errors - -it("should be able to import a named export", function () { - expect(x).toBe(1); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-2522/index.js b/packages/rspack/tests/cases/parsing/issue-2522/index.js deleted file mode 100644 index 5597843871e4..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2522/index.js +++ /dev/null @@ -1,21 +0,0 @@ -import { a, a as aa } from "./module"; -import b from "./module"; -import * as c from "./module"; - -it("should import into object shorthand", function () { - var o = { - a, - aa, - b, - c - }; - expect(o).toEqual({ - a: 123, - aa: 123, - b: 456, - c: nsObj({ - a: 123, - default: 456 - }) - }); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-2522/module.js b/packages/rspack/tests/cases/parsing/issue-2522/module.js deleted file mode 100644 index b67c59d9ff6c..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2522/module.js +++ /dev/null @@ -1,2 +0,0 @@ -export var a = 123; -export default 456; diff --git a/packages/rspack/tests/cases/parsing/issue-2523/index.js b/packages/rspack/tests/cases/parsing/issue-2523/index.js deleted file mode 100644 index a61a8d1a76c1..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2523/index.js +++ /dev/null @@ -1,9 +0,0 @@ -import A from "./module"; -import { B } from "./module"; -import { c } from "./module"; - -it("should allow to export a class", function () { - expect(typeof A).toBe("function"); - expect(typeof B).toBe("function"); - expect(c).toBe("c"); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-2523/module.js b/packages/rspack/tests/cases/parsing/issue-2523/module.js deleted file mode 100644 index d4a35ad7a70d..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2523/module.js +++ /dev/null @@ -1,4 +0,0 @@ -export default class A {} -export class B {} - -export const c = "c"; diff --git a/packages/rspack/tests/cases/parsing/issue-2528-2/index.js b/packages/rspack/tests/cases/parsing/issue-2528-2/index.js deleted file mode 100644 index 9dc5c8db47d5..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2528-2/index.js +++ /dev/null @@ -1,3 +0,0 @@ -foo(); - -import { foo } from "./module"; diff --git a/packages/rspack/tests/cases/parsing/issue-2528-2/module.js b/packages/rspack/tests/cases/parsing/issue-2528-2/module.js deleted file mode 100644 index ac98a4885b92..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2528-2/module.js +++ /dev/null @@ -1,3 +0,0 @@ -export function foo() { - it("should run", function () {}); -} diff --git a/packages/rspack/tests/cases/parsing/issue-2528/helperA.js b/packages/rspack/tests/cases/parsing/issue-2528/helperA.js deleted file mode 100644 index 29e64c55aacb..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2528/helperA.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (a) { - return a; -}; diff --git a/packages/rspack/tests/cases/parsing/issue-2528/helperB.js b/packages/rspack/tests/cases/parsing/issue-2528/helperB.js deleted file mode 100644 index 3dc5742a9247..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2528/helperB.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - mark: function (a) { - return a(); - } -}; diff --git a/packages/rspack/tests/cases/parsing/issue-2528/helperC.js b/packages/rspack/tests/cases/parsing/issue-2528/helperC.js deleted file mode 100644 index 81fb93abaf6b..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2528/helperC.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - wrap: function (fn) { - return function () { - var context = { - prev: 0, - next: 0, - stop: function () { - this.next = "end"; - } - }; - while (context.next !== "end") fn(context); - }; - } -}; diff --git a/packages/rspack/tests/cases/parsing/issue-2528/index.js b/packages/rspack/tests/cases/parsing/issue-2528/index.js deleted file mode 100644 index 169efbf94d35..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2528/index.js +++ /dev/null @@ -1,69 +0,0 @@ -import { foo } from "./module"; -import impA from "./helperA"; -import impB from "./helperB"; -import impC from "./helperC"; - -var notExportedAsync = (function () { - var ref = impA( - impB.mark(function _callee2() { - return impC.wrap( - function _callee2$(_context2) { - while (1) { - switch ((_context2.prev = _context2.next)) { - case 0: - foo(); - - case 1: - case "end": - return _context2.stop(); - } - } - }, - _callee2, - this - ); - }) - ); - - return function notExportedAsync() { - return ref.apply(this, arguments); - }; -})(); - -export var exportedAsync = (function () { - var ref = impA( - impB.mark(function _callee() { - return impC.wrap( - function _callee$(_context) { - while (1) { - switch ((_context.prev = _context.next)) { - case 0: - _context.next = 2; - return foo(); - - case 2: - case "end": - return _context.stop(); - } - } - }, - _callee, - this - ); - }) - ); - - return function exportedAsync() { - return ref.apply(this, arguments); - }; -})(); - -import { count } from "./module"; - -it("should run async functions", function () { - var org = count; - notExportedAsync(); - expect(count).toBe(org + 1); - exportedAsync(); - expect(count).toBe(org + 2); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-2528/module.js b/packages/rspack/tests/cases/parsing/issue-2528/module.js deleted file mode 100644 index e11ac6315941..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2528/module.js +++ /dev/null @@ -1,6 +0,0 @@ -export function foo() { - count++; - return; -} - -export var count = 0; diff --git a/packages/rspack/tests/cases/parsing/issue-2570/fn.js b/packages/rspack/tests/cases/parsing/issue-2570/fn.js deleted file mode 100644 index 92ee727c31a1..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2570/fn.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function () { - return [].slice.call(arguments); -} diff --git a/packages/rspack/tests/cases/parsing/issue-2570/index.js b/packages/rspack/tests/cases/parsing/issue-2570/index.js deleted file mode 100644 index 3fa71fc421cc..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2570/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import fn from "./fn"; - -it("should generate valid code when calling a harmony import function with brackets", function () { - var a = fn(1); - var b = fn(2); - var c = fn(3, 4); - var d = fn(5, 6); - - expect(a).toEqual([1]); - expect(b).toEqual([2]); - expect(c).toEqual([3, 4]); - expect(d).toEqual([5, 6]); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-2618/index.js b/packages/rspack/tests/cases/parsing/issue-2618/index.js deleted file mode 100644 index 68585f7cb295..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2618/index.js +++ /dev/null @@ -1,9 +0,0 @@ -import defaultValue, { value, value2, value3, value4 } from "./module"; - -it("should be possible to redefine Object in a module", function () { - expect(value).toBe(123); - expect(value2).toBe(123); - expect(value3).toBe(123); - expect(value4).toBe(123); - expect(defaultValue).toBe(123); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-2618/module.js b/packages/rspack/tests/cases/parsing/issue-2618/module.js deleted file mode 100644 index 003ba7cbee59..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2618/module.js +++ /dev/null @@ -1,7 +0,0 @@ -var Object = 123; - -export const value = Object; -export var value2 = Object; -export default Object; -export * from "./module2"; -export { value3 as value4 } from "./module2"; diff --git a/packages/rspack/tests/cases/parsing/issue-2618/module2.js b/packages/rspack/tests/cases/parsing/issue-2618/module2.js deleted file mode 100644 index b8104da3df83..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2618/module2.js +++ /dev/null @@ -1 +0,0 @@ -export var value3 = 123; diff --git a/packages/rspack/tests/cases/parsing/issue-2622/index.js b/packages/rspack/tests/cases/parsing/issue-2622/index.js deleted file mode 100644 index fa432f846828..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2622/index.js +++ /dev/null @@ -1,16 +0,0 @@ -import { a, b } from "./module"; - -function func(x = a, y = b) { - return [x, y]; -} - -var func2 = function (x = a, y = b) { - return [x, y]; -}; - -it("should import into default parameters", function () { - expect(func()).toEqual(["a", "b"]); - expect(func2()).toEqual(["a", "b"]); - expect(func(1)).toEqual([1, "b"]); - expect(func2(2)).toEqual([2, "b"]); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-2622/module.js b/packages/rspack/tests/cases/parsing/issue-2622/module.js deleted file mode 100644 index 2151809d032a..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2622/module.js +++ /dev/null @@ -1,2 +0,0 @@ -export var a = "a"; -export var b = "b"; diff --git a/packages/rspack/tests/cases/parsing/issue-2895/a.js b/packages/rspack/tests/cases/parsing/issue-2895/a.js deleted file mode 100644 index 3fc709fce3f4..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2895/a.js +++ /dev/null @@ -1,6 +0,0 @@ -export const a = { - x: 1 - }, - b = { - x: 2 - }; diff --git a/packages/rspack/tests/cases/parsing/issue-2895/index.js b/packages/rspack/tests/cases/parsing/issue-2895/index.js deleted file mode 100644 index 444e1a94e753..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-2895/index.js +++ /dev/null @@ -1,6 +0,0 @@ -import { a, b } from "./a"; - -it("should export a const value without semicolon", function () { - expect(a).toEqual({ x: 1 }); - expect(b).toEqual({ x: 2 }); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-3116/file.js b/packages/rspack/tests/cases/parsing/issue-3116/file.js deleted file mode 100644 index 358b4ed7f40b..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-3116/file.js +++ /dev/null @@ -1,2 +0,0 @@ -export default "default"; -export var abc = "abc"; diff --git a/packages/rspack/tests/cases/parsing/issue-3116/file2.js b/packages/rspack/tests/cases/parsing/issue-3116/file2.js deleted file mode 100644 index 358b4ed7f40b..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-3116/file2.js +++ /dev/null @@ -1,2 +0,0 @@ -export default "default"; -export var abc = "abc"; diff --git a/packages/rspack/tests/cases/parsing/issue-3116/index.js b/packages/rspack/tests/cases/parsing/issue-3116/index.js deleted file mode 100644 index 371e0b4448e4..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-3116/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import * as file from "./file"; -import * as file2 from "./file2"; - -it("should translate indexed access to harmony import correctly", function () { - expect(file["default"]).toBe("default"); - expect(file["abc"]).toBe("abc"); -}); - -it("should translate dynamic indexed access to harmony import correctly", function () { - var fault = "fault"; - expect(file2["de" + fault]).toBe("default"); - expect(file2["abc"]).toBe("abc"); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-3238/index.js b/packages/rspack/tests/cases/parsing/issue-3238/index.js deleted file mode 100644 index 4131efffcba4..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-3238/index.js +++ /dev/null @@ -1,4 +0,0 @@ -it("supports empty element in destructuring", function () { - const second = ([, x]) => x; - expect(second([1, 2])).toEqual(2); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-3252/a.js b/packages/rspack/tests/cases/parsing/issue-3252/a.js deleted file mode 100644 index 0fa719b45bc2..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-3252/a.js +++ /dev/null @@ -1,14 +0,0 @@ -export class V6Engine { - toString() { - return "V6"; - } -} -export class V8Engine { - toString() { - return "V8"; - } -} - -export function getVersion() { - return "1.0"; -} diff --git a/packages/rspack/tests/cases/parsing/issue-3252/index.js b/packages/rspack/tests/cases/parsing/issue-3252/index.js deleted file mode 100644 index 672f59b26c88..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-3252/index.js +++ /dev/null @@ -1,9 +0,0 @@ -import * as E from "./a"; - -function fooBar({ some, bar = E.V6Engine }) { - return new bar().toString(); -} - -it("supports default argument assignment in import", function () { - expect(fooBar({ some: "test" })).toEqual("V6"); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-3273/file.js b/packages/rspack/tests/cases/parsing/issue-3273/file.js deleted file mode 100644 index 173df5cb0567..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-3273/file.js +++ /dev/null @@ -1 +0,0 @@ -export var test = "test"; diff --git a/packages/rspack/tests/cases/parsing/issue-3273/index.js b/packages/rspack/tests/cases/parsing/issue-3273/index.js deleted file mode 100644 index b32815670410..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-3273/index.js +++ /dev/null @@ -1,38 +0,0 @@ -import { test } from "./file"; - -it("should hide import by local var", function () { - var test = "ok"; - expect(test).toBe("ok"); -}); - -it("should hide import by object pattern", function () { - var { test } = { test: "ok" }; - expect(test).toBe("ok"); -}); - -it("should hide import by array pattern", function () { - var [test] = ["ok"]; - expect(test).toBe("ok"); -}); - -it("should hide import by array pattern (nested)", function () { - var [[test]] = [["ok"]]; - expect(test).toBe("ok"); -}); - -it("should hide import by pattern in function", function () { - (function ({ test }) { - expect(test).toBe("ok"); - })({ test: "ok" }); -}); - -it("should allow import in default (incorrect)", function () { - var { other = test, test } = { test: "ok" }; - expect(test).toBe("ok"); - expect(typeof other).toBe("undefined"); -}); - -it("should allow import in default", function () { - var { other = test } = { test: "ok" }; - expect(other).toBe("test"); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-3769/a.js b/packages/rspack/tests/cases/parsing/issue-3769/a.js deleted file mode 100644 index 88491225de1a..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-3769/a.js +++ /dev/null @@ -1 +0,0 @@ -export const thing = 123; diff --git a/packages/rspack/tests/cases/parsing/issue-3769/b.js b/packages/rspack/tests/cases/parsing/issue-3769/b.js deleted file mode 100644 index 05e08712040e..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-3769/b.js +++ /dev/null @@ -1 +0,0 @@ -export default 123; diff --git a/packages/rspack/tests/cases/parsing/issue-3769/c.js b/packages/rspack/tests/cases/parsing/issue-3769/c.js deleted file mode 100644 index 05e08712040e..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-3769/c.js +++ /dev/null @@ -1 +0,0 @@ -export default 123; diff --git a/packages/rspack/tests/cases/parsing/issue-3769/cjs.js b/packages/rspack/tests/cases/parsing/issue-3769/cjs.js deleted file mode 100644 index c69302f3c044..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-3769/cjs.js +++ /dev/null @@ -1,2 +0,0 @@ -exports.__esModule = true; -exports.test = 123; diff --git a/packages/rspack/tests/cases/parsing/issue-3769/d.js b/packages/rspack/tests/cases/parsing/issue-3769/d.js deleted file mode 100644 index 05e08712040e..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-3769/d.js +++ /dev/null @@ -1 +0,0 @@ -export default 123; diff --git a/packages/rspack/tests/cases/parsing/issue-3769/imported.js b/packages/rspack/tests/cases/parsing/issue-3769/imported.js deleted file mode 100644 index e89508f43c1b..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-3769/imported.js +++ /dev/null @@ -1 +0,0 @@ -exports.test = "test"; diff --git a/packages/rspack/tests/cases/parsing/issue-3769/index.js b/packages/rspack/tests/cases/parsing/issue-3769/index.js deleted file mode 100644 index e88152342c7f..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-3769/index.js +++ /dev/null @@ -1,3 +0,0 @@ -it("should generate valid code", function () { - expect(require("./module").myTest).toBe("test"); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-3769/module.js b/packages/rspack/tests/cases/parsing/issue-3769/module.js deleted file mode 100644 index 66436df69f4f..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-3769/module.js +++ /dev/null @@ -1,19 +0,0 @@ -import { thing } from "./a"; - -import user_settings_main from "./c"; -import user_settings_change_password from "./d"; - -export { test as myTest } from "./imported"; - -export { default as preload } from "./d?1"; -export { default as snackbar } from "./d?2"; -export { default as authentication } from "./d?3"; -export { default as navigator } from "./d?4"; -export { default as locale } from "./d?5"; -export { default as example_users } from "./d?6"; -export { default as user_profile } from "./d?7"; -export { default as block_user } from "./d?8"; -export { default as log } from "./d?9"; - -export const user_settings = - (thing, user_settings_main, user_settings_change_password); diff --git a/packages/rspack/tests/cases/parsing/issue-3964/index.js b/packages/rspack/tests/cases/parsing/issue-3964/index.js deleted file mode 100644 index 0ec2630cd7bd..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-3964/index.js +++ /dev/null @@ -1,4 +0,0 @@ -it("should be possible to export default an imported name", function () { - var x = require("./module"); - expect(x).toEqual(nsObj({ default: 1234 })); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-3964/module.js b/packages/rspack/tests/cases/parsing/issue-3964/module.js deleted file mode 100644 index 00e1299ebb5f..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-3964/module.js +++ /dev/null @@ -1,2 +0,0 @@ -import X from "./x"; -export default X; diff --git a/packages/rspack/tests/cases/parsing/issue-3964/x.js b/packages/rspack/tests/cases/parsing/issue-3964/x.js deleted file mode 100644 index 055bd1d77ecc..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-3964/x.js +++ /dev/null @@ -1 +0,0 @@ -export default 1234; diff --git a/packages/rspack/tests/cases/parsing/issue-4179/index.js b/packages/rspack/tests/cases/parsing/issue-4179/index.js deleted file mode 100644 index bb94666a106e..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-4179/index.js +++ /dev/null @@ -1,8 +0,0 @@ -import def from "./module?harmony"; -import * as mod from "./module?harmony-start"; - -it("should export a sequence expression correctly", function () { - expect(require("./module?cjs")).toEqual(nsObj({ default: 2 })); - expect(def).toBe(2); - expect(mod.default).toBe(2); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-4179/module.js b/packages/rspack/tests/cases/parsing/issue-4179/module.js deleted file mode 100644 index 939b016f2403..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-4179/module.js +++ /dev/null @@ -1 +0,0 @@ -export default (1, 2); diff --git a/packages/rspack/tests/cases/parsing/issue-4357/b.js b/packages/rspack/tests/cases/parsing/issue-4357/b.js deleted file mode 100644 index eff703ff4657..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-4357/b.js +++ /dev/null @@ -1 +0,0 @@ -export default "b"; diff --git a/packages/rspack/tests/cases/parsing/issue-4357/index.js b/packages/rspack/tests/cases/parsing/issue-4357/index.js deleted file mode 100644 index 969e8f3a4b10..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-4357/index.js +++ /dev/null @@ -1,28 +0,0 @@ -import b from "./b"; - -it("should parse dynamic property names", function () { - var o = { - [require("./a")]: "a", - [b]: "b" - }; - expect(o).toEqual({ - a: "a", - b: "b" - }); -}); - -it("should match dynamic property names", function () { - const { [require("./a")]: aa, [b]: bb } = { a: "a", b: "b" }; - const [ - x, - , - ...[ - { - [b]: { [b]: cc } - } - ] - ] = [0, 1, { b: { b: "c" } }]; - expect(aa).toBe("a"); - expect(bb).toBe("b"); - expect(cc).toBe("c"); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-4608-1-non-strict/index.js b/packages/rspack/tests/cases/parsing/issue-4608-1-non-strict/index.js deleted file mode 100644 index 8ccf32914985..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-4608-1-non-strict/index.js +++ /dev/null @@ -1,31 +0,0 @@ -it("should find var declaration in control statements", function () { - var f = function (x) { - expect(x).toBe("fail"); - }; - - (function () { - with ({ a: 1 }) { - var require = f; - } - - require("fail"); - })(); -}); - -it("should find var declaration in control statements after usage", function () { - var f = function (x) { - expect(x).toBe("fail"); - }; - - (function () { - var test = function () { - require("fail"); - }; - - with ({ a: 1 }) { - var require = f; - } - - test(); - })(); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-4608-1-non-strict/test.filter.js b/packages/rspack/tests/cases/parsing/issue-4608-1-non-strict/test.filter.js deleted file mode 100644 index d957820f37ad..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-4608-1-non-strict/test.filter.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (config) { - return !config.module; -}; diff --git a/packages/rspack/tests/cases/parsing/issue-4608-1/index.js b/packages/rspack/tests/cases/parsing/issue-4608-1/index.js deleted file mode 100644 index bc2bc64beddb..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-4608-1/index.js +++ /dev/null @@ -1,141 +0,0 @@ -it("should find var declaration later in code", function () { - expect(typeof require).toBe("undefined"); - var require; -}); - -it("should find var declaration in same statement", function () { - var fn = function () { - require("fail"); - }, - require; - - require = function (x) { - expect(x).toBe("fail"); - }; - fn(); -}); - -it("should find a catch block declaration", function () { - try { - var f = function (x) { - expect(x).toBe("fail"); - }; - throw f; - } catch (require) { - require("fail"); - } -}); - -it("should find var declaration in control statements", function () { - var f = function (x) { - expect(x).toBe("fail"); - }; - - (function () { - { - var require = f; - } - - require("fail"); - })(); - - (function () { - var i = 1; - while (i--) { - var require = f; - } - - require("fail"); - })(); - - (function () { - do { - var require = f; - } while (false); - - require("fail"); - })(); - - (function () { - for (var i = 0; i < 1; i++) { - var require = f; - } - - require("fail"); - })(); - - (function () { - for (var i in { a: 1 }) { - var require = f; - } - - require("fail"); - })(); -}); - -it("should find var declaration in control statements after usage", function () { - var f = function (x) { - expect(x).toBe("fail"); - }; - - (function () { - var test = function () { - require("fail"); - }; - - { - var require = f; - } - - test(); - })(); - - (function () { - var test = function () { - require("fail"); - }; - - var i = 1; - while (i--) { - var require = f; - } - - test(); - })(); - - (function () { - var test = function () { - require("fail"); - }; - - do { - var require = f; - } while (false); - - test(); - })(); - - (function () { - var test = function () { - require("fail"); - }; - - for (var i = 0; i < 1; i++) { - var require = f; - } - - test(); - })(); - - (function () { - var test = function () { - require("fail"); - }; - - for (var i in { a: 1 }) { - var require = f; - } - - test(); - })(); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-4608-2/index.js b/packages/rspack/tests/cases/parsing/issue-4608-2/index.js deleted file mode 100644 index 03a5545e0fb7..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-4608-2/index.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; - -it("should find var declaration in control statements", function () { - var f = function (x) { - expect(x).toBe("fail"); - }; - - (function () { - for (let x of ["a"]) { - var require = f; - } - - require("fail"); - })(); -}); - -it("should find var declaration in control statements after usage", function () { - var f = function (x) { - expect(x).toBe("fail"); - }; - - (function () { - var test = function () { - require("fail"); - }; - - for (let x of ["a"]) { - var require = f; - } - - test(); - })(); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-4709/index.js b/packages/rspack/tests/cases/parsing/issue-4709/index.js deleted file mode 100644 index 6b840a5ce35b..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-4709/index.js +++ /dev/null @@ -1,15 +0,0 @@ -function getDirectiveRequire(directive) { - var require = directive.require || (directive.controller && directive.name); - - if (!isArray(require) && isObject(require)) { - forEach(require, function (value, key) { - var match = value.match(REQUIRE_PREFIX_REGEXP); - var name = value.substring(match[0].length); - if (!name) require[key] = match[0] + key; - }); - } - - return require; -} - -it("should parse these snippets successfully", function () {}); diff --git a/packages/rspack/tests/cases/parsing/issue-4816/a.js b/packages/rspack/tests/cases/parsing/issue-4816/a.js deleted file mode 100644 index 6cd1d0075d40..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-4816/a.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = "a"; diff --git a/packages/rspack/tests/cases/parsing/issue-4870/file.js b/packages/rspack/tests/cases/parsing/issue-4870/file.js deleted file mode 100644 index 173df5cb0567..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-4870/file.js +++ /dev/null @@ -1 +0,0 @@ -export var test = "test"; diff --git a/packages/rspack/tests/cases/parsing/issue-4870/index.js b/packages/rspack/tests/cases/parsing/issue-4870/index.js deleted file mode 100644 index c67767c046c7..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-4870/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { test } from "./file"; - -it("should allow import in array destructuring", function () { - var other; - [other = test] = []; - expect(other).toBe("test"); -}); - -it("should allow import in object destructuring", function () { - var other; - ({ other = test } = {}); - expect(other).toBe("test"); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-5624/index.js b/packages/rspack/tests/cases/parsing/issue-5624/index.js deleted file mode 100644 index f1d960006004..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-5624/index.js +++ /dev/null @@ -1,6 +0,0 @@ -import { fn } from "./module"; - -it("should allow conditionals as callee", function () { - var x = (true ? fn : fn)(); - expect(x).toBe("ok"); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-5624/module.js b/packages/rspack/tests/cases/parsing/issue-5624/module.js deleted file mode 100644 index 0b718d29f3d5..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-5624/module.js +++ /dev/null @@ -1,3 +0,0 @@ -export function fn() { - return "ok"; -} diff --git a/packages/rspack/tests/cases/parsing/issue-5889/index.js b/packages/rspack/tests/cases/parsing/issue-5889/index.js deleted file mode 100644 index fdeb23789212..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-5889/index.js +++ /dev/null @@ -1,5 +0,0 @@ -const result = require("./module"); - -it("should correctly replace 'require' bindings", () => { - expect(result).toBe(true); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-5889/module.js b/packages/rspack/tests/cases/parsing/issue-5889/module.js deleted file mode 100644 index 1d2cc2140936..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-5889/module.js +++ /dev/null @@ -1,6 +0,0 @@ -let result = false; -if (require) { - result = true; -} - -module.exports = result; diff --git a/packages/rspack/tests/cases/parsing/issue-6867/a.js b/packages/rspack/tests/cases/parsing/issue-6867/a.js deleted file mode 100644 index ea9b101e1c22..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-6867/a.js +++ /dev/null @@ -1 +0,0 @@ -export default function () {} diff --git a/packages/rspack/tests/cases/parsing/issue-6867/b.js b/packages/rspack/tests/cases/parsing/issue-6867/b.js deleted file mode 100644 index fa1f790f39bd..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-6867/b.js +++ /dev/null @@ -1 +0,0 @@ -export default (function () {}); diff --git a/packages/rspack/tests/cases/parsing/issue-6867/c.js b/packages/rspack/tests/cases/parsing/issue-6867/c.js deleted file mode 100644 index 386baca17315..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-6867/c.js +++ /dev/null @@ -1 +0,0 @@ -export default function foo() {} diff --git a/packages/rspack/tests/cases/parsing/issue-6867/d.js b/packages/rspack/tests/cases/parsing/issue-6867/d.js deleted file mode 100644 index b50a7fca0380..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-6867/d.js +++ /dev/null @@ -1 +0,0 @@ -export default (function bar() {}); diff --git a/packages/rspack/tests/cases/parsing/issue-6867/e.js b/packages/rspack/tests/cases/parsing/issue-6867/e.js deleted file mode 100644 index a6e68e983892..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-6867/e.js +++ /dev/null @@ -1 +0,0 @@ -export default class {} diff --git a/packages/rspack/tests/cases/parsing/issue-6867/f.js b/packages/rspack/tests/cases/parsing/issue-6867/f.js deleted file mode 100644 index c595f701a149..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-6867/f.js +++ /dev/null @@ -1 +0,0 @@ -export default (class {}); diff --git a/packages/rspack/tests/cases/parsing/issue-6867/g.js b/packages/rspack/tests/cases/parsing/issue-6867/g.js deleted file mode 100644 index 2eddcfbd8f4b..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-6867/g.js +++ /dev/null @@ -1 +0,0 @@ -export default class A {} diff --git a/packages/rspack/tests/cases/parsing/issue-6867/h.js b/packages/rspack/tests/cases/parsing/issue-6867/h.js deleted file mode 100644 index b07fcbf42c5d..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-6867/h.js +++ /dev/null @@ -1 +0,0 @@ -export default (class A {}); diff --git a/packages/rspack/tests/cases/parsing/issue-6867/index.js b/packages/rspack/tests/cases/parsing/issue-6867/index.js deleted file mode 100644 index 40e16839f565..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-6867/index.js +++ /dev/null @@ -1,47 +0,0 @@ -it("should compile default export unnamed function declaration", function () { - return import(/* webpackChunkName: "a" */ "./a").then(({ default: a }) => { - a(); - }); -}); - -it("should compile default export unnamed function expression", function () { - return import(/* webpackChunkName: "b" */ "./b").then(({ default: b }) => { - b(); - }); -}); - -it("should compile default export named function declaration", function () { - return import(/* webpackChunkName: "c" */ "./c").then(({ default: c }) => { - c(); - }); -}); - -it("should compile default export named function expression", function () { - return import(/* webpackChunkName: "d" */ "./d").then(({ default: d }) => { - d(); - }); -}); - -it("should compile default export unnamed class declaration", function () { - return import(/* webpackChunkName: "e" */ "./e").then(({ default: E }) => { - new E(); - }); -}); - -it("should compile default export unnamed class expression", function () { - return import(/* webpackChunkName: "f" */ "./f").then(({ default: F }) => { - new F(); - }); -}); - -it("should compile default export named class declaration", function () { - return import(/* webpackChunkName: "g" */ "./g").then(({ default: G }) => { - new G(); - }); -}); - -it("should compile default export named class expression", function () { - return import(/* webpackChunkName: "h" */ "./h").then(({ default: H }) => { - new H(); - }); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-7318/index.js b/packages/rspack/tests/cases/parsing/issue-7318/index.js deleted file mode 100644 index b99c69468033..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-7318/index.js +++ /dev/null @@ -1,5 +0,0 @@ -const type = require("./typeof"); - -it("should not output invalid code", () => { - expect(type).toBe("number"); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-7318/typeof.js b/packages/rspack/tests/cases/parsing/issue-7318/typeof.js deleted file mode 100644 index b820a93bcb0f..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-7318/typeof.js +++ /dev/null @@ -1,2 +0,0 @@ -typeof 1; -module.exports = "number"; diff --git a/packages/rspack/tests/cases/parsing/issue-7335/a.js b/packages/rspack/tests/cases/parsing/issue-7335/a.js deleted file mode 100644 index 2cf44cad69a8..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-7335/a.js +++ /dev/null @@ -1 +0,0 @@ -export default 9; diff --git a/packages/rspack/tests/cases/parsing/issue-7335/index.js b/packages/rspack/tests/cases/parsing/issue-7335/index.js deleted file mode 100644 index d094c68c6312..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-7335/index.js +++ /dev/null @@ -1,35 +0,0 @@ -import x from "./a"; - -const sum1 = (x, y, total = x + y) => total; -const id1 = (a = x) => a; - -function sum2(x, y, total = x + y) { - return total; -} -function id2(a = x) { - return a; -} - -const sum3 = function (x, y, total = x + y) { - return total; -}; -const id3 = function (a = x) { - return a; -}; - -it("should shadow imported bindings", () => { - // Arrow functions - expect(sum1(2, 3)).toBe(5); - expect(id1(1)).toBe(1); - expect(id1()).toBe(9); - - // Function declarations - expect(sum2(2, 3)).toBe(5); - expect(id2(1)).toBe(1); - expect(id2()).toBe(9); - - // Function expressions - expect(sum3(2, 3)).toBe(5); - expect(id3(1)).toBe(1); - expect(id3()).toBe(9); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-7519/a.js b/packages/rspack/tests/cases/parsing/issue-7519/a.js deleted file mode 100644 index 2e42f0590718..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-7519/a.js +++ /dev/null @@ -1,20 +0,0 @@ -export let count = 1; - -export function inc() { - count++; -} - -export function incTruthy() { - count++; - return true; -} - -export function mult(n) { - count *= n; -} - -export function setCount(c) { - count = c; -} - -// export const multUsed = __webpack_exports_info__.mult.used; diff --git a/packages/rspack/tests/cases/parsing/issue-7519/index.js b/packages/rspack/tests/cases/parsing/issue-7519/index.js deleted file mode 100644 index 44bccf6e13ef..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-7519/index.js +++ /dev/null @@ -1,38 +0,0 @@ -import { - count, - mult, - inc, - incTruthy, - setCount, - // multUsed, - incUsed -} from "./a"; - -it("logical 'and' should work", () => { - setCount(1); - inc() && "true" && 0 && mult(2); - expect(count).toBe(2); - inc() && false && mult(2); - expect(count).toBe(3); - true && inc() && inc() && false && mult(2); - /* inc itself returns undefined */ - expect(count).toBe(4); - true && incTruthy() && incTruthy() && false && mult(2); - expect(count).toBe(6); -}); - -it("logical 'or' should work", () => { - setCount(1); - false || "" || inc(); - expect(count).toBe(2); - (0 || "" || inc() || inc()) && false && mult(2); - expect(count).toBe(4); -}); - -it("mult should not be used", () => { - if (inc() && true && false) { - mult(2); - } - - // expect(multUsed).toBe(false); -}); diff --git a/packages/rspack/tests/cases/parsing/issue-7519/test.filter.js b/packages/rspack/tests/cases/parsing/issue-7519/test.filter.js deleted file mode 100644 index 49ac5066bb84..000000000000 --- a/packages/rspack/tests/cases/parsing/issue-7519/test.filter.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (config) { - return config.mode !== "development"; -}; diff --git a/packages/rspack/tests/cases/parsing/issue-4357/a.js b/packages/rspack/tests/cases/parsing/rspack-issue-4643/a.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-4357/a.js rename to packages/rspack/tests/cases/parsing/rspack-issue-4643/a.js diff --git a/packages/rspack/tests/cases/parsing/issue-4643/b.js b/packages/rspack/tests/cases/parsing/rspack-issue-4643/b.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-4643/b.js rename to packages/rspack/tests/cases/parsing/rspack-issue-4643/b.js diff --git a/packages/rspack/tests/cases/parsing/issue-4643/c.js b/packages/rspack/tests/cases/parsing/rspack-issue-4643/c.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-4643/c.js rename to packages/rspack/tests/cases/parsing/rspack-issue-4643/c.js diff --git a/packages/rspack/tests/cases/parsing/issue-4643/d.js b/packages/rspack/tests/cases/parsing/rspack-issue-4643/d.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-4643/d.js rename to packages/rspack/tests/cases/parsing/rspack-issue-4643/d.js diff --git a/packages/rspack/tests/cases/parsing/issue-4643/e.js b/packages/rspack/tests/cases/parsing/rspack-issue-4643/e.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-4643/e.js rename to packages/rspack/tests/cases/parsing/rspack-issue-4643/e.js diff --git a/packages/rspack/tests/cases/parsing/issue-4643/index.js b/packages/rspack/tests/cases/parsing/rspack-issue-4643/index.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-4643/index.js rename to packages/rspack/tests/cases/parsing/rspack-issue-4643/index.js diff --git a/packages/rspack/tests/cases/parsing/issue-4643/a.js b/packages/rspack/tests/cases/parsing/rspack-issue-4816/a.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-4643/a.js rename to packages/rspack/tests/cases/parsing/rspack-issue-4816/a.js diff --git a/packages/rspack/tests/cases/parsing/issue-4816/b.js b/packages/rspack/tests/cases/parsing/rspack-issue-4816/b.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-4816/b.js rename to packages/rspack/tests/cases/parsing/rspack-issue-4816/b.js diff --git a/packages/rspack/tests/cases/parsing/issue-4816/index.js b/packages/rspack/tests/cases/parsing/rspack-issue-4816/index.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-4816/index.js rename to packages/rspack/tests/cases/parsing/rspack-issue-4816/index.js diff --git a/packages/rspack/tests/cases/parsing/issue-4816/regexp/a.filtered.js b/packages/rspack/tests/cases/parsing/rspack-issue-4816/regexp/a.filtered.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-4816/regexp/a.filtered.js rename to packages/rspack/tests/cases/parsing/rspack-issue-4816/regexp/a.filtered.js diff --git a/packages/rspack/tests/cases/parsing/issue-4816/regexp/a.js b/packages/rspack/tests/cases/parsing/rspack-issue-4816/regexp/a.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-4816/regexp/a.js rename to packages/rspack/tests/cases/parsing/rspack-issue-4816/regexp/a.js diff --git a/packages/rspack/tests/cases/parsing/issue-5120-binding/errors.js b/packages/rspack/tests/cases/parsing/rspack-issue-5120-binding/errors.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-5120-binding/errors.js rename to packages/rspack/tests/cases/parsing/rspack-issue-5120-binding/errors.js diff --git a/packages/rspack/tests/cases/parsing/issue-5120-binding/fail.js b/packages/rspack/tests/cases/parsing/rspack-issue-5120-binding/fail.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-5120-binding/fail.js rename to packages/rspack/tests/cases/parsing/rspack-issue-5120-binding/fail.js diff --git a/packages/rspack/tests/cases/parsing/issue-5120-binding/index.js b/packages/rspack/tests/cases/parsing/rspack-issue-5120-binding/index.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-5120-binding/index.js rename to packages/rspack/tests/cases/parsing/rspack-issue-5120-binding/index.js diff --git a/packages/rspack/tests/cases/parsing/issue-5120-binding/webpack.config.js b/packages/rspack/tests/cases/parsing/rspack-issue-5120-binding/webpack.config.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-5120-binding/webpack.config.js rename to packages/rspack/tests/cases/parsing/rspack-issue-5120-binding/webpack.config.js diff --git a/packages/rspack/tests/cases/parsing/issue-5120-strict-block/errors.js b/packages/rspack/tests/cases/parsing/rspack-issue-5120-strict-block/errors.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-5120-strict-block/errors.js rename to packages/rspack/tests/cases/parsing/rspack-issue-5120-strict-block/errors.js diff --git a/packages/rspack/tests/cases/parsing/issue-5120-strict-block/fail.js b/packages/rspack/tests/cases/parsing/rspack-issue-5120-strict-block/fail.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-5120-strict-block/fail.js rename to packages/rspack/tests/cases/parsing/rspack-issue-5120-strict-block/fail.js diff --git a/packages/rspack/tests/cases/parsing/issue-5120-strict-block/index.js b/packages/rspack/tests/cases/parsing/rspack-issue-5120-strict-block/index.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-5120-strict-block/index.js rename to packages/rspack/tests/cases/parsing/rspack-issue-5120-strict-block/index.js diff --git a/packages/rspack/tests/cases/parsing/issue-5120-strict-block/webpack.config.js b/packages/rspack/tests/cases/parsing/rspack-issue-5120-strict-block/webpack.config.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-5120-strict-block/webpack.config.js rename to packages/rspack/tests/cases/parsing/rspack-issue-5120-strict-block/webpack.config.js diff --git a/packages/rspack/tests/cases/parsing/issue-5120-strict/errors.js b/packages/rspack/tests/cases/parsing/rspack-issue-5120-strict/errors.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-5120-strict/errors.js rename to packages/rspack/tests/cases/parsing/rspack-issue-5120-strict/errors.js diff --git a/packages/rspack/tests/cases/parsing/issue-5120-strict/fail.js b/packages/rspack/tests/cases/parsing/rspack-issue-5120-strict/fail.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-5120-strict/fail.js rename to packages/rspack/tests/cases/parsing/rspack-issue-5120-strict/fail.js diff --git a/packages/rspack/tests/cases/parsing/issue-5120-strict/index.js b/packages/rspack/tests/cases/parsing/rspack-issue-5120-strict/index.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-5120-strict/index.js rename to packages/rspack/tests/cases/parsing/rspack-issue-5120-strict/index.js diff --git a/packages/rspack/tests/cases/parsing/issue-5120-strict/webpack.config.js b/packages/rspack/tests/cases/parsing/rspack-issue-5120-strict/webpack.config.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-5120-strict/webpack.config.js rename to packages/rspack/tests/cases/parsing/rspack-issue-5120-strict/webpack.config.js diff --git a/packages/rspack/tests/cases/parsing/issue-5120-var/index.js b/packages/rspack/tests/cases/parsing/rspack-issue-5120-var/index.js similarity index 100% rename from packages/rspack/tests/cases/parsing/issue-5120-var/index.js rename to packages/rspack/tests/cases/parsing/rspack-issue-5120-var/index.js diff --git a/packages/rspack/tests/cases/parsing/webpack-is-included/index.js b/packages/rspack/tests/cases/parsing/webpack-is-included/index.js deleted file mode 100644 index 4ba18efb2862..000000000000 --- a/packages/rspack/tests/cases/parsing/webpack-is-included/index.js +++ /dev/null @@ -1,20 +0,0 @@ -import "./module1"; -import { - isWebpackIncludedFunction, - used, - unused, - notPresented -} from "./module2"; - -it("__webpack_is_included__ should be a function", () => { - expect(isWebpackIncludedFunction).toBe(true); -}); - -it("__webpack_is_included__ should be true for bundled modules, otherwise false", () => { - expect(used).toBe(true); - expect(unused).toBe(false); -}); - -it("__webpack_is_included__ should return false for missing module", () => { - expect(notPresented).toBe(false); -}); diff --git a/packages/rspack/tests/cases/parsing/webpack-is-included/module1.js b/packages/rspack/tests/cases/parsing/webpack-is-included/module1.js deleted file mode 100644 index 0ed3b5ff348d..000000000000 --- a/packages/rspack/tests/cases/parsing/webpack-is-included/module1.js +++ /dev/null @@ -1 +0,0 @@ -import "./moduleUsed"; diff --git a/packages/rspack/tests/cases/parsing/webpack-is-included/module2.js b/packages/rspack/tests/cases/parsing/webpack-is-included/module2.js deleted file mode 100644 index 9be23d6d0800..000000000000 --- a/packages/rspack/tests/cases/parsing/webpack-is-included/module2.js +++ /dev/null @@ -1,5 +0,0 @@ -export const isWebpackIncludedFunction = - typeof __webpack_is_included__ === "function"; -export const unused = __webpack_is_included__("./moduleUnused"); -export const used = __webpack_is_included__("./moduleUsed"); -export const notPresented = __webpack_is_included__("./anyOtherModule"); diff --git a/packages/rspack/tests/cases/parsing/webpack-is-included/moduleUnused.js b/packages/rspack/tests/cases/parsing/webpack-is-included/moduleUnused.js deleted file mode 100644 index 368db0f467aa..000000000000 --- a/packages/rspack/tests/cases/parsing/webpack-is-included/moduleUnused.js +++ /dev/null @@ -1,2 +0,0 @@ -export default 2; -console.log.bind(); diff --git a/packages/rspack/tests/cases/parsing/webpack-is-included/moduleUsed.js b/packages/rspack/tests/cases/parsing/webpack-is-included/moduleUsed.js deleted file mode 100644 index 6c85825693b9..000000000000 --- a/packages/rspack/tests/cases/parsing/webpack-is-included/moduleUsed.js +++ /dev/null @@ -1,2 +0,0 @@ -export default 1; -console.log.bind(); diff --git a/packages/rspack/tests/cases/wasm/decoding/index.js b/packages/rspack/tests/cases/wasm/decoding/index.js deleted file mode 100644 index a474538bae52..000000000000 --- a/packages/rspack/tests/cases/wasm/decoding/index.js +++ /dev/null @@ -1,15 +0,0 @@ -it("should support wasm compiled from c++", function () { - return import("./memory3.wasm").then(function (wasm) { - expect(wasm._Z3getv()).toBe(0); - wasm._Z3seti(42); - expect(wasm._Z3getv()).toBe(42); - }); -}); - -it("should raw memory export without data", function () { - return import("./memory2.wasm").then(function (wasm) { - expect(wasm.memory).toBeInstanceOf(WebAssembly.Memory); - expect(wasm.memory.buffer).toBeInstanceOf(ArrayBuffer); - expect(wasm.memory.buffer.byteLength).toBe(1 << 16); - }); -}); diff --git a/packages/rspack/tests/cases/wasm/decoding/memory2.wasm b/packages/rspack/tests/cases/wasm/decoding/memory2.wasm deleted file mode 100644 index 654daf1d9b03..000000000000 Binary files a/packages/rspack/tests/cases/wasm/decoding/memory2.wasm and /dev/null differ diff --git a/packages/rspack/tests/cases/wasm/decoding/memory3.wasm b/packages/rspack/tests/cases/wasm/decoding/memory3.wasm deleted file mode 100644 index 0c2ca20c8852..000000000000 Binary files a/packages/rspack/tests/cases/wasm/decoding/memory3.wasm and /dev/null differ diff --git a/packages/rspack/tests/cases/wasm/decoding/webpack.config.js b/packages/rspack/tests/cases/wasm/decoding/webpack.config.js deleted file mode 100644 index 7f2fb31ed802..000000000000 --- a/packages/rspack/tests/cases/wasm/decoding/webpack.config.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - output: { - wasmLoading: "async-node" - }, - experiments: { - asyncWebAssembly: true - } -}; diff --git a/packages/rspack/tests/cases/wasm/export-imported-global/env.js b/packages/rspack/tests/cases/wasm/export-imported-global/env.js deleted file mode 100644 index 184f8f266e6f..000000000000 --- a/packages/rspack/tests/cases/wasm/export-imported-global/env.js +++ /dev/null @@ -1,2 +0,0 @@ -export const n = 1; -export const m = 1.25; diff --git a/packages/rspack/tests/cases/wasm/export-imported-global/index.js b/packages/rspack/tests/cases/wasm/export-imported-global/index.js deleted file mode 100644 index 2c1144676b78..000000000000 --- a/packages/rspack/tests/cases/wasm/export-imported-global/index.js +++ /dev/null @@ -1,18 +0,0 @@ -it("should export imported global", function () { - return import("./module").then(function ({ v, w, x, test }) { - if (WebAssembly.Global) { - expect(v.constructor).toBe(WebAssembly.Global); - expect(w.constructor).toBe(WebAssembly.Global); - expect(x.constructor).toBe(WebAssembly.Global); - - expect(+v).toBe(1); - expect(+w).toBe(1); - expect(+x).toBe(1.25); - } else { - expect(v).toBe(1); - expect(w).toBe(1); - expect(x).toBe(1.25); - } - expect(test()).toBe(2); - }); -}); diff --git a/packages/rspack/tests/cases/wasm/export-imported-global/module.js b/packages/rspack/tests/cases/wasm/export-imported-global/module.js deleted file mode 100644 index bd82c8f8b1c5..000000000000 --- a/packages/rspack/tests/cases/wasm/export-imported-global/module.js +++ /dev/null @@ -1 +0,0 @@ -export * from "./module.wat"; diff --git a/packages/rspack/tests/cases/wasm/export-imported-global/module.wat b/packages/rspack/tests/cases/wasm/export-imported-global/module.wat deleted file mode 100644 index c20daa398645..000000000000 --- a/packages/rspack/tests/cases/wasm/export-imported-global/module.wat +++ /dev/null @@ -1,17 +0,0 @@ -(module - (import "./env.js" "n" (global i32)) - (import "./env.js" "m" (global $g2 f64)) - (export "v" (global 0)) - (global $g i32 (get_global 0)) - (export "w" (global $g)) - (export "x" (global $g2)) - (func (export "test") (result i32) - get_global $g2 - get_global $g2 - f64.add - drop - get_global 0 - get_global $g - i32.add - ) -) diff --git a/packages/rspack/tests/cases/wasm/export-imported-global/webpack.config.js b/packages/rspack/tests/cases/wasm/export-imported-global/webpack.config.js deleted file mode 100644 index a99ddacbe43b..000000000000 --- a/packages/rspack/tests/cases/wasm/export-imported-global/webpack.config.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = { - output: { - wasmLoading: "async-node" - }, - module: { - rules: [ - { - test: /\.wat$/, - use: "wast-loader", - type: "webassembly/async" - } - ] - }, - experiments: { - asyncWebAssembly: true - } -}; diff --git a/packages/rspack/tests/cases/wasm/global-refs-imported-global/env.js b/packages/rspack/tests/cases/wasm/global-refs-imported-global/env.js deleted file mode 100644 index 3d521168145b..000000000000 --- a/packages/rspack/tests/cases/wasm/global-refs-imported-global/env.js +++ /dev/null @@ -1 +0,0 @@ -export const n = 33; diff --git a/packages/rspack/tests/cases/wasm/global-refs-imported-global/index.js b/packages/rspack/tests/cases/wasm/global-refs-imported-global/index.js deleted file mode 100644 index 890d98169c17..000000000000 --- a/packages/rspack/tests/cases/wasm/global-refs-imported-global/index.js +++ /dev/null @@ -1,5 +0,0 @@ -it("should allow global with imported global as initializer", function () { - return import("./module.wat").then(function ({ get }) { - expect(get()).toEqual(33); - }); -}); diff --git a/packages/rspack/tests/cases/wasm/global-refs-imported-global/module.wat b/packages/rspack/tests/cases/wasm/global-refs-imported-global/module.wat deleted file mode 100644 index eb1ea8c6f6a5..000000000000 --- a/packages/rspack/tests/cases/wasm/global-refs-imported-global/module.wat +++ /dev/null @@ -1,9 +0,0 @@ -(module - (import "./env.js" "n" (global i32)) - (global i32 (get_global 0)) - - (func (export "get") (result i32) - (get_global 1) - ) -) - diff --git a/packages/rspack/tests/cases/wasm/global-refs-imported-global/webpack.config.js b/packages/rspack/tests/cases/wasm/global-refs-imported-global/webpack.config.js deleted file mode 100644 index a99ddacbe43b..000000000000 --- a/packages/rspack/tests/cases/wasm/global-refs-imported-global/webpack.config.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = { - output: { - wasmLoading: "async-node" - }, - module: { - rules: [ - { - test: /\.wat$/, - use: "wast-loader", - type: "webassembly/async" - } - ] - }, - experiments: { - asyncWebAssembly: true - } -}; diff --git a/packages/rspack/tests/cases/wasm/import-wasm-wasm/index.js b/packages/rspack/tests/cases/wasm/import-wasm-wasm/index.js deleted file mode 100644 index a51e3556518e..000000000000 --- a/packages/rspack/tests/cases/wasm/import-wasm-wasm/index.js +++ /dev/null @@ -1,6 +0,0 @@ -it("should allow to run a WebAssembly module with imports", function () { - return import("./wasm.wat").then(function (wasm) { - const result = wasm.addNumber(20); - expect(result).toEqual(42); - }); -}); diff --git a/packages/rspack/tests/cases/wasm/import-wasm-wasm/wasm.wat b/packages/rspack/tests/cases/wasm/import-wasm-wasm/wasm.wat deleted file mode 100644 index 3c9f7ca0f83d..000000000000 --- a/packages/rspack/tests/cases/wasm/import-wasm-wasm/wasm.wat +++ /dev/null @@ -1,9 +0,0 @@ -(module - (type $t0 (func (result i32))) - (type $t1 (func (param i32) (result i32))) - (import "./wasm2.wat" "getNumber" (func $./wasm2.wasm.getNumber (type $t0))) - (func $addNumber (export "addNumber") (type $t1) (param $p0 i32) (result i32) - (i32.add - (get_local $p0) - (call $./wasm2.wasm.getNumber)))) - diff --git a/packages/rspack/tests/cases/wasm/import-wasm-wasm/wasm2.wat b/packages/rspack/tests/cases/wasm/import-wasm-wasm/wasm2.wat deleted file mode 100644 index 0331fb4fc153..000000000000 --- a/packages/rspack/tests/cases/wasm/import-wasm-wasm/wasm2.wat +++ /dev/null @@ -1,5 +0,0 @@ -(module - (type $t0 (func (result i32))) - (func $getNumber (export "getNumber") (type $t0) (result i32) - (i32.const 22))) - diff --git a/packages/rspack/tests/cases/wasm/import-wasm-wasm/webpack.config.js b/packages/rspack/tests/cases/wasm/import-wasm-wasm/webpack.config.js deleted file mode 100644 index a99ddacbe43b..000000000000 --- a/packages/rspack/tests/cases/wasm/import-wasm-wasm/webpack.config.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = { - output: { - wasmLoading: "async-node" - }, - module: { - rules: [ - { - test: /\.wat$/, - use: "wast-loader", - type: "webassembly/async" - } - ] - }, - experiments: { - asyncWebAssembly: true - } -}; diff --git a/packages/rspack/tests/cases/wasm/imported-global-preserve-ordering/env.js b/packages/rspack/tests/cases/wasm/imported-global-preserve-ordering/env.js deleted file mode 100644 index 72ab60e17a25..000000000000 --- a/packages/rspack/tests/cases/wasm/imported-global-preserve-ordering/env.js +++ /dev/null @@ -1,2 +0,0 @@ -export const a = 1; -export const b = 2; diff --git a/packages/rspack/tests/cases/wasm/imported-global-preserve-ordering/index.js b/packages/rspack/tests/cases/wasm/imported-global-preserve-ordering/index.js deleted file mode 100644 index 1dde476df15e..000000000000 --- a/packages/rspack/tests/cases/wasm/imported-global-preserve-ordering/index.js +++ /dev/null @@ -1,14 +0,0 @@ -it("should preserve the ordering of globals", function () { - return import("./module.wat").then(function (e) { - if (WebAssembly.Global) { - expect(e.c.constructor).toBe(WebAssembly.Global); - expect(e.d.constructor).toBe(WebAssembly.Global); - - expect(+e.c).toBe(3); - expect(+e.d).toBe(4); - } else { - expect(e.c).toBe(3); - expect(e.d).toBe(4); - } - }); -}); diff --git a/packages/rspack/tests/cases/wasm/imported-global-preserve-ordering/module.wat b/packages/rspack/tests/cases/wasm/imported-global-preserve-ordering/module.wat deleted file mode 100644 index 091f353ce33f..000000000000 --- a/packages/rspack/tests/cases/wasm/imported-global-preserve-ordering/module.wat +++ /dev/null @@ -1,10 +0,0 @@ -(module - (import "./env.js" "a" (global i32)) - (import "./env.js" "b" (global i32)) - - (global $c i32 (i32.const 3)) - (global $d i32 (i32.const 4)) - - (export "c" (global $c)) - (export "d" (global $d)) -) diff --git a/packages/rspack/tests/cases/wasm/imported-global-preserve-ordering/webpack.config.js b/packages/rspack/tests/cases/wasm/imported-global-preserve-ordering/webpack.config.js deleted file mode 100644 index a99ddacbe43b..000000000000 --- a/packages/rspack/tests/cases/wasm/imported-global-preserve-ordering/webpack.config.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = { - output: { - wasmLoading: "async-node" - }, - module: { - rules: [ - { - test: /\.wat$/, - use: "wast-loader", - type: "webassembly/async" - } - ] - }, - experiments: { - asyncWebAssembly: true - } -}; diff --git a/packages/rspack/tests/cases/wasm/imported-global-preserve-type/env.js b/packages/rspack/tests/cases/wasm/imported-global-preserve-type/env.js deleted file mode 100644 index 14c6d09efedf..000000000000 --- a/packages/rspack/tests/cases/wasm/imported-global-preserve-type/env.js +++ /dev/null @@ -1 +0,0 @@ -export const number = 0xffffffffff; diff --git a/packages/rspack/tests/cases/wasm/imported-global-preserve-type/index.js b/packages/rspack/tests/cases/wasm/imported-global-preserve-type/index.js deleted file mode 100644 index 7f33d37dac71..000000000000 --- a/packages/rspack/tests/cases/wasm/imported-global-preserve-type/index.js +++ /dev/null @@ -1,5 +0,0 @@ -it("should preserve the valtype of the imported global", function () { - return import("./module.wat").then(function ({ get }) { - expect(get()).toBe(0xffffffffff); - }); -}); diff --git a/packages/rspack/tests/cases/wasm/imported-global-preserve-type/module.wat b/packages/rspack/tests/cases/wasm/imported-global-preserve-type/module.wat deleted file mode 100644 index e8a590fe6ace..000000000000 --- a/packages/rspack/tests/cases/wasm/imported-global-preserve-type/module.wat +++ /dev/null @@ -1,7 +0,0 @@ -(module - (import "./env.js" "number" (global f64)) - - (func (export "get") (result f64) - (get_global 0) - ) -) diff --git a/packages/rspack/tests/cases/wasm/imported-global-preserve-type/webpack.config.js b/packages/rspack/tests/cases/wasm/imported-global-preserve-type/webpack.config.js deleted file mode 100644 index a99ddacbe43b..000000000000 --- a/packages/rspack/tests/cases/wasm/imported-global-preserve-type/webpack.config.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = { - output: { - wasmLoading: "async-node" - }, - module: { - rules: [ - { - test: /\.wat$/, - use: "wast-loader", - type: "webassembly/async" - } - ] - }, - experiments: { - asyncWebAssembly: true - } -}; diff --git a/packages/rspack/tests/cases/wasm/imports-circular/index.js b/packages/rspack/tests/cases/wasm/imports-circular/index.js deleted file mode 100644 index 0112e6219180..000000000000 --- a/packages/rspack/tests/cases/wasm/imports-circular/index.js +++ /dev/null @@ -1,5 +0,0 @@ -it("should allow to run a WebAssembly module importing JS circular", function () { - return import("./module").then(function (mod) { - expect(mod.result).toBe(42); - }); -}); diff --git a/packages/rspack/tests/cases/wasm/imports-circular/module.js b/packages/rspack/tests/cases/wasm/imports-circular/module.js deleted file mode 100644 index eeede2a5a03a..000000000000 --- a/packages/rspack/tests/cases/wasm/imports-circular/module.js +++ /dev/null @@ -1,7 +0,0 @@ -import { addNumber } from "./wasm.wat"; - -export var result = addNumber(22); - -export function getNumber() { - return 20; -} diff --git a/packages/rspack/tests/cases/wasm/imports-circular/wasm.wat b/packages/rspack/tests/cases/wasm/imports-circular/wasm.wat deleted file mode 100644 index 2cf1e2f1c61c..000000000000 --- a/packages/rspack/tests/cases/wasm/imports-circular/wasm.wat +++ /dev/null @@ -1,9 +0,0 @@ -(module - (type $t0 (func (result i32))) - (type $t1 (func (param i32) (result i32))) - (import "./module" "getNumber" (func $./module.getNumber (type $t0))) - (func $addNumber (export "addNumber") (type $t1) (param $p0 i32) (result i32) - (i32.add - (get_local $p0) - (call $./module.getNumber)))) - diff --git a/packages/rspack/tests/cases/wasm/imports-circular/webpack.config.js b/packages/rspack/tests/cases/wasm/imports-circular/webpack.config.js deleted file mode 100644 index a99ddacbe43b..000000000000 --- a/packages/rspack/tests/cases/wasm/imports-circular/webpack.config.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = { - output: { - wasmLoading: "async-node" - }, - module: { - rules: [ - { - test: /\.wat$/, - use: "wast-loader", - type: "webassembly/async" - } - ] - }, - experiments: { - asyncWebAssembly: true - } -}; diff --git a/packages/rspack/tests/cases/wasm/imports-many-direct/index.js b/packages/rspack/tests/cases/wasm/imports-many-direct/index.js deleted file mode 100644 index 9c76ebbc29f4..000000000000 --- a/packages/rspack/tests/cases/wasm/imports-many-direct/index.js +++ /dev/null @@ -1,6 +0,0 @@ -it("should allow to run a WebAssembly module with many direct wasm dependencies", function () { - return import("./wasm.wat").then(function (wasm) { - const result = wasm.testI64(); - expect(result).toEqual(42); - }); -}); diff --git a/packages/rspack/tests/cases/wasm/imports-many-direct/other1.wat b/packages/rspack/tests/cases/wasm/imports-many-direct/other1.wat deleted file mode 100644 index 34e5244de57a..000000000000 --- a/packages/rspack/tests/cases/wasm/imports-many-direct/other1.wat +++ /dev/null @@ -1,7 +0,0 @@ -(module - (type $t0 (func (param i64) (result i64))) - (func $getI64 (type $t0) (param $p0 i64) (result i64) - get_local $p0 - i64.const 20 - i64.add) - (export "getI64" (func $getI64))) diff --git a/packages/rspack/tests/cases/wasm/imports-many-direct/other2.wat b/packages/rspack/tests/cases/wasm/imports-many-direct/other2.wat deleted file mode 100644 index cffc26b9a1fd..000000000000 --- a/packages/rspack/tests/cases/wasm/imports-many-direct/other2.wat +++ /dev/null @@ -1,7 +0,0 @@ -(module - (type $t0 (func (param i64) (result i64))) - (func $getI64 (type $t0) (param $p0 i64) (result i64) - get_local $p0 - i64.const 22 - i64.add) - (export "getI64" (func $getI64))) diff --git a/packages/rspack/tests/cases/wasm/imports-many-direct/wasm.wat b/packages/rspack/tests/cases/wasm/imports-many-direct/wasm.wat deleted file mode 100644 index 8657746e381f..000000000000 --- a/packages/rspack/tests/cases/wasm/imports-many-direct/wasm.wat +++ /dev/null @@ -1,13 +0,0 @@ -(module - (type $t0 (func (param i64) (result i64))) - (type $t1 (func (result i32))) - (import "./other1.wat" "getI64" (func $getI641 (type $t0))) - (import "./other2.wat" "getI64" (func $getI642 (type $t0))) - (func $testI64 (type $t1) (result i32) - i64.const 1152921504606846976 - call $getI641 - call $getI642 - i64.const 1152921504606846976 - i64.sub - i32.wrap/i64) - (export "testI64" (func $testI64))) diff --git a/packages/rspack/tests/cases/wasm/imports-many-direct/webpack.config.js b/packages/rspack/tests/cases/wasm/imports-many-direct/webpack.config.js deleted file mode 100644 index a99ddacbe43b..000000000000 --- a/packages/rspack/tests/cases/wasm/imports-many-direct/webpack.config.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = { - output: { - wasmLoading: "async-node" - }, - module: { - rules: [ - { - test: /\.wat$/, - use: "wast-loader", - type: "webassembly/async" - } - ] - }, - experiments: { - asyncWebAssembly: true - } -}; diff --git a/packages/rspack/tests/cases/wasm/imports-multiple/index.js b/packages/rspack/tests/cases/wasm/imports-multiple/index.js deleted file mode 100644 index 5667add55b04..000000000000 --- a/packages/rspack/tests/cases/wasm/imports-multiple/index.js +++ /dev/null @@ -1,5 +0,0 @@ -it("should allow to run a WebAssembly module importing from multiple modules", function () { - return import("./module").then(function (mod) { - expect(mod.result).toBe(42); - }); -}); diff --git a/packages/rspack/tests/cases/wasm/imports-multiple/module.js b/packages/rspack/tests/cases/wasm/imports-multiple/module.js deleted file mode 100644 index deccad21fe43..000000000000 --- a/packages/rspack/tests/cases/wasm/imports-multiple/module.js +++ /dev/null @@ -1,7 +0,0 @@ -import { getResult } from "./wasm.wasm"; - -export var result = getResult(1); - -export function getNumber() { - return 20; -} diff --git a/packages/rspack/tests/cases/wasm/imports-multiple/module2.js b/packages/rspack/tests/cases/wasm/imports-multiple/module2.js deleted file mode 100644 index 60b7eac0eaba..000000000000 --- a/packages/rspack/tests/cases/wasm/imports-multiple/module2.js +++ /dev/null @@ -1,5 +0,0 @@ -import { getNumber as getN } from "./wasm.wasm"; - -export function getNumber() { - return getN(); -} diff --git a/packages/rspack/tests/cases/wasm/imports-multiple/wasm.wasm b/packages/rspack/tests/cases/wasm/imports-multiple/wasm.wasm deleted file mode 100644 index 19fef4041f6c..000000000000 Binary files a/packages/rspack/tests/cases/wasm/imports-multiple/wasm.wasm and /dev/null differ diff --git a/packages/rspack/tests/cases/wasm/imports-multiple/webpack.config.js b/packages/rspack/tests/cases/wasm/imports-multiple/webpack.config.js deleted file mode 100644 index 7f2fb31ed802..000000000000 --- a/packages/rspack/tests/cases/wasm/imports-multiple/webpack.config.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - output: { - wasmLoading: "async-node" - }, - experiments: { - asyncWebAssembly: true - } -}; diff --git a/packages/rspack/tests/cases/wasm/imports/index.js b/packages/rspack/tests/cases/wasm/imports/index.js deleted file mode 100644 index 5ed3f4cb3b75..000000000000 --- a/packages/rspack/tests/cases/wasm/imports/index.js +++ /dev/null @@ -1,6 +0,0 @@ -it("should allow to run a WebAssembly module with imports", function () { - return import("./wasm.wat?1").then(function (wasm) { - const result = wasm.addNumber(3); - expect(result).toEqual(11); - }); -}); diff --git a/packages/rspack/tests/cases/wasm/imports/module.js b/packages/rspack/tests/cases/wasm/imports/module.js deleted file mode 100644 index 7eaa835a37cd..000000000000 --- a/packages/rspack/tests/cases/wasm/imports/module.js +++ /dev/null @@ -1,3 +0,0 @@ -export function getNumber() { - return 8; -} diff --git a/packages/rspack/tests/cases/wasm/imports/wasm.wat b/packages/rspack/tests/cases/wasm/imports/wasm.wat deleted file mode 100644 index 2cf1e2f1c61c..000000000000 --- a/packages/rspack/tests/cases/wasm/imports/wasm.wat +++ /dev/null @@ -1,9 +0,0 @@ -(module - (type $t0 (func (result i32))) - (type $t1 (func (param i32) (result i32))) - (import "./module" "getNumber" (func $./module.getNumber (type $t0))) - (func $addNumber (export "addNumber") (type $t1) (param $p0 i32) (result i32) - (i32.add - (get_local $p0) - (call $./module.getNumber)))) - diff --git a/packages/rspack/tests/cases/wasm/imports/webpack.config.js b/packages/rspack/tests/cases/wasm/imports/webpack.config.js deleted file mode 100644 index a99ddacbe43b..000000000000 --- a/packages/rspack/tests/cases/wasm/imports/webpack.config.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = { - output: { - wasmLoading: "async-node" - }, - module: { - rules: [ - { - test: /\.wat$/, - use: "wast-loader", - type: "webassembly/async" - } - ] - }, - experiments: { - asyncWebAssembly: true - } -}; diff --git a/packages/rspack/tests/cases/wasm/memory/index.js b/packages/rspack/tests/cases/wasm/memory/index.js deleted file mode 100644 index 5a0068e97757..000000000000 --- a/packages/rspack/tests/cases/wasm/memory/index.js +++ /dev/null @@ -1,8 +0,0 @@ -it("should allow direct memory connection between wasm modules", function () { - return import("./run").then(function (module) { - expect(module.x1).toBe(42); - expect(module.x2).toBe(42); - expect(module.y1).toBe(11); - expect(module.y2).toBe(11); - }); -}); diff --git a/packages/rspack/tests/cases/wasm/memory/mem-access.wat b/packages/rspack/tests/cases/wasm/memory/mem-access.wat deleted file mode 100644 index 508708243317..000000000000 --- a/packages/rspack/tests/cases/wasm/memory/mem-access.wat +++ /dev/null @@ -1,11 +0,0 @@ -(module - (type $t0 (func (result i32))) - (type $t1 (func (param i32))) - (import "./memory.wat" "memory" (memory $./memory.wasm.memory 1)) - (func $get (export "get") (type $t0) (result i32) - (i32.load - (i32.const 0))) - (func $set (export "set") (type $t1) (param $p i32) - (i32.store - (i32.const 0) - (get_local $p)))) diff --git a/packages/rspack/tests/cases/wasm/memory/memory.wat b/packages/rspack/tests/cases/wasm/memory/memory.wat deleted file mode 100644 index c9c59eb1589c..000000000000 --- a/packages/rspack/tests/cases/wasm/memory/memory.wat +++ /dev/null @@ -1,4 +0,0 @@ -(module - (memory $memory (export "memory") 1) - (data (i32.const 12) "\00\00\00\00")) - diff --git a/packages/rspack/tests/cases/wasm/memory/run.js b/packages/rspack/tests/cases/wasm/memory/run.js deleted file mode 100644 index 618f05ebba4a..000000000000 --- a/packages/rspack/tests/cases/wasm/memory/run.js +++ /dev/null @@ -1,19 +0,0 @@ -import { set as a1Set, get as a1Get } from "./mem-access.wat?1"; -import { set as a2Set, get as a2get } from "./mem-access.wat?2"; - -a1Set(42); -export const x1 = a1Get(); -export const x2 = a2get(); -a2Set(11); -export const y1 = a1Get(); -export const y2 = a2get(); -// TODO namespace import is not align webpack -// import * as a1 from "./mem-access.wat?1"; -// import * as a2 from "./mem-access.wat?2"; - -// a1.set(42); -// export const x1 = a1.get(); -// export const x2 = a2.get(); -// a2.set(11); -// export const y1 = a1.get(); -// export const y2 = a2.get(); diff --git a/packages/rspack/tests/cases/wasm/memory/webpack.config.js b/packages/rspack/tests/cases/wasm/memory/webpack.config.js deleted file mode 100644 index a99ddacbe43b..000000000000 --- a/packages/rspack/tests/cases/wasm/memory/webpack.config.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = { - output: { - wasmLoading: "async-node" - }, - module: { - rules: [ - { - test: /\.wat$/, - use: "wast-loader", - type: "webassembly/async" - } - ] - }, - experiments: { - asyncWebAssembly: true - } -}; diff --git a/packages/rspack/tests/cases/wasm/simple/index.js b/packages/rspack/tests/cases/wasm/simple/index.js deleted file mode 100644 index 345e9f3be637..000000000000 --- a/packages/rspack/tests/cases/wasm/simple/index.js +++ /dev/null @@ -1,13 +0,0 @@ -it("should allow to run a WebAssembly module (indirect)", function () { - return import("./module").then(function (module) { - const result = module.run(); - expect(result).toEqual(42); - }); -}); - -it("should allow to run a WebAssembly module (direct)", function () { - return import("./wasm.wat?2").then(function (wasm) { - const result = wasm.add(wasm.getNumber(), 2); - expect(result).toEqual(42); - }); -}); diff --git a/packages/rspack/tests/cases/wasm/simple/module.js b/packages/rspack/tests/cases/wasm/simple/module.js deleted file mode 100644 index 75232dccede2..000000000000 --- a/packages/rspack/tests/cases/wasm/simple/module.js +++ /dev/null @@ -1,5 +0,0 @@ -import { add, getNumber } from "./wasm.wat?1"; - -export function run() { - return add(getNumber(), 2); -} diff --git a/packages/rspack/tests/cases/wasm/simple/wasm.wat b/packages/rspack/tests/cases/wasm/simple/wasm.wat deleted file mode 100644 index 477902e7f3c8..000000000000 --- a/packages/rspack/tests/cases/wasm/simple/wasm.wat +++ /dev/null @@ -1,10 +0,0 @@ -(module - (type $t0 (func (param i32 i32) (result i32))) - (type $t1 (func (result i32))) - (func $add (export "add") (type $t0) (param $p0 i32) (param $p1 i32) (result i32) - (i32.add - (get_local $p0) - (get_local $p1))) - (func $getNumber (export "getNumber") (type $t1) (result i32) - (i32.const 40))) - diff --git a/packages/rspack/tests/cases/wasm/simple/webpack.config.js b/packages/rspack/tests/cases/wasm/simple/webpack.config.js deleted file mode 100644 index a99ddacbe43b..000000000000 --- a/packages/rspack/tests/cases/wasm/simple/webpack.config.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = { - output: { - wasmLoading: "async-node" - }, - module: { - rules: [ - { - test: /\.wat$/, - use: "wast-loader", - type: "webassembly/async" - } - ] - }, - experiments: { - asyncWebAssembly: true - } -}; diff --git a/packages/rspack/tests/cases/wasm/table/index.js b/packages/rspack/tests/cases/wasm/table/index.js deleted file mode 100644 index 856c6acc7073..000000000000 --- a/packages/rspack/tests/cases/wasm/table/index.js +++ /dev/null @@ -1,32 +0,0 @@ -// the message is inconsistency between some nodejs versions -const UNKNOWN_FUNCTION_TABLE = - /table index is out of bounds|invalid index into function table|invalid function/; - -it("should support tables", function () { - return import("./wasm-table.wat").then(function (wasm) { - expect(wasm.callByIndex(0)).toEqual(42); - expect(wasm.callByIndex(1)).toEqual(13); - expect(() => wasm.callByIndex(2)).toThrow(UNKNOWN_FUNCTION_TABLE); - }); -}); - -it("should support exported tables", function () { - return import("./wasm-table-export.wat").then(function (wasm) { - expect(wasm.table).toBeInstanceOf(WebAssembly.Table); - expect(wasm.table.length).toBe(2); - const e0 = wasm.table.get(0); - const e1 = wasm.table.get(1); - expect(e0).toBeInstanceOf(Function); - expect(e1).toBeInstanceOf(Function); - expect(e0()).toEqual(42); - expect(e1()).toEqual(13); - }); -}); - -it("should support imported tables", function () { - return import("./wasm-table-imported.wat").then(function (wasm) { - expect(wasm.callByIndex(0)).toEqual(42); - expect(wasm.callByIndex(1)).toEqual(13); - expect(() => wasm.callByIndex(2)).toThrow(UNKNOWN_FUNCTION_TABLE); - }); -}); diff --git a/packages/rspack/tests/cases/wasm/table/wasm-table-export.wat b/packages/rspack/tests/cases/wasm/table/wasm-table-export.wat deleted file mode 100644 index 1771a2b546fb..000000000000 --- a/packages/rspack/tests/cases/wasm/table/wasm-table-export.wat +++ /dev/null @@ -1,9 +0,0 @@ -(module - (type $t0 (func (result i32))) - (func $f1 (type $t0) (result i32) - (i32.const 42)) - (func $f2 (type $t0) (result i32) - (i32.const 13)) - (table $table (export "table") 2 anyfunc) - (elem (i32.const 0) $f1 $f2)) - diff --git a/packages/rspack/tests/cases/wasm/table/wasm-table-imported.wat b/packages/rspack/tests/cases/wasm/table/wasm-table-imported.wat deleted file mode 100644 index 1ccabddd1321..000000000000 --- a/packages/rspack/tests/cases/wasm/table/wasm-table-imported.wat +++ /dev/null @@ -1,8 +0,0 @@ -(module - (type $t0 (func (result i32))) - (type $t1 (func (param i32) (result i32))) - (import "./wasm-table-export.wat" "table" (table $./wasm-table-export.wasm.table 2 anyfunc)) - (func $callByIndex (export "callByIndex") (type $t1) (param $i i32) (result i32) - (call_indirect (type $t0) - (get_local $i)))) - diff --git a/packages/rspack/tests/cases/wasm/table/wasm-table.wat b/packages/rspack/tests/cases/wasm/table/wasm-table.wat deleted file mode 100644 index 6ddcde499a9c..000000000000 --- a/packages/rspack/tests/cases/wasm/table/wasm-table.wat +++ /dev/null @@ -1,14 +0,0 @@ -(module - (type $t0 (func (result i32))) - (type $t1 (func (result i32))) - (type $t2 (func (param i32) (result i32))) - (func $f0 (type $t0) (result i32) - (i32.const 42)) - (func $f1 (type $t0) (result i32) - (i32.const 13)) - (func $callByIndex (export "callByIndex") (type $t2) (param $p0 i32) (result i32) - (call_indirect (type $t1) - (get_local $p0))) - (table $T0 2 anyfunc) - (elem (i32.const 0) $f0 $f1)) - diff --git a/packages/rspack/tests/cases/wasm/table/webpack.config.js b/packages/rspack/tests/cases/wasm/table/webpack.config.js deleted file mode 100644 index a99ddacbe43b..000000000000 --- a/packages/rspack/tests/cases/wasm/table/webpack.config.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = { - output: { - wasmLoading: "async-node" - }, - module: { - rules: [ - { - test: /\.wat$/, - use: "wast-loader", - type: "webassembly/async" - } - ] - }, - experiments: { - asyncWebAssembly: true - } -}; diff --git a/packages/rspack/tests/cases/wasm/unused-export/index.js b/packages/rspack/tests/cases/wasm/unused-export/index.js deleted file mode 100644 index 0d687037270d..000000000000 --- a/packages/rspack/tests/cases/wasm/unused-export/index.js +++ /dev/null @@ -1,6 +0,0 @@ -it("should allow wasm with unused exports", function () { - return import("./module").then(function (module) { - const result = module.run(); - expect(result).toEqual(42); - }); -}); diff --git a/packages/rspack/tests/cases/wasm/unused-export/module.js b/packages/rspack/tests/cases/wasm/unused-export/module.js deleted file mode 100644 index cad01039e37f..000000000000 --- a/packages/rspack/tests/cases/wasm/unused-export/module.js +++ /dev/null @@ -1,5 +0,0 @@ -import { getNumber } from "./wasm.wat"; - -export function run() { - return getNumber(); -} diff --git a/packages/rspack/tests/cases/wasm/unused-export/wasm.wat b/packages/rspack/tests/cases/wasm/unused-export/wasm.wat deleted file mode 100644 index 3a1352710205..000000000000 --- a/packages/rspack/tests/cases/wasm/unused-export/wasm.wat +++ /dev/null @@ -1,10 +0,0 @@ -(module - (type $t0 (func (param i32 i32) (result i32))) - (type $t1 (func (result i32))) - (func $add (export "add") (type $t0) (param $p0 i32) (param $p1 i32) (result i32) - (i32.add - (get_local $p0) - (get_local $p1))) - (func $getNumber (export "getNumber") (type $t1) (result i32) - (i32.const 42))) - diff --git a/packages/rspack/tests/cases/wasm/unused-export/webpack.config.js b/packages/rspack/tests/cases/wasm/unused-export/webpack.config.js deleted file mode 100644 index a99ddacbe43b..000000000000 --- a/packages/rspack/tests/cases/wasm/unused-export/webpack.config.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = { - output: { - wasmLoading: "async-node" - }, - module: { - rules: [ - { - test: /\.wat$/, - use: "wast-loader", - type: "webassembly/async" - } - ] - }, - experiments: { - asyncWebAssembly: true - } -}; diff --git a/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/Q_rsqrt.wasm b/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/Q_rsqrt.wasm deleted file mode 100644 index e5c17c16d931..000000000000 Binary files a/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/Q_rsqrt.wasm and /dev/null differ diff --git a/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/duff.wasm b/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/duff.wasm deleted file mode 100644 index 0b75ea455a87..000000000000 Binary files a/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/duff.wasm and /dev/null differ diff --git a/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/fact.wasm b/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/fact.wasm deleted file mode 100644 index 50ce8c098a4c..000000000000 Binary files a/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/fact.wasm and /dev/null differ diff --git a/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/fast-math.wasm b/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/fast-math.wasm deleted file mode 100644 index 1733deb9ba7c..000000000000 Binary files a/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/fast-math.wasm and /dev/null differ diff --git a/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/index.js b/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/index.js deleted file mode 100644 index 44faec739b61..000000000000 --- a/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/index.js +++ /dev/null @@ -1,53 +0,0 @@ -it("Q_rsqrt should work", function () { - return import("./Q_rsqrt.wasm").then(function (wasm) { - const result = wasm._Z7Q_rsqrtf(1 / 1764); - expect(result).toBeGreaterThan(41.9); - expect(result).toBeLessThan(42.1); - }); -}); - -it("testFunction should work", function () { - return import("./testFunction.wasm").then(function (wasm) { - const view = new Int32Array(wasm.memory.buffer); - view[0] = 123; - view[1] = 1; - view[2] = 2; - view[3] = 3; - const result = wasm._Z12testFunctionPii(4, 3); - expect(result).toEqual(6); - }); -}); - -it("fact should work", function () { - return import("./fact.wasm").then(function (wasm) { - const result = wasm._Z4facti(11); - expect(result).toEqual(39916800); - }); -}); - -it("popcnt should work", function () { - return import("./popcnt.wasm").then(function (wasm) { - expect(wasm.main(0xf0f)).toEqual(16); - expect(wasm._Z5countj(0xf0f)).toEqual(8); - }); -}); - -it("fast-math should work", function () { - return import("./fast-math.wasm").then(function (wasm) { - expect(wasm._Z3food(42)).toEqual(14); - expect(wasm._Z9maybe_mindd(42, 24)).toEqual(24); - expect(wasm._Z8call_powd(42)).toEqual(9682651996416); - expect(wasm._Z6do_powd(42)).toEqual(9682651996416); - expect(wasm._Z6factorddd(42, 42, 42)).toEqual(3528); - }); -}); - -it("duff should work", function () { - return import("./duff.wasm").then(function (wasm) { - const view = new Uint8Array(wasm.memory.buffer); - view[0] = 123; - for (let i = 1; i < 100; i++) view[i] = i; - const result = wasm._Z4sendPcS_m(200, 1, 100); - for (let i = 1; i < 100; i++) expect(view[199 + i]).toEqual(i); - }); -}); diff --git a/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/node_modules/env.js b/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/node_modules/env.js deleted file mode 100644 index bb82d984bdc4..000000000000 --- a/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/node_modules/env.js +++ /dev/null @@ -1 +0,0 @@ -export const _Z3powdd = Math.pow; diff --git a/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/popcnt.wasm b/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/popcnt.wasm deleted file mode 100644 index f605a5a95f78..000000000000 Binary files a/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/popcnt.wasm and /dev/null differ diff --git a/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/testFunction.wasm b/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/testFunction.wasm deleted file mode 100644 index 3be47ce57b46..000000000000 Binary files a/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/testFunction.wasm and /dev/null differ diff --git a/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/webpack.config.js b/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/webpack.config.js deleted file mode 100644 index 7f2fb31ed802..000000000000 --- a/packages/rspack/tests/cases/wasm/wasm-explorer-examples-async/webpack.config.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - output: { - wasmLoading: "async-node" - }, - experiments: { - asyncWebAssembly: true - } -}; diff --git a/packages/rspack/tests/configCases/asset-url/target-node1/index.css b/packages/rspack/tests/configCases/asset-url/target-node1/index.css deleted file mode 100644 index 077f6dd7c017..000000000000 --- a/packages/rspack/tests/configCases/asset-url/target-node1/index.css +++ /dev/null @@ -1 +0,0 @@ -a {} diff --git a/packages/rspack/tests/configCases/asset-url/target-node1/index.js b/packages/rspack/tests/configCases/asset-url/target-node1/index.js deleted file mode 100644 index 67f1fa946989..000000000000 --- a/packages/rspack/tests/configCases/asset-url/target-node1/index.js +++ /dev/null @@ -1,7 +0,0 @@ -const currentDir = require("url").pathToFileURL(__dirname); - -it("should handle import.meta.url in URL()", () => { - const { href } = new URL("./index.css", import.meta.url); - - expect(href).toBe(currentDir + "/public/index.css"); -}); diff --git a/packages/rspack/tests/configCases/asset-url/target-node1/webpack.config.js b/packages/rspack/tests/configCases/asset-url/target-node1/webpack.config.js deleted file mode 100644 index e051fe08c3a5..000000000000 --- a/packages/rspack/tests/configCases/asset-url/target-node1/webpack.config.js +++ /dev/null @@ -1,19 +0,0 @@ -/** @type {import("@rspack/core").Configuration} */ -module.exports = { - mode: "development", - target: "node", - devtool: false, - output: { - assetModuleFilename: "[name][ext]", - publicPath: "public/" - }, - module: { - rules: [ - { - test: /\.css$/, - dependency: ["esm", "commonjs"], - use: "url-loader" - } - ] - } -}; diff --git a/packages/rspack/tests/configCases/asset-url/target-node2/index.css b/packages/rspack/tests/configCases/asset-url/target-node2/index.css deleted file mode 100644 index 077f6dd7c017..000000000000 --- a/packages/rspack/tests/configCases/asset-url/target-node2/index.css +++ /dev/null @@ -1 +0,0 @@ -a {} diff --git a/packages/rspack/tests/configCases/asset-url/target-node2/index.js b/packages/rspack/tests/configCases/asset-url/target-node2/index.js deleted file mode 100644 index 434cac684a7d..000000000000 --- a/packages/rspack/tests/configCases/asset-url/target-node2/index.js +++ /dev/null @@ -1,7 +0,0 @@ -const currentDir = require("url").pathToFileURL(__dirname); - -it("should handle import.meta.url in URL()", () => { - const { href } = new URL("./index.css", import.meta.url); - - expect(href).toBe(currentDir + "/index.css"); -}); diff --git a/packages/rspack/tests/configCases/asset-url/target-node2/webpack.config.js b/packages/rspack/tests/configCases/asset-url/target-node2/webpack.config.js deleted file mode 100644 index d237740db3aa..000000000000 --- a/packages/rspack/tests/configCases/asset-url/target-node2/webpack.config.js +++ /dev/null @@ -1,9 +0,0 @@ -/** @type {import("@rspack/core").Configuration} */ -module.exports = { - mode: "development", - target: "node", - devtool: false, - output: { - assetModuleFilename: "[name][ext]" - } -}; diff --git a/webpack-test/cases/mjs/type-module/package.json b/webpack-test/cases/mjs/type-module/package.json index f478457e038b..1c3ab4e0dc84 100644 --- a/webpack-test/cases/mjs/type-module/package.json +++ b/webpack-test/cases/mjs/type-module/package.json @@ -1,3 +1,3 @@ { - "TODO: remember to recover `type: \"module\"`": "" + "TODO: remember to recover `type: \"module\"`, currently test use `require` for `test.filter.js` which violates node": "" } diff --git a/webpack-test/cases/mjs/type-module/test.filter.js b/webpack-test/cases/mjs/type-module/test.filter.js index 6be426b1b83d..08c17da1bc76 100644 --- a/webpack-test/cases/mjs/type-module/test.filter.js +++ b/webpack-test/cases/mjs/type-module/test.filter.js @@ -1,3 +1,3 @@ const { FilteredStatus } = require("../../../lib/util/filterUtil") -module.exports = () => {return [FilteredStatus.PARTIAL_PASS, "https://github.com/web-infra-dev/rspack/issues/3544, https://github.com/web-infra-dev/rspack/issues/3203"]} +module.exports = () => {return [FilteredStatus.PARTIAL_PASS, "https://github.com/web-infra-dev/rspack/issues/3544, https://github.com/web-infra-dev/rspack/issues/5197"]} diff --git a/webpack-test/cases/parsing/issue-4608-1-non-strict/test.filter.js b/webpack-test/cases/parsing/issue-4608-1-non-strict/test.filter.js index 6760f03c00a8..d957820f37ad 100644 --- a/webpack-test/cases/parsing/issue-4608-1-non-strict/test.filter.js +++ b/webpack-test/cases/parsing/issue-4608-1-non-strict/test.filter.js @@ -1,5 +1,3 @@ -// module.exports = function (config) { -// return !config.module; -// }; - -module.exports = () => {return "https://github.com/web-infra-dev/rspack/issues/4439"} +module.exports = function (config) { + return !config.module; +}; diff --git a/webpack-test/cases/parsing/issue-4608-1/test.filter.js b/webpack-test/cases/parsing/issue-4608-1/test.filter.js deleted file mode 100644 index c624e985245d..000000000000 --- a/webpack-test/cases/parsing/issue-4608-1/test.filter.js +++ /dev/null @@ -1,4 +0,0 @@ - -module.exports = () => {return "https://github.com/web-infra-dev/rspack/issues/4439"} - - \ No newline at end of file diff --git a/webpack-test/cases/parsing/issue-4608-2/test.filter.js b/webpack-test/cases/parsing/issue-4608-2/test.filter.js index 815b64213647..08b6c2c3d58e 100644 --- a/webpack-test/cases/parsing/issue-4608-2/test.filter.js +++ b/webpack-test/cases/parsing/issue-4608-2/test.filter.js @@ -1,12 +1,6 @@ -/* var supportsForOf = require("../../../helpers/supportsForOf"); module.exports = function (config) { return supportsForOf(); }; - -*/ -module.exports = () => {return "https://github.com/web-infra-dev/rspack/issues/4439"} - - \ No newline at end of file diff --git a/webpack-test/cases/parsing/renaming/test.filter.js b/webpack-test/cases/parsing/renaming/test.filter.js index 763d0e362087..ea5dc5c4837e 100644 --- a/webpack-test/cases/parsing/renaming/test.filter.js +++ b/webpack-test/cases/parsing/renaming/test.filter.js @@ -1,4 +1,3 @@ module.exports = () => {return "https://github.com/web-infra-dev/rspack/issues/4313, https://github.com/web-infra-dev/rspack/issues/3346"} - \ No newline at end of file diff --git a/webpack-test/configCases/asset-url/target-node1/test.filter.js b/webpack-test/configCases/asset-url/target-node1/test.filter.js deleted file mode 100644 index 3be456dcd23c..000000000000 --- a/webpack-test/configCases/asset-url/target-node1/test.filter.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = () => {return false} \ No newline at end of file diff --git a/webpack-test/configCases/asset-url/target-node2/test.filter.js b/webpack-test/configCases/asset-url/target-node2/test.filter.js deleted file mode 100644 index 3be456dcd23c..000000000000 --- a/webpack-test/configCases/asset-url/target-node2/test.filter.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = () => {return false} \ No newline at end of file diff --git a/webpack-test/scripts/test-metric-util.js b/webpack-test/scripts/test-metric-util.js index cdc258f4b966..31747e884e42 100644 --- a/webpack-test/scripts/test-metric-util.js +++ b/webpack-test/scripts/test-metric-util.js @@ -45,7 +45,7 @@ function renderTestToMarkdown(testFullName) { let fullName = testFullName let extra = ""; if (decoded !== null) { - icon = decoded.status === FilteredStatus.TODO ? "⚪️" + icon = decoded.status === FilteredStatus.TODO ? "⚪️" : decoded.status === FilteredStatus.NO_PLAN ? "⚫️" : decoded.status === FilteredStatus.FAILED ? "🔴" : decoded.status === FilteredStatus.PARTIAL_PASS ? "🟡"