0

I have a swift library compiled with SwiftPM and I have two testTargets declared in my Package.swift. I would like to be able to run these two test targets independently in my CI, so I have been trying to run something like: swift test --filter='unitTests' swift test --filter='integrationTests'

When I run without --filter, I see 4 unit tests run, with 1 failure; and 1 integration test, with 1 failure. However, these --filter commands result in 1 passing unit test, and 0 integration tests, running.

But when I add --list to those commands, all the appropriate tests appear in the list. I can't find any reason these tests would be excluded when using --filter.

Am I missing something about the behavior of --filter here?

qqq
  • 1,360
  • 1
  • 9
  • 24

1 Answers1

0

The --filter option works on test names (and not the type of test). SwiftPM uses regex on test names with the given input and runs the matching tests.

  • That is what I expect, in particular `unitTests` and `integrationTests` are the names of my test targets and therefore they appear as the prefix to my test names, as they appear in `--list`, like `unitTests.firstBehaviorSpec; integrationTests.complexBehaviorSpec`. So this behavior still surprises me. – qqq Feb 13 '18 at 00:23