3

我正在研究基本的反应项目,我可以在我的 mac 上用 chrome 运行 karma 和 mocha 测试。但是 bitbucket 管道说我没有 chrome,所以问题是如何在那里安装 chrome,我每次构建时都必须安装它吗?

我的yml

image: node:7.10.0
    pipelines:
      default:
        - step:
            script:
              - npm install -g bower
              - bower install --allow-root
              - npm install
              - npm test

业力.conf.js

module.exports = function(config) {
config.set({
    basePath: '',
    frameworks: ['mocha'],
    files: [
        './tests/*.js'
    ],
    exclude: [],
    preprocessors: {
        './tests/*.js': ['webpack']
    },
    // webpack configuration
    webpack: require('./webpack.dev.js'),
    webpackMiddleware: {
        stats: 'errors-only'
    },
    reporters: ['progress'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Chrome'], //run in Chrome
    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: true,
    concurrency: Infinity
});

};

4

1 回答 1

4

image: node:7.10.0文件中的行bitbucket-pipelines.yml指定要使用的 Docker 映像。在您的情况下,它是一个普通的节点版本 7.10.0 图像,因此其中不包含 Chrome。

你可以做两件事:

  • 阅读 Docker,了解如何创建包含 Chrome(或任何其他软件)的自己的映像,然后在管道中使用该映像
  • 或者,可能更容易:搜索由其他人创建的现有 Docker 映像,其中包括节点、Chrome 和可能需要的其他软件。image: <image-name>然后,在配置行中使用该图像。

在任何一种情况下,一旦你有了合适的图像,当你的管道运行时就需要它,并且 Chrome 将立即可用,并且你不需要任何类型的“安装”。

于 2017-05-29T07:03:29.947 回答