Skip to content

Commit

Permalink
Add a test for swc-project#2546
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Oct 26, 2021
1 parent 085df0d commit 6d272bf
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
17 changes: 17 additions & 0 deletions node-swc/__tests__/transform/api_test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const swc = require("../../../");
const path = require("path");

it("should handle minify", () => {
const src = '/* Comment */import foo, {bar} from "foo"';
Expand Down Expand Up @@ -173,4 +174,20 @@ it("should respect `error.filename = false`", async () => {
expect(e).not.toContain("-->")
}

});

it("should merge parser config", async () => {
const filename = path.resolve(
__dirname + "/../../tests/issue-2546/input.ts"
);

const { code } = await swc.transformFile(filename, {
jsc: {
parser: {
syntax: "typescript",
}
}
})

expect(code).not.toBeFalsy()
});
12 changes: 12 additions & 0 deletions node-swc/tests/issue-2546/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"jsc": {
"parser": {
"syntax": "typescript",
"decorators": true
},
"transform": {
"legacyDecorator": true,
"decoratorMetadata": true
}
}
}
6 changes: 6 additions & 0 deletions node-swc/tests/issue-2546/input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { injectable } from 'inversify';


@injectable()
export default abstract class MyClass {
}

0 comments on commit 6d272bf

Please sign in to comment.