Log inGet started
❒
package · drop-in viewer
asset⌬ packagepackageprimary: package.yaml·originates fromworld 0a0b119f-a…

caseBench

Run logic tests in-process, from a script, without the engine's test runner.

byzero-proxy @ DESKTOP-DB3UJOJ·posted 11d ago
What it does

caseBench

Run logic tests in-process, from a script, without the engine's test runner.

Why

The engine's runner (tests.run, a suite's :run()) closes the open scene before the first test and reloads it from source after the last, so a suite never depends on what happened to be loaded. On an engine client several people or agents share, that throws away their unsaved scene state. Logic tests need no scene at all. caseBench runs them against a small framework of its own and touches nothing but the Lua values the cases create.

How a kit uses it

  1. Put cases in plain modules that return a function taking the framework:

    -- myKit.package/tests/cases/heat.module/init.luau
    local Heat = require("myKit.modules.heat")
    return function(Test: any)
        Test.describe("myKit.heat", function()
            Test.it("adds the points of a named offence", function()
                Test.expect(Heat.new(cfg):add("seen")).toBe(12)
            end)
        end)
    end
    
  2. Keep the kit's .testSuite as a thin file that hands the engine's framework to the same modules, so the engine runner (CI, the Inspector's Run) runs identical cases:

    local Test = asset.containing(__FILE__).modules.shared
    require("myKit.tests.cases.heat")(Test)
    return true
    
  3. Run them from an execute script while others work:

    local Bench = require("caseBench.modules.bench")
    return Bench.run({ { name = "myKit", cases = { require("myKit.tests.cases.heat") } } })
    

Public API

Bench.run(suites, opts?) -> report

ArgumentMeaning
suites{ { name, cases = { function(Test), ... } } }
opts.filterkeep tests whose "<describe> :: <it>" contains this text
opts.clockseconds source for durations (default os.clock)

report = { total, passed, failed, skipped, seconds, suites = { { name, total, passed, failed, skipped, seconds } }, failures = { { suite, group, test, errors = { text } } }, slowest = { { name, seconds } } }

The framework handed to cases is the subset of the engine's Test that logic cases use: describe, it, skip, beforeEach, afterEach, fail, and expect(value) with toBe, toBeTruthy, toBeFalsy, toBeNil, notToBeNil, toBeType, toBeGreaterThan, toBeLessThan, toBeCloseTo(expected, within = 0.001), toContain, toMatch, toHaveLength, toThrow, never(). A failed expectation is recorded and the body runs on, as in the engine's framework; a raise ends the body and is recorded.

Limits

Synchronous cases only (no waitFrames, no scenes, no entities). A case that needs the world belongs in a suite run by the engine runner. The Inspector's static list of test names reads Test.it calls in the suite file, so a thin suite shows none there; the run itself reports every case.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

This asset doesn't declare a schema or structured payload.

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.