Skip to main content

NevermoreTestRunnerUtils

Unified test runner utilities for Nevermore packages. Handles both smoke tests (game boot) and Jest unit tests.

  • If a jest.config is found under the given root, runs Jest tests
  • If no jest.config is found, boot success is the test (smoke test)
  • Detects Open Cloud execution via OpenCloudService to control behavior

A run reports itself by returning NevermoreTestResults.TestRunResults, not by throwing. The engine truncates a long run's log output, so counts scraped back out of that text are exactly what goes missing on the runs where they matter most. A test script hands the table straight out of its top level:

local results = NevermoreTestRunnerUtils.runTestsIfNeededAsync(root)
if results then
	return results
end

Reading Jest's result into that table is NevermoreTestResults's job, which is a separate module so it can be unit tested without Jest present.

Properties

RESULTS_FORMAT

NevermoreTestRunnerUtils.RESULTS_FORMAT: string

Tag identifying a results table to whatever reads a run's return values.

Functions

isOpenCloud

NevermoreTestRunnerUtils.isOpenCloud() → boolean

Returns true if running inside an Open Cloud Luau Execution context.

runTestsIfNeededAsync

NevermoreTestRunnerUtils.runTestsIfNeededAsync(
rootInstance--

The instance to scan for jest.config (e.g. the package folder in ServerScriptService)

) → NevermoreTestResults.TestRunResults?

Runs Jest tests if a jest.config is found under root. Otherwise treats boot success as the test (smoke test).

Returns nil when no test run was attempted, which is how a real game server tells itself apart from a test place: script sources are unreadable there, so the caller falls through to its normal boot instead.

Outside Open Cloud (e.g. Studio via studio-bridge) nothing reads the returned results, so ProcessService:ExitAsync() carries the verdict out instead.

Show raw api
{
    "functions": [
        {
            "name": "isOpenCloud",
            "desc": "Returns true if running inside an Open Cloud Luau Execution context.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 67,
                "path": "src/nevermore-test-runner/src/Server/NevermoreTestRunnerUtils/init.lua"
            }
        },
        {
            "name": "runTestsIfNeededAsync",
            "desc": "Runs Jest tests if a jest.config is found under root. Otherwise treats\nboot success as the test (smoke test).\n\nReturns nil when no test run was attempted, which is how a real game server\ntells itself apart from a test place: script sources are unreadable there, so\nthe caller falls through to its normal boot instead.\n\nOutside Open Cloud (e.g. Studio via studio-bridge) nothing reads the returned\nresults, so ProcessService:ExitAsync() carries the verdict out instead.",
            "params": [
                {
                    "name": "root",
                    "desc": "The instance to scan for jest.config (e.g. the package folder in ServerScriptService)",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "NevermoreTestResults.TestRunResults?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 97,
                "path": "src/nevermore-test-runner/src/Server/NevermoreTestRunnerUtils/init.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "RESULTS_FORMAT",
            "desc": "Tag identifying a results table to whatever reads a run's return values.",
            "lua_type": "string",
            "source": {
                "line": 48,
                "path": "src/nevermore-test-runner/src/Server/NevermoreTestRunnerUtils/init.lua"
            }
        }
    ],
    "types": [],
    "name": "NevermoreTestRunnerUtils",
    "desc": "Unified test runner utilities for Nevermore packages.\nHandles both smoke tests (game boot) and Jest unit tests.\n\n- If a jest.config is found under the given root, runs Jest tests\n- If no jest.config is found, boot success is the test (smoke test)\n- Detects Open Cloud execution via OpenCloudService to control behavior\n\nA run reports itself by *returning* [NevermoreTestResults.TestRunResults], not\nby throwing. The engine truncates a long run's log output, so counts scraped\nback out of that text are exactly what goes missing on the runs where they\nmatter most. A test script hands the table straight out of its top level:\n\n```lua\nlocal results = NevermoreTestRunnerUtils.runTestsIfNeededAsync(root)\nif results then\n\treturn results\nend\n```\n\nReading Jest's result into that table is [NevermoreTestResults]'s job, which\nis a separate module so it can be unit tested without Jest present.",
    "source": {
        "line": 27,
        "path": "src/nevermore-test-runner/src/Server/NevermoreTestRunnerUtils/init.lua"
    }
}