在Jest中运行特定测试套件的单个测试 [英] Run single test of a specific test suite in Jest

查看:389
本文介绍了在Jest中运行特定测试套件的单个测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为"test-file-1"的文件,其中有一些描述(测试套件)的名称都是唯一的,并且在其中有一些测试,这些测试在各个测试套件中可能具有相似的名称.

I have a file called "test-file-1", within it i have a few describes (test suites) with unique names and inside them i have tests which may have similar names across test suites.

要运行单个测试套件或测试,请在下面键入以下命令.

To run a single test suite or test i type the command below.

npm test -- -t "Test Suite or Test"

我正在尝试弄清楚如何对特定测试套件进行单个测试.

I'm trying to figure out how to run a single test of a specific test suite.

推荐答案

尝试了许多不同的事情后,我发现它比我想象的要简单.

After trying a lot of different things i found out that it was simpler than i thought.

您只需要将测试放在测试套件之后,并使用相同的字符串即可:

You simply have to put the test after the test suite in the same string:

npm test -- -t "<Test Suite> <Test>"

这篇关于在Jest中运行特定测试套件的单个测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆