gpt4 book ai didi

mocha.js - 为什么在运行 mocha 时找不到我的测试文件?

转载 作者:行者123 更新时间:2023-12-04 17:23:24 28 4
gpt4 key购买 nike

我正在遵循此 tutorial 的第 1 步
我有以下文件夹结构:

├── lib
│ ├── json
│ │ ├── messages.json
│ │ └── testMessages.json
│ └── model.js
├── test
│ └── model.test.js
└── package.json
我的 package.json有以下运行 Mocha 测试
“test”: “mocha -r esm ./test/* —exit”,
但我收到以下错误
> backend@1.0.0 test /Users/lee33ya/Desktop/mern-app/backend
> mocha -r esm ./test/* --exit

Error: No test files found: "./test/*"
npm ERR! Test failed. See above for more details.
我做错了什么,我能做些什么来解决我的测试没有运行的问题?
我的 github

最佳答案

发现两个问题

  • 您的 package.json 文件放错了位置。将它与“.gitignore”文件放在一起。然后运行“npm install”
  • “Chai ”是必需的。做“npm install chai”

  • Output

    关于mocha.js - 为什么在运行 mocha 时找不到我的测试文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64926661/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com