gdharness 1.3.36 → 1.3.37

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/build/cli.js CHANGED
@@ -10508,9 +10508,24 @@ function parseJUnit(xml) {
10508
10508
  };
10509
10509
  }
10510
10510
  function hookFailuresPrinted(printed) {
10511
+ let above = null;
10511
10512
  return printed.flatMap((line) => {
10513
+ if (REPORT_HEADING.test(line)) {
10514
+ above = [];
10515
+ return [];
10516
+ }
10517
+ if (REPORT_END.test(line)) {
10518
+ above = null;
10519
+ return [];
10520
+ }
10512
10521
  const found = HOOK_FAILURE.exec(line);
10513
- return found === null ? [] : [{ hook: found[2] ?? "", path: found[3] ?? "", line: Number(found[4]), message: found[1] ?? "" }];
10522
+ if (found === null) {
10523
+ above?.push(line.trim());
10524
+ return [];
10525
+ }
10526
+ const message = [...above ?? [], found[1] ?? ""].filter((part) => part !== "").join(" ");
10527
+ above = [];
10528
+ return [{ hook: found[2] ?? "", path: found[3] ?? "", line: Number(found[4]), message }];
10514
10529
  });
10515
10530
  }
10516
10531
  function whyNoReport(printed, asked) {
@@ -10784,7 +10799,7 @@ function testProgressMessage(printed, elapsedMs) {
10784
10799
  const done = finished.length === 0 ? "No suite has finished" : `${finished.length === 1 ? "One suite has" : `${finished.length} suites have`} finished${failing === 0 ? "" : `, ${failing} with failures`}`;
10785
10800
  return `${done}${running === null ? "" : `; running ${running}`}; ${took} in.`;
10786
10801
  }
10787
- var MalformedReportError, ENTITIES, ATTRIBUTE, IGNORED_ROW_LINE, suiteNameOf = (path) => (path.split("/").at(-1) ?? path).replace(/\.gd$/, ""), HOOK_FAILURE, NOTHING_RAN, NO_SUCH_PATH, DISCOVERY_FAILED = "Script errors were detected during test discovery!", ESCAPE, LOCATION = `'[^'\\n]*' in \\S+:\\d+`, IGNORING_CASE = " \\(ignoring case\\)", PRINTED_ACTUAL, QUOTED_EQUALITY, COLOUR, SPELLED, BOTH_SIDES_ALIKE_NOTE = "[gdharness: the expected and the actual printed alike because gdUnit4 drops the marks that tell them apart when it writes its report, and the runner printed no copy of this one, so neither side above is the value the assertion found.]", VALUE_NOT_RECOVERED_NOTE = '[gdharness: the value after "but was" may not be the one the assertion found. gdUnit4 writes a failing string into its report as a character diff against the expected one with the marks dropped, which merges the two, and the runner printed no copy of this one to read the value back from.]', RENDERED_AWAY_NOTE = '[gdharness: the two sides print alike, so what tells them apart is something gdUnit4 does not print. The usual cause is BBCode in the expected string, which gdUnit4 renders as formatting instead of showing; the value after "but was" is the one the assertion found.]', MOST_REPORTS_SHOWN = 20, LONGEST_DETAIL = 20000, MASKED_BRACKET = "[lb]", PRINTED_DICTIONARY, ORPHANS_LEFT, HOOKS_LEFT, RUNNING_SUITE, ORPHANS, OVERALL = "Overall Summary", SUITE_COUNTS, CASE_FAILED;
10802
+ var MalformedReportError, ENTITIES, ATTRIBUTE, IGNORED_ROW_LINE, suiteNameOf = (path) => (path.split("/").at(-1) ?? path).replace(/\.gd$/, ""), HOOK_FAILURE, REPORT_HEADING, REPORT_END, NOTHING_RAN, NO_SUCH_PATH, DISCOVERY_FAILED = "Script errors were detected during test discovery!", ESCAPE, LOCATION = `'[^'\\n]*' in \\S+:\\d+`, IGNORING_CASE = " \\(ignoring case\\)", PRINTED_ACTUAL, QUOTED_EQUALITY, COLOUR, SPELLED, BOTH_SIDES_ALIKE_NOTE = "[gdharness: the expected and the actual printed alike because gdUnit4 drops the marks that tell them apart when it writes its report, and the runner printed no copy of this one, so neither side above is the value the assertion found.]", VALUE_NOT_RECOVERED_NOTE = '[gdharness: the value after "but was" may not be the one the assertion found. gdUnit4 writes a failing string into its report as a character diff against the expected one with the marks dropped, which merges the two, and the runner printed no copy of this one to read the value back from.]', RENDERED_AWAY_NOTE = '[gdharness: the two sides print alike, so what tells them apart is something gdUnit4 does not print. The usual cause is BBCode in the expected string, which gdUnit4 renders as formatting instead of showing; the value after "but was" is the one the assertion found.]', MOST_REPORTS_SHOWN = 20, LONGEST_DETAIL = 20000, MASKED_BRACKET = "[lb]", PRINTED_DICTIONARY, ORPHANS_LEFT, HOOKS_LEFT, RUNNING_SUITE, ORPHANS, OVERALL = "Overall Summary", SUITE_COUNTS, CASE_FAILED;
10788
10803
  var init_junit = __esm(() => {
10789
10804
  MalformedReportError = class MalformedReportError extends Error {
10790
10805
  constructor(message) {
@@ -10796,6 +10811,8 @@ var init_junit = __esm(() => {
10796
10811
  ATTRIBUTE = /\s*([^\s=/>]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/y;
10797
10812
  IGNORED_ROW_LINE = /^gdharness ignored (res:\/\/.+?\.gd > [^:\s]+:\d+)\s*$/;
10798
10813
  HOOK_FAILURE = /^\s*(.*?)\s*\tat '(before|after)' in (res:\/\/.+?):(\d+)\s*$/;
10814
+ REPORT_HEADING = /\bfinalize\(\)\s+Report:\s*$/;
10815
+ REPORT_END = /^\s*Statistics:/;
10799
10816
  NOTHING_RAN = /no test cases found/i;
10800
10817
  NO_SUCH_PATH = /given directory or file does not exists:\s*(.+?)\s*$/i;
10801
10818
  ESCAPE = String.fromCharCode(27);
@@ -11074,6 +11091,12 @@ function named(items) {
11074
11091
  const shown = items.slice(0, MOST_NAMED).join(", ");
11075
11092
  return items.length > MOST_NAMED ? `${shown} and ${String(items.length - MOST_NAMED)} more` : shown;
11076
11093
  }
11094
+ function uncollectedSaid(found) {
11095
+ return found.map(({ path, cases }) => {
11096
+ const one = cases.length === 1;
11097
+ return `${path} declares ${named(cases)} and does not extend GdUnitTestSuite, directly or through what it extends, so gdUnit4 never runs ${one ? "it" : "them"}: extend GdUnitTestSuite, or take the test_ prefix off ${one ? "a function that is" : "functions that are"} no case`;
11098
+ });
11099
+ }
11077
11100
  function judgeEngine(printed, handed, end) {
11078
11101
  const faults = [];
11079
11102
  const failing = new Set;
@@ -16218,7 +16241,7 @@ function annotationsOf(spec) {
16218
16241
  openWorldHint: false
16219
16242
  };
16220
16243
  }
16221
- var PROJECT_INFO_SECTIONS, PROJECT_PATH, RUNNING_PROJECT_PATH, RUNNING_PID, SCENE_PATH, WITHOUT_AN_EDITOR = "Through the editor when one serves the project; with none, a headless engine runs the editor's own tool and the answer says so under writtenBy, or readBy for a read. That engine runs every script of the file, where the editor runs only tool scripts, so what a script changes as the file loads or as a property is set is put back before anything is saved, and a file where that cannot be done, such as a scene whose script does not compile, is refused and nothing is written. Each file the written one refers to is named by its uid, as the editor names it, except a file the project's uid cache has no uid for yet (one made since the project was last scanned), which is named by path and listed under namedByPath with the call that scans it. An editor of the project that is running and has not reached this server is waited for rather than written around.", ALSO_SAVED = "A scene is saved as the engine holds it once the file has loaded, and one property can set others as it loads, as anchors_preset gives a centred Control both its grow directions, so a scene not last saved by an editor can gain, change or lose lines the call did not ask for, on any node the file held, the one it names among them: alsoSaved lists each as {node, property, was, saved}, was left out where the file set nothing and saved where it now sets nothing. What a set itself moved on its node is under alsoChanged rather than here, and a node the call adds, saved as the engine saves any new one, is not listed. The scene loads as it did; only its text changed.", IMPORTED_FIRST = "importedFirst names the files whose import was behind them on disk, such as a picture changed since it was imported or one never imported, which were imported before the run through project_import reimport, so the run reads them as they are now; it is left out when every import was current. notImportedFirst lists, as project_import reimport does, any it could not import, and importNote says that the run reads those as they were. The import gives every script without a .uid sidecar one, as the editor's scan does, writing it beside the script in the project, and uidsWrittenFirst names those scripts. The files inside an addon are counted per addon rather than named, under importedInAddons and uidsWrittenInAddons. importTookMs is how long the import took; it is outside the run's own time limit, so a call that imported can take that much longer than the limit it was given.", WHOLE_NUMBERS = 'A whole number of 2^53 or more, such as a 64-bit seed or a resource uid, is written as its digits, {"_type": "int", "value": "9007199254740993"}, the form a read answers with: a JSON number that large can arrive as a neighbour of the one sent, so sent as a number it is refused.', SCRIPT_PATH, RESOURCE_FILE = 'File inside the project, such as "sprites/hero.png" or "materials/steel.tres".', EXPORT_PLATFORMS, RESOURCE_PATH, NODE_PATH, PROPERTIES, XY, ANIMATION_TRACK, SCRIPT_MODIFICATIONS, INPUT_EVENTS, TILESET_SOURCES, TILEMAP_CELLS, COLOUR2, TOOL_SPECS, SPECS_BY_NAME;
16244
+ var PROJECT_INFO_SECTIONS, PROJECT_PATH, RUNNING_PROJECT_PATH, RUNNING_PID, SCENE_PATH, WITHOUT_AN_EDITOR = "Through the editor when one serves the project; with none, a headless engine runs the editor's own tool and the answer says so under writtenBy, or readBy for a read. That engine runs every script of the file, where the editor runs only tool scripts, so what a script changes as the file loads or as a property is set is put back before anything is saved, and a file where that cannot be done, such as a scene whose script does not compile, is refused and nothing is written. Each file the written one refers to is named by its uid, as the editor names it, except a file the project's uid cache has no uid for yet (one made since the project was last scanned), which is named by path and listed under namedByPath with the call that scans it. An editor of the project that is running and has not reached this server is waited for rather than written around.", ALSO_SAVED = "A scene is saved as the engine holds it once the file has loaded, and one property can set others as it loads, as anchors_preset gives a centred Control both its grow directions, so a scene not last saved by an editor can gain, change or lose lines the call did not ask for, on any node the file held, the one it names among them: alsoSaved lists each as {node, property, was, saved}, was left out where the file set nothing and saved where it now sets nothing. What a set itself moved on its node is under alsoChanged rather than here, and neither a node the call adds nor the format lines (header uid, load_steps, unique_id) are listed. The scene loads as it did; only its text changed.", IMPORTED_FIRST = "importedFirst names the files whose import was behind them on disk, such as a picture changed since it was imported or one never imported, which were imported before the run through project_import reimport, so the run reads them as they are now; it is left out when every import was current. notImportedFirst lists, as project_import reimport does, any it could not import, and importNote says that the run reads those as they were. The import gives every script without a .uid sidecar one, as the editor's scan does, writing it beside the script in the project, and uidsWrittenFirst names those scripts. The files inside an addon are counted per addon rather than named, under importedInAddons and uidsWrittenInAddons. importTookMs is how long the import took; it is outside the run's own time limit, so a call that imported can take that much longer than the limit it was given.", WHOLE_NUMBERS = 'A whole number of 2^53 or more, such as a 64-bit seed or a resource uid, is written as its digits, {"_type": "int", "value": "9007199254740993"}, the form a read answers with: a JSON number that large can arrive as a neighbour of the one sent, so sent as a number it is refused.', SCRIPT_PATH, RESOURCE_FILE = 'File inside the project, such as "sprites/hero.png" or "materials/steel.tres".', EXPORT_PLATFORMS, RESOURCE_PATH, NODE_PATH, PROPERTIES, XY, ANIMATION_TRACK, SCRIPT_MODIFICATIONS, INPUT_EVENTS, TILESET_SOURCES, TILEMAP_CELLS, COLOUR2, TOOL_SPECS, SPECS_BY_NAME;
16222
16245
  var init_tool_definitions = __esm(() => {
16223
16246
  init_launch();
16224
16247
  PROJECT_INFO_SECTIONS = [
@@ -16298,7 +16321,7 @@ var init_tool_definitions = __esm(() => {
16298
16321
  property: { type: "string", description: "For property tracks: the property to animate." },
16299
16322
  method: {
16300
16323
  type: "string",
16301
- description: "For method tracks: the method to call. The answer's methodFound says whether the target node has it; a method it lacks is still added, since it may be written next, and until it exists each call the track makes fails. A key whose args the method cannot take (too few or too many, or an object where it takes a value or the reverse) is written too, and answers argumentsFit false with misfit saying why. remove_track: only the keys calling this method."
16324
+ description: "For method tracks: the method to call. A method track holds every method key for its node, so a key calling another method joins the node's track, with existingTrack true. The answer's methodFound says whether the target node has it; a method it lacks is still added, while a nodePath that reaches no node is refused, since it may be written next, and until it exists each call the track makes fails. A key whose args the method cannot take (too few or too many, or an object where it takes a value or the reverse) is written too, and answers argumentsFit false with misfit saying why. remove_track: only the keys calling this method."
16302
16325
  },
16303
16326
  keyframes: {
16304
16327
  type: "array",
@@ -16807,13 +16830,13 @@ var init_tool_definitions = __esm(() => {
16807
16830
  title: "Run tests",
16808
16831
  effect: "additive",
16809
16832
  description: "Runs the project's gdUnit4 tests and answers with every case that did not pass: where it is, and what the assertion said. Each entry under failed carries its first report as message and detail, and, when it has more than one, its reports under reports in the order the case met them: gdUnit4 goes on past a failed assertion, and a case can fail several and then stop on a runtime error, which makes its status error. Identical reports fold into one with times, at most twenty different ones are kept (reportsLeftOut counts the rest), and past about a megabyte the largest cases keep only their first message (failedWithoutDetail). failures counts the cases that failed an assertion and errors the cases that hit an error, so such a case counts in both. Suites where everything passed are counted, not listed, and an engine message keeps the frames above gdUnit4, not the twenty inside it; identical engine messages come back once under engineEntries, with times saying how often they were printed, and with script, line and function for the project script one points at, as editor_output's entries have. The class list is rebuilt first, so a suite written a moment ago is found, and the rebuild's answer is under classes. What changed on disk since it was imported is then imported before any suite runs, and named under importedFirst. On Windows and Linux the run gets a user:// of its own, away from a player's saves; on macOS the engine reads user:// off HOME, so it writes where the player keeps theirs, and savesNote says so. The run is headless unless a suite in it needs a window as gdharness test reads it, and then has one, on a desktop of its own on Windows. A run that found nothing to run is never called a pass, and names the path it looked in. A script that does not load stops gdUnit4 before any suite runs: its errors come back in full under scriptErrors, and the scripts that failed only because one they depend on did are listed by path under failedThroughDependency. When they failed on a class whose own script has a parser error, which gdUnit4 never names, that script is checked by the engine and its error comes first under scriptErrors, with the class it declares under declares, and the errors a script has only because that class did not resolve, which the engine reads as Variant, are kept apart under followFromUnresolved. An autoload that does not compile stops the run at once, its errors listed the same way. A client sending a progress token is told as each suite finishes, and at least every twenty seconds. A run that ends without a report, at its timeout or otherwise, names the suites it finished under suitesFinished, the failing ones with their failed cases under suitesFailing, and the one it was in under suiteRunning. When a client cuts a run off, that is kept in the project and the next project_test there carries it under previousRunCut. A run where nothing failed but orphan nodes were left comes back under warnings, with the count per suite: gdUnit4 decides its verdict on those and keeps them out of its report, so they are read off what it printed. A run whose every case passed is still not called passed when it printed a script error that no case failed on: gdUnit4 fails a case on the script errors its logger sees, and it cannot see a stack overflow, so the cases pass on whatever the faulted calls returned. Those errors come back under uncaughtScriptErrors, and under engineEntries by index with detailUnder rather than with their backtrace a second time; a backtrace that repeats, as a recursion's does, has each repeated frame or cycle of frames written once with the frames it covers and how many times. One raised inside assert_error(...).is_runtime_error is the test's own and is not listed there, and none are when the project turns off gdUnit4's report/godot/script_error setting; a suite declares them all the same. Needs gdUnit4 under addons/gdUnit4.",
16810
- answer: "passed is the verdict to read. exitCode is the engine's own exit, gdUnit4's code for what it saw (100 a case failed, 101 only warnings, 105 script errors it detected), and is 0 beside passed false when the run is failed for something gdUnit4 does not judge, such as an engine error no suite declared. time is gdUnit4's own sum of the seconds its cases took, from its report. tookMs is the whole call in milliseconds, from the class rebuild to the engine's exit, which is what a caller waits for, and tookMsBy splits it into the class rebuild (classes), the import after it (import) and the engine running the suites (engine), each with any wait for an engine slot or the editor's scan in it. The run is judged as gdharness test judges it: undeclaredErrors names each engine error that no suite declared in its GDHARNESS_EXPECTED_ERRORS constant, and each engine warning a suite printed and did not declare in its GDHARNESS_EXPECTED_WARNINGS, marked warning true, with the suite and the case that printed it, and declaredNotPrinted each declared error or warning its case did not print. gdUnit4 does not fail a case on push_error or push_warning, so a case that printed one undeclared is in neither failed nor errors: it is named here, and the run is failed for it. A declared text must be the whole line after ERROR: or WARNING: and its space, so a longer one its case printed holding the text is named under printedInstead. Either fails the run, and each suite holding one is listed with its count. leakedAtExit holds the engine's lines saying it exited still holding objects, resources, memory pages or a server's RIDs, which fail the run too, and the note names any script of the project Godot itself never frees and, on a run with engineArgs [\"--verbose\"], what the engine held. engineErrors counts every engine error the run printed but those a suite declared. orphans totals the orphan nodes gdUnit4 counted, and each suite that left some has its count, and a warning saying how to free them, under warnings, with left naming each case that left some (before or after for one of the suite's hooks, or the one value \"before or after\" where no case began and the two cannot be told apart) and the nodes, by class, name and script. suites lists only the suites with something to say (a case that failed, erred or was skipped, a hook that failed, orphans, or an error undeclared or declared and not printed), and suitesPassed counts the rest. Under classes, the classes each addon declares are counted under addedInAddons and changedInAddons rather than named, and a class the rebuild puts back that the cache had after the last rebuild is named under classes.lostSinceLastRebuild, which is the editor writing its shorter list over the file on every save until restarted. A suite needs a window when it declares const GDHARNESS_NEEDS_WINDOW: bool = true, or calls scene_runner and declares nothing; a run holding one has a window, at the size project.godot gives its viewport and with no sound, and windowed is true and windowNote names those suites and any saying it runs headless that shared the window. On a machine with no display such a run is headless, windowed is false, and windowNote says so. " + IMPORTED_FIRST,
16833
+ answer: "passed is the verdict to read. exitCode is the engine's own exit, gdUnit4's code for what it saw (100 a case failed, 101 only warnings, 105 script errors it detected), and is 0 beside passed false when the run is failed for something gdUnit4 does not judge, such as an engine error no suite declared. time is gdUnit4's own sum of the seconds its cases took, from its report. tookMs is the whole call in milliseconds, from the class rebuild to the engine's exit, which is what a caller waits for, and tookMsBy splits it into the class rebuild (classes), the import after it (import) and the engine running the suites (engine), each with any wait for an engine slot or the editor's scan in it. The run is judged as gdharness test judges it: undeclaredErrors names each engine error that no suite declared in its GDHARNESS_EXPECTED_ERRORS constant, and each engine warning a suite printed and did not declare in its GDHARNESS_EXPECTED_WARNINGS, marked warning true, with the suite and the case that printed it, and declaredNotPrinted each declared error or warning its case did not print. gdUnit4 does not fail a case on push_error or push_warning, so a case that printed one undeclared is in neither failed nor errors: it is named here, and the run is failed for it. A declared text must be the whole line after ERROR: or WARNING: and its space, so a longer one its case printed holding the text is named under printedInstead. Either fails the run, and each suite holding one is listed with its count. leakedAtExit holds the engine's lines saying it exited still holding objects, resources, memory pages or a server's RIDs, which fail the run too, and the note names any script of the project Godot itself never frees and, on a run with engineArgs [\"--verbose\"], what the engine held. engineErrors counts every engine error the run printed but those a suite declared. orphans totals the orphan nodes gdUnit4 counted, and each suite that left some has its count, and a warning saying how to free them, under warnings, with left naming each case that left some (before or after for one of the suite's hooks, or the one value \"before or after\" where no case began and the two cannot be told apart) and the nodes, by class, name and script. suites lists only the suites with something to say (a case that failed, erred or was skipped, a hook that failed, orphans, or an error undeclared or declared and not printed), and suitesPassed counts the rest. A before() or after() that failed comes back under hookFailures with its suite, line and whole message; failures and errors count cases and leave it out, so the verdict names it as failed hooks, and the cases after a failed before() still run and are counted. Under classes, the classes each addon declares are counted under addedInAddons and changedInAddons rather than named, and a class the rebuild puts back that the cache had after the last rebuild is named under classes.lostSinceLastRebuild, which is the editor writing its shorter list over the file on every save until restarted. A suite needs a window when it declares const GDHARNESS_NEEDS_WINDOW: bool = true, or calls scene_runner and declares nothing; a run holding one has a window, at the size project.godot gives its viewport and with no sound, and windowed is true and windowNote names those suites and any saying it runs headless that shared the window. On a machine with no display such a run is headless, windowed is false, and windowNote says so. " + IMPORTED_FIRST,
16811
16834
  parameters: {
16812
16835
  projectPath: PROJECT_PATH,
16813
16836
  path: {
16814
16837
  type: ["string", "array"],
16815
16838
  items: { type: "string" },
16816
- description: "A test directory or suite file inside the project, or a list of them, all run on one engine: a named set of suites boots once rather than once per suite. An entry given twice, or a suite inside a directory also listed, runs once. An entry that is not there is left out and named under missing, the rest run, and such a run is never called passed; when no entry is there the run is refused before the engine starts, naming each one. A script named that declares no test_ function at the top level is refused the same way. Default tests and test, those the project has, which is where gdharness test looks."
16839
+ description: "A test directory or suite file inside the project, or a list of them, all run on one engine: a named set of suites boots once rather than once per suite. An entry given twice, or a suite inside a directory also listed, runs once. An entry that is not there is left out and named under missing, the rest run, and such a run is never called passed; when no entry is there the run is refused before the engine starts, naming each one. A script named that declares no test_ function at the top level is refused the same way, and so is a directory holding no suite. A script that declares test_ functions and does not extend GdUnitTestSuite, which gdUnit4 never runs and never mentions, is refused when named, and under a directory run whole it is named under notSuites and the run is not called passed. Default tests and test, those the project has, which is where gdharness test looks."
16817
16840
  },
16818
16841
  ignore: {
16819
16842
  type: "array",
@@ -17663,7 +17686,7 @@ var init_tool_definitions = __esm(() => {
17663
17686
  name: "editor_output",
17664
17687
  title: "Game and editor output",
17665
17688
  description: "What the project started by editor_run has printed, as entries with a severity: the errors and warnings the engine reported, each with where it happened, and everything else as info. For a run the editor plays the reports come from the game itself, through the runtime addon, since the editor's debugger relays what a game prints and not what it reports; a played game without the runtime addon answers here with its prints alone, with errorsUnread true and no clean, since what it raised reaches nothing here. A run answers with counts and a verdict: clean is true when no error was reported, and warnings, counted beside it, do not make it false. heldAt is three answers: null for a run this server knows is not held, running or over, an object for one it knows is held at a breakpoint, whether the adapter said so or the runtime did by accepting a connection and never answering, and absent with heldUnknown beside it for a server that connected to the debugger after the stop and has no runtime to ask, since the adapter reports a stop only to the sessions connected when it happened. A run that has quit still answers here, with running false and its exit code, until the next one starts; a run ended by a signal has no exit code, and exitSignal names the signal instead. A run this server started also answers with transcript, the file both its streams are written to: uncapped, written while the run is going, and the thing to read or tail for a long run rather than the engine's own log, which every engine start rotates away. Read the file for output and this answer for state: endedBy says whether gdharness ended the run, and a transcript that has stopped growing is a run between prints rather than a run that is over. running is asked of the operating system whenever there is a process to ask about, which is every run this server started and every editor-played run whose game announced its runtime. For an editor-played run that never announced, there is no process id here and running is the editor's answer, which can lag: one reported a game as playing fifteen seconds after its process was ended from outside. editor_status names that game under runtimes, which does not depend on the editor answering. op: \"editor\" answers about the editor itself instead, which is a different log and the only way anything here can read what an editor printed: its console reaches no plugin, so the addon cannot scrape it, and an editor gdharness opened is asked for a log file as it starts. That covers the whole session from the editor's first line, where the output worth reading usually is, since the class cache, the plugins and the language server speak before any harness connects. It answers counts with no clean, since an editor neither passes nor fails, the entries in the order they were printed and, beside them under repeated, each message shape several lines share: how many, what varied in each slot of it and how many different values stood there, the first occurrence, and the ordinary lines above the group, found by walking back past the group rather than by counting lines. An editor somebody opened by hand has no console here and is refused saying so rather than answered empty, because an editor that printed nothing and an editor nobody captured are not the same thing. startedAt is when the run began and elapsedMs how long it has been going; for a run that is over, endedAt is when it ended and elapsedMs how long it ran, and both are left out when nobody saw the end, as for a game closed in the editor or a run picked up from a note written before ends were recorded.",
17666
- answer: "An entry with lines under its headline has them as detail, and, when one of them names a project script, script, line and function say where: the at: line when it names one, otherwise the innermost frame of the backtrace that does. A push_error or push_warning has the engine's own push_error as its at: line, so its script and line are the game's call that raised it. Each entry's source says where it was read: transcript for a line of the run's transcript file, which holds both its streams and is how every run with one is read; stdout or stderr for a line of that stream of a run with no transcript, such as an editor-played run picked up after a reconnect whose first server left no note; debugger for what the editor's debug adapter reported and the game never printed, such as the script error a game stopped on. A printerr line is info: it prints to stderr, and the engine reports no error for it. For op editor with no editor connected, connected is false, editorRunning says whether the editor whose console it is still runs, and editorNote whether this server closed it or it went without a close, as a crash does; the next editor gdharness opens on the project starts a new console.",
17689
+ answer: "An entry with lines under its headline has them as detail, and, when one of them names a project script, script, line and function say where: the at: line when it names one, otherwise the innermost frame of the backtrace that does. A push_error or push_warning has the engine's own push_error as its at: line, so its script and line are the game's call that raised it. Each entry's source says where it was read: transcript for a line of the run's transcript file, which holds both its streams and is how every run with one is read; stdout or stderr for a line of that stream of a run with no transcript, such as an editor-played run picked up after a reconnect whose first server left no note; debugger for what the editor's debug adapter reported and the game never printed, such as the script error a game stopped on. A printerr line is info: it prints to stderr, and the engine reports no error for it. For op editor with no editor connected, connected is false, editorRunning says whether the editor whose console it is still runs, and editorNote whether this server closed it or it went without a close, as a crash does; the next editor gdharness opens on the project starts a new console. With none connected and none ever opened here on the project, there is no console, and the refusal says so.",
17667
17690
  parameters: {
17668
17691
  projectPath: {
17669
17692
  type: "string",
@@ -18675,7 +18698,8 @@ class ProjectScripts {
18675
18698
  return this.searched(roots).flatMap((path) => this.suite(path) ?? []);
18676
18699
  }
18677
18700
  uncollectedUnder(roots) {
18678
- return this.searched(roots).flatMap((path) => {
18701
+ const named = roots.filter((root) => root.endsWith(".gd") && this.sources.has(root));
18702
+ return [...new Set([...named, ...this.searched(roots)])].flatMap((path) => {
18679
18703
  const cases = this.script(path)?.funcs.filter((name) => name.startsWith(CASE_PREFIX)) ?? [];
18680
18704
  return cases.length === 0 || this.suite(path) !== null ? [] : [{ path, cases: [...cases].sort() }];
18681
18705
  });
@@ -49966,9 +49990,13 @@ function failedVerdict(report) {
49966
49990
  if (report === null) {
49967
49991
  return "failures";
49968
49992
  }
49969
- const failed = report.failures + report.hookFailures > 0;
49970
- const erred = report.errors + report.hookErrors > 0;
49971
- return failed && erred ? "failures and errors" : erred ? "errors" : "failures";
49993
+ const parts = [
49994
+ report.failures > 0 ? "failures" : undefined,
49995
+ report.errors > 0 ? "errors" : undefined,
49996
+ report.hookFailures + report.hookErrors > 0 ? "failed hooks" : undefined
49997
+ ].filter((part) => part !== undefined);
49998
+ const last = parts.pop();
49999
+ return last === undefined ? "failures" : parts.length === 0 ? last : `${parts.join(", ")} and ${last}`;
49972
50000
  }
49973
50001
  function timedOutVerdict(timeoutMs, silentForMs, repeating = null) {
49974
50002
  const quiet = Math.round(silentForMs);
@@ -52635,9 +52663,10 @@ ${platform}`;
52635
52663
  }
52636
52664
  const missing = paths.value.filter((path) => !existsSync34(join43(project.value.path, path.slice("res://".length))));
52637
52665
  const projectScripts = new ProjectScripts(project.value.path);
52638
- const asked = projectScripts.searchedAsTold(paths.value.filter((path) => !missing.includes(path)));
52666
+ const present = paths.value.filter((path) => !missing.includes(path));
52667
+ const asked = projectScripts.searchedAsTold(present);
52639
52668
  const unusable = gdUnit4Unusable(project.value.path);
52640
- if (asked.length === 0) {
52669
+ if (asked.length === 0 && missing.length > 0) {
52641
52670
  const verdict = `nothing at ${missing.join(" and ")}`;
52642
52671
  const andNoRunner = unusable === null ? "" : `, and ${unusable.reason}`;
52643
52672
  return {
@@ -52669,10 +52698,25 @@ ${platform}`;
52669
52698
  const one = caseless.length === 1;
52670
52699
  return this.createErrorResponse(`${caseless.join(" and ")} ${one ? "declares" : "declare"} no case: gdUnit4 runs the functions named test_ at the top level of a script that extends GdUnitTestSuite, and ${one ? "it has" : "they have"} none.`);
52671
52700
  }
52701
+ const uncollected = projectScripts.uncollectedUnder(present);
52702
+ const suiteless = present.filter((path) => !path.endsWith(".gd") && projectScripts.suitesUnder([path]).length === 0);
52703
+ const namedNoSuite = uncollected.filter((one) => present.includes(one.path));
52704
+ if (suiteless.length > 0 || namedNoSuite.length > 0) {
52705
+ const one = suiteless.length === 1;
52706
+ const under = (path) => suiteless.some((folder) => path.startsWith(`${folder.replace(/\/+$/, "")}/`));
52707
+ const holding = uncollected.filter((script) => namedNoSuite.includes(script) || under(script.path));
52708
+ const keptOut = projectScripts.notSearched.map((folder) => `res://${folder.replace(/^res:\/\//, "")}`).filter((folder) => under(folder) && projectScripts.suitesUnder([folder]).length > 0);
52709
+ const keptOutSaid = keptOut.length === 0 ? "no script there does" : `the only ones there are under ${named(keptOut)}, which ${NOT_SEARCHED_SETTING} keeps out of every search: name ${keptOut.length === 1 ? "it" : "them"} as path to run ${keptOut.length === 1 ? "its" : "their"} suites`;
52710
+ return this.createErrorResponse([
52711
+ suiteless.length === 0 ? undefined : `${named(suiteless)} ${one ? "holds" : "hold"} no gdUnit4 suite: gdUnit4 runs the functions named test_ at the top level of a script that extends GdUnitTestSuite, directly or through what it extends, and ${keptOutSaid}.`,
52712
+ ...uncollectedSaid(holding).map((sentence) => `${sentence}.`)
52713
+ ].filter((part) => part !== undefined).join(" "));
52714
+ }
52672
52715
  const selection = selectTests(project.value.path, asked, args["tests"]);
52673
52716
  if (!selection.ok) {
52674
52717
  return this.createErrorResponse(selection.reason);
52675
52718
  }
52719
+ const notSuites = selection.value === null ? uncollectedSaid(uncollected) : [];
52676
52720
  const leftOut = new Set(readStringArray(args, "ignore") ?? []);
52677
52721
  const needs = windowNeedsOf(projectScripts, selection.value?.suites ?? asked);
52678
52722
  const needing = needs.needing.filter((path) => !leftOut.has(basename13(path, ".gd")));
@@ -53015,9 +53059,9 @@ ${error.text}`;
53015
53059
  ...new Set((selection.value?.selected ?? []).filter((one) => !report.suites.some((suite) => (suite.path === one.suite || suite.name === basename13(one.suite, ".gd")) && suite.cases.some((ran) => ran.name === one.test || new RegExp(`^${one.test}\\W`).test(ran.name)))).map((one) => `${basename13(one.suite, ".gd")}:${one.test}`))
53016
53060
  ];
53017
53061
  return this.jsonTextResponse({
53018
- passed: !timedOut && exitCode === 0 && nothingRan === null && report.tests > 0 && report.failures === 0 && report.errors === 0 && hookFailures.length === 0 && uncaught.length === 0 && undeclaredPrinted.length === 0 && declaredNotPrinted.length === 0 && countedLeaks.length === 0 && missing.length === 0 && testsNotRun.length === 0,
53062
+ passed: !timedOut && exitCode === 0 && nothingRan === null && report.tests > 0 && report.failures === 0 && report.errors === 0 && hookFailures.length === 0 && uncaught.length === 0 && undeclaredPrinted.length === 0 && declaredNotPrinted.length === 0 && countedLeaks.length === 0 && missing.length === 0 && testsNotRun.length === 0 && notSuites.length === 0,
53019
53063
  verdict: [
53020
- verdict === "passed" && undeclaredPrinted.length + declaredNotPrinted.length + countedLeaks.length + testsNotRun.length > 0 ? undefined : verdict,
53064
+ verdict === "passed" && undeclaredPrinted.length + declaredNotPrinted.length + countedLeaks.length + testsNotRun.length + notSuites.length > 0 ? undefined : verdict,
53021
53065
  ...[false, true].map((warning) => {
53022
53066
  const count = undeclaredPrinted.filter((error) => error.warning === warning).length;
53023
53067
  const word = warning ? "warning" : "error";
@@ -53029,9 +53073,11 @@ ${error.text}`;
53029
53073
  return count > 0 ? `${count === 1 ? `one declared ${word}` : `${String(count)} declared ${word}s`} never printed` : undefined;
53030
53074
  }),
53031
53075
  countedLeaks.length > 0 ? "the engine exited holding what it should have freed" : undefined,
53032
- testsNotRun.length > 0 ? `not run: ${testsNotRun.join(", ")}` : undefined
53076
+ testsNotRun.length > 0 ? `not run: ${testsNotRun.join(", ")}` : undefined,
53077
+ notSuites.length > 0 ? `${notSuites.length === 1 ? "one script declares" : `${String(notSuites.length)} scripts declare`} cases gdUnit4 never runs` : undefined
53033
53078
  ].filter((part) => part !== undefined).join("; "),
53034
53079
  ...missing.length > 0 ? { missing } : {},
53080
+ ...notSuites.length > 0 ? { notSuites } : {},
53035
53081
  ...testsNotRun.length > 0 ? { testsNotRun } : {},
53036
53082
  ...timedOut ? { timedOut, hung, silentForMs } : {},
53037
53083
  exitCode,
@@ -53064,6 +53110,7 @@ ${error.text}`;
53064
53110
  note: [
53065
53111
  missingNote,
53066
53112
  testsNotRun.length > 0 ? `${testsNotRun.join(", ")} ${testsNotRun.length === 1 ? "was" : "were"} asked for and not run, so the run is not called passed: gdUnit4 runs a test_ function only in a script that extends GdUnitTestSuite, and leaves out a suite whose script does not load.` : undefined,
53113
+ notSuites.length > 0 ? "What notSuites names declares cases gdUnit4 never runs, so the run is not called passed, as gdharness test judges it." : undefined,
53067
53114
  briefed > 0 ? `${briefed} of the ${failed.length} failing cases, those with the largest reports, are named with their first message only, since their reports would have made the answer too large to deliver; pass one case's suite path to see its reports.` : undefined,
53068
53115
  notApplied.length > 0 ? "An ignore entry named a case that ran all the same: gdUnit4 leaves a case out only as suite_name:test_name, and reads an entry with no colon as a suite name or a piece of a suite path. ignoreNotApplied gives the form for each case that ran." : undefined,
53069
53116
  unmatched.length > 0 ? `${unmatched.join(", ")} ${unmatched.length === 1 ? "names" : "name"} no suite, case or row under the paths run, so ${unmatched.length === 1 ? "it" : "they"} left nothing out.` : undefined,
@@ -55722,7 +55769,7 @@ ${error.text}`;
55722
55769
  }
55723
55770
  const noted = projectPath === undefined || greeted || launched !== null ? null : readEditorLogNote(projectPath);
55724
55771
  const editorPid = greeted ? status.editorPid ?? null : launched ?? noted?.pid ?? null;
55725
- const nothing = () => this.createErrorResponse("No editor is connected, so there is no console to read.", [
55772
+ const nothing = () => this.createErrorResponse(projectPath !== undefined && !greeted && launched === null ? `No editor is connected, and no editor gdharness opened on ${projectPath} left a console behind, so there is none to read.` : "No editor is connected, so there is no console to read.", [
55726
55773
  "editor_status says whether one is connected and whether it may yet be",
55727
55774
  "editor_launch opens one, and an editor opened here has its console captured"
55728
55775
  ]);
@@ -58881,12 +58928,6 @@ function searchedRoots(options) {
58881
58928
  return existsSync23(directory) && statSync14(directory).isDirectory();
58882
58929
  });
58883
58930
  }
58884
- function uncollectedSaid(found) {
58885
- return found.map(({ path, cases }) => {
58886
- const one = cases.length === 1;
58887
- return `${path} declares ${named(cases)} and does not extend GdUnitTestSuite, directly or through what it extends, so gdUnit4 never runs ${one ? "it" : "them"}: extend GdUnitTestSuite, or take the test_ prefix off ${one ? "a function that is" : "functions that are"} no case`;
58888
- });
58889
- }
58890
58931
  function selectedSuites(scripts, options) {
58891
58932
  const roots = rootsOf(options);
58892
58933
  if (options.selected.length === 0) {
package/build/keeper.js CHANGED
@@ -9190,7 +9190,7 @@ class GameDebugger {
9190
9190
  case "stack": {
9191
9191
  const frames = await this.stack();
9192
9192
  if (frames === null) {
9193
- return this.notHeld();
9193
+ return this.notHeld("stack to read");
9194
9194
  }
9195
9195
  return {
9196
9196
  held: this.heldState(),
@@ -9218,9 +9218,9 @@ class GameDebugger {
9218
9218
  ...this.held.canContinue ? {} : { canContinue: false }
9219
9219
  };
9220
9220
  }
9221
- notHeld() {
9221
+ notHeld(what) {
9222
9222
  return {
9223
- refused: "The game is running, not held, so it has no stack to read: debug_control pause stops it where it is, and a breakpoint stops it on its line."
9223
+ refused: `The game is running, not held, so it has no ${what}: debug_control pause stops it where it is, and a breakpoint stops it on its line.`
9224
9224
  };
9225
9225
  }
9226
9226
  async stack() {
@@ -9384,7 +9384,7 @@ class GameDebugger {
9384
9384
  async variables(frame) {
9385
9385
  const held = this.held;
9386
9386
  if (held === null) {
9387
- return this.notHeld();
9387
+ return this.notHeld("frame whose variables could be read");
9388
9388
  }
9389
9389
  const frames = await this.stack();
9390
9390
  if (frames === null) {
@@ -9431,7 +9431,7 @@ class GameDebugger {
9431
9431
  async evaluate(frame, expression) {
9432
9432
  const held = this.held;
9433
9433
  if (held === null) {
9434
- return this.notHeld();
9434
+ return this.notHeld("frame to work an expression out in");
9435
9435
  }
9436
9436
  const read = await this.variables(frame);
9437
9437
  if (!Array.isArray(read["scopes"])) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdharness",
3
- "version": "1.3.36",
3
+ "version": "1.3.37",
4
4
  "mcpName": "io.github.Aureliolo/gdharness",
5
5
  "description": "A harness for driving a Godot 4 project from an agent: editor addons, a runtime bridge into the running game, an MCP server in front of them, and a CLI that installs and diagnoses the Godot side.",
6
6
  "type": "module",