我通过Gitlab CI运行grunt命令,所以这会自动执行:
npm install
,然后grunt test
我遇到的问题是"幻像"从grunt的spec
html文件中请求文件时,页面需要主机参考。
因此,如果我通过host: http://example.com/path-to-repo/
,那么它会正确加载,但这会破坏CI的目的,因为我需要它就像最近构建的文件夹是网页一样。
希望这是有道理的,有人可以帮助解释如何让这些最近构建的文件夹成为grunt / jasmine / phantom中的主机
答案 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-connect
和grunt-contrib-jasmine