Nf-test check number of output files

I’ve been playing around with gprofiler. One parameter is sources, which (in the R code) is split by ‘,’ and then the process will write one output file per value.

I want to add a test to make sure this parameter is behaving correctly (it isn’t in the master version, and I’ve changed it).

In the main.nf file of gprofiler, there is a variable defined as
tuple val(meta), path(“.gprofiler2..sub_enriched_pathways.png”) , emit: sub_plot , optional: true

I want to check that there are two files created in the output directory, but I can’t manage to do that.
I’ve tried adding variantions of
{ assert process.out.sub_plot.[0][1].collect().size() == 2},

to main.nf.test, and I just get errors about syntax (something about closures).

How do I check how many files were generated? It seems similar to Nf-test: Capture all process/workflow outputs without capturing md5sums of files in snapshots, but not really

Thank you,

Uri David

Edited to add, if I try
{ assert process.out.sub_plot[0][1].list().size() == 2}

I get an error groovy.lang.MissingMethodException: No signature of method: java.util.ArrayList.list() is applicable for argument types: () values:

If I try
{ assert process.out.sub_plot[0][1].size() == 2} it doesn’t have an error- is this the correct manner?

Is there a way to get debug prints, by using something like process_out.sub_plot.view() (I tried that command and it didn’t work)

Never mind.
Figured it out, but keeping if it might be useful for other people
{ assert process.out.sub_plot[0][1].size() == 2}

Also, the nf-core documentation has a very good explanation of nf-test, which supplements the explanation in the nf-test website. Docs: nf-test: Example assertions