Search code examples
javascriptunit-testingava

how do you ignore non-test files with ava?


Can I ignore a setup or support folder so that ava doesn't try to run the files inside?

I have some common utility files used for mocking that should logically live inside the test/ folder alongside tests but I don't want to run them as tests.


Solution

  • To ignore files prefix them with an underscore _ or an exclamation mark !


    In ava's documentation for configuration under the files bulletpoint it states:

    Files with an underscore prefix are ignored

    And the documentation at the top also explicitly states:

    To ignore files, prefix the pattern with an ! (exclamation mark).