问题描述
所以我已经建立了一个github项目并将其链接到Jenkins,但是每当我执行构建尝试时,它都会在控制台中显示:
So I have set up a github project and linked it to Jenkins but whenever I execute a build attempt it says in the console:
C:\Program Files (x86)\Jenkins\workspace\SYS-ictlab>mocha
'mocha' is not recognized as an internal or external command,
operable program or batch file.
我想念什么?
预先感谢
推荐答案
如果在此之前作为CI阶段的一部分执行了npm install
,并且在然后您可以按以下方式调用mocha二进制文件
If you have executed an npm install
as part of your CI stage prior to this, and you have mocha added as a (dev) dependency in your package.json
then you can invoke the mocha binary file as follows
node ./node_modules/mocha/bin/mocha
您正在尝试调用该命令,就好像它已被链接"一样,因此可以全局访问,只有在运行npm install -g mocha
之后才能执行.这可能并非在所有CI环境中都可行,因此上述解决方案更为常见.
You are attempting to invoke the command as if it has been 'linked' so it is accessible globally, this is only doable after running npm install -g mocha
. This may not be doable in all CI environments, so the above solution is more common.
这篇关于如何使用Jenkins自动化Mocha测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!