在Requier.context test.ts中仅设置一个单元测试

发布于 2025-01-26 10:06:53 字数 287 浏览 0 评论 0原文

我试图在所需的上下文中设置一个单个规格:

const context = require.context('./', true, /my-element.component\.spec\.ts$/);

但是它在该路径中找不到任何规格,但是如果我将上下文作为默认值留下上下文,则可以找到它!

默认值:const Context = require.context('./',true,/\。spec \ .ts $/);

有人可以帮助我吗?

I am trying to set up a single spec in the required context as follows:

const context = require.context('./', true, /my-element.component\.spec\.ts$/);

But it is not finding any spec in that path, however if I leave the context as default, it finds it!

DEFAULT: const context = require.context('./', true, /\.spec\.ts$/);

Can someone help me with this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

奢欲 2025-02-02 10:06:53

您是否只是错过逃脱组件前面的点?

const context = require.context('./', true, /my-element\.component\.spec\.ts$/);

Did you just miss to escape the dot in front of component?

const context = require.context('./', true, /my-element\.component\.spec\.ts$/);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文