更新时间:2023-02-10 22:40:34
开关 --listTests
返回测试文件的 JSON 数组,然后退出(而不是运行测试).>
它可能不是您正在寻找的,因为它不解析describe
/it
函数,输出也不是很漂亮.
https://facebook.github.io/jest/docs/en/cli.html#listtests
Is it possible to get a list of suites/specs without running the actual tests w/ Jest.
For example, I have a test that looks like this:
describe('when blah blah blah', function () {
it('returns foobar', function () { /* test code */ })
})
Ideally, I'd like to be able to just get a list of describe/it statements to quickly look at scenarios covered.
# stdout
when blah blah blah
returns foobar
I think this is possible with rspec, using a dry-run
flag. Is there any such option with Jest?
I took a look at the Jest CLI documentation and have done an issue search at the project's Github page, but could not find anything.
The switch --listTests
returns a JSON array of the test files and then exits (instead of running the tests).
It might not be exactly what you're looking for though since it doesn't parse the
describe
/it
functions, nor is the output very pretty.