diff --git a/ecmascript/ext-transforms/src/jest.rs b/ecmascript/ext-transforms/src/jest.rs index f45e890dccb..4ccb0436442 100644 --- a/ecmascript/ext-transforms/src/jest.rs +++ b/ecmascript/ext-transforms/src/jest.rs @@ -46,7 +46,7 @@ impl Jest { computed: false, .. }, ) => match &callee.obj { - ExprOrSuper::Super(_) => {} + ExprOrSuper::Super(_) => new.push(T::from_stmt(stmt)), ExprOrSuper::Expr(callee_obj) => match &**callee_obj { Expr::Ident(i) if i.sym == *"jest" => match &*callee.prop { Expr::Ident(prop) if HOIST_METHODS.contains(&*prop.sym) => { diff --git a/node-swc/__tests__/transform/hidden_jest.js b/node-swc/__tests__/transform/hidden_jest.js index 9dcf1f096e4..606cfe07262 100644 --- a/node-swc/__tests__/transform/hidden_jest.js +++ b/node-swc/__tests__/transform/hidden_jest.js @@ -18,3 +18,30 @@ it("should hoist methods", () => { console.log(\"Hello\"); console.log(\"World\");`); }); + + +it("should preserve calls", () => { + const src = `class Foo { + method() { + super.foo() + } + }`; + + expect( + swc.transformSync(src, { + jsc: { + transform: { + hidden: { + jest: true + } + }, + target: 'es2019' + } + }) + .code.trim() + ).toBe(`class Foo { + method() { + super.foo(); + } +}`); +}); diff --git a/package.json b/package.json index 0cb9677fd6b..f55202968ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@swc/core", - "version": "1.2.33", + "version": "1.2.34", "description": "Super-fast alternative for babel", "homepage": "https://swc.rs", "main": "./index.js", diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index 0d9bbeec99e..10f0ec51ee6 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -5,7 +5,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "wasm" repository = "https://github.com/swc-project/swc.git" -version = "1.2.32" +version = "1.2.34" [lib] crate-type = ["cdylib"]