【Ava】 No tests found in xxx 问题

在用ava测试js的时候,运行测试出现错误No tests found in xxx ,但实际上这文件夹下是有测试文件的,最开始以为是需要什么额外的配置,但对比了一下官网,发现用法没问题。在网上搜索也没有结果,然后仔细看了一下报错信息,发现还有一行错误信息:

TypeError [ERR_INVALID_ARG_VALUE]: The argument 'id' must be a non-empty string. Received ''

Object.<anonymous> (service/user.service.js:2:24)

错误出现在service/user.service.js问价第二行,查看发现是因为在导入包的时候没写完,写成了const {findByIdRepo} = require('') ,遂修改成const {findByIdRepo} = require('../repository/user.repository'),再运行,就没有问题了

总结一下:错误日志真的很重要,很多问题看错误日志就能发现解决办法

参考博客

 https://www.cnblogs.com/lxz123/p/13353260.html

原文地址:https://www.cnblogs.com/qxxblogs/p/13657118.html