Using Travis-CI for client-side JavaScript libraries?

前端 未结 4 1726
耶瑟儿~
耶瑟儿~ 2020-12-23 14:04

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 appr

4条回答
  •  余生分开走
    2020-12-23 14:18

    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).

提交回复
热议问题