lnyarl / grunt-deadlink

check dead links in files
MIT License
4 stars 6 forks source link

Grunt exit code is always 0 even when there are dead links found #9

Closed akhy closed 8 years ago

akhy commented 8 years ago

I am following the documentation on README. Here's my Gruntfile.js:

var _ = require('underscore');

module.exports = function(grunt) {
  grunt.initConfig({
    deadlink: {
      options: {
        logAll: true,
        filter: function(content) { // `function` or `regular expressions` to take a link. default is markdown.
            var expressions = [
              /\[[^\]]*\]\((http[s]?:\/\/[^\) ]+)/g,  //[...](<url>)
              /\[[^\]]*\]\s*:\s*(http[s]?:\/\/.*)/g,  //[...]: <url>
            ];
            var result = [];
            _.forEach(expressions, function(expression) {
              var match = expression.exec(content);
              while(match != null) {
                result.push(match[1]);
                match = expression.exec(content);
              }
            });
            return result; // Return array of link.
        }
      },
      target: {
        src: [ "*.md", "*.markdown" ] // glob pattern. files path that include links to checking.
      },
    },
  });
  grunt.loadNpmTasks('grunt-deadlink');
  grunt.registerTask('test', ['deadlink:target']);
}

And here's the result:

20150929_105645_nv7c5

Am I doing something wrong? It should return non-zero exit code in order for Travis-CI test to fail, right?