Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maxulysse committed Oct 7, 2024
1 parent 1136621 commit 26a3798
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
19 changes: 14 additions & 5 deletions tests/getAllFilesFromDir/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@ nextflow_pipeline {

then {
// Use getAllFilesFromDir() to get a list of all files and folders from the output directory, minus the timestamped files
def stable_name = getAllFilesFromDir(params.outdir, true, ['pipeline_info/execution_*.{html,txt}'], null, [''])
def stable_name = getAllFilesFromDir(params.outdir, true, ['pipeline_info/execution_*.{html,txt}'], null, ['**'])
// Use getAllFilesFromDir() to get a list of all files and folders from the output directory, minus the timestamped files
def stable_name_again = getAllFilesFromDir(params.outdir, true, [''], null, ['stable/*'])
// Use getAllFilesFromDir() to get a list of all files from the output directory, minus the non-stable files
def stable_content = getAllFilesFromDir(params.outdir, false, ['pipeline_info/execution_*.{html,txt}'], 'tests/getAllFilesFromDir/.nftignore', [''])
def stable_content = getAllFilesFromDir(params.outdir, false, ['pipeline_info/execution_*.{html,txt}'], 'tests/getAllFilesFromDir/.nftignore', ['**'])
assert snapshot(
// Only snapshot name
stable_name*.name,
// Only snapshot name again
stable_name_again*.name,
// Snapshot content
stable_content
stable_content,
// Capture file with includeGlobs
).match()
}
}
Expand All @@ -38,12 +43,16 @@ nextflow_pipeline {
//with default params and relative
println(getAllFilesFromDir(params.outdir, relative: true))
// Use getAllFilesFromDir() to get a list of all files and folders from the output directory, minus the timestamped files
def stable_name = getAllFilesFromDir(params.outdir, includeDir: true, ignore: ['pipeline_info/execution_*.{html,txt}'])
def stable_name = getAllFilesFromDir(params.outdir, includeDir: true, ignore: ['pipeline_info/execution_*.{html,txt}'])
// Use getAllFilesFromDir() to get a list of all files and folders from the stable folder within the output dir
def stable_name_again = getAllFilesFromDir(params.outdir, includeDir: true, include: ['stable/*'])
// works also with spaces.
def stable_content = getAllFilesFromDir params.outdir, ignore: ['pipeline_info/execution_*.{html,txt}'], ignoreFile: 'tests/getAllFilesFromDir/.nftignore'
def stable_content = getAllFilesFromDir params.outdir, ignore: ['pipeline_info/execution_*.{html,txt}'], ignoreFile: 'tests/getAllFilesFromDir/.nftignore'
assert snapshot(
// Only snapshot name
stable_name*.name,
// Only snapshot name again
stable_name_again*.name,
// Snapshot content
stable_content
).match()
Expand Down
18 changes: 13 additions & 5 deletions tests/getAllFilesFromDir/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@
"stable_content.txt",
"stable_name.txt"
],
[
"stable_content.txt",
"stable_name.txt"
],
[
"stable_content.txt:md5,f6d73f703cda1c725ea78369a6c3a48d"
]
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.07.0"
"nextflow": "24.09.0"
},
"timestamp": "2024-10-02T10:15:47.491035"
"timestamp": "2024-10-07T16:53:04.994417"
},
"getAllFilesFromDir": {
"content": [
Expand All @@ -25,14 +29,18 @@
"stable_content.txt",
"stable_name.txt"
],
[
"stable_content.txt",
"stable_name.txt"
],
[
"stable_content.txt:md5,f6d73f703cda1c725ea78369a6c3a48d"
]
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
"nextflow": "24.09.0"
},
"timestamp": "2024-09-30T13:09:08.845794"
"timestamp": "2024-10-07T16:53:01.146706"
}
}
}
2 changes: 1 addition & 1 deletion tests/getRelativePath/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ nextflow_pipeline {

then {
// Use getAllFilesFromDir() to get a list of all files and folders from the output directory, minus the timestamped files
def stable_name = getAllFilesFromDir(params.outdir, true, ['pipeline_info/execution_*.{html,txt}'], null, [''])
def stable_name = getAllFilesFromDir(params.outdir, true, ['pipeline_info/execution_*.{html,txt}'], null, ['**'])
assert snapshot(
// Use getRelativePath to get the relative path starting from outputDir
getRelativePath(stable_name, outputDir)
Expand Down

0 comments on commit 26a3798

Please sign in to comment.