Travis CI - Builds正在超时

时间:2015-06-23 17:03:09

标签: travis-ci

我的.travis.yml

language: node_js
node_js:
  - "0.12"
before_install:
  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"

到目前为止,我只添加了一些非常简单的测试(检查是否存在类属性)。 我可以看到测试已经执行。

然后,Travis输出中的最后几行是:

WARN [web-server]: 404: /css/style.min.css?1435068425.642
No output has been received in the last 10 minutes, this potentially indicates a stalled build or something wrong with the build itself.
The build has been terminated

如果测试正在运行,那么必须已经安装了构建和依赖项吗? 那么为什么一旦所有测试都被执行,过程就没有完成?

karma.config:

module.exports = function(config) {
  config.set({
    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',
    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: [
        'jasmine',
        'requirejs'
    ],
    // list of files / patterns to load in the browser
    files: [
      {pattern: 'js/vendor/**/*.js', included: false},
      {pattern: 'js/*.js', watched: true, included: false},
      {pattern: 'test/**/*Spec.js', watched: true, included: false},
      {pattern: 'css/**/*.css', included: false},
      'test/test-main.js'
    ],
    // list of files to exclude
    exclude: [
        'test/lib/**/*.js',
        'js/vendor/**/test/*.js', //do not include the vendor tests
        'js/_admin.js'
    ],
    preprocessors: {
    },
    reporters: ['progress'],
    // web server port
    port: 9876,
    // enable / disable colors in the output (reporters and logs)
    colors: true,
    // level of logging
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Firefox'], //'Chrome', 'PhantomJS', 'PhantomJS_custom'
    singleRun: false,
  });//config.set
};//module.exports
文件夹测试中的

test-main.js:

var allTestFiles = [];
var TEST_REGEXP = /(spec|test)\.js$/i;

Object.keys(window.__karma__.files).forEach(function(file) {
    if (TEST_REGEXP.test(file)) {
        // Normalize paths to RequireJS module names.
        allTestFiles.push(file);
    }
    //console.log('test files:', allTestFiles);
});

require.config({
    baseUrl: '/base',
    paths: {
        'jquery': './js/vendor/jquery/jquery-2.1.4.min',
        'jquery-ui': './js/vendor/jquery-ui-1.11.4.custom/jquery-ui.min',
        'underscore': './js/vendor/underscore/underscore-min',
        'backbone': './js/vendor/backbone/backbone-min',
        'mustache': './js/vendor/mustache/mustache.min',
        'domReady': './js/vendor/requirejs/plugins/domReady/domReady',
        'text': './js/vendor/requirejs/plugins/text/text',
        //------------------------------------
        //custom requireJS application modules
        'my': './js/my',
        'my-CSS': './js/my-CSS'
    },
    shim: {
        'underscore': {
            exports: '_'
        }
    },
    deps: allTestFiles,
    callback: window.__karma__.start
});

my-CSS模块像这样加载css:

//custom requireJS module to hold the crowdUI class
define(["my"], function (my) { //prerequisites
    'use strict';
    //load the CSS definitions
    document.head.appendChild(
        my.createElement('link', {
            attribute: {
                id: 'my-CSS',
                href: './css/style.min.css?' + crowdUI.TIMESTAMP,
                rel: 'stylesheet',
                type: 'text/css'
            }
        })
    );

});

1 个答案:

答案 0 :(得分:5)

如果问题仅在于您的任务需要超过10分钟而且不会产生输出,那么修复很简单:在travis_wait之前添加命令。

例如travis_wait myCommand而非myCommand