@flamework-experimental/testing
v2.0.0-beta.1
Published
In-place tests for Flamework games: define sections of tests, run them through a BindableFunction in Workspace, from the client through a RemoteFunction, or from an Open Cloud task; and the flamework-test CLI that opens the place in Roblox Studio or publi
Readme
@flamework-experimental/testing
Tests that run inside a real place, and the CLI that runs them. Two halves in one package:
The roblox-ts side (
out/):defineTests,test,test.skipandtest.concurrent,defer,scratch,skip, theexpect*assertions, andTestingPlugin, which hosts the sections onWorkspace.FlameworkTests(a BindableFunction) andWorkspace.FlameworkTestsServer(a RemoteFunction) under thetestingscope. How to write the tests is in the guide's Testing in the place.flamework-test(cli/, the package'sbin): runs those sections where the engine is real, from a terminal or CI. It runs them in one of two places:- Roblox Studio on this machine, the default. It opens the place Rojo built, runs the tests in a play session on the server and the client, reports, and closes the place again. No account, upload or key is needed.
- The cloud, when asked. It publishes the build to a testing place, and runs the server's tests inside a real Roblox server through the Open Cloud Luau Execution API.
Either way, a copy of the original place can be patched with the build first, so the tests see the assets that exist only in the original.
bun add @flamework-experimental/testing
bun run test # guide 12's test script: compile with the scope, rojo build, flamework-test testThe place has to be compiled with the testing scope, or it has no test host, so the quick start is
the
test script
from guide 12, as a package script. It compiles with FLAMEWORK_SCOPES set to testing in its own
environment, builds the place, runs flamework-test test test.rbxl, and compiles again with the
variable set to nothing. Never put the scope in .env or .env.local: every build on the machine
reads them, the ones you ship included.
The CLI needs Bun, whatever installed the package: its bin is TypeScript that
Bun runs as it is. npm install and pnpm add work too, and their flamework-test command starts
bun, so npx flamework-test works once Bun is on the PATH, and says '"bun"' is not recognized
otherwise. A Node build of the CLI would need a bundling step and a second runtime to test it under,
for a tool that already needs Studio, Rojo and, for patching, Lune. It needs neither TypeScript nor
@flamework-experimental/transformer: it reads flamework.config.json itself, so a project built
by another Flamework compiler runs it without them.
Building is Rojo's job, so the CLI takes the file Rojo produced and does not wrap rojo build. Rojo
does not create a missing output directory, which is why the file goes in the project root.
What a run leaves in the project, all of it for .gitignore:
- the places the CLI makes beside the build (
place.patched.rbxlwith an original place,place.<project>.rbxlunder--project), which/*.rbxlcovers with the build itself; build/version.json, whichcloud publishwrites, and sotest --cloud;- Studio's
place.rbxl.lockbeside a place it has open. The CLI removes the lock of a window it ends, but one left by a Studio closed any other way stays, so ignore*.rbxl.locktoo.
The patch's own files (its plan and its Lune task) go to a folder of the system's temp directory, one per run, removed when the patch is done. The rest of this file covers the CLI.
test: Studio on this machine
bunx flamework-test test place.rbxl # both realms
bunx flamework-test test place.rbxl --realm client # one of them
bunx flamework-test test place.rbxl --sections economy # a section, or economy/buys
bunx flamework-test test place.rbxl --keep # leave Studio and the play session open
bunx flamework-test test place.rbxl --show-windows # open Studio where you can see it
bunx flamework-test test place.rbxl --fail-on-skip # a skipped test fails the run
bunx flamework-test test place.rbxl --keep-awake # keep the display on while it runs
bunx flamework-test test place.rbxl --concurrency 1 # concurrent tests one at a timeIt needs Roblox Studio installed, with "MCP server" enabled in its Assistant settings. That setting
is what lets the CLI drive a window. test then:
- launches Studio on the file and waits for the window to connect;
- starts a play session;
- invokes
Workspace.FlameworkTestsin the server's data model, then in the client's; - prints each realm's summary;
- stops the session and closes the window.
Every realm runs even when one fails: when its tests fail, when it does not answer within
--run-timeout, and when the call itself fails, such as when the place has no test host. That last
error is printed as the snippet raised it (the server's run failed: Workspace.FlameworkTests did
not appear within 30 seconds: ...), without the Studio Assistant's own locations in front of it.
The exit code is the worst of them.
Studio may run the Luau its MCP server executes in a sandboxed thread (it did from 2026-10-01; on
2026-10-05 it did not), and the host and the CLI work either way. A sandboxed thread may only
invoke a bindable that is Sandboxed itself and has no capability the thread lacks. So the host
makes Workspace.FlameworkTests Sandboxed, with no capabilities. That decides only who may call
it: the callback runs with the capabilities of the script that set it, so the tests keep
require, _G and everything else. A place built with 2.0.0-alpha.5 or earlier has a bindable
that is not Sandboxed; the CLI marks it before the invoke for as long as Studio lets sandboxed code
do that, and once Studio refuses, the place has to be rebuilt (see Troubleshooting).
--sections is judged across the realms that run: an entry only the server has is listed for the
client as not among the client's sections: coin, which does not fail it, and the run fails only on
an entry no realm has (MISS matched nothing in any realm: coins). With --realm, the one realm
judges alone.
A skipped test (skip(reason) or test.skip) is not a failure, and is shown all the same: each
realm's summary counts it (9 passed, 0 failed, 1 skipped) and lists it with its reason
(- name (skipped): reason), and a run under several projects ends with each project's count
(projects: default passed (1 skipped), ...). --fail-on-skip makes any skip fail the run, for
CI that must run everything: a section with a skip heads FAIL, and with --json, whose ok no
skip makes false, one line on stderr says the skips failed the run. A place built with
2.0.0-alpha.5 or earlier reports no skips, and --fail-on-skip then passes it with a note in the
summary (none under --json); an
older CLI against a newer place leaves skips out of its summary, and never fails on one. See
Skipped tests.
Tests marked concurrent (test.concurrent, or a section defined with { concurrent: true }) run
alongside each other in the place, up to testing.concurrency at once (4 by default); a plain test
always runs alone. --concurrency <n> overrides that limit for a run (1 runs every test alone).
The summaries and --json keep the tests in the order they started (declaration order, or a
--sections list's), and --list marks the concurrent ones. A place built before concurrent tests
ignores the flag, and the summary says so.
See Concurrent tests.
--keep-awake asks Windows to keep the display on from the start of the run to its end, and lets
go when the run ends, Ctrl+C included. While the display is off the engine renders nothing:
RenderStepped stops, and with it onRender, which fails client tests that wait for a frame in a
run nobody watches. A minimized Studio window still renders. It is off by default, changes no power
setting, and does nothing (saying so) anywhere but Windows. See
Unattended runs.
Hidden windows
On Windows, test opens Studio on a hidden desktop of its own, flamework-test, so a run never
shows a window or takes the focus: not its splash, not its main window, not a dialog. Every run and
project uses that one desktop, --parallel windows included. --show-windows opens the windows on
your desktop as before, and so do FLAMEWORK_TEST_SHOW_WINDOWS=1 and "flameworkTest": {
"showWindows": true }, after the flag. studio open always shows its window, since looking at it
is what it is for. Anywhere but Windows nothing is hidden, and the flag changes nothing.
- The same run. The MCP proxy reaches a hidden window as any other, the play session runs, and the client renders: a screen capture of one shows the scene. A hidden window costs what a shown one does. Both render at Studio's own frame-rate cap (240 frames a second, measured on a 144 Hz display), with about 1.2 cores busy while a play session idles, 0.8 to 0.9 in edit mode, a fifth of the GPU's 3D engine, and 3.1 to 3.3 GB at most (2026-10-05). A minimized window would render at 60 and cost about half, but it draws no 3D scene, which a test could tell, so nothing is minimized.
- A window that never connects may be showing a dialog nobody can see there (a login, an update,
a crash report). The error says so: run again with
--show-windowsto see it. It also names every window that registered with the MCP proxy during the wait, with what the run made of each (see the next list). A Studio signed out of Roblox shows its login dialog there: the run reads that from Studio's own log and stops at once, saying so (... is not signed in to Roblox ...). --keepleaves the window hidden. Windows moves no window from one desktop to another, and a window is kept mostly to be driven:studio exec,run,call screen_captureand the rest reach it there, andstudio closecloses it. To look at a kept window, run with--show-windows --keep.studio lockandstudio listsay which windows are on the hidden desktop. The desktop is Windows' to remove once its last window has closed and no flamework-test holds it.
How test handles Studio windows:
- It takes the Studio lock before it launches Studio, so that one
flamework-test command uses Studio at a time on this machine (its one window, or a
--parallelrun's several), and waits while another project's window or run holds it. It holds the lock across all its projects, and frees it once its last window has closed. - A window whose title shows that very file is from an earlier build and would test stale code, so it is closed first: asked, then ended after ten seconds. The title decides. A window since saved elsewhere or retitled is left open, like every window of another file, whatever its name. A window on the hidden desktop, which only flamework-test opens, is matched by the command line it was started with too, and ended without asking.
- The window
testopens is closed by ending the Studio process thatteststarted, without asking first. Asking never closes it: Studio marks a place file it opens as changed the moment it has loaded it, before any play session or Luau, so the ask only raises its "Save changes to place.rbxl?" prompt, and nothing a run makes is kept. It is only reported closed once that process is gone. A process still running fails the run, named by its PID and title. - The window is found on the MCP proxy, which says nothing of the process behind a window:
- Whatever the proxy listed before the launch is never taken for it, nor asked anything.
- A new window listed under the file's name is taken, as before.
- The proxy may list a window under a name that is not its place's, and never correct it: a
hidden window registered as
Gamewhilegame.Nameinside it was right (2026-10-07). So a new window listed under a name that names no place, neither a file (*.rbxl,*.rbxlx) nor a cloud place (... (placeId: <id>)), such asGameorPlace1, or under no name for over 30 seconds, is asked who it is, read-only, unless a flamework-test project has claimed it (the Studio lock's record, the windows it closed for another project):execute_luaureturns itsgame.Nameand Workspace'sFlameworkTestLaunchattribute, and nothing else. A window listed under another place's name is never asked. - A patched place (an original, or a chosen
--project) carries that attribute, a random id of the one launch it was made for, so the window that answers with it is this run's, whatever it is listed as. A plain run's build andstudio open's file get no id: their window is told by itsgame.Name, whatever id the file carries from an earlier run, under the listed name's rule: each other Studio showing a file of that name must be matched by a window the proxy listed under that name before the launch. - A window that has not said which place it has open yet is asked again a look (5 seconds)
after its last answer, until the wait runs out, however slow its start: one that cannot be
reached yet, one still loading its place (
game.NameisGame), or, for a patched place, one that names the file but whose id cannot be read yet. A window whose answers cannot be read at all is asked three times. Each question gets 20 seconds, or what is left of the wait.--parallelprojects share the answers, and between them ask a window no more often than one project would. - The run says
connected: place.deferred.rbxl (<id>), which the MCP proxy lists as "Game": told by the launch id its place carries, and from then on drives the window by its MCP id: the Studio lock's record keeps that id and the listed name, so the studio commands find it too. - The wait is
--connect-timeout <seconds>(FLAMEWORK_TEST_CONNECT_TIMEOUT, else 180), never--run-timeout, which is each realm's run.
- A window the run gives up on (one that never connected, say) is closed too, unless
--keep. - Runs of same-named files started at the same time take turns to open their windows, because the proxy lists a window by its file name alone. A run that finds another window of a file with that name opening alongside its own cannot tell the two apart, so it refuses and closes its own.
- Ctrl+C stops the run and cleans up what it started, through the steps a finished run takes: it
stops the play session it started (one Studio is still starting is stopped once the start has
finished) and closes the window it opened (by its process;
--keepkeeps both), releases its window-name claim, frees the Studio lock, removes the patch's temp folder, stops lune and the MCP proxy, and lets go of the--keep-awakerequest. A Ctrl+C while it waits for the lock leaves nothing to clean up. It runs nothing more (not the other realm, not the next project) and ends on one line naming what it cleaned up and what it left; the CLI's own process exits 130. A second Ctrl+C exits at once, however soon it comes, naming what may be left. Through theflamework-testbin (and so through a package script) the shell gets its prompt back at once, with the bin's own Ctrl+C status rather than 130, and the cleanup's lines follow a few seconds later; to wait for them, runbun node_modules/@flamework-experimental/testing/cli/src/cli.ts ...yourself (not from a package script). See Ctrl+C.
| Command | Does |
|---|---|
| test <file> [--realm server\|client\|both] [--sections a,b] [--list] [--json] [--keep [--lock-hold <minutes>]] [--show-windows] [--original-place <rbxl>] [--run-timeout <120s>] [--concurrency <n>] [--fail-on-skip] [--keep-awake] [--lock-timeout <seconds>] [--connect-timeout <seconds>] | The above, on the hidden desktop unless --show-windows. --keep prints the window's studio_id=<id> pid=<pid> line, and keeps one project's window only. |
| test <file> --project <a.project.json> [--project <b.project.json>] | The above once per project, each in a place made under that project's $properties; see Running under several Rojo projects. |
| test <file> --project <a> --project <b> --parallel [n] | Up to n projects' windows side by side (no number: 2; at most 4, and no more than there are projects), each project's lines printed together, in project order; see Side by side. |
| test <file> --cloud | The cloud run instead: publishes the file, then runs the server's tests in it; see below. |
| patch <file> --original-place <rbxl> [--out <path>] | Lays the build over a copy of the original and writes the result, without running anything. |
| patch <file> --project <file> [--out <path>] | Sets the project's $properties on the build and writes that, place.<project>.rbxl; with an original, patches a copy of it under that project. |
Studio commands
These are the pieces test is made of, for driving a window by hand, and a way to call any of
Studio's MCP tools. They act on:
- the window flamework-test opened for this project (
studio open,test --keep); - if there is none, for
studio statusonly, the window that has the testing place open (found by its place id), and if there is none, the only window with a local place file open; - or whatever
--studio <name|id>names.
A command that changes a window, with none of this project's open, says so (and, when another
project closed this project's last window, or found it closed, what became of it) rather than take
another window only to refuse it. Only the testing-place lookup needs the testing place's ids. When
nothing matches, they say so and list what is open. On Ctrl+C, studio run stops the session it
started, studio open stops waiting and leaves the window, and the Luau of studio exec or a
studio call runs on in Studio.
Which windows a command may change. close, play, stop, exec, run and call act
only on the window flamework-test opened for this project, the one the Studio lock
records. The project is the nearest folder holding a flamework.config.json, else the nearest
holding a package.json, else where the command runs, so every folder of a game speaks for it. The
window is known by its MCP id and the place it was launched on (its file's name, or the testing
place's id), so an id the proxy has since given another window is not taken for it. Any other window
is refused before anything is sent to it, naming the window and --any-window: the user's own
windows, one opened by hand or by an older flamework-test, and another project's flamework-test
window, whose run or agent may still be using it. This project's window is refused too while a
command of this project run by another process is running in it (test, test --keep, a
studio open still waiting for its window to connect), or between two of its windows, naming that
run: test closes its window when it ends, and test --keep and studio open leave it to this
project then. --any-window acts on the window anyway; use it on a window the user has open only
once the user has said so. status, list, tools and lock read, and work on any window.
| Command | Does |
|---|---|
| studio open [file] [--lock-hold <minutes>] [--connect-timeout <seconds>] [--json] | Takes the Studio lock, opens the testing place from the cloud in a new Studio window (with a file, that local place) and waits for it to connect (--connect-timeout, else FLAMEWORK_TEST_CONNECT_TIMEOUT, else 180 seconds, which the error names when it runs out), telling it the way test does (it makes no launch id, so a window listed under no place's name is told by its game.Name, whatever id the file carries from an earlier test). Prints its MCP id on a line of its own, studio_id=<id> pid=<pid>, or JSON with --json. A window that never connects is closed again. While this project's window is open, it refuses, naming that window: use it, or studio close it first. |
| studio close | Closes the window flamework-test opened for this project, by its Studio process (even when the proxy no longer lists it), without asking, as test closes its own (asking only raises a save prompt), checks it is gone, and frees the Studio lock. While a command of this project run by another process (test, test --keep, studio open) is using that window, it refuses, naming that run. With --any-window, another window, found by its title: when several windows have that title, none is closed. A window still running after the forced close is reported with its PID, and the command fails. |
| studio status | Edit or play, and which data models exist. |
| studio play / studio stop | Starts or ends a play session. |
| studio exec --code "<luau>" / --script <file> [--realm edit\|server\|client] [--call-timeout <120s>] | Runs Luau in the chosen data model and prints what it returned. |
| studio run [--realm server\|client\|both] [--sections a,b] [--list] [--json] [--keep] [--run-timeout <120s>] [--concurrency <n>] [--fail-on-skip] [--keep-awake] | Runs the tests in a play session, starting one if needed and stopping it afterwards unless --keep, without opening or closing anything. |
| studio list [--json] | The windows the MCP proxy reaches: each one's id and place, whether flamework-test opened it (and for which project), whether it holds the Studio lock, and whether it is on the hidden desktop, under a line on the lock. Studio processes the proxy reaches none of are named, with the setting that is probably off. |
| studio tools [name] [--json] | The tools Studio's MCP proxy offers, read live from it, so the list is what this Studio has: each one's name and the first line of its description. With a name, its whole description and its arguments (a JSON schema). |
| studio call <tool> [json-args \| --args-file <file>] [--studio <id>] [--out <dir>] [--json] [--call-timeout <120s>] | Calls any tool. studio_id, which every tool but list_roblox_studios takes, is filled in from --studio (else this project's window); a studio_id in the arguments names the window the same way, and is refused the same way. A tool whose arguments have no studio_id is sent without a window only when it is known to act on none (list_roblox_studios), else only with --any-window, since which window it acts on cannot be told. Text is printed; images are written to files in --out, by default <temp>/flamework-test/captures, named by their type (screen_capture answers a JPEG: .jpg), and each path printed; --json prints the raw answer. A tool's error exits 1 with its message, without the Studio Assistant's own locations. studio call <tool> --help is studio tools <tool>. |
| studio lock [--json] [--check-window] | Who holds the Studio lock (project, command, since, last use, when its hold runs out), whether its command still runs, each window it has open or is opening (place, Studio PID, whether that process still runs, whether it is on the hidden desktop, MCP id), and whether the lock is live, expired or stale. With --check-window, whether each window is on the MCP proxy too: not asked unless wanted, since starting a proxy joins the hub other clients share. |
| studio unlock [--force] | Frees a stale lock, and an expired one, closing its window (flamework-test's only). Refuses a live one, naming the holder and when its hold runs out; --force closes that window too. |
bunx flamework-test studio open # the testing place, from the cloud
bunx flamework-test studio run --realm client # the client's sections in it
bunx flamework-test studio closeStudio may run execute_luau sandboxed, through studio exec or studio call alike (it did from
2026-10-01; on 2026-10-05 it did not). Sandboxed, a snippet has no require of the place's
modules, no _G or shared, no DataStore; under a refusal of that kind (lacking capability, a
bindable that is not Sandboxed) the CLI adds a line saying the snippet ran sandboxed. Code that
reaches the game through a Sandboxed bindable, as the test host does, works either way.
The Studio lock
One flamework-test command uses Studio at a time on this machine, across projects and agents: its
one window, or the several of a test --parallel. test and studio open take the lock before
they launch Studio; a cloud run opens no window and takes nothing. The lock is a folder,
studio-lock, in a per-user folder every project and agent shares: %LOCALAPPDATA%\flamework-test
on Windows (~/Library/Application Support/flamework-test on macOS,
$XDG_STATE_HOME/flamework-test or ~/.local/state/flamework-test elsewhere), never the temp
folder, which an agent's harness may set per agent. FLAMEWORK_TEST_STATE_DIR moves it. Every
project has to agree on it, so set it in the shell, never in a project's .env: flamework-test does
not read it from the .env files next to flamework.config.json, but Bun loads a .env (and
.env.local) from the folder a command runs in before flamework-test starts, and one there would
move the lock for the commands run from it. The folder holds a record of who took it: the CLI's PID,
the project directory, the command, since when, its last use and when its hold runs out, and every
window the command has open or is opening, each with its place, its Studio PID once launched and its
MCP id. The window-name claims live beside it, and the notes of windows closed for another project.
- How long. A command holds it while it runs, window or not:
testkeeps it from its first project's window to its last (with--parallel, several of them open at once), and frees it once it has closed its last window, and so does its Ctrl+C cleanup.test --keepandstudio openleave the window open on purpose, holding the lock, untilstudio close, or until the window closes any other way. A window that a command did not mean to leave open (a second Ctrl+C, a killed process) is closed by the next command that opens a window, at once, and that command says so. - The hold. A window flamework-test left open may sit unused for 15 minutes (
--lock-hold <minutes>onstudio openandtest --keep,FLAMEWORK_TEST_LOCK_HOLD,flameworkTest.lockHold). Every command that uses it renews that:studio status,play,stop,exec,runandcall, and a runningtestall along. Once the hold has run out, the next command that opens a window, orstudio unlock, closes it the way flamework-test closes its own (by the Studio process it launched, never another), says so in one line, and takes the lock. The owner's next command on that window says it was closed after so many minutes idle, and to open it again. - Stale. A lock whose command has ended and whose Studio process has exited (closed by hand,
say), or whose PID is another process now (told by its name and start time), or whose command
ended with no window open, is taken over by the next command, which says so in one line. No
command is needed to free it. Studio's own lock beside the place file (
place.rbxl.lock), which a Studio that was ended leaves behind, is removed when it names that window's process, and the owner gets a note: its next command says its window has closed, and to open it again, rather than not finding it. - Waiting. A command that finds the lock held says once who holds it (project, command, place,
PID, since), then again about every minute, and waits up to 300 seconds (
--lock-timeout <seconds>,FLAMEWORK_TEST_LOCK_TIMEOUT,flameworkTest.lockTimeout; 0 does not wait). Then it exits 1, naming the holder and how the lock gets freed. Ctrl+C during the wait exits 130, holding nothing. 300 seconds outlast another agent's test run, and leave room for a run of its own within the ten minutes an agent's tool call allows at most. - This project's own window. A window this project's
studio openortest --keepleft open:testof the very file it has open closes it, as a window left from an earlier build, and takes the lock. Anything else that would open a window while it is open refuses at once, naming it, rather than wait for itself. While a command of this project is still running in another process (another agent'stest, say), a command that would open a window waits for it instead, as for any other project. - Seeing it.
studio locksays who holds it and whether it is live, expired or stale;studio listheads with it. - Several windows. A
test --parallelholds the lock for every window it opens, in one record.studio locklists each (window 1 of 2:, with its place, Studio PID and MCP id, and--check-windowasks the proxy about each), andstudio listmarks each as holding the lock. Every rule holds per window: the lock is stale only once every window it names has gone; a run cut short leaves its windows to the next taker, which closes every one of them (and removes the.rbxl.lockStudio left beside each one already gone); a window that would not close stays in the record, by its own Studio process and place file, for the next taker to close.studio closecloses all of this project's, or the one--studio <id>names. - Older CLIs. A window opened by flamework-test 2.0.0-alpha.6 or earlier, or by hand, holds no
lock: a command does not wait for it, and it is not this project's window. 2.0.0-alpha.6 kept its
window-name claims in
<temp>/flamework-test; this version keeps them in the folder above and does not look there, so an alpha.6 run and this one opening a file of the same name at the same moment do not see each other's claim. A claim alpha.6 left behind is harmless: only alpha.6 reads it, and takes it over once its process has gone.
From a coding agent
Every tool of Studio's MCP server is reachable through the CLI, with no MCP server configured in the agent's own harness:
bunx flamework-test studio open place.rbxl # prints: studio_id=<id> pid=<pid>
bunx flamework-test studio list # the windows, and which one is this project's
bunx flamework-test studio tools # what Studio offers; studio tools <name> for one
bunx flamework-test studio call get_studio_state --studio <id>
bunx flamework-test studio call screen_capture --studio <id> --args-file capture.json
bunx flamework-test studio close # closes it and frees the Studio lock- Put a tool's arguments in a file and pass
--args-file: a shell may strip the quotes inside an argument (Windows PowerShell does). testopens its window on a hidden desktop (Windows): nothing shows, and the user's focus is left alone.test --keepleaves it there, where the studio commands drive it (studio call screen_captureincluded).studio openshows its window.refusing to ... the Studio window ...means the window is not the one flamework-test opened for this project. Open your own withstudio open. Use--any-windowon a window the user has open only after asking the user.refusing to ... this project's Studio window ...: `test` is running in it(ortest --keep,studio open) means another process's run is using it: wait for that run to end.no Studio window flamework-test opened for this project is openmeans what it says:studio openone.waiting for the Studio lockmeans another project's window is open; the line says whose, and until when its hold runs. Never close a window you did not open: ask the user, or wait.... "MCP server" setting is probably offmeans Studio runs but its MCP server does not: ask the user to turn it on in Studio's Assistant settings, then retry.
How much to run
A Studio run takes minutes, and every project on the machine queues behind it for the Studio lock. Run what the change can break:
- Docs, comments, a name inside one file: the build (
rbxtsc), and no Studio run. - One feature: its sections only:
--sections <section>, plus--realmwhen one realm is enough. - Shared code: the sections of that code and of what uses it directly.
- The whole run, every Rojo project (
--project), cloud runs and benchmarks: only when the user asks, or after you suggest it, saying why and how long it takes, and the user agrees. - Several Rojo projects: with
--parallel 2, unless the run measures time or needs a window's focus (Side by side).
Cloud commands
These need a testing experience and an Open Cloud key (see Settings). They run the
server's sections only, because a Luau execution task has no client. The Luau that cloud run
submits to run the tests is called the shim. Ctrl+C cannot undo what reached Roblox: an upload it
cuts short may still make a version (and build/version.json is not written), and a task already
created runs on until it finishes or its timeout, since the Luau Execution API cannot cancel one;
the run's last line names the task's path.
| Command | Does |
|---|---|
| cloud publish <file> [--published] [--original-place <rbxl>] | Uploads the place Rojo built (patched first when an original is named) to the testing place as a Saved version, and records the version number in build/version.json. |
| cloud run [--place-version N] [--sections a,b] [--list] [--run-timeout 120s] [--json] [--concurrency <n>] [--fail-on-skip] | Submits the test shim against the recorded version (--run-timeout is the task's, 300s at most), waits, prints the task's log and a summary, exits non-zero on any failure (and, with --fail-on-skip, on a skip). |
| cloud run --code "<luau>" / --script <file> | Runs arbitrary Luau instead of the shim and prints what it returned: a hypothesis about a real server, answered in a minute. |
| cloud probe | Reports what the task environment looks like from the inside. |
--dry-run prints the request a command would send, without the key. Flags may come before or
after the command.
Why the cloud needs testing.entry and Studio does not. A Luau execution task loads the place
but runs none of its Scripts, so nothing ignites the game. The shim has to require the ModuleScript
that exports ignite() and call it. "testing": { "entry": "src/server/main" } in
flamework.config.json tells it which one. In Studio, the place's own Scripts run, and the module
is up before the tests are invoked. A cloud command checks for the entry before it publishes
anything. See
Running the tests
for the setup.
The place must be closed in Studio while cloud publish runs: Roblox refuses to save a version of
a place that is open (409 Server is busy).
Settings
Each setting is taken from the first of these that has it:
- its flag;
- its environment variable, from the shell;
- the same variable from
.envand.env.localnext to the nearestflamework.config.json; - that file's
flameworkTestsection, read the way the Flamework build reads the file (so it may use${NAME}itself).
A setting has one name throughout: the flag is the key in kebab case, and the variable is
FLAMEWORK_TEST_ and the key in capitals (--lock-hold, "lockHold", FLAMEWORK_TEST_LOCK_HOLD).
The API key's variable is the one exception, ROBLOX_API_KEY, the name Roblox's own tools use.
| Key | Flag | Variable | Default | Sets |
|---|---|---|---|---|
| failOnSkip | --fail-on-skip | FLAMEWORK_TEST_FAIL_ON_SKIP | off | A skipped test fails the run, for CI that must run everything. |
| keepAwake | --keep-awake | FLAMEWORK_TEST_KEEP_AWAKE | off | A Studio run keeps the display on while it lasts (RenderStepped stops while it sleeps). |
| showWindows | --show-windows | FLAMEWORK_TEST_SHOW_WINDOWS | off | A Studio test opens its windows where they can be seen; see Hidden windows. |
| parallel | --parallel [n] | FLAMEWORK_TEST_PARALLEL | 1 | How many projects' windows run side by side; see Side by side. |
| lockTimeout | --lock-timeout <seconds> | FLAMEWORK_TEST_LOCK_TIMEOUT | 300 | How long a command waits for the Studio lock; 0 does not wait. |
| lockHold | --lock-hold <minutes> | FLAMEWORK_TEST_LOCK_HOLD | 15 | How long a window left open may sit unused, one minute at least (a window in use renews it every 30 seconds). |
| universeId | --universe-id <id> | FLAMEWORK_TEST_UNIVERSE_ID | none | The testing experience. |
| placeId | --place-id <id> | FLAMEWORK_TEST_PLACE_ID | none | The testing place, which a cloud run publishes to and studio open opens. Never the original place. |
| apiKey | --api-key <key> | ROBLOX_API_KEY | none | The Open Cloud key. Prefer the variable: a flag ends up in the shell history. |
| originalPlace | --original-place <rbxl> | FLAMEWORK_TEST_ORIGINAL_PLACE | none | A copy of the original place to lay the build over; see Patching. |
| | --project <file> | FLAMEWORK_TEST_PROJECT | default.project.json | The Rojo projects a run follows, comma-separated; see Running under several Rojo projects. |
| | --connect-timeout <seconds> | FLAMEWORK_TEST_CONNECT_TIMEOUT | 180 | How long a launched window is waited for on the MCP proxy. |
| | | FLAMEWORK_TEST_STATE_DIR | %LOCALAPPDATA%\flamework-test | Where the Studio lock lives; set it in the shell only (see The Studio lock). |
| | | FLAMEWORK_TEST_LUNE_EXE, FLAMEWORK_TEST_STUDIO_EXE, FLAMEWORK_TEST_STUDIO_MCP_EXE | found | Where lune, Roblox Studio and its MCP proxy are, when they are not found by themselves. |
"flameworkTest": {
"universeId": "10765968722",
"placeId": "108973151455286",
"apiKey": "${ROBLOX_API_KEY:-}",
"originalPlace": "places/original.rbxl", // optional, relative to this file; see Patching
"parallel": 2
},
"testing": { "entry": "src/server/main" } // the place's own section; cloud runs only# .env.local (gitignored)
ROBLOX_API_KEY=...The key needs universe-places:write, and universe.place.luau-execution-session:read and
:write, for the testing experience. A Studio run needs none of the cloud settings, except,
optionally, the original place. The flameworkTest section is read by this CLI only and is never
compiled into the place; the testing section is the place's own (one test's timeout,
concurrency, entry), compiled in. A switch's variable reads true or false (1, 0,
yes, no, on, off; empty is off), and --fail-on-skip=false, --keep-awake=false or
--show-windows=false turns one off for a run. A cloud run refuses the flags of the Studio-only
settings and reads none of their variables or keys. A roblox-ts build needs
@flamework-experimental/transformer 2.0.0-beta.0 or later for the section, whose schema has it.
Timeouts. Each has its own name: --run-timeout is how long a run may take (each realm's in
Studio, 120s by default; the task's in the cloud, 300s at most), --call-timeout how long
studio exec or a studio call may take, --connect-timeout how long a launched window is waited
for, and testing.timeout in flamework.config.json how long one test may take (30 seconds by
default, compiled into the place). flamework-test --version prints the CLI's own version; the
place version a cloud run runs is --place-version.
The names of the alphas are refused (2.0.0-beta.0), each with a message naming its new one: the
cloud section and the CLI's keys in testing, the variables FAIL_ON_SKIP, KEEP_AWAKE,
FLAMEWORK_TEST_SHOW, ROJO_PROJECT, ORIGINAL_PLACE, TESTING_UNIVERSE_ID, TESTING_PLACE_ID,
LUNE_EXE, ROBLOX_STUDIO_EXE and STUDIO_MCP_EXE and the TESTING_PLACE_API_KEY alias (set
anywhere the CLI reads, an old variable stops every command before it does anything), the flags
--show, --hold, --original, --testing-universe, --testing-place, --key, --timeout and
--version <n>, and cloud test. The
changelog has the
table.
Patching a copy of the original place
A game's assets often live only in the place itself, and a Rojo build has none of them. Save a copy
of the original from Studio (File > Save to File), and name it with --original-place,
FLAMEWORK_TEST_ORIGINAL_PLACE or flameworkTest.originalPlace. test and cloud publish then
lay the build over a copy of it, and run or upload that. patch does the same without running
anything.
The patch follows the Rojo project file (--project, default default.project.json), so it
changes exactly what a build would:
| In the project file | In the patched place |
|---|---|
| A node with $path | The build's instance replaces the original's, whatever was under it. That is the fresh code. |
| A node with only $className | The original's instance is kept, with everything it holds. When the original has none, the build's is taken. |
| $properties | Applied, typed from the reflection database: booleans, numbers, strings, enums, Vector3, Vector2, Color3. |
| Everything else in the original | Untouched. |
The patch prints one line for each change it made and for anything it skipped. It stamps the place
with the name of the project it followed (Workspace's FlameworkTestProject attribute; default
for default.project.json). It runs under Lune, which reads and
writes place files. Without lune on the path (or FLAMEWORK_TEST_LUNE_EXE), a command given an
original stops before running or uploading anything. A lune that hangs is stopped, saying so: lune
--version after a minute, the patch after five.
Running under several Rojo projects
A place file can hold any property, including the ones no script may set once the game runs. So a
project's $properties on Workspace are how a test run gets a SignalBehavior or a streaming
setup. The patch writes them into the place before Studio opens it, and the play session honours
them. Verified on 2026-09-13 with Lune 0.10.5 and Rojo 7.7.0:
| Workspace property | Values | Set by the patch | In the play session |
|---|---|---|---|
| SignalBehavior | Default, Immediate, Deferred, AncestryDeferred | yes | Deferred measured: no signal fires inside the write, all after task.wait(); Default in a fresh place behaves as Immediate |
| StreamingEnabled | boolean | yes | readable, and far content stays off the client |
| StreamingTargetRadius | studs | yes | 256 measured: a part 600 studs out never reaches the client, which the default 1024 would send |
| ModelStreamingBehavior | Legacy, Default, Improved | yes | Improved measured: a far Model is absent on the client entirely, where Default sends the empty container |
| StreamingMinRadius | studs | yes | written to the file; not readable and not told apart from the target radius in a small place |
| StreamingIntegrityMode | Default, MinimumRadiusPause, PauseOutsideLoadedArea, Disabled | yes | written to the file; PauseOutsideLoadedArea did not pause a teleported character in the time it took the far area to stream in |
Only StreamingEnabled can be read back from a script. The other five are NotScriptable, and show
only in what the engine does. Any other property the reflection database knows can be set the same
way: Workspace.Gravity, PhysicsSteppingMethod, and the properties of Lighting and
SoundService.
To test under one of these, write a project file that differs from default.project.json in its
$properties, and name it on the run. For example, tests/deferred.project.json:
{
"name": "flamework-game",
"tree": {
// the same tree as default.project.json, with:
"Workspace": { "$className": "Workspace", "$properties": { "SignalBehavior": "Deferred" } }
}
}bunx flamework-test test place.rbxl --project tests/deferred.project.json
bunx flamework-test test place.rbxl --project tests/deferred.project.json --project tests/streaming.project.json --parallel 2Each project gets one run of every realm, in a place named after it (place.deferred.rbxl), under
its own heading. Every project runs even after one fails, but for a window that would not close: it
is still open, and keeps its place among the windows the run has open at once (one, or
--parallel's n), so the projects that would need another are not run, and fail saying why. The
output ends with projects: deferred passed, streaming FAILED, and the exit code is the worst of
them.
Several projects are best run side by side, with --parallel 2, or more when memory allows (see
Side by side). Run them one after another only when the run measures time or needs
a window's focus.
--projectmay be repeated or comma-separated.FLAMEWORK_TEST_PROJECT=tests/deferred.project.json,tests/streaming.project.jsonin.envdoes the same without the flags, andFLAMEWORK_TEST_PROJECT=turns it off again.- With no project named, the run is the plain one: the build as it is, or laid over the original
when one is named, following
default.project.json. - A chosen project needs
luneeven without an original. The build was made byrojo buildfromdefault.project.json, so the project's properties have to be set on a copy. --run-timeout, the hang report and every other flag apply to each project's run.
Side by side
--parallel [n] runs up to n projects' windows at once (--parallel alone: 2), started in
project order, the next as soon as a project's window has closed. A framework tested under several
configurations then costs about what the slowest windows do, not the sum: this repository's four
projects took 7 min 20 s one after another and about 5 min with --parallel 2 (2026-10-05).
The windows launch one at a time, each once the Studio before it has signed in to Roblox (a few
seconds, read from Studio's log; until it registers, or 30 seconds at most, when its log says
nothing): two Studios signing in at once can sign every Studio out (seen 2026-10-20).
It is the preferred way to run several projects: --parallel 2, or more when memory allows (about
3 GB a window). Leave it out (or pass --parallel 1 over a configured number) when the run measures
time, such as a benchmark or a timing-sensitive case, since windows running side by side compete for
the CPU and skew the timings (see the last point below), or when it needs a window's focus, such as
input that needs a visible, focused window (--show-windows).
- Each window takes about 3 GB with its play session, which runs a server and a client (2.8 to 3.1
GB measured): two windows need about 6 GB free, four about 12. At most 4 run at once, whatever is
asked (saying so), and never more than there are projects.
FLAMEWORK_TEST_PARALLEL, then"flameworkTest": { "parallel": 2 }, set it after the flag; 1, the default, runs them one after another. - The lines read as a run one after another prints them: each project's lines together, lune's
included, in project order. While a later project runs, short lines on stderr say how it is
getting on (
[deferred] connected: ...,[deferred] passed in 2 min; its lines follow default's).--jsonprints on stdout what a run one after another prints, in the same order. What taking the Studio lock says (a wait, a window closed) is among the lines of the project that took it. - A project that fails (a window that never connects, a realm that errs or hangs) fails alone,
among its own lines; the others run on. The
projects:line and the exit code are as ever. - One run holds the Studio lock for all of its windows, all on the one hidden
desktop unless
--show-windows, and Ctrl+C closes every one of them.--keepstill keeps one project's window only, and a cloud run refuses--parallel: every project's cloud run publishes to the one testing place. - Windows that share the machine share its time: each project's realms took up to 2.6 s longer than
one after another (35 to 39 s on the server, 30 to 31 s on the client), its window was open about
10 % longer, and no test failed in two runs of
--parallel 2(2026-10-05).
The tree still comes from the build. A project chosen for a run changes what the place's services
and containers are set to, not what Rojo synced into them. To test a different tree, build with
that project (rojo build tests/big.project.json -o big.rbxl) and run that file.
Inside the place, getProject() from @flamework-experimental/testing returns the name of the
project the place was made under (deferred), or undefined in a place the CLI did not make. A test
can use it to assert what that project changes, or to skip(reason) under the others, which the
summary lists (a plain return would count as a pass). The run result
carries it as project, and the summary line prints it. To look at such a place in Studio, the
patch command makes the same place without running it:
flamework-test patch place.rbxl --project tests/deferred.project.json.
What runs in the cloud
A task loads the place but runs none of its Scripts. So the shim requires the testing package's own cloud module, which:
- ignites the game from the ModuleScript that
testing.entrynames in the config; - waits for
Workspace.FlameworkTests; - invokes it, and returns the result as JSON.
See Running the tests for the setup on the game's side, the limits, and what each error means.
Limits
- Five task creations a minute per key owner.
- 45 task and log reads a minute.
- Ten concurrent tasks per place.
- 300 seconds per task.
A run uses one task.
Troubleshooting
| Symptom | Cause |
|---|---|
| RobloxStudioBeta.exe was not found / StudioMCP.exe, Roblox Studio's MCP proxy, was not found | Studio is not installed here; set FLAMEWORK_TEST_STUDIO_EXE / FLAMEWORK_TEST_STUDIO_MCP_EXE, or run in the cloud with --cloud. |
| ... never showed up on the MCP proxy within 3 min (--connect-timeout) | The window opened but "MCP server" is disabled in Studio's Assistant settings, or, on the hidden desktop, it is showing a dialog nobody can see there (a login, an update, a crash report): run again with --show-windows to see which. studio open and test close it again (test --keep leaves it). The error names every window that registered with the proxy meanwhile, with its id, the name it was listed under and what it answered when asked (asked: game.Name "...", launch id ...; not this launch's), or why it was not asked (listed under another place's name, claimed by a flamework-test project). A slow start (a cold Studio, many plugins) may need a longer --connect-timeout. |
| Studio started (PID n) but is not signed in to Roblox, so <file> never opened | Studio is signed out of Roblox: the window showed its login dialog on the hidden desktop, where nobody can answer it. Ask the user to open Roblox Studio and sign in (one sign-in serves every Studio of theirs), then run again. The run reads this from Studio's own log (%LOCALAPPDATA%\Roblox\logs) and stops at the first look that shows it instead of waiting out --connect-timeout; with --show-windows it says so once and waits, since the dialog can be answered there. |
| could not start ... on the hidden desktop flamework-test (CreateProcessW: error N) / could not make the hidden desktop | Windows refused the hidden launch; --show-windows opens Studio on your desktop instead. |
| Roblox Studio is running (...), but the MCP proxy reaches none of them | The same setting, off in every running Studio: turn it on, then retry. |
| waiting for the Studio lock, held by flamework-test for <project> ... | Another project's flamework-test window is open; the command waits for it (see The Studio lock). |
| the Studio lock is still held after waiting 5 min | It still was: wait longer (--lock-timeout), ask whoever uses it to studio close it, or wait for its hold to run out. studio lock shows it. |
| this project's Studio window is still open: ... | This project's studio open or test --keep window holds the lock: use it (--studio <id>), or studio close it first. |
| refusing to <do something to> the Studio window ...: flamework-test did not open it for this project | The window is the user's, another project's, or from an older flamework-test. --any-window acts on it anyway, with the user's go-ahead. |
| refusing to <do something to> this project's Studio window ...: `test` is running in it (or test --keep, studio open; or is running for this project ... with no window open right now) | A command of this project, run by another process, is using the window, or is between two of its windows. test closes its window when it ends; test --keep and studio open leave it to this project then. Wait for it; studio lock shows it. |
| no Studio window flamework-test opened for this project is open | A command that changes a window found none of this project's, and does not take another in its place. studio open one; --studio <id> names another, which needs --any-window and the user's go-ahead. |
| refusing to call <tool>: it takes no studio_id | The tool's arguments name no window, so which one it acts on cannot be told. --any-window sends it anyway, with the user's go-ahead. |
| the Studio window flamework-test opened for this project ... was closed at ... after 16 min idle | Another project took the Studio lock once the window's hold had run out. Open it again; --lock-hold keeps a window longer. |
| the Studio window flamework-test opened for this project ... has closed: closed by hand, or Studio exited; flamework-test for ... found it so | The window closed (by hand, or Studio crashed) and another project took the lock over. Open it again. |
| the server's run failed: Workspace.FlameworkTests did not appear within 30 seconds | The place was built without the testing scope active (FLAMEWORK_SCOPES=testing for that build), so the plugin stayed inert. The other realm still runs, and reports the same. |
| the server's run failed: The current thread cannot invoke 'FlameworkTests' since 'FlameworkTests' has additional values for the Capabilities property: ... | Studio ran MCP code sandboxed, as it may, and the place was built with 2.0.0-alpha.5 or earlier, whose host does not make its bindable Sandboxed. A later CLI marks it before the invoke while Studio allows that; this error means it could not, or the CLI is that old too. Update the package and rebuild the place; a later CLI says so under the error. |
| MISS matched nothing in any realm: ... | A --sections entry names no section or test in any realm that ran: a typo, or a section whose provider is not registered. |
| the client's run did not finish within 120s (--run-timeout) | A test is stuck past testing.timeout, or the host never started; the next line names the last test that reported (PASS, FAIL or SKIP), and the one after it in that section is the hanging one (if that section runs concurrent tests, which report as each ends: any of them that has not reported). |
| (skipped): RenderStepped doesn't fire: the display may be asleep | The PC's display was off, so the engine rendered nothing; run with --keep-awake. |
| 1 skipped, which fails the run under --fail-on-skip (with --json, on stderr: 1 skipped on the client, ...) | A test skipped under --fail-on-skip (or FLAMEWORK_TEST_FAIL_ON_SKIP, flameworkTest.failOnSkip); the summary names it and its reason, under a section that heads FAIL. |
| FLAMEWORK_TEST_FAIL_ON_SKIP must be true or false / FLAMEWORK_TEST_KEEP_AWAKE must be true or false / FLAMEWORK_TEST_SHOW_WINDOWS must be true or false | The variable holds something else: true, false, 1, 0, yes, no, on, off, or empty for off. |
| flamework-test's environment variables were renamed: FAIL_ON_SKIP is now FLAMEWORK_TEST_FAIL_ON_SKIP | A variable from before 2.0.0-beta.0 is set in the shell, .env or .env.local (an empty one too). Rename it as the message says, and any ${NAME} reference to it in flamework.config.json; nothing was run. |
| --show is now --show-windows (and the other renamed flags, --timeout, --version <n>, cloud test) | A name from before 2.0.0-beta.0; use the one the message names. |
| flamework-test's settings have a section of their own, "flameworkTest" | flamework.config.json still has a cloud section or the CLI's keys in testing; move each where the message says. A build refuses it too. |
| --keep-awake is for Studio runs / --show-windows is for Studio runs | A cloud run has no display or window on this machine; drop the flag. |
| --parallel is for Studio runs | Every project's cloud run publishes to the one testing place, so they run one after another; drop the flag. |
| note: --parallel 6 is more than the 4 Studio windows flamework-test opens at once | It runs 4 at a time: each window takes about 3 GB. |
| [deferred] passed in 2 min; its lines follow default's (stderr) | Not a problem: under --parallel, a project that has ended waits for the ones before it to print theirs, so each project's lines stay together. |
| not run: the Studio window of default would not close, and this run opens no more than one window at once (--parallel) | That window is still open, after the line naming it (... is still open): close it by hand or with studio close, then run the projects that were not run. |
| no Studio window has the testing place ... open | Nothing has it open, or the window has "MCP server" disabled and so is not listed. studio list shows what is. |
| Ctrl+C under bun run left Studio open and printed no interrupted by Ctrl+C line | The script runs the CLI's file with bun directly, and bun run ends that process at once; call the flamework-test bin. The next test of that file closes the window. |
| After Ctrl+C the prompt came back at once, and the interrupted by Ctrl+C line came after it | Expected through the bin: its shim ends at once and the CLI cleans up after it. Run the CLI's file with bun to wait for it. |
| a cloud run needs "testing": { "entry": ... } | The cloud needs the ModuleScript that ignites the game; Studio does not. |
| 403 PERMISSION_DENIED naming a scope | The key lacks that scope for this experience. |
| 409 Conflict: Save failed. Server is busy on publish | The place is open in Roblox Studio; studio close it and publish again. |
| 429 | The creation limit. |
| Task FAILED: @flamework-experimental/testing is not in this place | The package is not installed, or nothing the entry module imports includes TestingPlugin. |
| lune is needed to patch the original place / to set the properties of the project ... | Install Lune (rokit or aftman) or set FLAMEWORK_TEST_LUNE_EXE. Nothing was run or uploaded. |
| `lune --version` did not answer within 1 min / the patch did not finish within 5 min, and lune was stopped | lune hung, and was stopped: check that lune --version answers in that shell; flamework-test patch runs the patch alone. Nothing was run or uploaded. |
| the Rojo project ... does not exist | A --project or FLAMEWORK_TEST_PROJECT entry names no file; every project is checked before the first run. |
| two projects are both named ... | Runs, files and the place's attribute are named after the project file, so tests/a.project.json and other/a.project.json cannot both be in one run. |
| skipped Workspace.X (not a property the reflection database knows) | The name is not a property of that class in Lune's reflection database; check the spelling against the Studio Properties window. |
Development
bun test cli/testsruns the CLI suite with a mockedfetch, a fake Studio proxy and fake processes. Nothing reaches the network, Studio or Lune.- The real thing runs in
tests/place, the repository's test place. Its dependencies are workspace links to this package and the others.bun run test:placefrom the repository root builds the packages and runs the place's suite in Studio under four Rojo projects, with no packing or copying. bun run typecheckrunstsc -p cli --noEmit, andbun run buildbuilds the roblox-ts side.
The CLI runs under Bun. The Luau it submits or runs lives in cli/tasks/*.lune, imported as text.
The reason: a game's Rojo project syncs node_modules/@flamework-experimental into the place, and
Rojo would make ModuleScripts of .luau files.
