in resharper/src/UnitTesting/GodotCoreTestRunnerHost.cs [23:70]
public override IPreparedProcess StartProcess(ProcessStartInfo startInfo, ITestRunnerContext context)
{
var solution = context.RuntimeDescriptor.Project.GetSolution();
var baseDirectory = solution.GetComponent<GodotTracker>().MainProjectBasePath;
var scenePaths = baseDirectory.GetChildDirectories(pluginDirectory,
PathSearchFlags.ExcludeFiles | PathSearchFlags.RecurseIntoSubdirectories).Select(a=>a.Combine(runnerScene)).Where(a => a.ExistsFile).ToArray();
if (!scenePaths.Any())
throw new Exception("Please manually put folder with files from https://github.com/van800/godot-demo-projects/tree/net6/mono/dodge_the_creeps/projects/MainProject/RiderTestRunner to your project.");
if (scenePaths.Length > 1)
throw new Exception($"Make sure you have only 1 {pluginDirectory}/{runnerScene} in your project.");
var args = CommandLineUtil.ToArray(startInfo.Arguments);
var testRunnerItem = args.Select((item, i) => new { Item = item, Index = i })
.First(x =>
{
var possiblePathToTestRunner = FileSystemPath.TryParse(x.Item);
return possiblePathToTestRunner.IsAbsolute &&
possiblePathToTestRunner.NameWithoutExtension.StartsWith("ReSharperTestRunner") &&
possiblePathToTestRunner.ExtensionNoDot == "dll";
});
var fileName = testRunnerItem.Item;
var usefulArgs = CommandLineUtil.ToString(args.Skip(testRunnerItem.Index + 1));
var solutionDir = solution.SolutionDirectory;
var model = solution.GetProtocolSolution().GetGodotFrontendBackendModel();
if (model == null)
throw new InvalidOperationException("Missing connection to frontend.");
if (!model.GodotPath.HasValue())
throw new InvalidOperationException("GodotPath is unknown.");
var godotPath = model.GodotPath.Value;
var sceneRelPath = scenePaths.Single().MakeRelativeTo(baseDirectory);
startInfo.FileName = godotPath;
startInfo.Arguments =
$"--path \"{solution.GetComponent<GodotTracker>().MainProjectBasePath}\" \"res://{sceneRelPath}\" --unit_test_assembly \"{fileName}\" --unit_test_args \"{usefulArgs}\"";
if (context is ITestRunnerExecutionContext executionContext)
{
return executionContext.Run.HostController.StartProcess(startInfo, executionContext.Run, context.Logger).Result;
}
return base.StartProcess(startInfo, context);
}