Im running into the same issue - it started happened as I struggled to configure SwiftTesting (it kept hanging on indexing). I had delete my build folder, and based on other suggestions my DerivedData folder.
Very frustrating to have a project completely break due to trying to get SwiftTesting to work.
EDIT: Turning off explicitly build modules in build settings seems to have cured the issue - although my tests still hang on 'indexing'