Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vue.js 获得';订购人';使用lodash with Jest测试Vue组件时出现未定义的错误_Vue.js_Lodash_Jestjs - Fatal编程技术网

Vue.js 获得';订购人';使用lodash with Jest测试Vue组件时出现未定义的错误

Vue.js 获得';订购人';使用lodash with Jest测试Vue组件时出现未定义的错误,vue.js,lodash,jestjs,Vue.js,Lodash,Jestjs,拥有一个将lodash导入到main.js的Vue应用程序,如: 从“lodash”导入lodash Vue.use(VueLodash,lodash) 然后,我可以在单个文件组件中使用lodash orderBy函数,如: this.\uu.orderBy(this.comments,'updated\u at','desc') 一切正常 当我使用Jest运行测试时,尽管它抛出以下错误: 无法读取未定义的属性“orderBy” 我如何让Jest以与Vue相同的方式识别?您是如何解决这个问题的?

拥有一个将lodash导入到
main.js
的Vue应用程序,如:

从“lodash”导入lodash

Vue.use(VueLodash,lodash)

然后,我可以在单个文件组件中使用lodash orderBy函数,如:
this.\uu.orderBy(this.comments,'updated\u at','desc')

一切正常

当我使用Jest运行测试时,尽管它抛出以下错误:
无法读取未定义的属性“orderBy”


我如何让Jest以与Vue相同的方式识别?

您是如何解决这个问题的?