Skip to content

Commit

Permalink
Make tests work under Windows (avoid | in shell)
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Mar 21, 2017
1 parent da704f7 commit b251147
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/index.spec.ts
Expand Up @@ -135,30 +135,36 @@ describe('ts-node', function () {
})

it('should pipe into `ts-node` and evaluate', function (done) {
exec(`echo "console.log('hello')" | ${BIN_EXEC}`, function (err, stdout) {
const cp = exec(BIN_EXEC, function (err, stdout) {
expect(err).to.not.exist
expect(stdout).to.equal('hello\n')

return done()
})

cp.stdin.end("console.log('hello')")
})

it('should pipe into `ts-node`', function (done) {
exec(`echo "true" | ${BIN_EXEC} -p`, function (err, stdout) {
const cp = exec(`${BIN_EXEC} -p`, function (err, stdout) {
expect(err).to.not.exist
expect(stdout).to.equal('true\n')

return done()
})

cp.stdin.end('true')
})

it('should pipe into an eval script', function (done) {
exec(`echo "true" | ${BIN_EXEC} -p '(process.stdin as any).isTTY'`, function (err, stdout) {
const cp = exec(`${BIN_EXEC} -p '(process.stdin as any).isTTY'`, function (err, stdout) {
expect(err).to.not.exist
expect(stdout).to.equal('undefined\n')

return done()
})

cp.stdin.end('true')
})

it('should support require flags', function (done) {
Expand Down

0 comments on commit b251147

Please sign in to comment.