karma-runner / grunt-karma

Grunt plugin for Karma.
MIT License
468 stars 116 forks source link

teamcity reporter shows logs but package is not installed #221

Closed tcjcodes closed 7 years ago

tcjcodes commented 7 years ago

Hi, I'm new at test runners. I'm getting teamcity reporter logs even though I don't have it installed. I think it's a grunt-karma problem because they only show up when I run grunt karma:dist:run and not karma start or on my IntelliJ IDEA tasks (via IntelliJ Karma plugin). I only have 7 tests right now and the teamcity reporter kind of clogs up the terminal window.

Gruntfile.js code:

        karma: {
            options: {
                configFile: 'karma.conf.js',
            },
            dist: {
                background: true, // work with watch task
            }
        },

       // irrelevant tasks ommitted

        watch: {
            scripts: {
                files: [
                    'src/**/*.js',
                ],
                tasks: ['uglify', 'karma:dist:run']
            },
       }

karma.conf.js:

module.exports = function (config) {
    config.set({
        basePath: '',
        frameworks: ['jasmine'],
        files: [
            'node_modules/angular/angular.js',
            'node_modules/angular-sanitize/angular-sanitize.js',
            'node_modules/angular-mocks/angular-mocks.js',
            'src/**/*.spec.js',
            'dist/bundlemin.js'
        ],
        exclude: [],
        plugins: [
            require('karma-jasmine'),
            require('karma-ie-launcher'),
            require('karma-chrome-launcher'),
            require('karma-phantomjs-launcher'),
        ],
        preprocessors: {},
        reporters: ['progress'],
        port: 9876,
        colors: true,
        logLevel: config.LOG_WARN,
        autoWatch: false,
        browsers: ['PhantomJS'],
        singleRun: true,
        concurrency: Infinity
    })
}

Dev Dependencies:

  "devDependencies": {
    "angular-mocks": "^1.6.2",
    "grunt": "^1.0.1",
    "grunt-cli": "^1.2.0",
    "grunt-contrib-copy": "^1.0.0",
    "grunt-contrib-cssmin": "^1.0.2",
    "grunt-contrib-uglify": "^2.0.0",
    "grunt-contrib-watch": "^1.0.0",
    "grunt-init": "^0.3.2",
    "grunt-karma": "^2.0.0",
    "grunt-sass": "^1.2.1",
    "grunt-sass-globbing": "^1.5.1",
    "jasmine-core": "^2.5.2",
    "karma": "^1.5.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-ie-launcher": "^1.0.0",
    "karma-jasmine": "^1.1.0",
    "karma-phantomjs-launcher": "^1.0.2",
    "karma-spec-reporter": "0.0.26"
  }

Running npm list on the teamcity dependencies also shows no teamcity packages are installed.

tcjcodes commented 7 years ago

Below is the logs:

Running "karma:dist:run" (karma) task
##teamcity[enteredTheMatrix]
##teamcity[testSuiteStarted nodeId='1' parentNodeId='0' name='karma.conf.js' nodeType='config' locationHint='config://C:\Development\test-toolkit\karma.conf.js']
##teamcity[testSuiteStarted nodeId='2' parentNodeId='1' name='PhantomJS 2.1.1 (Windows 7 0.0.0)' nodeType='browser']
##teamcity[testCount count='14']
 **< omitting the tests here >** 
##teamcity[testFinished nodeId='18' duration='1']
##teamcity[testSuiteFinished nodeId='4']
##teamcity[testSuiteFinished nodeId='3']
##teamcity[testSuiteFinished nodeId='2']
##teamcity[testSuiteFinished nodeId='1']
tcjcodes commented 7 years ago

Hmm, this is no longer happening. I'm not sure what happened?

This is my new config:

// Karma configuration
// Generated on Mon Feb 20 2017 10:12:14 GMT-0800 (Pacific Standard Time)

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'],

        // list of files / patterns to load in the browser
        files: [
            'node_modules/angular/angular.js',
            'node_modules/angular-sanitize/angular-sanitize.js',
            'node_modules/angular-mocks/angular-mocks.js',
            'src/**/*.spec.js',
            'src/**/*.js',
        ],

        // list of files to exclude
        exclude: [],

        // plugins to extend karma functionality
        plugins: [
            require('karma-jasmine'),
            require('karma-ie-launcher'),
            require('karma-chrome-launcher'),
            require('karma-phantomjs-launcher'),
        ],

        // preprocess matching files before serving them to the browser
        // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
        preprocessors: {},

        // test results reporter to use
        // possible values: 'dots', 'progress'
        // available reporters: https://npmjs.org/browse/keyword/karma-reporter
        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_WARN,

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

        // start these browsers
        // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
        browsers: ['PhantomJS'],

        // Continuous Integration mode
        // if true, Karma captures browsers, runs the tests and exits
        singleRun: true,

        // Concurrency level
        // how many browser should be started simultaneous
        concurrency: Infinity
    })
}

Gruntfile.js

        karma: {
            options: {
                configFile: 'karma.conf.js',
            },
            dist: {
                background: true, // work with watch task
            }
        },

        watch: {
            scripts: {
                files: [
                    'src/**/*.js',
                ],
                tasks: ['karma', 'uglify']
            },
        }
    });
moefinley commented 7 years ago

Just figured this mystery out myself. If you have spawned a Karma server through Intelij\Webstorm etc. then the server is configured with the TeamCity reporter. Spawn your own server and you get the reporter you specified.