Search code examples
angularmocha.jschaie2e-testingcypress

Can I get the list of tests created with cypress?


I would like to get/extract all test name (decribe and it) but I can't figure out how to do it. I use cypress with angular.


Solution

  • You can do so via the terminal with this command. Execute it in the directory of your tests:

    grep -hr "describe(\| it(" *
    

    It will grep all describe( and it( in the files and display it. By using option -h it won't show the filename. By using option -r it will search recursive, searching trough all directories and files below the point of execution. I search for it( (with the space) for a reason. I assume you are using indention in the code, so it will exist. Besides that, by adding the space you rule out other commands that end with it (for example 'wait' and visit).