javascript - how to use testNamePattern of jest within package.json scripts field? - Stack Overflow

Honestly, jest of facebook has a bad document.I want to use jest -t xxx to update my snapshots.Here is

Honestly, jest of facebook has a bad document.

I want to use jest -t xxx to update my snapshots.

Here is my test, but no one works correctly.

  1. jest -u -t='test.tsx'

  2. jest -u -t 'test.tsx'

  3. jest -u -t /test.tsx/

  4. jest -u -t=/test.tsx/

I want to match and update snapshots test files which filename pattern like *.test.tsx.

How can I do that with jest testNamePattern?

Honestly, jest of facebook has a bad document.

I want to use jest -t xxx to update my snapshots.

Here is my test, but no one works correctly.

  1. jest -u -t='test.tsx'

  2. jest -u -t 'test.tsx'

  3. jest -u -t /test.tsx/

  4. jest -u -t=/test.tsx/

I want to match and update snapshots test files which filename pattern like *.test.tsx.

How can I do that with jest testNamePattern?

Share Improve this question asked Jul 11, 2017 at 11:24 Lin DuLin Du 103k135 gold badges334 silver badges565 bronze badges 1
  • have you tried jest -u -t '*.test.tsx' ? – JoeTidee Commented Jul 24, 2017 at 11:18
Add a ment  | 

1 Answer 1

Reset to default 9

First check jest --showConfig to see that you even have the option of --testNamePattern. I faced the same issue, and did not find this option in jest config.

So I changed my directory structure and used --testPathPattern option with regex. This works.

jest --testPathPattern='(tests)/spec/./snapshot-tests/.'

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742260215a4410765.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信