Skip to content

Commit 10be316

Browse files
Merge pull request #53 from yulcat/feature/fix-test-error
fix: prevent exceptions from manual test
2 parents 219eccc + 991b8e3 commit 10be316

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Editor/Services/TestRunnerService.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ private void CollectTestItems(ITestAdaptor testAdaptor, List<ITestAdaptor> tests
145145
/// </summary>
146146
public void RunStarted(ITestAdaptor testsToRun)
147147
{
148+
if (_tcs == null)
149+
return;
150+
148151
McpLogger.LogInfo($"Test run started: {testsToRun?.Name}");
149152
}
150153

@@ -161,6 +164,9 @@ public void TestStarted(ITestAdaptor test)
161164
/// </summary>
162165
public void TestFinished(ITestResultAdaptor result)
163166
{
167+
if (_tcs == null)
168+
return;
169+
164170
_results.Add(result);
165171
}
166172

@@ -169,8 +175,12 @@ public void TestFinished(ITestResultAdaptor result)
169175
/// </summary>
170176
public void RunFinished(ITestResultAdaptor result)
171177
{
178+
if (_tcs == null)
179+
return;
180+
172181
var summary = BuildResultJson(_results, result);
173182
_tcs?.TrySetResult(summary);
183+
_tcs = null;
174184
}
175185

176186
#endregion

0 commit comments

Comments
 (0)