karma-runner / grunt-karma

Grunt plugin for Karma.
MIT License
469 stars 118 forks source link

IE not exiting in Jenkins #55

Open pswai opened 10 years ago

pswai commented 10 years ago

I'm trying to setup a CI build with Jenkins. The build will execute grunt tool chain which includes grunt-karma for unit tests. It works fine with Chrome, Firefox and Safari but unfortunately not for IE. IE will just not exit and cause the whole build to stall. I've tried to run the grunt chain via command prompt on the same system and it works perfectly. May someone points out whether i missed something during the setup?

System Windows 7 x64 SP1 Internet Explorer 8.0 (Tried IE 9 also)

grunt-karma 0.6.2 karma 0.10.2 karma-ie-launcher 0.1.1

IE_BIN (Tried both) C:\Program Files (x86)\Internet Explorer\iexplore.exe C:\Program Files\Internet Explorer\iexplore.exe

Here's the log of karma, i deleted some for clarity:

Running "karma:continuous" (karma) task
DEBUG [plugin]: Loading karma-* from C:\Jenkins\jobs\TestIE\workspace\node_modules
DEBUG [plugin]: Loading plugin C:\Jenkins\jobs\TestIE\workspace\node_modules/karma-chrome-launcher.
DEBUG [plugin]: Loading plugin C:\Jenkins\jobs\TestIE\workspace\node_modules/karma-coffee-preprocessor.
DEBUG [plugin]: Loading plugin C:\Jenkins\jobs\TestIE\workspace\node_modules/karma-coverage.
DEBUG [plugin]: Loading plugin C:\Jenkins\jobs\TestIE\workspace\node_modules/karma-firefox-launcher.
DEBUG [plugin]: Loading plugin C:\Jenkins\jobs\TestIE\workspace\node_modules/karma-html2js-preprocessor.
DEBUG [plugin]: Loading plugin C:\Jenkins\jobs\TestIE\workspace\node_modules/karma-ie-launcher.
DEBUG [plugin]: Loading plugin C:\Jenkins\jobs\TestIE\workspace\node_modules/karma-jasmine.
DEBUG [plugin]: Loading plugin C:\Jenkins\jobs\TestIE\workspace\node_modules/karma-junit-reporter.
DEBUG [plugin]: Loading plugin C:\Jenkins\jobs\TestIE\workspace\node_modules/karma-opera-launcher.
DEBUG [plugin]: Loading plugin C:\Jenkins\jobs\TestIE\workspace\node_modules/karma-phantomjs-launcher.
DEBUG [plugin]: Loading plugin C:\Jenkins\jobs\TestIE\workspace\node_modules/karma-requirejs.
DEBUG [plugin]: Loading plugin C:\Jenkins\jobs\TestIE\workspace\node_modules/karma-safari-launcher.
DEBUG [plugin]: Loading plugin C:\Jenkins\jobs\TestIE\workspace\node_modules/karma-script-launcher.
DEBUG [plugin]: Loading inlined plugin (defining ).
INFO [karma]: Karma v0.10.2 server started at http://localhost:9876/
INFO [launcher]: Starting browser IE
DEBUG [launcher]: Creating temp dir at C:\Windows\TEMP\karma-98974088
DEBUG [launcher]: C:\Program Files\Internet Explorer\iexplore.exe http://localhost:9876/?id=98974088
DEBUG [watcher]: Excluded file "C:/Jenkins/jobs/TestIE/workspace/scripts/services/adapters/config.js"
  // A bunch of files
DEBUG [preprocessor.html2js]: Processing "C:/Jenkins/jobs/TestIE/workspace/template/accordion/accordion-group.html".
  // A bunch of files
DEBUG [watcher]: Resolved files:
    // A bunch of files
DEBUG [web-server]: serving: C:\Jenkins\jobs\TestIE\workspace\node_modules\karma\static/client.html
DEBUG [web-server]: serving: C:\Jenkins\jobs\TestIE\workspace\node_modules\karma\static/karma.js
DEBUG [karma]: A browser has connected on socket gmXEnoE93meu_PVKS2fO
INFO [IE 9.0.0 (Windows 7)]: Connected on socket gmXEnoE93meu_PVKS2fO
DEBUG [karma]: All browsers are ready, executing
DEBUG [web-server]: serving: C:\Jenkins\jobs\TestIE\workspace\node_modules\karma\static/context.html

karma.conf.js

// Karma configuration
// Generated on Wed Aug 28 2013 17:01:18 GMT+0800 (Malay Peninsula Standard Time)

module.exports = function(config) {
  config.set({

    // base path, that will be used to resolve files and exclude
    basePath: '',

    // frameworks to use
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      'scripts/vendor/jquery-1.10.2.min.js', // The order here is important
      'scripts/vendor/angular.js',
      'tests/lib/angular-mocks.js',
      'scripts/vendor/angular-ui-router.min.js',
      'scripts/*.js',
      'scripts/**/*.js',
      'template/**/*.html',
      //'tests/lib/angular-scenario.js',
      'tests/specs/**/*.js'
    ],

    // list of files to exclude
    exclude: [
      'scripts/services/adapters/*.js'
    ],

    // test results reporter to use
    // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
    reporters: ['progress'],

    // web server port
    port: 9876,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_DEBUG,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: false,

    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    browsers: [/*'Chrome', 'Firefox', 'Safari', 'PhantomJS', 'Opera',*/ 'IE'],

    // If browser does not capture in given timeout [ms], kill it
    captureTimeout: 60000,

    // Continuous Integration mode
    // if true, it capture browsers, run tests and exit
    singleRun: false
  });
};

Gruntfile.js

// More stuffs -----
    karma: {
      options: {
        configFile: 'karma.conf.js'
      },
      dev: {
        browsers: ['PhantomJS'],
        reporters: [
          'progress',
          'coverage'
        ],
        coverageReporter: {
          type: 'html',
          dir: reportRoot + '/coverage/'
        },
        color: true,
        background: true
      },
      continuous: {
        singleRun: true,
        browsers: [
          'IE', // Freeze Jenkins
          //'Chrome',
          //'Firefox',
          //'Safari',
          //'Opera', //Cannot be launched...
          //'PhantomJS'
        ],
        reporters: [
          'dots',
          'junit',
          'coverage'
        ],
        junitReporter: {
          outputFile: reportRoot + '/test_results.xml'
        },
        coverageReporter: {
          type: 'cobertura',
          dir: reportRoot + '/coverage/',
          file: 'coverage.xml'
        },
        color: false
      }
    },
// More stuffs -----

Thanks!

khirakawa commented 10 years ago

I ran into the same problem. The only workaround I could find was to make the master jenkins node be a slave itself, and run the job on the slave. Effectively, it runs the job on the same machine, but this seems to work... FWIW

jonsamwell commented 9 years ago

Any further progress on this? I'm facing the same issue when running Karma via grunt on a team city build agent. Running the process manually on the box works fine. IE only fails when it is run a part of a team city CI build?

dignifiedquire commented 9 years ago

Not really sure if this is something that can be fixed in grunt-karma or needs fixing somewhere else. If anybody has any ideas I'm happy to help out, but I'm out of ideas when it comes to fixing this.

Ashwin2488 commented 9 years ago

Having the same problem while trying to run in jenkins windows slave.

[33mWARN [IE 11.0.0 (Windows 7)]: Disconnected (1 times), because no message in 240000 ms.
Chrome 40.0.2214 (Windows 7): Executed 11 of 11 SUCCESS (0.093 secs / 0.083 secs)
IE 11.0.0 (Windows 7): Executed 0 of 0 DISCONNECTED (4 mins 0.017 secs / 0 secs)
INFO [karma]: Restarting IE 11.0.0 (Windows 7) (1 of 1 attempts)
INFO [IE 11.0.0 (Windows 7)]: Connected on socket 6E8hhdbgUETfIG56zZYB with id 19615130
WARN [IE 11.0.0 (Windows 7)]: Disconnected (2 times), because no message in 240000 ms.
Chrome 40.0.2214 (Windows 7): Executed 11 of 11 SUCCESS (0.093 secs / 0.083 secs)
IE 11.0.0 (Windows 7): Executed 0 of 0 DISCONNECTED (8 mins 0.357 secs / 0 secs)
Warning: Task "karma:jenkins" failed. Use --force to continue.

Aborted due to warnings.