improve readability of test failures
authoralexlamsl <alexlamsl@gmail.com>
Sat, 16 Apr 2016 14:33:29 +0000 (22:33 +0800)
committeralexlamsl <alexlamsl@gmail.com>
Sat, 16 Apr 2016 14:33:29 +0000 (22:33 +0800)
Gruntfile.js
tests/minifier.js

index 99984e6..7fb078a 100644 (file)
@@ -102,7 +102,7 @@ module.exports = function(grunt) {
     grunt.log.writeln(type + ' completed in ' + details.runtime + 'ms');
     details.failures.forEach(function(details) {
       grunt.log.error();
-      grunt.log.error(details.name);
+      grunt.log.error(details.name + (details.message ? ' [' + details.message + ']' : ''));
       grunt.log.error(details.source);
       grunt.log.error('Actual:');
       grunt.log.error(details.actual);
index 0ca58cf..c3df1b1 100644 (file)
@@ -213,8 +213,10 @@ test('space normalization around text', function() {
     ['a <nobr> b</nobr> c', 'a <nobr>b</nobr> c'],
     ['a <nobr> b </nobr> c', 'a <nobr>b</nobr> c']
   ].forEach(function(inputs) {
-    equal(minify(inputs[0], { collapseWhitespace: true }), inputs[1]);
-    equal(minify('<div>' + inputs[0] + '</div>', { collapseWhitespace: true }), '<div>' + inputs[1] + '</div>');
+    equal(minify(inputs[0], { collapseWhitespace: true }), inputs[1], inputs[0]);
+    var input = '<div>' + inputs[0] + '</div>';
+    var output = '<div>' + inputs[1] + '</div>';
+    equal(minify(input, { collapseWhitespace: true }), output, input);
   });
   equal(minify('<p>foo <img> bar</p>', { collapseWhitespace: true }), '<p>foo <img> bar</p>');
   equal(minify('<p>foo<img>bar</p>', { collapseWhitespace: true }), '<p>foo<img>bar</p>');