如何配置deps.edn,以便将集成测试与单元测试分开运行?
我有以下项目树:
.
├── deps.edn
├── src
│ (...)
├── test
│ └── package
│ └── test.clj
└── it
└── package
└── integration_test.clj所需的行为:
clj -Atest #runs unit tests only
clj -Ait #runs integration tests only尝试的配置:
{:deps (...)}
:aliases {:test {:extra-paths ["test"]
:extra-deps {lambdaisland/kaocha {:mvn/version "0.0-529"}}
:main-opts ["-m" "kaocha.runner"]}
:it {:extra-paths ["it"]
:extra-deps {lambdaisland/kaocha {:mvn/version "0.0-529"}}
:main-opts ["-m" "kaocha.runner"]}}}实际行为:
clj -Atest #runs unit tests only
clj -Ait #runs unit tests only发布于 2019-10-12 07:11:43
我们需要添加一个tests.edn文件:
#kaocha/v1
{:tests [{:id :unit
:test-paths ["test"]
:ns-patterns [".*"]}
{:id :integration
:test-paths ["it"]
:ns-patterns [".*"]}]}并将对上面定义的测试ids的引用添加到deps.edn
{:deps (...)}
:aliases {:test {:extra-paths ["test"]
:extra-deps {lambdaisland/kaocha {:mvn/version "0.0-529"}}
:main-opts ["-m" "kaocha.runner" "unit"]}
:it {:extra-paths ["it"]
:extra-deps {lambdaisland/kaocha {:mvn/version "0.0-529"}}
:main-opts ["-m" "kaocha.runner" "integration"]}}}https://stackoverflow.com/questions/58349267
复制相似问题