From 1e35b228847716e6ab61da8eb1914060f497671e Mon Sep 17 00:00:00 2001 From: maxulysse Date: Tue, 1 Oct 2024 18:24:58 +0200 Subject: [PATCH] add more details and examples --- README.md | 13 ++++++++++++- tests/getRelativePath/main.nf.test | 4 +++- tests/getRelativePath/main.nf.test.snap | 8 ++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 288ea9d..23934cb 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,18 @@ By using `getRelativePath()` we generate in the snapshot: ] ``` -While we only a flat structure without this function: +A reduced list can be generated by using the `getAllFilesFromDir()` not to output the folders. + +```text +"content": [ + [ + "stable/stable_content.txt", + "stable/stable_name.txt" + ] +] +``` + +While only a flat structure would be generated without using `getRelativePath()` and using `*.name` to capture the file names. ```text "content": [ diff --git a/tests/getRelativePath/main.nf.test b/tests/getRelativePath/main.nf.test index f7ecc4b..9ee7771 100644 --- a/tests/getRelativePath/main.nf.test +++ b/tests/getRelativePath/main.nf.test @@ -14,9 +14,11 @@ 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_file = getAllFilesFromDir(params.outdir, false, ['pipeline_info/execution_*.{html,txt}'], null ) assert snapshot( // Use getRelativePath to get the relative path starting from outputDir - getRelativePath(stable_name, outputDir) + getRelativePath(stable_name, outputDir), + getRelativePath(stable_file, outputDir) ).match() } } diff --git a/tests/getRelativePath/main.nf.test.snap b/tests/getRelativePath/main.nf.test.snap index 34a1751..60938ab 100644 --- a/tests/getRelativePath/main.nf.test.snap +++ b/tests/getRelativePath/main.nf.test.snap @@ -6,12 +6,16 @@ "stable", "stable/stable_content.txt", "stable/stable_name.txt" + ], + [ + "stable/stable_content.txt", + "stable/stable_name.txt" ] ], "meta": { "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-01T18:07:03.886102" + "timestamp": "2024-10-01T18:20:38.379963" } -} \ No newline at end of file +}