is there a way we can allow for deliberate snapshot matching?
@lukfor, is there a way we can allow for deliberate snapshot matching?
I've actually found it very useful to be able to have multiple tests refer to the same snapshot id. When testing a pipeline's logic, there will be times when skipping a process will impact files downstream of the process but not upstream. In this situation, it's been quite useful to group files that are expected to be unchanged into one snapshot id (which can be used across multiple tests) and those you expect to change. E.g.
{ assert snapshot(
path("$outputDir/cat/SAMPLE3_SE.merged.fastq.gz"),
path("$outputDir/pipeline_info/samplesheet.valid.csv")
).match("common_files")
}
With the new modification, if I now want to check that the files I expect to be unchanged are truly unchanged across multiple test, I would have to manually compare md5s in the snapshot.
Originally posted by @RHReynolds in https://github.com/askimed/nf-test/issues/188#issuecomment-1923562476
Thanks for opening this as an issue @lukfor! :)
I see. We could extend the mechanism so that ids starting, for example, with '!' could be used multiple times.
E.g.:
assert snapshot(...).match("!common_files")
Thanks for being so responsive on this! That sounds like a sensible solution to me.
Hey, @lukfor. I thought this was the opposite because I ran into it while using "versions" in nf-core/modules, and I can't find an example of anyone successfully doing it in modules. I've found examples of the opposite.
https://github.com/nf-core/modules/blob/b59962e477df7a20861ff7d982a16459a8557a65/modules/nf-core/learnmsa/align/tests/main.nf.test
I just searched for "match versions" in the repo.