Search code examples
reactjsjestjs

jest updateSnapshot for specific test file


I'm trying to figure out how o update a single snapshot file. In the docs it says just add the -t and I presume the file name but thats not working for me.

Example, in terminal I use.

jest -u -t test/js/tests/components/myTestApp.test.js

Any ideas why this is not working?. I also added the name as a string.


Solution

  • According to doc https://facebook.github.io/jest/docs/en/cli.html -t option is searching not for file name, but for specific spec name. They provided an example

    jest -u -t="ColorPicker"
    

    where "ColorPicker" is name of the spec, given in describe or test blocks.