askimed / nf-test

Simple test framework for Nextflow pipelines
https://www.nf-test.com
MIT License
146 stars 25 forks source link

can't test pipeline which uses relative paths in samplesheet (and runs fine with nextflow run) #273

Open blex-max opened 1 week ago

blex-max commented 1 week ago

I have a pipeline using nf-core structure which has some old e2e tests that I’m charged with converting to the nf-test format. The samplesheet input for each contains relative paths to the appropriate data - tests/sample-data/xxx.yyy and so on. This is fine when calling nextflow run […] main.nf --input samplesheet.csv, however when using nf-test and providing inputs in the params block of the test definition, the tests error out reporting that xxx.yyy does not exist - I can fix the error if I make the paths in the samplesheet absolute, but this makes the testing non-portable which defeats the point for us. How can I work around this? I’ve tried using ${projectDir} in the samplesheet, but, unsurprisingly I think, it doesn’t get expanded in this context and instead is treated as a string, so again the file appears not to exist. Presumably this has come up before? I consider this a bug in the sense that if nextflow run works, utilising nf-test shouldn't itself cause failure.

blex-max commented 6 days ago

got it working by modifying the test paths to ../../../path/to/data - it seems a bit unfortunate that this is necessary!