2016-11-04 140 views
1

所以,當我在本地運行我的回購它工作得很好,但是當我推一個承諾,它運行在特拉維斯CI我不斷收到此錯誤裏面的摩卡測試權限:特拉維斯CI的NodeJS建立在本地運行,但得到的特拉維斯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)); 
     }); 
    }); 
}); 

回答

0

不要手動安裝mocha特拉維斯-CI。這是默認的。

剛從.travis.yml文件中刪除您before_script的語句。

+0

這並不能改變什麼,還是同樣的錯誤。 –

+0

你可以顯示'test.js'文件嗎? –

+0

更好的版本添加到主體。 –