From 05b204d8ca99fb6f187abfb8d391a1ab6fe013a1 Mon Sep 17 00:00:00 2001 From: dev2a Date: Wed, 2 Jan 2019 22:29:02 +0100 Subject: [PATCH] [Test] Return empty string in intercept stdout --- Commands/init.js | 2 +- test/Commands/testInit.js | 1 + test/Commands/testLaravelConfig.js | 7 ++++++- test/Commands/testMakeCommand.js | 2 ++ test/Commands/testMissingJob.js | 1 + test/Commands/testModelsCreator.js | 1 + test/bootstrap/testInitCommand.js | 1 + test/bootstrap/testInitIndex.js | 1 + test/data/laravel_fake/artisan | 2 +- test/lib/shell/plugins/testHelp.js | 3 +++ test/lib/shell/plugins/testHistory.js | 1 + test/lib/shell/plugins/testRouter.js | 1 + test/lib/shell/routes/testMiddlewares.js | 6 ++++++ 13 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Commands/init.js b/Commands/init.js index 259a9e9..e6e080d 100644 --- a/Commands/init.js +++ b/Commands/init.js @@ -101,7 +101,7 @@ var writeConf = function writeConf() { comment += "*\n"; comment += "* config:\n"; comment += "* key: name of the config in laravel\n"; - comment += "* inport: - true import without ask\n"; + comment += "* import: - true import without ask\n"; comment += "* - false don't import\n"; comment += "* asis: true same as laravel\n"; comment += "* false look for a file with the key name in lib/config folder\n"; diff --git a/test/Commands/testInit.js b/test/Commands/testInit.js index b7e467b..c00c7dc 100644 --- a/test/Commands/testInit.js +++ b/test/Commands/testInit.js @@ -99,6 +99,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' diff --git a/test/Commands/testLaravelConfig.js b/test/Commands/testLaravelConfig.js index c69efb8..8ac75ab 100644 --- a/test/Commands/testLaravelConfig.js +++ b/test/Commands/testLaravelConfig.js @@ -58,7 +58,7 @@ module.exports = { stdout.push(txt); } - // return ''; + return ''; }); app.init({ chdir: appdir + '/' @@ -155,6 +155,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' @@ -196,6 +197,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' @@ -239,6 +241,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' @@ -273,6 +276,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' @@ -326,6 +330,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' diff --git a/test/Commands/testMakeCommand.js b/test/Commands/testMakeCommand.js index e2154d2..b57852f 100644 --- a/test/Commands/testMakeCommand.js +++ b/test/Commands/testMakeCommand.js @@ -31,6 +31,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' @@ -62,6 +63,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' diff --git a/test/Commands/testMissingJob.js b/test/Commands/testMissingJob.js index d3d435f..97ecc05 100644 --- a/test/Commands/testMissingJob.js +++ b/test/Commands/testMissingJob.js @@ -34,6 +34,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' diff --git a/test/Commands/testModelsCreator.js b/test/Commands/testModelsCreator.js index 7594044..f4f60ab 100644 --- a/test/Commands/testModelsCreator.js +++ b/test/Commands/testModelsCreator.js @@ -189,6 +189,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' diff --git a/test/bootstrap/testInitCommand.js b/test/bootstrap/testInitCommand.js index 8122ed5..cfd1949 100644 --- a/test/bootstrap/testInitCommand.js +++ b/test/bootstrap/testInitCommand.js @@ -51,6 +51,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); rewire('../utils/bootstrap'); app.init({ diff --git a/test/bootstrap/testInitIndex.js b/test/bootstrap/testInitIndex.js index c7d3ee7..eb810a7 100644 --- a/test/bootstrap/testInitIndex.js +++ b/test/bootstrap/testInitIndex.js @@ -24,6 +24,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); var appTest = rewire('../../bootstrap/app'); var fakeRedis = new FakeRedis(); diff --git a/test/data/laravel_fake/artisan b/test/data/laravel_fake/artisan index 2bf96ec..84de961 100644 --- a/test/data/laravel_fake/artisan +++ b/test/data/laravel_fake/artisan @@ -26,7 +26,7 @@ if (isset($argv[1])) { $config = [ 'app' => [ 'env' => 'testing', - 'debug' => true, + 'debug' => false, 'url' => 'http://localhost', 'timezone' => 'UTC', 'locale' => 'en', diff --git a/test/lib/shell/plugins/testHelp.js b/test/lib/shell/plugins/testHelp.js index 370b3f7..866dff6 100644 --- a/test/lib/shell/plugins/testHelp.js +++ b/test/lib/shell/plugins/testHelp.js @@ -24,6 +24,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); process.argv = ['node', appdir + '/artisan']; bddStdin('help\n', 'quit\n'); @@ -52,6 +53,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); bddStdin('help\n', 'quit\n'); app.init({ @@ -80,6 +82,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); process.argv = ['node', appdir + '/artisan']; bddStdin('help test\n', 'help test:second\n', 'help test:third\n', 'help not:found\n', 'quit\n'); diff --git a/test/lib/shell/plugins/testHistory.js b/test/lib/shell/plugins/testHistory.js index 1deeedd..7acb45f 100644 --- a/test/lib/shell/plugins/testHistory.js +++ b/test/lib/shell/plugins/testHistory.js @@ -24,6 +24,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' diff --git a/test/lib/shell/plugins/testRouter.js b/test/lib/shell/plugins/testRouter.js index e98da9c..c589c27 100644 --- a/test/lib/shell/plugins/testRouter.js +++ b/test/lib/shell/plugins/testRouter.js @@ -27,6 +27,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); app.init({ chdir: appdir + '/' diff --git a/test/lib/shell/routes/testMiddlewares.js b/test/lib/shell/routes/testMiddlewares.js index 8360d16..33646df 100644 --- a/test/lib/shell/routes/testMiddlewares.js +++ b/test/lib/shell/routes/testMiddlewares.js @@ -36,6 +36,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); process.stdin.destroy = function stdinDestroy() { unhookIntercept(); @@ -65,6 +66,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); process.stdin.destroy = function stdinDestroy() { unhookIntercept(); @@ -93,6 +95,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); process.stdin.destroy = function stdinDestroy() { unhookIntercept(); @@ -121,6 +124,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); process.stdin.destroy = function stdinDestroy() { unhookIntercept(); @@ -147,6 +151,7 @@ module.exports = { if (typeof txt === 'string') { stdout.push(txt.replace(/\u001b\[.*?m/g, '')); } + return ''; }); process.stdin.destroy = function stdinDestroy() { unhookIntercept(); @@ -179,6 +184,7 @@ module.exports = { test.equal(Math.round((end - start) / second), 2, 'time equal'); res.prompt(); test.done(); + unhookIntercept(); } ]); app.start();