Search code examples
loggingnpmgruntjsjasminegrunt-contrib-jasmine

Grunt grunt-contrib-jasmine report output to a log file


I am using this lib to create my jasmine test https://github.com/gruntjs/grunt-contrib-jasmine I have the test framework running without problem but when it print out things in console, it contains too much junk info that I do not want, is there anyway to output the test result into a log file?

In my gruntfile.js, I have

grunt.registerTask('test', ['jasmine']);

Is there anyway when we run grunt test , it output all result into log.txt something like this?


Solution

  • You could use task specific logs with logfile-grunt to capture all output from jasmine:

    https://github.com/brutaldev/logfile-grunt

    Or just pipe the output directly to a file:

    grunt test > log.txt
    

    Or if you'd just like to reduce the output from jasmine you can use the display:short option

    jasmine : {
        //your config
        options : {
            display : 'short'
        }
    }