Test complete

This commit is contained in:
proteriax
2021-07-22 14:28:43 -04:00
parent 6f28290529
commit 21003af738
9 changed files with 1119 additions and 21 deletions

View File

@ -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")
})
})