Tests retrieved from collection variable - test failures stop subsequent tests from running

I have tests that I want to use in multiple API calls. Using JavaScript from external files has been an open issue for 6 years now but isn’t officially supported (yet). I’m storing tests in collection variables so they can be retrieved in each APIs Tests. The issue is tests that fail stop execution like a general JS failure.

Tests being stored in collection variables via an API’s Pre-req

In an API call that also does setup (update collection variable values) I store the shared library of tests via a Pre-request Script. This is working fine.

image

A “normal” test failure

When a test is coded in an API’s Test area, failures don’t stop subsequent tests from running.

A failure for a test pulled in from a collection variable

I can pull tests from the collection variable and run them just fine. However when a Chai expectation fails it seems to be treated like a JavaScript failure instead of an test/expectation failure.

The test run fails, subsequent tests for this API don’t run nor do other APIs in the collection run.

How can I have tests retrieved from a collection variable run/fail like hard coded tests?