使用concurrently的--handle-input无法传递输入给vitest进程求助
解决concurrently转发输入到指定子进程的问题
方法1:通过前缀指定目标进程
开启--handle-input后,concurrently支持用[进程名]:[输入内容]的格式指定输入转发给对应进程。比如要给test进程发送u,直接输入:
test:u
回车后就能触发vitest的快照更新操作。
方法2:设置默认输入目标进程
如果不想每次输入都加前缀,可在npm脚本中添加--default-input-target test参数,修改后的脚本如下:
"test:unit": "concurrently --kill-others --handle-input --default-input-target test --names test,build \"vitest --environment jsdom\" \"vite build --watch\""
修改后运行脚本,直接按u再回车,输入会自动转发给test进程(vitest),无需额外前缀。
注意:若你的concurrently版本较低,可能没有--default-input-target选项,此时只能使用方法1。可通过以下命令查看版本并升级:
concurrently --version npm install concurrently@latest --save-dev
内容的提问来源于stack exchange,提问作者Luckylooke
相关产品推荐
相关产品推荐

