diff --git a/bindings/binding_typescript_wasm/__tests__/__snapshots__/transform.js.snap b/bindings/binding_typescript_wasm/__tests__/__snapshots__/transform.js.snap index 39bf6d2035a3..532010e65168 100644 --- a/bindings/binding_typescript_wasm/__tests__/__snapshots__/transform.js.snap +++ b/bindings/binding_typescript_wasm/__tests__/__snapshots__/transform.js.snap @@ -10,6 +10,16 @@ exports[`transform in strip-only mode should throw an error when it encounters a " `; +exports[`transform in strip-only mode should throw an error with a descriptive message when it encounters a decorator 1`] = ` +" + x Decorators are not supported + ,---- + 1 | class Foo { @decorator foo() {} } + : ^^^^^^^^^^ + \`---- +" +`; + exports[`transform in transform mode should transpile enum 1`] = ` "var Foo; (function(Foo) {})(Foo || (Foo = {})); diff --git a/bindings/binding_typescript_wasm/__tests__/transform.js b/bindings/binding_typescript_wasm/__tests__/transform.js index 67a5f534b974..7cf8e6675ce8 100644 --- a/bindings/binding_typescript_wasm/__tests__/transform.js +++ b/bindings/binding_typescript_wasm/__tests__/transform.js @@ -26,6 +26,14 @@ describe("transform", () => { }) ).rejects.toMatchSnapshot(); }); + + it('should throw an error with a descriptive message when it encounters a decorator', async () => { + await expect( + swc.transform("class Foo { @decorator foo() {} }", { + mode: "strip-only", + }) + ).rejects.toMatchSnapshot(); + }) }); describe("in transform mode", () => {