diff --git a/source/simulation2/components/tests/test_scripts.h b/source/simulation2/components/tests/test_scripts.h index 3203a3599f..dcb3790644 100644 --- a/source/simulation2/components/tests/test_scripts.h +++ b/source/simulation2/components/tests/test_scripts.h @@ -19,6 +19,8 @@ #include "ps/Filesystem.h" +#include "scriptinterface/ScriptContext.h" + class TestComponentScripts : public CxxTest::TestSuite { public: @@ -89,6 +91,8 @@ public: paths.push_back(VfsPath(L"simulation/components/tests/setup_test.js")); for (const VfsPath& path : paths) { + // Clean up previous scripts. + g_ScriptContext->ShrinkingGC(); CSimContext context; CComponentManager componentManager(context, g_ScriptContext, true); diff --git a/source/test_setup.cpp b/source/test_setup.cpp index 2449c3fdb0..4c3dfb2ecc 100644 --- a/source/test_setup.cpp +++ b/source/test_setup.cpp @@ -94,6 +94,14 @@ class MiscSetup : public CxxTest::GlobalFixture return true; } + virtual bool setUp() + { + // Clean up any JS leftover between tests. + g_ScriptContext->ShrinkingGC(); + + return true; + } + private: // We're doing the initialization and shutdown of the ScriptEngine explicitly here