【发布时间】:2018-07-31 16:35:13
【问题描述】:
所以当我在本地运行我的 repo 中的 mocha 测试时它工作得很好,但是当我推送一个提交并且它在 travis CI 上运行时,我不断收到这个错误:
sh: 1: mocha: Permission denied
npm ERR! Test failed. See above for more details.
我的.travis.yml
language: node_js
node_js:
- "6"
install:
-npm install
before_script: npm install -g mocha
before_script: chmod 0777 ./node_modules/.bin/mocha
package.json
{
"name": "skeletonapp",
"version": "0.0.0",
"description": "skeletonapp",
"main": "index.js",
"author": {
"name": "li"
},
"scripts": {
"test": "mocha"
},
"dependencies": {
"chai": "^3.5.0",
"mocha": "^3.1.2"
}
}
文件结构
https://travis-ci.org/LiamDotPro/Travis-CI-NodeJS-Skeleton---Mocha-Chai/builds/173340318
test.js
var assert = require('assert');
describe('Array', function () {
describe('#indexOf()', function () {
it('should return -1 when the value is not present', function () {
assert.equal(-1, [1, 2, 3].indexOf(4));
});
});
});
【问题讨论】:
标签: javascript node.js travis-ci