Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs #9

Merged
merged 9 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,37 @@
# nft-utils

nf-test utility functions

This repository contains utility functions for nf-test.

These functions are used to help capture level tests using nf-test.

## `removeNextflowVersion()`

Remove the Nextflow version from the yml pipeline created file.

Usage:

```groovy
assert snapshot(removeNextflowVersion("$outputDir/pipeline_info/nf_core_pipeline_software_mqc_versions.yml")).match()
```
maxulysse marked this conversation as resolved.
Show resolved Hide resolved

Only argument is path to the file.
maxulysse marked this conversation as resolved.
Show resolved Hide resolved

## `getAllFilesFromDir()`

Get all files (can include folders too) from a directory, not matching a regex pattern.

```groovy
def timestamp = [/.*\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}.*/]
def stable_name = getAllFilesFromDir(params.outdir, false, timestamp)
def stable_content = getAllFilesFromDir(params.outdir, false, timestamp + [/stable_name\.txt/] )
assert snapshot(
// Only snapshot name
stable_name*.name,
// Snapshot content
stable_content
).match()
```
maxulysse marked this conversation as resolved.
Show resolved Hide resolved

First argument is the directory path, second is a boolean to include folders, and the third is a list of regex patterns to exclude.
2 changes: 2 additions & 0 deletions tests/getAllFilesFromDir/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ nextflow_pipeline {
def stable_name = getAllFilesFromDir(params.outdir, false, timestamp)
def stable_content = getAllFilesFromDir(params.outdir, false, timestamp + [/stable_name\.txt/] )
assert snapshot(
// Only snapshot name
stable_name*.name,
// Snapshot content
stable_content
).match()
}
Expand Down