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

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

如果条件为真,如何执行 npm 运行 测试? 请检查下面的代码谢谢。

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

[=11=] = file directories.

尝试

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

演示:

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