1

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

  • 将我的存储库克隆到本地文件夹(不是我的 Web 服务器公用文件夹的一部分)
  • 运行npm install然后grunt test

spec我遇到的问题是,当从 grunt 的html 文件中请求文件时,“幻像”页面需要一个主机来引用。

因此,如果我通过host: http://example.com/path-to-repo/了,那么它会正确加载,但这违背了 CI 的目的,因为我需要它来充当最近构建的文件夹是网页的行为。

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

4

1 回答 1

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

于 2015-07-31T14:35:03.367 回答