我有以下结构:
src/examples/test_file.js
src/test/example.test.js
package.json:
"scripts": {
"test": "node ./test/*.test.js"
},
我通过 npm install tape --save
安装了磁带
我运行 npm test
并得到:
> node ./test/*.test.js
module.js:328
throw err;
^
Error: Cannot find module 'c:\src\test\*.test.js'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Function.Module.runMain (module.js:430:10)
at startup (node.js:141:18)
at node.js:1003:3
npm ERR! Test failed. See above for more details.
据此:https://ci.testling.com/guide/tape
对整个目录的测试应该只适用于 Node 包的全局安装。如何在不全局安装磁带的情况下使上述功能正常工作?
我正在使用 Node 5.4 和 Windows 10
编辑:
这对我来说在 Mac 上运行良好,在 linux 构建服务器上运行良好。我假设它的窗口相关
最佳答案
"scripts": {
"test": "tape ./test/*.test.js"
},
尝试使用对“磁带”的调用而不是“Node ”来更新您的脚本语句 npm 将在 ./node_moduels/.bin/tape 的本地安装中找到磁带 无需通过 Node 发送
关于node.js - 找不到磁带测试目录的 Node js 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35261114/