Skip to content

Commit

Permalink
[Test] Return empty string in intercept stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
d3v2a committed Jan 3, 2019
1 parent dabf29a commit 05b204d
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 1 addition & 0 deletions test/Commands/testInit.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ module.exports = {
if (typeof txt === 'string') {
stdout.push(txt.replace(/\u001b\[.*?m/g, ''));
}
return '';
});
app.init({
chdir: appdir + '/'
Expand Down
7 changes: 6 additions & 1 deletion test/Commands/testLaravelConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module.exports = {
stdout.push(txt);
}

// return '';
return '';
});
app.init({
chdir: appdir + '/'
Expand Down Expand Up @@ -155,6 +155,7 @@ module.exports = {
if (typeof txt === 'string') {
stdout.push(txt.replace(/\u001b\[.*?m/g, ''));
}
return '';
});
app.init({
chdir: appdir + '/'
Expand Down Expand Up @@ -196,6 +197,7 @@ module.exports = {
if (typeof txt === 'string') {
stdout.push(txt.replace(/\u001b\[.*?m/g, ''));
}
return '';
});
app.init({
chdir: appdir + '/'
Expand Down Expand Up @@ -239,6 +241,7 @@ module.exports = {
if (typeof txt === 'string') {
stdout.push(txt.replace(/\u001b\[.*?m/g, ''));
}
return '';
});
app.init({
chdir: appdir + '/'
Expand Down Expand Up @@ -273,6 +276,7 @@ module.exports = {
if (typeof txt === 'string') {
stdout.push(txt.replace(/\u001b\[.*?m/g, ''));
}
return '';
});
app.init({
chdir: appdir + '/'
Expand Down Expand Up @@ -326,6 +330,7 @@ module.exports = {
if (typeof txt === 'string') {
stdout.push(txt.replace(/\u001b\[.*?m/g, ''));
}
return '';
});
app.init({
chdir: appdir + '/'
Expand Down
2 changes: 2 additions & 0 deletions test/Commands/testMakeCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ module.exports = {
if (typeof txt === 'string') {
stdout.push(txt.replace(/\u001b\[.*?m/g, ''));
}
return '';
});
app.init({
chdir: appdir + '/'
Expand Down Expand Up @@ -62,6 +63,7 @@ module.exports = {
if (typeof txt === 'string') {
stdout.push(txt.replace(/\u001b\[.*?m/g, ''));
}
return '';
});
app.init({
chdir: appdir + '/'
Expand Down
1 change: 1 addition & 0 deletions test/Commands/testMissingJob.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module.exports = {
if (typeof txt === 'string') {
stdout.push(txt.replace(/\u001b\[.*?m/g, ''));
}
return '';
});
app.init({
chdir: appdir + '/'
Expand Down
1 change: 1 addition & 0 deletions test/Commands/testModelsCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ module.exports = {
if (typeof txt === 'string') {
stdout.push(txt.replace(/\u001b\[.*?m/g, ''));
}
return '';
});
app.init({
chdir: appdir + '/'
Expand Down
1 change: 1 addition & 0 deletions test/bootstrap/testInitCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ module.exports = {
if (typeof txt === 'string') {
stdout.push(txt.replace(/\u001b\[.*?m/g, ''));
}
return '';
});
rewire('../utils/bootstrap');
app.init({
Expand Down
1 change: 1 addition & 0 deletions test/bootstrap/testInitIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion test/data/laravel_fake/artisan
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if (isset($argv[1])) {
$config = [
'app' => [
'env' => 'testing',
'debug' => true,
'debug' => false,
'url' => 'http://localhost',
'timezone' => 'UTC',
'locale' => 'en',
Expand Down
3 changes: 3 additions & 0 deletions test/lib/shell/plugins/testHelp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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');
Expand Down
1 change: 1 addition & 0 deletions test/lib/shell/plugins/testHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = {
if (typeof txt === 'string') {
stdout.push(txt.replace(/\u001b\[.*?m/g, ''));
}
return '';
});
app.init({
chdir: appdir + '/'
Expand Down
1 change: 1 addition & 0 deletions test/lib/shell/plugins/testRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module.exports = {
if (typeof txt === 'string') {
stdout.push(txt.replace(/\u001b\[.*?m/g, ''));
}
return '';
});
app.init({
chdir: appdir + '/'
Expand Down
6 changes: 6 additions & 0 deletions test/lib/shell/routes/testMiddlewares.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ module.exports = {
if (typeof txt === 'string') {
stdout.push(txt.replace(/\u001b\[.*?m/g, ''));
}
return '';
});
process.stdin.destroy = function stdinDestroy() {
unhookIntercept();
Expand Down Expand Up @@ -65,6 +66,7 @@ module.exports = {
if (typeof txt === 'string') {
stdout.push(txt.replace(/\u001b\[.*?m/g, ''));
}
return '';
});
process.stdin.destroy = function stdinDestroy() {
unhookIntercept();
Expand Down Expand Up @@ -93,6 +95,7 @@ module.exports = {
if (typeof txt === 'string') {
stdout.push(txt.replace(/\u001b\[.*?m/g, ''));
}
return '';
});
process.stdin.destroy = function stdinDestroy() {
unhookIntercept();
Expand Down Expand Up @@ -121,6 +124,7 @@ module.exports = {
if (typeof txt === 'string') {
stdout.push(txt.replace(/\u001b\[.*?m/g, ''));
}
return '';
});
process.stdin.destroy = function stdinDestroy() {
unhookIntercept();
Expand All @@ -147,6 +151,7 @@ module.exports = {
if (typeof txt === 'string') {
stdout.push(txt.replace(/\u001b\[.*?m/g, ''));
}
return '';
});
process.stdin.destroy = function stdinDestroy() {
unhookIntercept();
Expand Down Expand Up @@ -179,6 +184,7 @@ module.exports = {
test.equal(Math.round((end - start) / second), 2, 'time equal');
res.prompt();
test.done();
unhookIntercept();
}
]);
app.start();
Expand Down

0 comments on commit 05b204d

Please sign in to comment.