title: Logging with grunt and qunit
body: <p>I am running javascript unittests with grunt/qunit. Sometimes the tests fails because of e.g syntax errors in the source files (works fine with file info if syntax errors are introduced in the test files). When that happens grunt simply prints the line number and not the file where the problem is.</p>
  
  <pre><code>Running "qunit:all" (qunit) task
  Warning: Line 99: Unexpected identifier Use --force to continue.
  
  Aborted due to warnings.
  </code></pre>
  
  <p>This does not help much since I have 100 of js files. I have looked into:</p>
  
  <p><a href="https://github.com/gruntjs/grunt-contrib-qunit" rel="nofollow">https://github.com/gruntjs/grunt-contrib-qunit</a></p>
  
  <p>and tried to add the following to my Gruntfile.js (grunt.event.on):</p>
  
  <pre><code>module.exports = function(grunt) {
      "use:strict";
      var reportDir = "output/reports/"+(new Date()).getTime().toString();
      grunt.initConfig({
          pkg: grunt.file.readJSON('package.json'),
          qunit: {
              options: {
                  '--web-security': 'no',
                  coverage: {
                      src: ['../src/**/*.js'],
                      instrumentedFiles: 'output/instrument/',
                      htmlReport: 'output/coverage',
                      coberturaReport: 'output/',
                      linesTresholdPct: 85
                  }
              },
              all: ["testsSuites.html"]
          }
      });
  
  
      // Has no effect
      grunt.event.on('qunit.error.onError', function (msg, stack) {
          grunt.util._.each(stack, function (entry) {
              grunt.log.writeln(entry.file + ':' + entry.line);
          });
          grunt.warn(msg);
      });     
  
      grunt.loadNpmTasks('grunt-contrib-qunit');
      grunt.loadNpmTasks('grunt-qunit-istanbul');
      grunt.registerTask('test', ['qunit']);
  </code></pre>
  
  <p>Where testsSuites.html contains:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;link rel="stylesheet" href="qunit/qunit.css"&gt;
      &lt;script src="qunit/qunit.js"&gt;&lt;/script&gt;
      &lt;script src="sinonjs/sinon-1.7.3.js"&gt;&lt;/script&gt;
      &lt;script src="sinonjs/sinon-qunit-1.0.0.js"&gt;&lt;/script&gt;
  
      &lt;!-- Sources --&gt;
      &lt;script src="../src/sample.js"&gt;&lt;/script&gt;
  
      &lt;!-- Test--&gt;
      &lt;script src="test/sample-test.js"&gt;&lt;/script&gt;
  
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div id="qunit"&gt;&lt;/div&gt;
      &lt;div id="qunit-fixture"&gt;&lt;/div&gt;
      &lt;script&gt;
      &lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>But the source file where the problem is located is still not printed. Is is out of Grunts hands to verify source code/show line number/file where e.g a syntax error is located?</p>
  
  <p>I have also tried running:</p>
  
  <pre><code>grunt test --debug 9
  </code></pre>
  
  <p>It prints some debug info but not any information regarding syntax errors in the javascript sources.</p>
  
  <p>I have tried to install JSHint and call it on all my javascript source files:</p>
  
  <pre><code>for i in $(find ../src -iname "*.js"); do jshint $i; done
  </code></pre>
  
  <p>Now I get tons of errors but Grunt is still happy. If I introduce a simple syntax error e.g:</p>
  
  <pre><code>(function(){
     var sampleVar 32;
  
  }
  </code></pre>
  
  <p>to provoke an error in Grunt:</p>
  
  <pre><code>Running "qunit:all" (qunit) task
  Warning: Line 2: Unexpected number Use --force to continue.
  
  Aborted due to warnings.
  </code></pre>
  
  <p>it simply disappears in the stream of errors generated by JSHint. How do I filter JSHint "warnings" from critical errors that will actually make Grunt fail?</p>
  
  <p>Or is it qunit that should be configured for more verbose output?</p>