Autotest and add_exception method

Stuff floating on intrawebs for adding more files to be ignored using “add_exception” may not work because by the time “run” hook gets a chance to run, files to be ignored regexp is already compiled. The alternative is to use “initialize” hook like this:

Autotest.add_hook :initialize do |at|

This is with 3.11.0 of ZenTest and YMMV.

One thought on “Autotest and add_exception method”

  1. Thanks for posting this! I just started using AutoTest and this saved me some time.

    Linux users might need to put:
    > at.add_exception(/^\.\/(coverage|\.git)/)

    since AutoTest is using Find and gets files/dirs as:
    > ./coverage
    > ./coverage/some_file
    > ./.git
    > ./.git/somefile

    I decided to be more strict and only include files from certain directories and exclude everything else. I used:
    > at.find_directories = [‘./test’]

Leave a Reply

Your email address will not be published. Required fields are marked *