@@ -33,6 +33,7 @@ import test.OutputCapture
3333
3434import java.nio.file.Files
3535import java.nio.file.Path
36+ import java.util.regex.Pattern
3637import java.util.zip.GZIPOutputStream
3738
3839/**
@@ -96,15 +97,20 @@ class CmdModuleRunTest extends Specification {
9697 Files . write(dest, modulePackage)
9798 return dest
9899 }
100+ def escapedPath = Pattern . quote(tempDir. toString())
101+ def pattern = ~/ "${escapedPath}\/ .+\/ test_output\. txt"/
99102
100103 and :
101104 def cmd = new CmdModuleRun ()
105+ def opts = new CliOptions ()
106+ opts. setQuiet(true )
102107 cmd. launcher = Mock (Launcher ) {
103- getOptions() >> new CliOptions ()
108+ getOptions() >> opts
104109 getCliString() >> " nextflow module run nf-core/test-module"
105110 }
106111 cmd. args = [' nf-core/test-module' ]
107112 cmd. root = tempDir
113+ cmd. workDir = tempDir. toString()
108114 cmd. client = mockClient
109115
110116 when :
@@ -116,9 +122,7 @@ class CmdModuleRunTest extends Specification {
116122 .findResults { line -> ! line. contains(' INFO' ) ? line : null }. join(" " )
117123
118124 then :
119- stdout. contains(' Executing module...' )
120- stdout. contains(' Process CREATE_FILE Outputs:' )
121- stdout. contains(" test_output.txt" )
125+ assert (stdout =~ pattern). find()
122126 and :
123127 // Verify module was installed
124128 Files . exists(moduleDir)
@@ -131,7 +135,7 @@ class CmdModuleRunTest extends Specification {
131135 def moduleScript = '''
132136 process CREATE_FILE_V2 {
133137 output:
134- path "test_output_v2.txt"
138+ path "test_output_v2.txt", emit: output_path
135139
136140 script:
137141 """
@@ -147,6 +151,8 @@ class CmdModuleRunTest extends Specification {
147151 Files . createDirectories(moduleDir)
148152 moduleDir. resolve(' main.nf' ). text = moduleScript
149153 moduleDir. resolve(' meta.yml' ). text = ' name: nf-core/test-module\n version: 2.0.0'
154+ def escapedPath = Pattern . quote(tempDir. toString())
155+ def pattern = ~/ "output_path": "${escapedPath}\/ .+\/ test_output_v2\. txt"/
150156
151157 and :
152158 def modulePackage = createModulePackage(moduleScript)
@@ -159,13 +165,16 @@ class CmdModuleRunTest extends Specification {
159165
160166 and :
161167 def cmd = new CmdModuleRun ()
168+ def opts = new CliOptions ()
169+ opts. setQuiet(true )
162170 cmd. launcher = Mock (Launcher ) {
163- getOptions() >> new CliOptions ()
171+ getOptions() >> opts
164172 getCliString() >> " nextflow module run nf-core/test-module"
165173 }
166174 cmd. args = [' nf-core/test-module' ]
167175 cmd. version = ' 2.0.0'
168176 cmd. root = tempDir
177+ cmd. workDir = tempDir. toString()
169178 cmd. client = mockClient
170179
171180 when :
@@ -178,9 +187,7 @@ class CmdModuleRunTest extends Specification {
178187 .findResults { line -> ! line. contains(' DEBUG' ) ? line : null }
179188 .findResults { line -> ! line. contains(' INFO' ) ? line : null }
180189 .findResults { line -> ! line. contains(' plugin' ) ? line : null }. join(" " )
181- stdout. contains(' Executing module...' )
182- stdout. contains(' Process CREATE_FILE_V2 Outputs:' )
183- stdout. contains(" test_output_v2.txt" )
190+ assert (stdout =~ pattern). find()
184191
185192 }
186193
0 commit comments