Gitlab CI从本地文件系统运行grunt

时间:2015-07-31 13:20:03

标签: git gruntjs phantomjs gitlab-ci gitlab-ci-runner

我通过Gitlab CI运行grunt命令,所以这会自动执行:

  • 将我的存储库克隆到本地文件夹(不属于我的网络服务器的公用文件夹)
  • 运行npm install,然后grunt test

我遇到的问题是"幻像"从grunt的spec html文件中请求文件时,页面需要主机参考。

因此,如果我通过host: http://example.com/path-to-repo/,那么它会正确加载,但这会破坏CI的目的,因为我需要它就像最近构建的文件夹是网页一样。

希望这是有道理的,有人可以帮助解释如何让这些最近构建的文件夹成为grunt / jasmine / phantom中的主机

1 个答案:

答案 0 :(得分:0)

终于明白了!

jasmine: {
    test: {
        src: ['src/<%= pkg.name %>.js'],
        options: {
            specs: ['spec/*-spec.js'],
            outfile: 'spec.html',
            keepRunner: true,
            host: 'http://127.0.0.1:9001/',
            vendor: ['vendor/file.js']
        }
    }
},
connect: {
   server: {
        options: {
            hostname: '127.0.0.1',
            port: 9001,
            onCreateServer: function(server, connect, options){
                console.log('***************\nonCreateServer', server, connect, options);
            }
        }
    }
},

我需要使用grunt-contrib-connectgrunt-contrib-jasmine

相关问题