karma-runner / grunt-karma

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

No color output when using grunt-contrib-watch, color is true #159

Open petvas opened 9 years ago

petvas commented 9 years ago

Gruntfile.js

module.exports = function (grunt) {
    'use strict';
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        karma: {
            options: {
                configFile: 'karma.conf.js'
            },
            unit: {
                background: true
            },
            continuous: {
                background: false,
                singleRun: true,
            }
        },
        jshint: {
            options: {
                reporter: require('jshint-stylish')
            },
            target: ['src/**/*.js', 'tests/**/*.js']
        },
        watch: {
            options: {
                spawn: false // add spawn option in watch task
            },
            dev: {
                files: ['src/**/*.js', 'tests/**/*.js'],
                tasks: ['jshint' , 'karma:unit:run'],
                options: {
                    spawn: false    
                }
            }
        }
    });

    require('load-grunt-tasks')(grunt);

    //defualt tasks
    grunt.registerTask('default', [ 'karma:unit:start', 'watch']);
};

karma.conf.js

module.exports = function (config) {
    config.set({
        // The root path location that will be used to resolve all relative paths defined in files and exclude. If the basePath configuration is a relative path then it will be resolved to the __dirname of the configuration file.
        basePath: '',

        // List of test frameworks you want to use. Typically, you will set this to ['jasmine'], ['mocha'] or ['qunit']...
        frameworks: ['jasmine'],

        // List of files/patterns to load in the browser.
        // included: to browser
        files: [
            {pattern: "src/**/*.js", included: true},
            {pattern: "tests/**/*.js", included: true}
        ],

        // List of files/patterns to exclude from loaded files.
        exclude: [],

        // A list of reporters to use.
        reporters: ['progress'],

        // The port where the web server will be listening.
        port: 9876,

        //  Enable or disable colors in the output (reporters and logs).
        colors: true,

        // Level of logging.
        logLevel: config.LOG_INFO,

        // Enable or disable watching files and executing the tests whenever one of these files changes.
        autoWatch: true,

        // A list of browsers to launch and capture. When Karma starts up, it will also start up each browser which is placed within this setting. Once Karma is shut down, it will shut down these browsers as well. You can capture any browser manually by opening the browser and visiting the URL where the Karma web server is listening (by default it is http://localhost:9876/).
        //Firefox: npm install karma-firefox-launcher --save-dev
        //Chrom: npm install karma-chrome-launcher --save-dev
        //IE: npm install karma-ie-launcher --save-dev
        browsers: ['Firefox', 'Chrome', 'IE'],

        // Timeout for capturing a browser (in ms).
        captureTimeout: 60000,

        // Continuous Integration mode.
        singleRun: false
    });
};
greglockwood commented 9 years ago

+1

kand commented 8 years ago

:+1:

ChiggerChug commented 8 years ago

+1

ghost commented 8 years ago

+1

sqrter commented 8 years ago

+1