From 927e05534f76646611b70220c68335558c5f64b5 Mon Sep 17 00:00:00 2001 From: sttk Date: Sun, 24 Mar 2019 00:39:48 +0900 Subject: [PATCH] Build: Add test for v8flags --- test/flags-v8flags.js | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 test/flags-v8flags.js diff --git a/test/flags-v8flags.js b/test/flags-v8flags.js new file mode 100644 index 00000000..1a487980 --- /dev/null +++ b/test/flags-v8flags.js @@ -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); + } + }); +});