2017-02-12 13:13:08 +01:00
|
|
|
import 'typings-test'
|
|
|
|
import { expect } from 'smartchai'
|
|
|
|
|
2017-03-08 16:51:02 +01:00
|
|
|
import * as smartshell from '../dist/index'
|
|
|
|
|
2017-03-10 20:14:40 +01:00
|
|
|
describe('smartshell', function () {
|
|
|
|
it('it should run async', function () {
|
|
|
|
this.timeout(1000000)
|
|
|
|
return smartshell.exec('npm -v').then((execResult) => {
|
|
|
|
expect(execResult.stdout).to.match(/[0-9\.]*/)
|
2017-03-08 16:51:02 +01:00
|
|
|
})
|
2017-03-10 20:14:40 +01:00
|
|
|
})
|
|
|
|
it('should run async and silent', function() {
|
|
|
|
return smartshell.execSilent('npm -v').then((execResult) => {
|
|
|
|
expect(execResult.stdout).to.match(/[0-9\.]*/)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
it('should stream a shell execution', function() {
|
|
|
|
let execStreamingResponse = smartshell.execStreaming('npm -v')
|
|
|
|
execStreamingResponse.childProcess.stdout.on('data', (data) => {
|
|
|
|
console.log('Received ' + data)
|
|
|
|
})
|
|
|
|
return execStreamingResponse.finalPromise
|
|
|
|
})
|
|
|
|
})
|