Mark Pampuch
03/10/2026, 8:30 AM.nf-test file
...
then {
////////////////////////////////////////////////////////
// CLOSURE VERSION OF HELPER FUNCTION WORKS. BUT HAVING TROUBLE MOVING IT TO test/lib/debugOut.groovy AND USING IT IN THE TEST.
////////////////////////////////////////////////////////
// def RESET = "\033[0m"
// def CYAN = "\033[36m"
// def YELLOW = "\033[33m"
// def GREEN = "\033[32m"
// def MAGENTA = "\033[35m"
// def debugOut
// debugOut = { obj, indent = "", top = true ->
// // Only print top-level object
// // equivalent to println "process.out:"
// if (top) {
// println ""
// println "--------------------------------"
// println "PROCESS OUTPUT"
// println "$obj"
// println "--------------------------------"
// println ""
// println "--------------------------------"
// println "DETAILED TREE VIEW OF PROCESS OUTPUT"
// println "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv"
// }
// if (obj instanceof Map) {
// obj.each { k, v ->
// println "${indent}${CYAN}${k}${RESET}:"
// printTree(v, indent + " ", false) // recursive call, top=false
// }
// }
// else if (obj instanceof List) {
// obj.eachWithIndex { v, i ->
// println "${indent}${YELLOW}- [$i]${RESET}"
// printTree(v, indent + " ", false)
// }
// }
// // File / Path / string pointing to a real file
// else if (obj instanceof File || obj instanceof java.nio.file.Path ||
// (obj instanceof String && new File(obj).exists())) {
// println "${indent}${GREEN}${obj}${RESET}"
// }
// else {
// println "${indent}${MAGENTA}${obj}${RESET}"
// }
// }
debugOut(process.out)
}
When I try to move this into tests/lib/debugOut.groovy, I can’t call it anymore
Test Process DECOMPRESS_GENOME
Test [f08b1056] '.fa.gz - decompresses to .fa' FAILED (26.618s)
groovy.lang.MissingMethodException: No signature of method: com.askimed.nf.test.lang.process.ProcessContext.debugOut() is applicable for argument types: (com.askimed.nf.test.lang.channels.Channels) values: [[0:[[[id:test_fa], /ibex/project/c2303/20260309_NEXTFLOW-ALGAE-TAXA-FROM-GENOME/.nf-test/tests/f08b1056fb8439342cb24ee0a38d3c3c/work/2e/fc6a86a6c75f05b31e8a41a62a5491/GCA_009858895.3_ASM985889v3_genomic.200409.fa]], ...]]
Nextflow stdout:
Nextflow stderr:
FAILURE: Executed 1 tests in 26.721s (1 failed)
Even when I convert this closure to a function I get the same issue.
I have this explicitly defined in my nf-test.config file (even though I think this is just re-instating the default config)
// load the helper groovy functions
libDir "tests/lib"
Does anyone know what I’m doing wrong to try and get this helper function to work in my nf-tests?Nicolas Vannieuwkerke
03/10/2026, 8:39 AMclass LibClass {
static debugOut() {...}
}
Then you will be able to use it like this:
then {
LibClass.debugOut(...)
}
You can name your class anything, LibClass is just an example here 😛Mark Pampuch
03/10/2026, 8:41 AMNicolas Vannieuwkerke
03/10/2026, 8:43 AM