diff --git a/test/transform.test.js b/test/transform.test.js index 30972125f..e6ea51794 100644 --- a/test/transform.test.js +++ b/test/transform.test.js @@ -318,3 +318,25 @@ test("should not polyfill using Symbol.asyncDispose", (t) => { }); t.assert.snapshot(code); }); + +test("should have proper error code", (t) => { + const inputCode = "module F { export type x = number }"; + try { + transformSync(inputCode, { + mode: "transform", + }); + } catch (error) { + assert.strictEqual(error.code, "UnsupportedSyntax"); + } +}); + +test("should have proper error code", (t) => { + const inputCode = "const foo;"; + try { + transformSync(inputCode, { + mode: "transform", + }); + } catch (error) { + assert.strictEqual(error.code, "InvalidSyntax"); + } +});