Best Practice for Separating Slow Tests in Kaocha (e.g., Integration Tests)

I’m trying to figure out the best way to separate slower tests (such as integration tests) in a Kaocha setup.

I’ve added a metadata tag like ^:slow to the appropriate tests and updated my test.edn to skip them by default:

{:skip-meta [:slow]}

This works fine when running Kaocha normally — the slow tests are skipped. However, I’m running into two issues:

  1. When using kaocha.watch with:

    (kaocha.watch/run (kaocha.repl/config))
    
    

    the :skip-meta config seems to be ignored, and the slow tests still run.

  2. When I try to run only the slow tests manually using:

    bin/kaocha --focus-meta slow
    
    

    they are skipped because of the :skip-meta setting in test.edn.

Question:
What’s the best practice for handling this kind of setup — where I want slow tests to be skipped by default but still runnable via focus when needed? Is there a better way to configure this or override :skip-meta dynamically?

Thanks in advance!

I would suggest organizing your tests into different suites per 3. Configuration — lambdaisland/kaocha 1.91.1392 and then starting watch mode configured to only run the unit test suite.

But how can I restrict

(kaocha.watch/run (kaocha.repl/config))

to a specific test suite? I see I can pass a map to config but no details what this should contain.

I’m not at a repl now but you could try adding :kaocha.filter/focus :unit to that config

Exactly, just tried this out to make sure since it’s been a while

(kaocha.watch/run (kaocha.repl/config {:kaocha.filter/focus [:integration]}))

The :id you give a test suite is a “testable id”, just like namespace or deftest names (as symbols), so it’s something you can focus on, and it’ll run all tests underneath that.