-
Notifications
You must be signed in to change notification settings - Fork 27
/
test.js
32 lines (28 loc) · 819 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'use strict';
var assert = require('assert');
var closureCompiler = require('./index');
var gutil = require('gulp-util');
var vinylFile = require('vinyl');
it('should minify JS', function (done) {
var execFile = function(cmd, args, cb) {
assert.equal(cmd, 'java');
assert.equal(args[0], '-jar');
assert.equal(args[1], '-XX:+TieredCompilation');
assert.equal(args[2], 'compiler.jar');
assert.ok(/^--flagfile=/.test(args[3]));
assert.ok(/^--js_output_file=/.test(args[4]));
done();
};
var options = {
compilerPath: 'compiler.jar',
fileName: 'foo.js'
};
var stream = closureCompiler(options, execFile);
var fakeFile = new vinylFile({
cwd: 'cwd',
path: 'path',
contents: new Buffer('abufferwiththiscontent')
});
stream.write(fakeFile);
stream.end()
});