3
votes

I am working with chisel-template

In my src/main/scala I have two folders, let say A and B.

In src/test/scala, I have a folder for A and a folder for B.

I want to test only A but when I do

$ sbt "test:runMain A.TestMain"

I have the errors of B which make the compilation fail. I know there are problems in B but I just want to check A first.

How can I test or compile only one folder ?

Thanks !

2

2 Answers

0
votes

I'm a beginner of scala, so there may be better ways.

sbt ReferenceManual tells us to add statement like below in build.sbt

excludeFilter in unmanagedSources := "excludedFileName"

If you want to exclude files only when running test, you can specify it like below.

excludeFilter in (Test, unmanagedSources) := "excludedFileName"

Probably, your question is about sbt, not chisel. That's why you may get better and more detailed answer if you add scala tag.

0
votes

I don't think there is a way to do this. But if you use scalatest to launch your tests instead of a main it's fairly easy. You can specify just the path you want with testOnly for example, from sbt command line

testOnly A.*

Or from the shell command line

sbt 'testOnly A.*'

In fact, with tests you can even specify specific tests within a test harness by using

sbt 'testOnly A.* -- -z "dog"'

(notes, the quoting is significant), you can run only those tests in package a that have the word dog in the test name