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

log.warn not present if --verbose not given #271

Open
LouisLeNezet opened this issue Nov 6, 2024 · 0 comments
Open

log.warn not present if --verbose not given #271

LouisLeNezet opened this issue Nov 6, 2024 · 0 comments

Comments

@LouisLeNezet
Copy link

Hi,

I've stumbled upon the following issue recently.
In the case of a function test giving a warning through log.warn the warning doesn't seems to be produced through the nf-test if --verbose is not set.

Here is a reproducible example:

The function:

def checkMetaChr(chr_a, chr_b, name){
    def intersect = chr_a
        .combine(chr_b)
        .map{
            a, b ->
            if (b != [[]] && !(a - b).isEmpty()) {
                def chr_names = (a - b).size() > params.max_chr_names ? (a - b)[0..params.max_chr_names - 1] + ['...'] : (a - b)
                def verb = (a - b).size() == 1 ? "is" : "are"
                log.warn "Chr : ${chr_names} ${verb} missing from ${name}"
                return (a-b)
            }
            return []
        }
        .flatten()
    return intersect
}

The nf-test file

nextflow_workflow {
    name "Test function"
    script "../main.nf"

    test ("Test checkMetaChr warning") {
            function "checkMetaChr"
            when {
                function {
                    """
                    input[0] = Channel.of([["chr1", "chrY" ]])
                    input[1] = Channel.of([["chr1"]])
                    input[2] = "test"
                    """
                }
            }
            then {
                assertAll (
                    { assert function.success },
                    { assert function.stdout.contains("WARN: Chr : [chrY] is missing from test") }
                )
            }
        }
}

The two commands:

nf-test test main.nf --verbose # works
nf-test test main.nf # doesn't works
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant