Skip to content

Commit

Permalink
Build: Add test for v8flags
Browse files Browse the repository at this point in the history
  • Loading branch information
sttk authored and phated committed Mar 26, 2019
1 parent ad18c27 commit 927e055
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions test/flags-v8flags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
'use strict';

var expect = require('expect');
var path = require('path');

var runner = require('gulp-test-tools').gulpRunner;
var headLines = require('gulp-test-tools').headLines;
var eraseTime = require('gulp-test-tools').eraseTime;

describe('flags: v8flags', function() {

it('Should respawn by a v8flag: --lazy', function(done) {
runner({ verbose: false })
.chdir(path.join(__dirname, 'fixtures/gulpfiles'))
.gulp('--lazy')
.run(cb);

function cb(err, stdout, stderr) {
expect(err).toEqual(null);
expect(stderr).toEqual('');

var line = eraseTime(headLines(stdout, 1));
expect(line).toEqual('Node flags detected: --lazy');

line = eraseTime(headLines(stdout, 2, 1));
expect(line).toMatch('Respawned to PID: ');
done(err);
}
});

it('Should respawn by v8flags: --lazy --harmony', function(done) {
runner({ verbose: false })
.chdir(path.join(__dirname, 'fixtures/gulpfiles'))
.gulp('--lazy --harmony')
.run(cb);

function cb(err, stdout, stderr) {
expect(err).toEqual(null);
expect(stderr).toEqual('');

var line = eraseTime(headLines(stdout, 1));
expect(line).toEqual('Node flags detected: --harmony, --lazy');

line = eraseTime(headLines(stdout, 2, 1));
expect(line).toMatch('Respawned to PID: ');
done(err);
}
});
});

0 comments on commit 927e055

Please sign in to comment.