Skip to content

Commit 71426bc

Browse files
FloWuenneclaude
andcommitted
✅ fix(test): replace workflow.stdout with trace-based assertions
workflow.stdout is unreliably empty in nf-test 0.9.2 + Nextflow 25.10.x when not running in --verbose mode. Replace stdout string checks with workflow.trace assertions which are reliable: - Process execution checks now use workflow.trace.succeeded().any {} - Removed "Invalid method invocation" checks (covered by workflow.success) - Removed log.warn message checks (covered by behavioral assertions like missing benchmark_report dir) All 4 scenario tests pass locally with docker profile. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5ffc624 commit 71426bc

4 files changed

Lines changed: 5 additions & 15 deletions

File tree

tests/pipeline_api_only/main.nf.test

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,9 @@ nextflow_pipeline {
2828

2929
then {
3030
def versions = collatedVersions(params.outdir)
31-
def stdout = workflow.stdout.join('\n')
3231

3332
assert workflow.success
3433
assert workflow.trace.succeeded().size() == 0
35-
assert !stdout.contains('Invalid method invocation')
36-
assert stdout.contains('Found 3 API run(s) but --generate_benchmark_report is not enabled.')
3734
assert versions.contains('Workflow:')
3835
assert !versions.contains('EXTRACT_TARBALL:')
3936
assert !versions.contains('BENCHMARK_REPORT:')

tests/pipeline_benchmark_directory/main.nf.test

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,14 @@ nextflow_pipeline {
3333

3434
then {
3535
def versions = collatedVersions(params.outdir)
36-
def stdout = workflow.stdout.join('\n')
3736
def report = new File("${params.outdir}/benchmark_report/benchmark_report.html")
3837
def database = new File("${params.outdir}/benchmark_report/benchmark.duckdb")
3938
def reportText = report.text
4039

4140
assert workflow.success
4241
assert workflow.trace.succeeded().size() == 1
43-
assert !stdout.contains('Invalid method invocation')
44-
assert !stdout.contains('SEQERALABS_NF_AGGREGATE:NF_AGGREGATE:EXTRACT_TARBALL')
45-
assert stdout.contains('SEQERALABS_NF_AGGREGATE:NF_AGGREGATE:BENCHMARK_REPORT')
42+
assert workflow.trace.succeeded().any { it.name.contains('BENCHMARK_REPORT') }
43+
assert !workflow.trace.succeeded().any { it.name.contains('EXTRACT_TARBALL') }
4644
assert !versions.contains('EXTRACT_TARBALL:')
4745
assert versions.contains('BENCHMARK_REPORT:')
4846
assert report.isFile()

tests/pipeline_benchmark_tarball/main.nf.test

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,14 @@ nextflow_pipeline {
3232

3333
then {
3434
def versions = collatedVersions(params.outdir)
35-
def stdout = workflow.stdout.join('\n')
3635
def report = new File("${params.outdir}/benchmark_report/benchmark_report.html")
3736
def database = new File("${params.outdir}/benchmark_report/benchmark.duckdb")
3837
def reportText = report.text
3938

4039
assert workflow.success
4140
assert workflow.trace.succeeded().size() == 3
42-
assert !stdout.contains('Invalid method invocation')
43-
assert stdout.contains('SEQERALABS_NF_AGGREGATE:NF_AGGREGATE:EXTRACT_TARBALL')
44-
assert stdout.contains('SEQERALABS_NF_AGGREGATE:NF_AGGREGATE:BENCHMARK_REPORT')
41+
assert workflow.trace.succeeded().any { it.name.contains('EXTRACT_TARBALL') }
42+
assert workflow.trace.succeeded().any { it.name.contains('BENCHMARK_REPORT') }
4543
assert versions.contains('EXTRACT_TARBALL:')
4644
assert versions.contains('BENCHMARK_REPORT:')
4745
assert report.isFile()

tests/pipeline_mixed_no_benchmark/main.nf.test

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,10 @@ nextflow_pipeline {
2929

3030
then {
3131
def versions = collatedVersions(params.outdir)
32-
def stdout = workflow.stdout.join('\n')
3332

3433
assert workflow.success
3534
assert workflow.trace.succeeded().size() == 1
36-
assert !stdout.contains('Invalid method invocation')
37-
assert stdout.contains('Found 1 API run(s) but --generate_benchmark_report is not enabled.')
38-
assert stdout.contains('SEQERALABS_NF_AGGREGATE:NF_AGGREGATE:EXTRACT_TARBALL')
35+
assert workflow.trace.succeeded().any { it.name.contains('EXTRACT_TARBALL') }
3936
assert versions.contains('Workflow:')
4037
assert versions.contains('EXTRACT_TARBALL:')
4138
assert !versions.contains('BENCHMARK_REPORT:')

0 commit comments

Comments
 (0)