如何根据文件名过滤DENO测试?
如何根据文件名过滤DENO测试?
例如,我有以下文件:
number_1_test.ts
number_2_test.ts
string_test.ts
我想运行number*
测试,
我无法使用以下命令:
deno test number*
也不:
deno test --filter number*
我应该怎么做?
DENO测试用法:
DENO TEST [option] [files] ... [ - < script_arg> ...]
- filter< filter>:使用此字符串或此字符串运行测试测试名称中的模式
How to filter Deno tests based on filename?
For example, I have the following files:
number_1_test.ts
number_2_test.ts
string_test.ts
I want to run number*
tests,
I can't use the following command:
deno test number*
nor:
deno test --filter number*
What should I do?
Deno test usage:
deno test [OPTIONS] [files]... [-- <SCRIPT_ARG>...]
--filter <filter>: Run tests with this string or pattern in the test name
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 globbing shell的功能。这是一个使用
bash
的示例:You can do this using the globbing capabilities of your shell. Here's an example using
bash
:您可以并排除测试文件通过
deno.json(c)
。就我而言,我将单元
*。spec.ts
与Integration*。test.ts
测试:使用相同的模式可以解决您的问题:
> DENO TEST ./src/**/number*.ts
You can include and exclude test files via
deno.json(c)
.In my case, I was separating the unit
*.spec.ts
from integration*.test.ts
tests:With the same pattern you can solve your issue:
deno test ./src/**/number*.ts