Run only ONE test with Jest

后端 未结 4 1188
借酒劲吻你
借酒劲吻你 2020-12-28 11:10

Very simple, I want to run just one test with Jest.

I put it.only or describe.only but it still runs a whole lot of tests. I think it runs

4条回答
  •  心在旅途
    2020-12-28 11:57

    For me it works if I use 2 params like this:

    yarn test --watch -f "src/...fullpath.../reducer.spec.js" -t "Name of the test"
    

    Flags:

    --watch: is optional
    
    -f: will do filtering of your files, so if you have a lot of tests with the same name, specify the full path to the exact file
    
    -t: works with 'describe' name or 'it' name of your test
    

提交回复
热议问题