Skip to content

Commit 8d96271

Browse files
authored
fix: test will be failed when vue-transformation is in then new folder (#85)
1 parent b83f1fd commit 8d96271

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/testUtils.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ jest.autoMockOff()
33
import * as fs from 'fs'
44
import * as path from 'path'
55
import runTransformation from './runTransformation'
6+
import transformationMap from '../transformations'
7+
import vueTransformationMap from '../vue-transformations'
68

79
export const runTest = (
810
description: string,
@@ -34,9 +36,9 @@ export const runTest = (
3436
path: inputPath,
3537
source: fs.readFileSync(inputPath).toString()
3638
}
37-
const transformation = require((transformationType == 'vue'
38-
? '../vue-transformations'
39-
: '../wrapAstTransformation') + `/${transformationName}`)
39+
const transformation = (transformationType == 'vue'
40+
? vueTransformationMap
41+
: transformationMap) [transformationName]
4042
expect(runTransformation(fileInfo, transformation)).toEqual(
4143
fs.readFileSync(outputPath).toString()
4244
)

0 commit comments

Comments
 (0)