mirror of
https://github.com/swc-project/swc.git
synced 2024-10-05 04:39:06 +03:00
Fix jest extension (#1106)
This commit is contained in:
parent
ab8df21797
commit
1f00d9ba26
@ -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) => {
|
||||
|
@ -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();
|
||||
}
|
||||
}`);
|
||||
});
|
||||
|
@ -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",
|
||||
|
@ -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"]
|
||||
|
Loading…
Reference in New Issue
Block a user