有一个Vue应用程序将lodash导入 main.js
,如:
import lodash from 'lodash'
Vue.use(VueLodash, lodash)
然后我可以在我的单个文件组件中使用lodash orderBy函数,例如: this._.orderBy(this.comments, 'updated_at', 'desc')
一切正常 .
当我使用Jest运行测试时它会引发以下错误: Cannot read property 'orderBy' of undefined
我怎样让Jest以与Vue相同的方式识别_?