对客户端JavaScript库使用Travis-CI? [英] Using Travis-CI for client-side JavaScript libraries?
问题描述
我不确定是否为客户端JavaScript库使用Travis-CI,因为它在Travis-CI服务器上与NodeJ一起编译。
想知道这是一个好的方法,对客户端库使用某种持续集成(如Travis-CI)?
是的,当然你应该使用与客户端库的持续集成。
我个人使用 PhantomJS(无网络浏览器),已经安装在Travis-CI 。我认为这是客户端的东西比NodeJ更好的选择。
如果你使用 Grunt ,它更容易使用,所有你需要的是一个简单的Gruntfile.js文件,你的测试运行在浏览器(我使用 QUnit )和一个简单的.travis.yml
Gruntfile.js
:
module.exports = function(grunt){
//项目配置。
grunt.initConfig({
qunit:{
files:['test / index.html']
}
});
//加载插件
grunt.loadNpmTasks('grunt-contrib-qunit');
//运行测试的任务
grunt.registerTask('test','qunit');
};
.travis.yml
:
before_script:
- sudo npm install -g grunt
脚本:grunt test --verbose - -force
您可以在我的一个项目中查看其操作( GitHub上的源代码)。
I'm not sure to use Travis-CI for my client-side JavaScript library or not, because it compiles with NodeJs on Travis-CI servers.
I want to know is this a good approach to use some kind of continuous integration such as Travis-CI for client-side libraries or not?
Yes of course you should use continous integration with client side libraries.
I personally use PhantomJS (headless webkit browser) which is already installed in Travis-CI. I think this is the better option for client-side stuff than NodeJs.
If you use Grunt, it gets even easier to use, all you need is a simple Gruntfile.js file, your tests that run in browser (I use QUnit), and a simple .travis.yml
Gruntfile.js
:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
qunit: {
files: ['test/index.html']
}
});
// Load plugin
grunt.loadNpmTasks('grunt-contrib-qunit');
// Task to run tests
grunt.registerTask('test', 'qunit');
};
.travis.yml
:
before_script:
- sudo npm install -g grunt
script: grunt test --verbose --force
You can see it in action at one of my projects (source on GitHub).
这篇关于对客户端JavaScript库使用Travis-CI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!