com.valectric.mooserunner 2.1.17 → 2.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Samples~/Demos/MooseRunner.Demo.CancellationTokens.Tests/SetupTeardownCancellationTests.cs +1 -0
- package/Samples~/Demos/MooseRunner.Demo.ErrorHandling.Tests/ErrorHandelingTest.cs +1 -0
- package/Samples~/Demos/MooseRunner.Demo.RealUseCase/RealUseCaseTest.cs +1 -0
- package/Samples~/Demos/MooseRunner.Demo.Support/MooseRunnerSampleVersionCheck.cs +57 -0
- package/Samples~/Demos/MooseRunner.Demo.Support/MooseRunnerSampleVersionCheck.cs.meta +2 -0
- package/Samples~/Demos/MooseRunner.Demo.Tests/DummyTestBase1.cs +1 -0
- package/Samples~/Demos/MooseRunner.Demo.Tests/DummyTestClass1.cs +1 -0
- package/Samples~/Demos/MooseRunner.Demo.Tests/DummyTestClass2.cs +1 -0
- package/Samples~/Demos/MooseRunner.Demo.Tests/InstanceHandlingVerificationTest.cs +1 -0
- package/package.json +1 -1
package/Samples~/Demos/MooseRunner.Demo.CancellationTokens.Tests/SetupTeardownCancellationTests.cs
CHANGED
|
@@ -21,6 +21,7 @@ namespace MooseRunner.Internal.Tests
|
|
|
21
21
|
[OneTimeSetUp]
|
|
22
22
|
public async Task OneTimeSetupMethod(CancellationToken ct)
|
|
23
23
|
{
|
|
24
|
+
MooseRunnerSampleVersionCheck.EnsureSingleVersion();
|
|
24
25
|
Debug.Log("[OneTimeSetUp] OneTimeSetUp started - 5 second delay");
|
|
25
26
|
Debug.Log("[OneTimeSetUp] Click STOP during OneTimeSetUp to test cancellation");
|
|
26
27
|
await Task.Delay(5000, ct);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.IO;
|
|
3
|
+
using System.Linq;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
|
|
6
|
+
namespace MooseRunner.Internal.Tests
|
|
7
|
+
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
/// Detects duplicate MooseRunner sample-version folders in Assets/Samples/.
|
|
10
|
+
/// Unity's UPM Sample import creates a new <c>Assets/Samples/MooseRunner/<version>/...</c>
|
|
11
|
+
/// folder on every upgrade and never deletes the previous one. The duplicate .cs files
|
|
12
|
+
/// share class FQNs (e.g. <c>MooseRunner.Internal.Tests.Enemy</c>) and stable .meta GUIDs,
|
|
13
|
+
/// which produces a "is not derived from MonoBehaviour or ScriptableObject!" runtime
|
|
14
|
+
/// error when prefabs instantiate. Called from each sample test's OneTimeSetUp so the
|
|
15
|
+
/// check fires only when the customer actually uses the samples.
|
|
16
|
+
/// </summary>
|
|
17
|
+
public static class MooseRunnerSampleVersionCheck
|
|
18
|
+
{
|
|
19
|
+
private static bool _alreadyChecked;
|
|
20
|
+
private const string SamplesRoot = "Assets/Samples/MooseRunner";
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
/// Throws <see cref="InvalidOperationException"/> if multiple MooseRunner sample-version
|
|
24
|
+
/// folders are present. First call performs the scan; subsequent calls within the same
|
|
25
|
+
/// domain are no-ops (the flag resets on domain reload, which is fine — the check is
|
|
26
|
+
/// idempotent and cheap).
|
|
27
|
+
/// </summary>
|
|
28
|
+
public static void EnsureSingleVersion()
|
|
29
|
+
{
|
|
30
|
+
if (_alreadyChecked) return;
|
|
31
|
+
_alreadyChecked = true;
|
|
32
|
+
|
|
33
|
+
if (!Directory.Exists(SamplesRoot)) return;
|
|
34
|
+
|
|
35
|
+
var versionDirs = Directory.GetDirectories(SamplesRoot);
|
|
36
|
+
if (versionDirs.Length <= 1) return;
|
|
37
|
+
|
|
38
|
+
var sortedFolders = versionDirs
|
|
39
|
+
.Select(Path.GetFileName)
|
|
40
|
+
.OrderBy(n => n)
|
|
41
|
+
.Select(n => " " + SamplesRoot + "/" + n);
|
|
42
|
+
|
|
43
|
+
string msg =
|
|
44
|
+
"Multiple MooseRunner sample versions detected. Unity's UPM 'Reimport Sample' " +
|
|
45
|
+
"creates a new versioned folder on every package upgrade and never deletes the " +
|
|
46
|
+
"previous one. Duplicate .cs files with the same class FQN and stable .meta GUIDs " +
|
|
47
|
+
"produce the runtime error \"... is not derived from MonoBehaviour or ScriptableObject!\" " +
|
|
48
|
+
"when prefabs instantiate.\n" +
|
|
49
|
+
"\n" +
|
|
50
|
+
"Found:\n" + string.Join("\n", sortedFolders) + "\n" +
|
|
51
|
+
"\n" +
|
|
52
|
+
"Fix: delete all but the newest folder under Assets/Samples/MooseRunner/, then re-run.";
|
|
53
|
+
Debug.LogError(msg);
|
|
54
|
+
throw new InvalidOperationException(msg);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -27,6 +27,7 @@ namespace MooseRunner.Internal.Tests
|
|
|
27
27
|
[OneTimeSetUp]
|
|
28
28
|
public void OneTimeSetUpMethod()
|
|
29
29
|
{
|
|
30
|
+
MooseRunnerSampleVersionCheck.EnsureSingleVersion();
|
|
30
31
|
// OneTimeSetUp should get a fresh instance, so _instanceId should be 99 (default)
|
|
31
32
|
Assert.AreEqual(99, _instanceId, "OneTimeSetUp should start with default _instanceId = 99 (fresh instance)");
|
|
32
33
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "com.valectric.mooserunner",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.18",
|
|
4
4
|
"displayName": "MooseRunner",
|
|
5
5
|
"description": "MooseRunner boosts PlayMode testing with Hot Reload, MCP for AIs, timescale control, and Task support. It enables rapid iteration, auto test reruns, full documentation and dedicated support.",
|
|
6
6
|
"unity": "6000.2",
|