-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a326009
commit 8f70f58
Showing
9 changed files
with
31 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import {expectType} from 'tsd'; | ||
import getStdin = require('.'); | ||
import getStdin from './index.js'; | ||
|
||
expectType<Promise<string>>(getStdin()); | ||
expectType<Promise<Buffer>>(getStdin.buffer()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import {serial as test} from 'ava'; | ||
import test from 'ava'; | ||
import delay from 'delay'; | ||
import getStdin from '.'; | ||
import getStdin from './index.js'; | ||
|
||
test('get stdin', async t => { | ||
test.serial('get stdin', async t => { | ||
process.stdin.isTTY = false; | ||
const promise = getStdin(); | ||
|
||
process.stdin.push('uni'); | ||
process.stdin.push('corns'); | ||
process.stdin.push('corns'); // eslint-disable-line unicorn/no-array-push-push | ||
await delay(1); | ||
process.stdin.emit('end'); | ||
|
||
t.is((await promise).trim(), 'unicorns'); | ||
}); | ||
|
||
test('get empty string when no stdin', async t => { | ||
test.serial('get empty string when no stdin', async t => { | ||
process.stdin.isTTY = true; | ||
t.is(await getStdin(), ''); | ||
}); |