Bug report
When writing nf-tests for a pipeline that uses Nextflow's output {} block, setting params.outdir = "$outputDir" in the test's params {} block has no effect on where the output {} block publishes files. Instead of publishing to $outputDir (the nf-test managed output directory), Nextflow creates a separate results/ directory inside the nf-test test work directory (.nf-test/tests/<hash>/results/).
This makes it impossible to properly test published outputs via nf-test's $outputDir, since the actual files land in an unmanaged results/ sibling directory.
Expected behavior
When the test overrides params.outdir = "$outputDir", the output {} block publishes files to $outputDir/subdir/, allowing nf-test assertions on params.outdir.
Actual behavior
Files are published to .nf-test/tests/<hash>/results/subdir/ regardless of params.outdir. The nf-test $outputDir (.nf-test/tests/<hash>/output/) does not contain the published files, breaking test assertions.
Steps to reproduce the problem
nf-test.config:
config {
testsDir "."
workDir ".nf-test"
}
nextflow.config:
params {
outdir = ''
publish_dir_mode = 'copy'
}
workflow.output.mode = params.publish_dir_mode
main.nf :
process SAY_HELLO {
input:
val name
output:
path "hello.txt", emit: greetings
script:
"""
echo "Hello, ${name}!" > hello.txt
"""
}
workflow {
SAY_HELLO(Channel.of("World"))
publish:
greetings = SAY_HELLO.out.greetings
}
output {
greetings {
path { "greetings" }
}
}
tests/pipeline.nf.test :
nextflow_pipeline {
name "Test pipeline"
script "main.nf"
test("default") {
when {
params {
outdir = "$outputDir"
}
}
then {
assert workflow.success
// Fails — file is in .nf-test/tests/<hash>/results/greetings/hello.txt
// NOT in .nf-test/tests/<hash>/output/greetings/hello.txt ($outputDir)
assert path("${params.outdir}/greetings/hello.txt").exists()
}
}
}
observed directoryy layout after test run
.nf-test/tests/<hash>/
├── output/ ← $outputDir (what params.outdir was set to) — empty
└── results/ ← created by output {} block, ignoring params.outdir
└── greetings/
└── hello.txt
Environment
- Nextflow version:
>= 25.10.0
- Java version:
0.9.4
- Operating system:
ubuntu
Additional context
Workaround
Add the following option to nf.test:
options "-output-dir $outputDir"
Suggested fix
When outputDir is not explicitly set in the options, use params.outdir as the default base directory for output {} publishing if params.outdir is defined.
Bug report
When writing nf-tests for a pipeline that uses Nextflow's
output {}block, settingparams.outdir = "$outputDir"in the test's params {} block has no effect on where theoutput {}block publishes files. Instead of publishing to $outputDir (the nf-test managed output directory), Nextflow creates a separate results/ directory inside the nf-test test work directory (.nf-test/tests/<hash>/results/).This makes it impossible to properly test published outputs via nf-test's
$outputDir, since the actual files land in an unmanagedresults/sibling directory.Expected behavior
When the test overrides
params.outdir = "$outputDir", theoutput {}block publishes files to$outputDir/subdir/, allowing nf-test assertions onparams.outdir.Actual behavior
Files are published to
.nf-test/tests/<hash>/results/subdir/regardless of params.outdir. The nf-test$outputDir (.nf-test/tests/<hash>/output/)does not contain the published files, breaking test assertions.Steps to reproduce the problem
nf-test.config:nextflow.config:main.nf :tests/pipeline.nf.test :observed directoryy layout after test run
Environment
>= 25.10.00.9.4ubuntuAdditional context
Workaround
Add the following option to nf.test:
Suggested fix
When outputDir is not explicitly set in the options, use params.outdir as the default base directory for output {} publishing if params.outdir is defined.