-
-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Hiroki Osame <[email protected]>
- Loading branch information
1 parent
bb00ef9
commit 2609f2d
Showing
3 changed files
with
40 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { testSuite } from 'manten'; | ||
import { tsx } from '../utils/tsx'; | ||
|
||
export default testSuite(async ({ describe }) => { | ||
describe('repl', ({ test }) => { | ||
test('handles ts', async () => { | ||
const tsxProcess = tsx({ | ||
args: [], | ||
}); | ||
|
||
const commands = [ | ||
'const message: string = "SUCCESS"', | ||
'message', | ||
]; | ||
|
||
await new Promise<void>((resolve) => { | ||
tsxProcess.stdout!.on('data', (data: Buffer) => { | ||
const chunkString = data.toString(); | ||
|
||
if (chunkString.includes('SUCCESS')) { | ||
return resolve(); | ||
} | ||
|
||
if (chunkString.includes('> ') && commands.length > 0) { | ||
const command = commands.shift(); | ||
tsxProcess.stdin?.write(`${command}\n`); | ||
} | ||
}); | ||
}); | ||
|
||
tsxProcess.kill(); | ||
}, 5000); | ||
}); | ||
}); |