test.js 459 B

123456789101112131415161718
  1. 'use strict';
  2. var fs = require('fs');
  3. var assert = require('assert');
  4. var gutil = require('gulp-util');
  5. var jsmin = require('./index');
  6. it('should minify js', function (cb) {
  7. var stream = jsmin();
  8. stream.on('data', function (file) {
  9. assert(file.contents.length < fs.statSync(__dirname + '/sample/test.js').size)
  10. cb();
  11. });
  12. stream.write(new gutil.File({
  13. path: './sample/test.js',
  14. contents: fs.readFileSync('./sample/dist/test.min.js')
  15. }));
  16. });