admin管理员组文章数量:1287684
I have an npm script where I want to match both ts
and tsx
file extensions... something like below:
"test": "mocha ..... app/test/**/*.spec.{ts,tsx}"
However, the above syntax doesn't work. What's the correct syntax for doing this?
I have an npm script where I want to match both ts
and tsx
file extensions... something like below:
"test": "mocha ..... app/test/**/*.spec.{ts,tsx}"
However, the above syntax doesn't work. What's the correct syntax for doing this?
Share Improve this question edited Aug 30, 2017 at 1:02 RyanZim 6,9941 gold badge31 silver badges46 bronze badges asked Aug 29, 2017 at 23:38 sir_thursdaysir_thursday 5,41913 gold badges68 silver badges121 bronze badges1 Answer
Reset to default 12Your pattern is correct. Your problem is that your shell is attempting to expand your glob for you instead of letting mocha
expand it.
To fix this, you need to double-quote your glob (note that double-quotes must be JSON-escaped with \
):
"test": "mocha ..... \"app/test/**/*.spec.{ts,tsx}\""
Single quotes will also work (and won't need JSON-escaped) if you don't care about Windows support.
本文标签: javascriptMatch multiple file extensions in npm scriptStack Overflow
版权声明:本文标题:javascript - Match multiple file extensions in npm script - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741321026a2372204.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论