I realize this must be solved numerous times elsew...
# nf-test
c
I realize this must be solved numerous times elsewhere in nf-core/subworkflow tests, but my searching skills are apparently lacking. Apologies. My tests all pass, but then fail when I'm interpreting this as random variation in the order of the output for the
txt
channel. What is the correct way to specify which file to check?
Copy code
then {
            assertAll(
                { assert workflow.success },
                { assert snapshot(
                    workflow.out.tagdir,
                    path(workflow.out.bedgraph.find {it[0].id == "sample1"}[1]).linesGzip.size(),
                    workflow.out.txt,
                    workflow.out.bed,
                    path(workflow.out.versions.get(0)).yaml
                ).match() }
            )
        }
f
you could check whats going on in your txt with .readLines()
m
I feel like the issue is more a question of order of files
👀 1
I assume you have more than 1 sample
the id changed from sample1 to sample2
this 1
c
sorry, lost track of this. Yes, the problem is the order of files, which of course isn't enforced in the output channel. I made some attempts and sorting or extracting specific files, but wasn't successful. I ended up 'solving' this by just checking that there exist 2 files in the output. I still believe that there are many examples of how to do this in other module tests and I failed to find it earlier. But maybe this would be a good example case in the docs?
m
no worries, this was happening in a modules/subworkflow test, right?
I think I have some nice improvments, thanks to @Nicolas Vannieuwkerke https://github.com/nf-core/rnavar/blob/dev/subworkflows/local/prepare_genome/tests/main.nf.test#L87-L90
👀 1
🎉 1