2

I am using grunt-jasmine-node to run jasmine-node tests when a file is modified. I do not want to output the jUnit XML file. However, I would love to be able to output the output that displays while running grunt, which is just the jasmine-node --verbose output. Is it possible to have a task that listens to my jasmine-node task and grab its output to a file? I would normally do this while not using grunt

jasmine-node --verbose spec | tee file.txt 

I would just like a new file created each time jasmine-node-grunt runs. I tried to make a little task that runs after jasmine-node just to see but I don't know how to have it grab the output which is logged from jasmine-node. This is what my Gruntfile looks like.

module.exports = function(grunt) {
    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        concurrent: {
            dev: {
                tasks: ['watch:hint'],
                options: {
                    logConcurrentOutput: true
                }
            }
        },

        watch: {
            hint: {
                files: ['/home/user/folder/text.txt'],
                tasks: ['jasmine_node', 'foo'],
                options: {
                    debounceDelay: 250,
                    nospawn: true
                }
            }
        },

        jasmine_node: {
            matchall: true,
            projectRoot: "./spec",
            requirejs: false,
            forceExit: false,
            jUnit: {
                report: true,
                savePath : "./build/reports/jasmine/",
                useDotNotation: true,
                consolidate: true
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-concurrent');
    grunt.loadNpmTasks('grunt-jasmine-node');
    grunt.loadNpmTasks('grunt-nodemailer');

    grunt.registerTask('foo', 'My Foo Task', function(){
        grunt.task.requires('jasmine_node');
        grunt.log.writeln('Testing');
    });

    grunt.registerTask('default', ['concurrent:dev']);
};
TorusTorus
  • 47
  • 8

0 Answers0