diff options
Diffstat (limited to 'test/bootlint_test.js')
-rw-r--r-- | test/bootlint_test.js | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/test/bootlint_test.js b/test/bootlint_test.js index dfc3cb2..526e12b 100644 --- a/test/bootlint_test.js +++ b/test/bootlint_test.js @@ -1,6 +1,6 @@ 'use strict'; -var grunt = require('grunt'); +const grunt = require('grunt'); /* ======== A Handy Little Nodeunit Reference ======== @@ -23,106 +23,106 @@ var grunt = require('grunt'); */ exports.bootlint = { - defaultOptions: function(test) { + defaultOptions(test) { test.expect(3); grunt.util.spawn({ grunt: true, args: ['bootlint:defaultOptions', '--no-color'] - }, function(err, result) { - test.ok(result.stdout.indexOf('test/fixtures/missing-doctype.html') >= 0, + }, (err, result) => { + test.ok(result.stdout.includes('test/fixtures/missing-doctype.html'), 'Should print file path'); - test.ok(result.stdout.indexOf('Document is missing a DOCTYPE declaration') >= 0, + test.ok(result.stdout.includes('Document is missing a DOCTYPE declaration'), 'Should warn about missing a DOCTYPE'); - test.ok(result.stdout.indexOf('9 lint errors found across 5 files') >= 0, + test.ok(result.stdout.includes('9 lint errors found across 5 files'), 'Should print number of lint errors and files'); test.done(); }); }, - relaxerror: function(test) { + relaxerror(test) { test.expect(4); grunt.util.spawn({ grunt: true, args: ['bootlint:relaxerror', '--no-color'] - }, function(err, result) { - test.ok(result.stdout.indexOf('E001') === -1, + }, (err, result) => { + test.ok(!result.stdout.includes('E001'), 'Should not warn about missing a DOCTYPE'); - test.ok(result.stdout.indexOf('W001') >= 0, + test.ok(result.stdout.includes('W001'), 'Should warn about missing charset'); - test.ok(result.stdout.indexOf('W005') === -1, + test.ok(!result.stdout.includes('W005'), 'Should not warn about missing jQuery'); - test.ok(result.stdout.indexOf('1 lint error found across 3 files') >= 0, + test.ok(result.stdout.includes('1 lint error found across 3 files'), 'Should print correct number of lint errors and files'); test.done(); }); }, - stoponerror: function(test) { + stoponerror(test) { test.expect(2); grunt.util.spawn({ grunt: true, args: ['bootlint:stoponerror', '--no-color'] - }, function(err, result) { - test.ok(result.stdout.indexOf('E001') >= 0, + }, (err, result) => { + test.ok(result.stdout.includes('E001'), 'Should warn about missing a DOCTYPE'); - test.ok(result.stdout.indexOf('W001') === -1, + test.ok(!result.stdout.includes('W001'), 'Should not warn about anything after E001'); test.done(); }); }, - stoponwarning: function(test) { + stoponwarning(test) { test.expect(3); grunt.util.spawn({ grunt: true, args: ['bootlint:stoponwarning', '--no-color'] - }, function(err, result) { - test.ok(result.stdout.indexOf('E001') >= 0, + }, (err, result) => { + test.ok(result.stdout.includes('E001'), 'Should display error of missing a DOCTYPE'); - test.ok(result.stdout.indexOf('W001') >= 0, + test.ok(result.stdout.includes('W001'), 'Should warn about W001'); - test.ok(result.stdout.indexOf('E029') === -1, + test.ok(!result.stdout.includes('E029'), 'Should not warn about anything after W001'); test.done(); }); }, - stoponboth: function(test) { + stoponboth(test) { test.expect(1); grunt.util.spawn({ grunt: true, args: ['bootlint:stoponboth', '--no-color'] - }, function(err, result) { - test.ok(result.stdout.indexOf('E001') === -1, + }, (err, result) => { + test.ok(!result.stdout.includes('E001'), 'Should not warn about E001'); test.done(); }); }, - showallerrors: function(test) { + showallerrors(test) { test.expect(1); grunt.util.spawn({ grunt: true, args: ['bootlint:showallerrors', '--no-color'] - }, function(err, result) { - test.ok(result.stdout.indexOf('8 lint errors found across 3 files. Use --force to continue.') >= 0, + }, (err, result) => { + test.ok(result.stdout.includes('8 lint errors found across 3 files. Use --force to continue.'), 'Should show all errors before hard fail.'); test.done(); }); }, - showallerrorswithstop: function(test) { + showallerrorswithstop(test) { test.expect(1); grunt.util.spawn({ grunt: true, args: ['bootlint:showallerrorswithstop', '--no-color'] - }, function(err, result) { - test.ok(result.stdout.indexOf('8 lint errors found across 3 files. Use --force to continue.') >= 0, + }, (err, result) => { + test.ok(result.stdout.includes('8 lint errors found across 3 files. Use --force to continue.'), 'Should show all errors before hard fail even if stopon* is set.'); test.done(); }); }, - pass: function(test) { + pass(test) { test.expect(1); grunt.util.spawn({ grunt: true, args: ['bootlint:pass', '--no-color'] - }, function(err, result) { - test.ok(result.stdout.indexOf('1 file lint free.') >= 0, + }, (err, result) => { + test.ok(result.stdout.includes('1 file lint free.'), 'Should print correct number of lint free files'); test.done(); }); |