[TestBox 4.5.0] Test Fails Only When Run After Other Tests

I encountered a peculiar issue with TestBox where one of my API integration tests fails only if it runs after other test bundles.

The only thing that sets this particular test apart from the rest is that it uses execute() instead of get()/post()/etc.... This particular test comes from the ColdBox Hero to Superhero class I took in Vegas a few years back, so maybe there’s a better way to test for this particular case.

Here’s the test:

// EchoTest.cfm
describe( "REST API Echo Tests", function(){

	beforeEach(function( currentSpec ){
		// Setup as a new ColdBox request, VERY IMPORTANT. ELSE EVERYTHING LOOKS LIKE THE SAME REQUEST.
		setup();
    });
	it( "Has a method to handle global exceptions", function(){
		var event = execute( 
			event 			= "v1:echo.onError", 
			renderResults 	= true, 
			eventArguments	= { exception={ message="unit test", detail="unit test", stacktrace="" } }
		);
		
		var response = event.getPrivateValue( "response" );
		expect(	response.getError() ).toBeTrue();
		expect(	response.getStatusCode() ).toBe( 500 );
	});

	// ... rest of tests

The problem is, if I run all my tests, this test fails:
image
The specific error in the response object messages is: “InvalidHTTPMethod Execution of (onError): GET”

However, if I run the EchoTest.cfm file by itself, the test passes as expected:
image

Status code 405 means “Method Not Allowed,” which I assume would fall into the category of a handler restricting a particular request method. However, this test is being called via `execute(), and is referencing the event directly.

For reference, Echo.cfc handler extends coldbox.system.RestHandler

If anyone has any tips for troubleshooting, please feel free to chime in, as I would be very interested in figuring out what is going on. :slight_smile: