Menu

class: _AspecRunner

[165:7] extends: object

Members

  • groups
  • specs
  • groupsByName
  • currentGroup
  • hasOnly
  • running
  • specIndex
  • passed
  • failed
  • skipped
  • total
  • startMs
  • currentSpec
  • currentDone
  • currentTimeoutTimer
  • currentPollTimer
  • currentGroupRecord
  • seenGroupsAll
  • lastSpecGroupName

Methods

  • _AspecRunner ()

  • describe (string Name, callback Fn)

  • it (string Name, callback Fn)

  • itSkip (string Name, callback Fn)

  • itOnly (string Name, callback Fn)

  • itAsync (string Name, callback Fn, int TimeoutMs = 2000)

  • beforeEach (callback Fn)

  • afterEach (callback Fn)

  • beforeAll (callback Fn)

  • afterAll (callback Fn)

  • onFail (callback Fn)

  • requireGroup (string Caller)

  • groupName ()

  • run ()

  • scheduleNext ()

  • onTick ()

  • runSyncSpec (spec)

  • runAsyncSpec (spec)

  • onAsyncPoll ()

  • onAsyncTimeout ()

  • completeAsyncSpec ()

  • runAfterAndAdvance ()

  • advance ()

  • finish ()

  • runHooks (string GroupName, string HookFieldName)

  • recordPass (spec)

  • recordFail (spec, string Msg)

  • qualName (spec)

class: aspec

[524:14] static extends: object

Static facade. All registration and run methods delegate to the singleton _AspecRunner so the runner can use ::method callback references against its own instance methods (which is what works reliably in current Aussom-Script).

Methods

  • describe (string Name, callback Fn)

    Start a describe block. Currently flat (top-level only).

    • @p Name Description label.
    • @p Fn Callback that registers it / hooks for this group.
  • it (string Name, callback Fn)

    Register a synchronous spec.

    • @p Name Description label.
    • @p Fn Test function (takes no arguments).
  • itSkip (string Name, callback Fn)

    Register a synchronous spec to skip.

    • @p Name Description label.
    • @p Fn Test function (takes no arguments).
  • itOnly (string Name, callback Fn)

    Register a synchronous spec as the ONLY one to run. When any spec is marked itOnly, every spec not so marked is skipped.

    • @p Name Description label.
    • @p Fn Test function (takes no arguments).
  • itAsync (string Name, callback Fn, int TimeoutMs = 2000)

    Register an asynchronous spec. The function receives a DoneToken argument; the spec is complete when done.ok() or done.fail(msg) is called, or when TimeoutMs elapses.

    • @p Name Description label.
    • @p Fn Test function (takes one DoneToken argument).
    • @p TimeoutMs Per-spec timeout in milliseconds (default 2000).
  • beforeEach (callback Fn)

  • afterEach (callback Fn)

  • beforeAll (callback Fn)

  • afterAll (callback Fn)

  • onFail (callback Fn)

    Register a callback fired whenever a spec in the current group fails. Callback receives (specName, errMsg). Useful for captureState() style diagnostics.

  • run ()

    Start running the registered specs. Walks them in registration order, scheduling each via Timer(0) so the JS event loop can service pending async callbacks between specs. Logs an aunit-compatible summary line when finished.

  • reset ()

    Reset registration and run state. Intended for self-tests of the aspec runner; consumer code does not normally need this.

class: DoneToken

[122:7] extends: object

Members

  • _fired
  • _passed
  • _errMsg

Methods

  • ok ()

    Mark the spec as passed. Idempotent.

  • fail (string Msg)

    Mark the spec as failed with a message. Idempotent.

    • @p Msg Failure message.
  • isFired ()

    True once ok() or fail() has been called.

  • isPassed ()

    True if ok() was called; false after fail() (or while pending).

  • getErrorMessage ()

    Failure message after fail(); null otherwise.

class: _AspecGroup

[102:7] extends: object

Members

  • name
  • beforeEachHooks
  • afterEachHooks
  • beforeAllHooks
  • afterAllHooks
  • failHooks

Methods

  • _AspecGroup (string Name)

class: _AspecSpec

[75:7] extends: object

aspec.aus Async-aware test runner for Aussom-Script. Inspired by Jasmine's describe / it / beforeEach / done pattern. Lives entirely in Aussom-Script (no engine, ast*, or @Test annotation involvement) so it can wait for asynchronous work (Http callbacks, Timer callbacks, addListener handlers, js.promise resolutions) without the @Async / Method.invoke conflict documented in design/lessons-learned.md entries 1 and 19. The runner walks specs sequentially. Between specs it yields the JavaScript event loop via Timer(0, ...) so pending macrotasks (HTTP callbacks, timer callbacks, etc.) can fire and update the done token before the next spec starts. Output format matches aunit (PASSED: N SKIPPED: M FAILED: K TOTAL: T) so existing Playwright runners that grep for the summary line work unchanged. Usage: include aspec; class Specs { public main(args) { aspec.describe("HelloBadge", ::groupHelloBadge); aspec.run(); } public groupHelloBadge() { aspec.it("renders the name", ::specRenders); aspec.itAsync("loads via Http", ::specLoadsAsync, 3000); } public specRenders() { test.expect(1 + 1, 2); } public specLoadsAsync(done) { Http.getAsync("/api/x", ::onOk, ::onErr); this.lastDone = done; } public onOk(resp) { ... this.lastDone.ok(); } public onErr(msg) { this.lastDone.fail(msg); } }

Members

  • name
  • groupName
  • fn
  • isAsync
  • timeoutMs
  • skip
  • only

Methods

  • _AspecSpec (string Name, string GroupName, callback Fn, bool IsAsync, int TimeoutMs, bool Skip)

class: _aspec

[508:14] static extends: object

Members

  • runner

Methods

  • get ()

  • reset ()

    Reset the singleton. Mostly for self-tests of aspec itself.