Closed rcarver closed 1 year ago
@rcarver used your fork, tried to implement per above... script works great, and my build is as expected. But when I run tests I get the below:
@jdowd7 strange! I actually moved this code into a separate repo if you want to try it that way? Based on that error I'd try a clean build and restart Xcode.
Closing this PR since the standalone approach works well.
@rcarver thanks! I'll give this a try. Drop in meaning manually import and not using SPM?
@jdowd7 yes use via SPM. It defines a new assertSnapshots
function so you should just be able to swap import SnapshotTesting
to import SnapshotTestingEnvOverlay
Following the thread in #553 it seems there are two steps to using snapshots on Xcode cloud:
ci_scripts
directory, which is the only set of files available during a test run. This can be done via symlink.assertSnapshot
must be called with asnapshotDirectory
argument pointing to the location of the file's snapshots within theci_scripts
directory.The project I'm working with has many swift packages, many of which use snapshots. I wanted a way to run the snapshot tests on Xcode cloud without changing the local workflow.
This change allows configuration of the snapshot directory via ENV var, with an option specifically for this workflow.
1. Symlink snapshots
This script finds all
__Snapshot__
directories and symlinks them intoci_scripts/snapshots
. Run it from your project root.2. Configure the snapshots location for CI
Set an ENV var to change where the library finds snapshots:
The result is that snapshots from all packages are flattened and symlinked into the
ci_scripts
dir, thenSnapshotTesting
constructs a matching path for assertion when run via CI.