@@ -147,21 +147,19 @@ async function template(id) {
147147}
148148
149149//Testcase generator
150- function testcase ( name , env , { prod = { } , test = { } , ...step } ) {
150+ function testcase ( name , env , args ) {
151+ const { prod = { } , test = { } , ...step } = JSON . parse ( JSON . stringify ( args ) )
151152 const context = { prod, test} [ env ] ?? { }
152153 if ( context . skip )
153154 return null
154- const result = { ...JSON . parse ( JSON . stringify ( step ) ) , ...context , name :`${ name } - ${ step . name ?? "(unnamed)" } ` }
155- context . with ??= { }
155+
156+ Object . assign ( step . with , context . with ?? { } )
157+ delete context . with
158+ const result = { ...step , ...context , name :`${ name } - ${ step . name ?? "(unnamed)" } ` }
156159 for ( const [ k , v ] of Object . entries ( result . with ) ) {
157- if ( k in context . with )
158- result . with [ k ] = context . with [ k ]
159160 if ( ( env === "test" ) && ( secrets . $regex . test ( v ) ) )
160161 result . with [ k ] = v . replace ( secrets . $regex , secrets [ v . match ( secrets . $regex ) ?. groups ?. secret ] )
161162 }
162- if ( ! result . with . base )
163- delete result . with . base
164- delete result . with . filename
165163
166164 if ( env === "prod" ) {
167165 result . if = "${{ success() || failure() }}"
@@ -170,8 +168,12 @@ function testcase(name, env, {prod = {}, test = {}, ...step}) {
170168 }
171169
172170 if ( env === "test" ) {
171+ if ( ! result . with . base )
172+ delete result . with . base
173+ delete result . with . filename
173174 Object . assign ( result . with , { use_mocked_data :"yes" , verify :"yes" } )
174175 }
175176
177+ console . log ( arguments , result )
176178 return result
177179}
0 commit comments