Test complete
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { readFileSync } from "fs"
|
||||
import { readFileSync, existsSync } from "fs"
|
||||
import { describe, it } from "mocha"
|
||||
import { resolve } from "path"
|
||||
import { expect } from "chai"
|
||||
@ -14,13 +14,20 @@ const equal = (name: Snapshot) => {
|
||||
const folder = resolve(__dirname, "snapshots", name)
|
||||
const actual = readFileSync(resolve(folder, "input.txt"), "utf-8")
|
||||
const expected = readFileSync(resolve(folder, "output.txt"), "utf-8")
|
||||
const babelrc: babel.TransformOptions = existsSync(resolve(folder, ".babelrc"))
|
||||
? JSON.parse(readFileSync(resolve(folder, ".babelrc"), "utf-8"))
|
||||
: {}
|
||||
|
||||
const transformed = transform(actual, {
|
||||
parserOpts: {
|
||||
...babelrc.parserOpts,
|
||||
plugins: ["decorators-legacy", "typescript"],
|
||||
},
|
||||
babelrc: false,
|
||||
configFile: false,
|
||||
presets: babelrc.presets,
|
||||
plugins: [
|
||||
...(babelrc.plugins ?? []),
|
||||
plugin,
|
||||
{
|
||||
visitor: {
|
||||
@ -52,11 +59,15 @@ describe("tsc-decorator", () => {
|
||||
equal("computedProperties")
|
||||
})
|
||||
|
||||
it("works with class/consrtuctor decorators", () => {
|
||||
it("works with class/constructor decorators", () => {
|
||||
equal("constructor")
|
||||
})
|
||||
|
||||
it("does not interfere with export declarations", () => {
|
||||
equal("exports")
|
||||
})
|
||||
|
||||
it("works with private properties", () => {
|
||||
equal("privateProperties")
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user