Initial commit
This commit is contained in:
28
node_modules/cliss/test/main.test.pipe.stdin.js
generated
vendored
Normal file
28
node_modules/cliss/test/main.test.pipe.stdin.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('assert');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const { exec } = require('child_process');
|
||||
|
||||
const testsPath = path.resolve(__dirname, './specs/cliss-options');
|
||||
|
||||
describe('stdin', function(){
|
||||
it('command.pipe.stdin', function(){
|
||||
return execCli(testsPath, 'nested1')
|
||||
.then(result => assert.equal(result, 'nested1:viastdinoptionsPipe'));
|
||||
})
|
||||
})
|
||||
|
||||
function execCli(moduleCliPath, args) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const cmd = `echo "VIASTDIN" | node ${moduleCliPath} ${args}`;
|
||||
exec(cmd, (err, stdout, stderr) => {
|
||||
if (err || stderr) {
|
||||
return reject(err || stderr);
|
||||
}
|
||||
|
||||
resolve(stdout.replace(/ +$/gm, '').replace(/\n$/, ''));
|
||||
}).stdin.end();
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user