Import Testing is failing for me on the command line when I build on a macOS VM, whether I use swift from Xcode, command-line tools, or the open-source toolchain. It works in Xcode in the same VM. I’m guessing it’s not the VM status but some misconfiguration, but I cannot find it. I noticed it in later 6.2.x and now in 6.3.
The distracting rub might be that these are in shared source libraries. The targets live in Source/ and are package products, but are used in many test modules in other packages. That configuration works elsewhere, but is it a supported approach?
The VM is run under the macOS Virtualization framework, and otherwise works as expected. There is no difference AFAICT in paths, software configuration, or source.
Swift Testing, like XCTest, is only available at test time. It won't be possible to link to it from a production target. There's a grey middle area for "test libraries" but it's unclear if that's relevant to you or not.
Unfortunately I don't think there's enough info here for us to reproduce the issue. If it's specific to Apple platforms, please file feedback with Apple and let me know the FB number. If it's occurring on other platforms too, please instead file a GitHub issue. Either way, make sure to include steps to reproduce the issue!
I think that’s exactly my situation, and it’s been working for some time.
I don’t
Understood; I’m not asking for a reproducer, but curious if someone has insight into ways to investigate - someone who knows more about how the testing library is made available, might work or have changed.
Sorry, not a test-library issue; it fails in stock test code on the VM using any toolchain (though they give different errors).
There is a slight difference in the machine version (RELEASE_ARM64_T6000 vs RELEASE_ARM64_VMAPPLE); perhaps some platform-recognition logic fails and first presents as the missing testing library.
(This failure blocks using a VM to sandbox agents)
Showing machine and swift versions. All paths/versions identical to working non-VM. The only difference is the version suffix.
# not vm: RELEASE_ARM64_T6000
$ uname -a
Darwin s1x.local 25.4.0 Darwin Kernel Version 25.4.0: Thu Mar 19 19:30:44 PDT 2026; root:xnu-12377.101.15~1/RELEASE_ARM64_T6000 arm64
# VM: RELEASE_ARM64_VMAPPLE
$ uname-a
Darwin ss263.local 25.4.0 Darwin Kernel Version 25.4.0: Thu Mar 19 19:29:33 PDT 2026; root:xnu-12377.101.15~1/RELEASE_ARM64_VMAPPLE arm64
# Xcode
$ which swift
HOME/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift
$ swift --version
swift-driver version: 1.148.6 Apple Swift version 6.3 (swiftlang-6.3.0.123.5 clang-2100.0.123.102)
Target: arm64-apple-macosx26.0
# standard project
$ swift package init --type library
$ swift test
HOME/git/CheckTest/Tests/CheckTestTests/CheckTestTests.swift:1:8: error: no such module 'Testing'
1 | import Testing
| `- error: no such module 'Testing'
# swift.org
$ which swift
HOME/Library/Developer/Toolchains/swift-6.3-RELEASE.xctoolchain/usr/bin/swift
$ swift --version
Apple Swift version 6.3 (swift-6.3-RELEASE)
Target: arm64-apple-macosx26.0
$ swift test
@__swiftmacro_14CheckTestTests7example0B0fMp_.swift:3:98: error: 'isolation()' is only available in macOS 10.15 or newer
Pilot error: Corrected by ensuring that xcode-select matches first swift in PATH. Mismatches seem to work outside the VM, but that’s likely due to incidental consistency between the two sets of libraries.