+var exec = require('child_process').exec;
var vows = require('vows');
var path = require('path');
var fs = require('fs');
return {
plain: '@import "' + plainPath + '";',
- preminified: fs.readFileSync(minPath, 'utf8')
+ preminified: fs.readFileSync(minPath, 'utf8').trim()
};
},
'minifying': {
assert.equal(line, preminifiedTokens[i]);
});
}
+ },
+ 'minifying via CLI': {
+ 'topic': function (data) {
+ var isIE7Mode = filename.indexOf('ie7') > 0;
+
+ exec(
+ '__DIRECT__=1 ./bin/cleancss -b ' + (isIE7Mode ? '-c ie7 ' : '') + path.join(dir, filename),
+ { maxBuffer: 500 * 1024 },
+ this.callback.bind(null, data)
+ );
+ },
+ 'outputs right content': function (data, error, stdout) {
+ var optimizedLines = stdout.split(lineBreak);
+ var preoptimizedLines = data.preminified.split(lineBreak);
+
+ optimizedLines.forEach(function (line, i) {
+ assert.equal(line, preoptimizedLines[i]);
+ });
+ }
}
};
});