<@U06V253M4> TestBox is throwing an error of eleme...
# box-products
s
@bdw429s TestBox is throwing an error of element filetemplate is not defined in local when trying to generate code coverage... Ever ran into this?
b
@satauros Not sure what you're seeing. Can you post the full error message here?
s
@bdw429s I'm using : • Adobe ColdFusion 2016 (
adobe@2016
as engine) • TestBox
testbox-4.5.0+5-202112132349
with index.cfm containing the following code:
Copy code
<cfparam name="url.opt_run" default="true">
<cfparam name="url.recurse" default="true">
<cfparam name="url.coverageEnabled" default="true">
<cfparam name="url.coveragePathToCapture" default="#expandPath( '/subsidies/models' )#">
<cfparam name="url.coverageWhitelist" default="">
<cfparam name="url.coverageBlacklist" default="/qb,/testbox,/tests,Application.cfc,/index.cfm,/reset.cfm">
<cfinclude template="../libs/testbox/test-runner/index.cfm">
Using
server start
I spin up the server and navigate to http://127.0.0.1/tests/ which yields the following error : https://gist.github.com/satauros/ef8ec8ac0d8e1dc5e482453a1030a8eb I've narrowed it down to line 111 in testbox.system.coverage.browser.CodeBrowser.cfc (well duh, following the stack trace mentioned above ofc :D), but I have no idea as to why it fails... At this point i've implemented a "hack" by wrapping the
fileWrite( ... )
with a
try{ } catch { }
block, but now I don't trust the results of the coverage anymore...
b
@satauros Wow, that's an interesting error. I'm thinking this has to be an Adobe bug of some sort
Look at the code
Copy code
savecontent variable="local.fileTemplate" {
				include "templates/file.cfm";
			}

			fileWrite( theFile, local.fileTemplate );
There's literally no way
local.fileTemplate
shouldn't be defined right there.
s
I know, right...
b
Probably related to our use of streams
But still some stupid Adobe bug
Giancarlo reported a similar really weird error (only on Adobe) just at CFSummit where a variable that totally existed was being reported as not existing.
s
Could it be that b/c it is defined in an anonymous closure, the local scope is acting up?
Have had that before...
b
It's prolly related, but who knows how
I assume switching to a regular
for()
loop would "work" (but be slower)
Does the same error happen on CF 2021?
even if we have a repro case, Adobe isn't going to do anything about it being broken on 2016
s
Ill try it using cf 2021. I'll try to run it on lucee as well (its for testing purposes only). I'll get back to you
šŸ‘ 1
Works on Lucee
šŸ‘ 1