Skip to content

Commit 1f00d9b

Browse files
authored
Fix jest extension (#1106)
1 parent ab8df21 commit 1f00d9b

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

ecmascript/ext-transforms/src/jest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl Jest {
4646
computed: false, ..
4747
},
4848
) => match &callee.obj {
49-
ExprOrSuper::Super(_) => {}
49+
ExprOrSuper::Super(_) => new.push(T::from_stmt(stmt)),
5050
ExprOrSuper::Expr(callee_obj) => match &**callee_obj {
5151
Expr::Ident(i) if i.sym == *"jest" => match &*callee.prop {
5252
Expr::Ident(prop) if HOIST_METHODS.contains(&*prop.sym) => {

node-swc/__tests__/transform/hidden_jest.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,30 @@ it("should hoist methods", () => {
1818
console.log(\"Hello\");
1919
console.log(\"World\");`);
2020
});
21+
22+
23+
it("should preserve calls", () => {
24+
const src = `class Foo {
25+
method() {
26+
super.foo()
27+
}
28+
}`;
29+
30+
expect(
31+
swc.transformSync(src, {
32+
jsc: {
33+
transform: {
34+
hidden: {
35+
jest: true
36+
}
37+
},
38+
target: 'es2019'
39+
}
40+
})
41+
.code.trim()
42+
).toBe(`class Foo {
43+
method() {
44+
super.foo();
45+
}
46+
}`);
47+
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@swc/core",
3-
"version": "1.2.33",
3+
"version": "1.2.34",
44
"description": "Super-fast alternative for babel",
55
"homepage": "https://swc.rs",
66
"main": "./index.js",

wasm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2018"
55
license = "Apache-2.0/MIT"
66
name = "wasm"
77
repository = "https://github.com/swc-project/swc.git"
8-
version = "1.2.32"
8+
version = "1.2.34"
99

1010
[lib]
1111
crate-type = ["cdylib"]

0 commit comments

Comments
 (0)