swift test fails on a new command line project without any changes. I did the following steps:
$ mkdir swift_testing
$ cd swift_testing
$ swift package init --name TestingDemo --type executable
$ swift test
Expectation:
The created tests run and show test failures or success on the command line.
Observation:
The following cryptic errors are printed:
Building for debugging...
error: emit-module command failed with exit code 1 (use -v to see invocation)
/Users/dom/Documents/ablage/swift_testing/Tests/TestingDemoTests/TestingDemoTests.swift:1:8: error: module 'Testing' is in package 'swift_testing' but was built from a non-package interface; modules of the same package can only be loaded if built from source or package interface: /Applications/Xcode-26.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/Testing.framework/Modules/Testing.swiftmodule/arm64-apple-macos.swiftinterface
1 | import Testing
| `- error: module 'Testing' is in package 'swift_testing' but was built from a non-package interface; modules of the same package can only be loaded if built from source or package interface: /Applications/Xcode-26.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/Testing.framework/Modules/Testing.swiftmodule/arm64-apple-macos.swiftinterface
2 | @testable import TestingDemo
3 |
/Users/dom/Documents/ablage/swift_testing/Tests/TestingDemoTests/TestingDemoTests.swift:1:8: warning: module 'Testing' is in package 'swift_testing' but was loaded from SDK; modules of the same package should be built locally from source only: /Applications/Xcode-26.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/Testing.framework/Modules/Testing.swiftmodule/arm64-apple-macos.swiftinterface
1 | import Testing
| `- warning: module 'Testing' is in package 'swift_testing' but was loaded from SDK; modules of the same package should be built locally from source only: /Applications/Xcode-26.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/Testing.framework/Modules/Testing.swiftmodule/arm64-apple-macos.swiftinterface
2 | @testable import TestingDemo
3 |
/Users/dom/Documents/ablage/swift_testing/Tests/TestingDemoTests/TestingDemoTests.swift:1:8: error: module 'Testing' is in package 'swift_testing' but was built from a non-package interface; modules of the same package can only be loaded if built from source or package interface: /Applications/Xcode-26.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/Testing.framework/Modules/Testing.swiftmodule/arm64-apple-macos.swiftinterface
1 | import Testing
| `- error: module 'Testing' is in package 'swift_testing' but was built from a non-package interface; modules of the same package can only be loaded if built from source or package interface: /Applications/Xcode-26.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/Testing.framework/Modules/Testing.swiftmodule/arm64-apple-macos.swiftinterface
2 | @testable import TestingDemo
3 |
/Users/dom/Documents/ablage/swift_testing/Tests/TestingDemoTests/TestingDemoTests.swift:1:8: warning: module 'Testing' is in package 'swift_testing' but was loaded from SDK; modules of the same package should be built locally from source only: /Applications/Xcode-26.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/Testing.framework/Modules/Testing.swiftmodule/arm64-apple-macos.swiftinterface
1 | import Testing
| `- warning: module 'Testing' is in package 'swift_testing' but was loaded from SDK; modules of the same package should be built locally from source only: /Applications/Xcode-26.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/Testing.framework/Modules/Testing.swiftmodule/arm64-apple-macos.swiftinterface
2 | @testable import TestingDemo
3 |
error: fatalError
Am I wrong to expect that a template project should be able to run its tests? How can I fix that?