【问题标题】:How to pass an argument to 2nd command when using `concurrently` with npm?与npm一起使用`concurrent`时如何将参数传递给第二个命令?
【发布时间】:2022-07-10 20:06:37
【问题描述】:

我有 2 个 npm 脚本:tsc -wjest --watch 我想同时执行。我知道有一个名为concurrently 的工具可以用于此目的。

"test:watch": "concurrently -P --kill-others \"npm run watch\"  \"jest --watchAll -- {@} \"",

问题是我想将参数传递给 Jest 命令,而不是 concurrently 命令。

在使用concurrentlynpm 时如何将参数传递给第二个命令?

【问题讨论】:

    标签: npm jestjs ts-jest concurrently


    【解决方案1】:

    使用传递标志将参数从命令行传递到脚本。

    "test:watch": "concurrently -P --kill-others \"npm run watch\"  \"jest --watchAll -- {@} \"",
    

    像这样使用它:

    npm run test:watch -- -- cookie
    

    您需要使用两次-- 才能到达内部 Jest 脚本!

    【讨论】:

      猜你喜欢
      • 2017-01-12
      • 1970-01-01
      • 2021-02-14
      • 1970-01-01
      • 2013-04-12
      • 1970-01-01
      • 2018-08-24
      • 1970-01-01
      • 2018-04-21
      相关资源
      最近更新 更多