提交 8ab2eedf 编写于 作者: Q qiang

fix: 修复单元测试 uni-cli-shared 初始化过早报错的问题

上级 14005c1c
const path = require('path')
const t = require('@babel/types')
const babelTraverse = require('@babel/traverse').default
const {
normalizePath
} = require('@dcloudio/uni-cli-shared')
const {
parseComponents
} = require('./util')
......@@ -58,7 +55,7 @@ module.exports = function (ast, state = {}) {
}
} catch (e) {
if (state.filename) {
console.error('at ' + normalizePath(path.relative(process.env.UNI_INPUT_DIR, state.filename)) + ':1')
console.error('at ' + require('@dcloudio/uni-cli-shared').normalizePath(path.relative(process.env.UNI_INPUT_DIR, state.filename)) + ':1')
}
throw e
}
......@@ -66,4 +63,4 @@ module.exports = function (ast, state = {}) {
ast,
state
}
}
}
const path = require('path')
const t = require('@babel/types')
const babelTraverse = require('@babel/traverse').default
const {
normalizePath
} = require('@dcloudio/uni-cli-shared')
const {
parseComponents
} = require('./util')
......@@ -110,7 +107,7 @@ module.exports = function (ast, state = {
components: [],
options: {}
}) {
try {
try {
babelTraverse(ast, {
CallExpression (path) {
const callee = path.node.callee
......@@ -185,7 +182,7 @@ module.exports = function (ast, state = {
})
} catch (e) {
if (state.filename) {
console.error('at ' + normalizePath(path.relative(process.env.UNI_INPUT_DIR, state.filename)) + ':1')
console.error('at ' + require('@dcloudio/uni-cli-shared').normalizePath(path.relative(process.env.UNI_INPUT_DIR, state.filename)) + ':1')
}
throw e
}
......@@ -193,4 +190,4 @@ module.exports = function (ast, state = {
ast,
state
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册