pgreen2
pgreen2

Reputation: 3651

Not a valid command: it when executing sbt it

I followed the steps for adding integration tests found at http://www.scala-sbt.org/release/docs/Detailed-Topics/Testing#integration-tests.

However, when I run sbt it, see the following:

$ sbt it
[info] Loading project definition from myproj/project
[info] Set current project to myproj (in build file:myproj/)
[error] Not a valid command: it
[error] Not a valid project ID: it
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: it
[error] it
[error]   ^

sbt test works as expected

Upvotes: 1

Views: 2439

Answers (2)

Jacek Laskowski
Jacek Laskowski

Reputation: 74749

What's described in Integration Tests is about how to add a new configuration, namely it. There are many configurations available, e.g. Compile, Test, Runtime, Docs, Pom - you can find the default ones as vals in the sbt.Configuration object.

The official documentation of SBT in Selecting the configuration and Scoping by configuration axis should explain why you calling sbt it would require a command or a task with the it name which as it turned out was not the case.

The it configuration binds tasks that you may have used in the other configurations like test be reconfigured so the integration tests are in it directory (rather than in their default one - src/test).

Upvotes: 1

pgreen2
pgreen2

Reputation: 3651

After a bunch of googling, I realized the problem was that integration tests aren't quite the same as tests. To run integration tests, the configuration is slightly different:

sbt it:test

When I do that, everything works fine.

Upvotes: 2

Related Questions