Skip to content

Commit 22ead19

Browse files
committed
test: Implement nf-tests
1 parent 72c657f commit 22ead19

13 files changed

+371
-3
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ testing/
77
testing*
88
*.pyc
99
null/
10+
11+
.nf-test*

docs/output.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ Once installed, open IGV, go to `File > Open Session` and select the `igv_sessio
321321
- `genome/`
322322
- A number of genome-specific files are generated by the pipeline in order to aid in the filtering of the data, and because they are required by standard tools such as BEDTools. These can be found in this directory along with the genome fasta file which is required by IGV. If using a genome from AWS iGenomes and if it exists a `README.txt` file containing information about the annotation version will also be saved in this directory.
323323
- `genome/index/`
324-
325324
- `bwa/`: Directory containing BWA indices.
326325
- `bowtie2/`: Directory containing BOWTIE2 indices.
327326
- `chromap/`: Directory containing Chromap indices.

tests/bowtie2.nf.test

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
nextflow_pipeline {
2+
3+
name "Test pipeline with bowtie2 aligner"
4+
script "../main.nf"
5+
tag "bowtie2"
6+
7+
test("bowtie2") {
8+
9+
when {
10+
params {
11+
outdir = "$outputDir"
12+
aligner = "bowtie2"
13+
}
14+
}
15+
16+
then {
17+
assertAll(
18+
{ assert workflow.success },
19+
{ assert snapshot(
20+
workflow.trace.succeeded().size(),
21+
path("$outputDir/pipeline_info/nf_core_chipseq_software_mqc_versions.yml").readLines().first().contains("Workflow"),
22+
file("$outputDir/multiqc/multiqc_report.html").name
23+
).match() }
24+
)
25+
}
26+
}
27+
28+
test("bowtie2 with stub") {
29+
30+
options "-stub"
31+
32+
when {
33+
params {
34+
outdir = "$outputDir"
35+
aligner = "bowtie2"
36+
}
37+
}
38+
39+
then {
40+
assertAll(
41+
{ assert workflow.success },
42+
{ assert snapshot(
43+
workflow.trace.succeeded().size()
44+
).match() }
45+
)
46+
}
47+
}
48+
}

tests/bowtie2.nf.test.snap

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"bowtie2": {
3+
"content": [
4+
215,
5+
false,
6+
"multiqc_report.html"
7+
],
8+
"meta": {
9+
"nf-test": "0.9.2",
10+
"nextflow": "25.04.6"
11+
},
12+
"timestamp": "2025-09-03T12:24:15.101851"
13+
},
14+
"bowtie2 with stub": {
15+
"content": [
16+
20
17+
],
18+
"meta": {
19+
"nf-test": "0.9.2",
20+
"nextflow": "25.04.6"
21+
},
22+
"timestamp": "2025-09-03T12:25:08.264636"
23+
}
24+
}

tests/chromap.nf.test

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
nextflow_pipeline {
2+
3+
name "Test pipeline with chromap aligner"
4+
script "../main.nf"
5+
tag "chromap"
6+
7+
test("chromap") {
8+
9+
when {
10+
params {
11+
outdir = "$outputDir"
12+
aligner = "chromap"
13+
}
14+
}
15+
16+
then {
17+
assertAll(
18+
{ assert workflow.success },
19+
{ assert snapshot(
20+
workflow.trace.succeeded().size(),
21+
path("$outputDir/pipeline_info/nf_core_chipseq_software_mqc_versions.yml").readLines().first().contains("Workflow"),
22+
file("$outputDir/multiqc/multiqc_report.html").name
23+
).match() }
24+
)
25+
}
26+
}
27+
28+
test("chromap with stub") {
29+
30+
options "-stub"
31+
32+
when {
33+
params {
34+
outdir = "$outputDir"
35+
aligner = "chromap"
36+
}
37+
}
38+
39+
then {
40+
assertAll(
41+
{ assert workflow.success },
42+
{ assert snapshot(
43+
workflow.trace.succeeded().size()
44+
).match() }
45+
)
46+
}
47+
}
48+
}

tests/chromap.nf.test.snap

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"chromap": {
3+
"content": [
4+
215,
5+
false,
6+
"multiqc_report.html"
7+
],
8+
"meta": {
9+
"nf-test": "0.9.2",
10+
"nextflow": "25.04.6"
11+
},
12+
"timestamp": "2025-09-03T12:24:13.69564"
13+
},
14+
"chromap with stub": {
15+
"content": [
16+
20
17+
],
18+
"meta": {
19+
"nf-test": "0.9.2",
20+
"nextflow": "25.04.6"
21+
},
22+
"timestamp": "2025-09-03T12:25:08.441176"
23+
}
24+
}

tests/nextflow.config

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@
44
========================================================================================
55
*/
66

7-
// TODO nf-core: Specify any additional parameters here
8-
// Or any resources requirements
7+
// Limit resources so that this can run on GitHub Actions
8+
process {
9+
resourceLimits = [
10+
cpus: 2,
11+
memory: '6.GB',
12+
time: '6.h'
13+
]
14+
}
15+
916
params {
1017
modules_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/'
1118
pipelines_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/chipseq'

tests/skip_consensus_peaks.nf.test

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
nextflow_pipeline {
2+
3+
name "Test pipeline with --skip_consensus_peaks"
4+
script "../main.nf"
5+
tag "skip_consensus_peaks"
6+
7+
test("skip_consensus_peaks") {
8+
9+
when {
10+
params {
11+
outdir = "$outputDir"
12+
skip_consensus_peaks = true
13+
}
14+
}
15+
16+
then {
17+
assertAll(
18+
{ assert workflow.success },
19+
{ assert snapshot(
20+
workflow.trace.succeeded().size(),
21+
path("$outputDir/pipeline_info/nf_core_chipseq_software_mqc_versions.yml").readLines().first().contains("Workflow"),
22+
file("$outputDir/multiqc/multiqc_report.html").name
23+
).match() }
24+
)
25+
}
26+
}
27+
28+
test("skip_consensus_peaks with stub") {
29+
30+
options "-stub"
31+
32+
when {
33+
params {
34+
outdir = "$outputDir"
35+
skip_consensus_peaks = true
36+
}
37+
}
38+
39+
then {
40+
assertAll(
41+
{ assert workflow.success },
42+
{ assert snapshot(
43+
workflow.trace.succeeded().size()
44+
).match() }
45+
)
46+
}
47+
}
48+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"skip_consensus_peaks with stub": {
3+
"content": [
4+
20
5+
],
6+
"meta": {
7+
"nf-test": "0.9.2",
8+
"nextflow": "25.04.6"
9+
},
10+
"timestamp": "2025-09-03T11:55:37.125143"
11+
},
12+
"skip_consensus_peaks": {
13+
"content": [
14+
210,
15+
false,
16+
"multiqc_report.html"
17+
],
18+
"meta": {
19+
"nf-test": "0.9.2",
20+
"nextflow": "25.04.6"
21+
},
22+
"timestamp": "2025-09-03T11:55:08.155806"
23+
}
24+
}

tests/skip_trimming.nf.test

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
nextflow_pipeline {
2+
3+
name "Test pipeline with --skip_trimming"
4+
script "../main.nf"
5+
tag "skip_trimming"
6+
7+
test("skip_trimming") {
8+
9+
when {
10+
params {
11+
outdir = "$outputDir"
12+
skip_trimming = true
13+
}
14+
}
15+
16+
then {
17+
assertAll(
18+
{ assert workflow.success },
19+
{ assert snapshot(
20+
workflow.trace.succeeded().size(),
21+
path("$outputDir/pipeline_info/nf_core_chipseq_software_mqc_versions.yml").readLines().first().contains("Workflow"),
22+
file("$outputDir/multiqc/multiqc_report.html").name
23+
).match() }
24+
)
25+
}
26+
}
27+
28+
test("skip_trimming with stub") {
29+
30+
options "-stub"
31+
32+
when {
33+
params {
34+
outdir = "$outputDir"
35+
skip_trimming = true
36+
}
37+
}
38+
39+
then {
40+
assertAll(
41+
{ assert workflow.success },
42+
{ assert snapshot(
43+
workflow.trace.succeeded().size()
44+
).match() }
45+
)
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)