简体   繁体   English

如何在 lerna exec 命令中执行 npm run 测试?

[英]How can I perform a npm run test in a lerna exec command?

how to execute a npm run test if the condition is true?如果条件为真,如何执行 npm run 测试? please check the code below thanks.请检查下面的代码谢谢。

lerna exec --concurrency 1 --scope=file --  pwd | awk '{ if ($0 ~ /pattern_match/) {npm run test} }'

$0 = file directories.

Try尝试

lerna exec --concurrency 1 --scope=file --  pwd | grep '<pattern match>' && npm run test

Demo :演示:

$echo asd  |  grep [0-9] && echo "Yes" 
$echo 123  |  grep [0-9] && echo "Yes" 
123
Yes
$

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM