@quenty/studio-bridge 0.23.0 → 0.24.0
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/CHANGELOG.md +21 -0
- package/README.md +36 -8
- package/dist/src/bridge/bridge-connection.d.ts.map +1 -1
- package/dist/src/bridge/bridge-connection.js +1 -0
- package/dist/src/bridge/bridge-connection.js.map +1 -1
- package/dist/src/bridge/bridge-session.d.ts +11 -16
- package/dist/src/bridge/bridge-session.d.ts.map +1 -1
- package/dist/src/bridge/bridge-session.js +37 -29
- package/dist/src/bridge/bridge-session.js.map +1 -1
- package/dist/src/bridge/bridge-session.test.js +35 -0
- package/dist/src/bridge/bridge-session.test.js.map +1 -1
- package/dist/src/bridge/internal/bridge-host.d.ts +2 -0
- package/dist/src/bridge/internal/bridge-host.d.ts.map +1 -1
- package/dist/src/bridge/internal/bridge-host.js +1 -0
- package/dist/src/bridge/internal/bridge-host.js.map +1 -1
- package/dist/src/bridge/internal/host-protocol.d.ts.map +1 -1
- package/dist/src/bridge/internal/host-protocol.js +23 -10
- package/dist/src/bridge/internal/host-protocol.js.map +1 -1
- package/dist/src/bridge/types.d.ts +5 -2
- package/dist/src/bridge/types.d.ts.map +1 -1
- package/dist/src/bridge/types.js.map +1 -1
- package/dist/src/commands/console/exec/exec.d.ts +13 -3
- package/dist/src/commands/console/exec/exec.d.ts.map +1 -1
- package/dist/src/commands/console/exec/exec.js +82 -7
- package/dist/src/commands/console/exec/exec.js.map +1 -1
- package/dist/src/commands/console/exec/exec.test.js +63 -1
- package/dist/src/commands/console/exec/exec.test.js.map +1 -1
- package/dist/src/commands/framework/action-loader.test.js +1 -1
- package/dist/src/commands/framework/action-loader.test.js.map +1 -1
- package/dist/src/commands/playtest/player/playtest-players.d.ts.map +1 -1
- package/dist/src/commands/playtest/player/playtest-players.js +15 -93
- package/dist/src/commands/playtest/player/playtest-players.js.map +1 -1
- package/dist/src/commands/playtest/player/playtest-players.test.js +34 -21
- package/dist/src/commands/playtest/player/playtest-players.test.js.map +1 -1
- package/dist/src/commands/playtest/playtest-sessions.d.ts +19 -3
- package/dist/src/commands/playtest/playtest-sessions.d.ts.map +1 -1
- package/dist/src/commands/playtest/playtest-sessions.js +54 -74
- package/dist/src/commands/playtest/playtest-sessions.js.map +1 -1
- package/dist/src/commands/playtest/playtest-sessions.test.js +74 -8
- package/dist/src/commands/playtest/playtest-sessions.test.js.map +1 -1
- package/dist/src/commands/playtest/run/run.d.ts +9 -7
- package/dist/src/commands/playtest/run/run.d.ts.map +1 -1
- package/dist/src/commands/playtest/run/run.js +33 -38
- package/dist/src/commands/playtest/run/run.js.map +1 -1
- package/dist/src/commands/process/close/close.d.ts +4 -0
- package/dist/src/commands/process/close/close.d.ts.map +1 -1
- package/dist/src/commands/process/close/close.js +54 -4
- package/dist/src/commands/process/close/close.js.map +1 -1
- package/dist/src/commands/process/close/close.test.js +36 -3
- package/dist/src/commands/process/close/close.test.js.map +1 -1
- package/dist/src/commands/process/info/info.d.ts +15 -2
- package/dist/src/commands/process/info/info.d.ts.map +1 -1
- package/dist/src/commands/process/info/info.js +44 -4
- package/dist/src/commands/process/info/info.js.map +1 -1
- package/dist/src/commands/process/info/info.test.js +48 -0
- package/dist/src/commands/process/info/info.test.js.map +1 -1
- package/dist/src/commands/process/launch/launch.d.ts.map +1 -1
- package/dist/src/commands/process/launch/launch.js +22 -3
- package/dist/src/commands/process/launch/launch.js.map +1 -1
- package/dist/src/commands/process/launch/launch.test.js +27 -5
- package/dist/src/commands/process/launch/launch.test.js.map +1 -1
- package/dist/src/commands/process/list/list.d.ts +49 -6
- package/dist/src/commands/process/list/list.d.ts.map +1 -1
- package/dist/src/commands/process/list/list.js +185 -18
- package/dist/src/commands/process/list/list.js.map +1 -1
- package/dist/src/commands/process/list/list.test.js +92 -1
- package/dist/src/commands/process/list/list.test.js.map +1 -1
- package/dist/src/commands/process/run/run.d.ts +1 -1
- package/dist/src/commands/process/run/run.d.ts.map +1 -1
- package/dist/src/commands/process/run/run.js +3 -3
- package/dist/src/commands/process/run/run.js.map +1 -1
- package/dist/src/docker/docker-delegator.js +1 -1
- package/dist/src/docker/docker-delegator.js.map +1 -1
- package/dist/src/docker/docker-delegator.test.js +1 -1
- package/dist/src/docker/docker-delegator.test.js.map +1 -1
- package/dist/src/plugin/playtest-bridge.d.ts +36 -0
- package/dist/src/plugin/playtest-bridge.d.ts.map +1 -0
- package/dist/src/plugin/playtest-bridge.js +65 -0
- package/dist/src/plugin/playtest-bridge.js.map +1 -0
- package/dist/src/plugin/playtest-bridge.test.d.ts +2 -0
- package/dist/src/plugin/playtest-bridge.test.d.ts.map +1 -0
- package/dist/src/plugin/playtest-bridge.test.js +35 -0
- package/dist/src/plugin/playtest-bridge.test.js.map +1 -0
- package/dist/src/process/studio-launch-registry.d.ts +14 -0
- package/dist/src/process/studio-launch-registry.d.ts.map +1 -0
- package/dist/src/process/studio-launch-registry.js +37 -0
- package/dist/src/process/studio-launch-registry.js.map +1 -0
- package/dist/src/process/studio-launch-registry.test.d.ts +2 -0
- package/dist/src/process/studio-launch-registry.test.d.ts.map +1 -0
- package/dist/src/process/studio-launch-registry.test.js +38 -0
- package/dist/src/process/studio-launch-registry.test.js.map +1 -0
- package/dist/src/process/studio-process-closer.d.ts +3 -1
- package/dist/src/process/studio-process-closer.d.ts.map +1 -1
- package/dist/src/process/studio-process-closer.js +29 -11
- package/dist/src/process/studio-process-closer.js.map +1 -1
- package/dist/src/process/studio-process-identity.d.ts +10 -0
- package/dist/src/process/studio-process-identity.d.ts.map +1 -0
- package/dist/src/process/studio-process-identity.js +63 -0
- package/dist/src/process/studio-process-identity.js.map +1 -0
- package/dist/src/process/studio-process-identity.test.d.ts +2 -0
- package/dist/src/process/studio-process-identity.test.d.ts.map +1 -0
- package/dist/src/process/studio-process-identity.test.js +30 -0
- package/dist/src/process/studio-process-identity.test.js.map +1 -0
- package/dist/src/roblox-mcp/index.d.ts +3 -0
- package/dist/src/roblox-mcp/index.d.ts.map +1 -0
- package/dist/src/roblox-mcp/index.js +3 -0
- package/dist/src/roblox-mcp/index.js.map +1 -0
- package/dist/src/roblox-mcp/mcp/mcp-stdio-client.d.ts +60 -0
- package/dist/src/roblox-mcp/mcp/mcp-stdio-client.d.ts.map +1 -0
- package/dist/src/roblox-mcp/mcp/mcp-stdio-client.js +171 -0
- package/dist/src/roblox-mcp/mcp/mcp-stdio-client.js.map +1 -0
- package/dist/src/roblox-mcp/mcp/mcp-stdio-client.test.d.ts +2 -0
- package/dist/src/roblox-mcp/mcp/mcp-stdio-client.test.d.ts.map +1 -0
- package/dist/src/roblox-mcp/mcp/mcp-stdio-client.test.js +104 -0
- package/dist/src/roblox-mcp/mcp/mcp-stdio-client.test.js.map +1 -0
- package/dist/src/roblox-mcp/mcp/repair-list-result.d.ts +2 -0
- package/dist/src/roblox-mcp/mcp/repair-list-result.d.ts.map +1 -0
- package/dist/src/roblox-mcp/mcp/repair-list-result.js +22 -0
- package/dist/src/roblox-mcp/mcp/repair-list-result.js.map +1 -0
- package/dist/src/roblox-mcp/mcp/repair-list-result.test.d.ts +2 -0
- package/dist/src/roblox-mcp/mcp/repair-list-result.test.d.ts.map +1 -0
- package/dist/src/roblox-mcp/mcp/repair-list-result.test.js +42 -0
- package/dist/src/roblox-mcp/mcp/repair-list-result.test.js.map +1 -0
- package/dist/src/roblox-mcp/roblox-studio-mcp.d.ts +34 -0
- package/dist/src/roblox-mcp/roblox-studio-mcp.d.ts.map +1 -0
- package/dist/src/roblox-mcp/roblox-studio-mcp.js +190 -0
- package/dist/src/roblox-mcp/roblox-studio-mcp.js.map +1 -0
- package/dist/src/roblox-mcp/roblox-studio-mcp.test.d.ts +2 -0
- package/dist/src/roblox-mcp/roblox-studio-mcp.test.d.ts.map +1 -0
- package/dist/src/roblox-mcp/roblox-studio-mcp.test.js +123 -0
- package/dist/src/roblox-mcp/roblox-studio-mcp.test.js.map +1 -0
- package/dist/src/roblox-mcp/studio/studio-session.d.ts +39 -0
- package/dist/src/roblox-mcp/studio/studio-session.d.ts.map +1 -0
- package/dist/src/roblox-mcp/studio/studio-session.js +175 -0
- package/dist/src/roblox-mcp/studio/studio-session.js.map +1 -0
- package/dist/src/roblox-mcp/studio/studio-session.test.d.ts +2 -0
- package/dist/src/roblox-mcp/studio/studio-session.test.d.ts.map +1 -0
- package/dist/src/roblox-mcp/studio/studio-session.test.js +213 -0
- package/dist/src/roblox-mcp/studio/studio-session.test.js.map +1 -0
- package/dist/src/roblox-mcp/studio-mcp-locator.d.ts +19 -0
- package/dist/src/roblox-mcp/studio-mcp-locator.d.ts.map +1 -0
- package/dist/src/roblox-mcp/studio-mcp-locator.js +121 -0
- package/dist/src/roblox-mcp/studio-mcp-locator.js.map +1 -0
- package/dist/src/roblox-mcp/studio-mcp-locator.test.d.ts +2 -0
- package/dist/src/roblox-mcp/studio-mcp-locator.test.d.ts.map +1 -0
- package/dist/src/roblox-mcp/studio-mcp-locator.test.js +107 -0
- package/dist/src/roblox-mcp/studio-mcp-locator.test.js.map +1 -0
- package/dist/src/roblox-mcp/studio-mcp-snapshot.d.ts +23 -0
- package/dist/src/roblox-mcp/studio-mcp-snapshot.d.ts.map +1 -0
- package/dist/src/roblox-mcp/studio-mcp-snapshot.js +65 -0
- package/dist/src/roblox-mcp/studio-mcp-snapshot.js.map +1 -0
- package/dist/src/roblox-mcp/studio-mcp-snapshot.test.d.ts +2 -0
- package/dist/src/roblox-mcp/studio-mcp-snapshot.test.d.ts.map +1 -0
- package/dist/src/roblox-mcp/studio-mcp-snapshot.test.js +81 -0
- package/dist/src/roblox-mcp/studio-mcp-snapshot.test.js.map +1 -0
- package/dist/src/roblox-mcp/test/fake-mcp-server.d.ts +27 -0
- package/dist/src/roblox-mcp/test/fake-mcp-server.d.ts.map +1 -0
- package/dist/src/roblox-mcp/test/fake-mcp-server.js +55 -0
- package/dist/src/roblox-mcp/test/fake-mcp-server.js.map +1 -0
- package/dist/src/server/web-socket-protocol.d.ts +50 -15
- package/dist/src/server/web-socket-protocol.d.ts.map +1 -1
- package/dist/src/server/web-socket-protocol.js +63 -13
- package/dist/src/server/web-socket-protocol.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/playtest-bridge.md +21 -0
- package/package.json +2 -2
- package/src/bridge/bridge-connection.ts +1 -0
- package/src/bridge/bridge-session.test.ts +51 -0
- package/src/bridge/bridge-session.ts +66 -47
- package/src/bridge/internal/bridge-host.ts +3 -0
- package/src/bridge/internal/host-protocol.ts +22 -9
- package/src/bridge/types.ts +5 -0
- package/src/commands/console/exec/exec.test.ts +94 -0
- package/src/commands/console/exec/exec.ts +130 -16
- package/src/commands/console/exec/execute.lua +147 -5
- package/src/commands/console/exec/execute.spec.lua +22 -2
- package/src/commands/framework/action-loader.test.ts +1 -1
- package/src/commands/playtest/player/playtest-players.lua +127 -0
- package/src/commands/playtest/player/playtest-players.spec.lua +48 -0
- package/src/commands/playtest/player/playtest-players.test.ts +40 -21
- package/src/commands/playtest/player/playtest-players.ts +30 -110
- package/src/commands/playtest/playtest-sessions.test.ts +116 -14
- package/src/commands/playtest/playtest-sessions.ts +77 -88
- package/src/commands/playtest/run/run.ts +44 -58
- package/src/commands/playtest/start/start-playtest.lua +105 -6
- package/src/commands/process/close/close.test.ts +52 -3
- package/src/commands/process/close/close.ts +78 -4
- package/src/commands/process/info/info.test.ts +76 -0
- package/src/commands/process/info/info.ts +74 -6
- package/src/commands/process/launch/launch.test.ts +33 -5
- package/src/commands/process/launch/launch.ts +41 -3
- package/src/commands/process/list/list.test.ts +130 -1
- package/src/commands/process/list/list.ts +290 -22
- package/src/commands/process/run/run.ts +4 -4
- package/src/docker/docker-delegator.test.ts +1 -1
- package/src/docker/docker-delegator.ts +1 -1
- package/src/plugin/playtest-bridge.test.ts +53 -0
- package/src/plugin/playtest-bridge.ts +98 -0
- package/src/process/studio-launch-registry.test.ts +56 -0
- package/src/process/studio-launch-registry.ts +63 -0
- package/src/process/studio-process-closer.ts +36 -11
- package/src/process/studio-process-identity.test.ts +45 -0
- package/src/process/studio-process-identity.ts +90 -0
- package/src/roblox-mcp/index.ts +17 -0
- package/src/roblox-mcp/mcp/mcp-stdio-client.test.ts +148 -0
- package/src/roblox-mcp/mcp/mcp-stdio-client.ts +270 -0
- package/src/roblox-mcp/mcp/repair-list-result.test.ts +52 -0
- package/src/roblox-mcp/mcp/repair-list-result.ts +23 -0
- package/src/roblox-mcp/roblox-studio-mcp.test.ts +168 -0
- package/src/roblox-mcp/roblox-studio-mcp.ts +330 -0
- package/src/roblox-mcp/studio/studio-session.test.ts +284 -0
- package/src/roblox-mcp/studio/studio-session.ts +279 -0
- package/src/roblox-mcp/studio-mcp-locator.test.ts +186 -0
- package/src/roblox-mcp/studio-mcp-locator.ts +180 -0
- package/src/roblox-mcp/studio-mcp-snapshot.test.ts +113 -0
- package/src/roblox-mcp/studio-mcp-snapshot.ts +104 -0
- package/src/roblox-mcp/test/fake-mcp-server.ts +74 -0
- package/src/server/web-socket-protocol.ts +119 -29
- package/templates/studio-bridge-plugin/playtest/StudioBridgePlaytest.client.lua +32 -0
- package/templates/studio-bridge-plugin/playtest/StudioBridgePlaytest.server.lua +40 -0
- package/templates/studio-bridge-plugin/src/Shared/ActionRouter.lua +25 -3
- package/templates/studio-bridge-plugin/src/Shared/PrecompiledSources.lua +47 -0
- package/templates/studio-bridge-plugin/src/Shared/PrecompiledSources.spec.lua +57 -0
- package/templates/studio-bridge-plugin/src/Shared/StudioBridgeClient.lua +357 -0
- package/templates/studio-bridge-plugin/src/Shared/StudioBridgeSessionUtils.lua +29 -3
- package/templates/studio-bridge-plugin/src/Shared/StudioBridgeSessionUtils.spec.lua +35 -2
- package/templates/studio-bridge-plugin/src/StudioBridgePlugin.server.lua +16 -292
- package/src/commands/playtest/run/playtest-runner.luau +0 -264
- package/src/commands/playtest/run/playtest-runner.spec.lua +0 -71
- package/src/commands/playtest/run/run-playtest-script.lua +0 -139
- package/src/commands/playtest/run/run-playtest-script.spec.lua +0 -43
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
--!strict
|
|
2
|
-
--[=[
|
|
3
|
-
Action that runs a script in a fresh playtest's server and answers with
|
|
4
|
-
`scriptComplete`, the same reply as `execute`.
|
|
5
|
-
|
|
6
|
-
It does not need the playtest's own plugin sessions, so it works whether or
|
|
7
|
-
not Studio loads user plugins into playtests.
|
|
8
|
-
|
|
9
|
-
- Compiles the code first, so a syntax error fails here without starting a
|
|
10
|
-
playtest.
|
|
11
|
-
- Plants the runner source the bridge sends as a Script in
|
|
12
|
-
ServerScriptService, with the code as a ModuleScript named `Code` under it.
|
|
13
|
-
The playtest copies the edit DataModel, so the runner starts in its server,
|
|
14
|
-
runs the code and ends the playtest with the result.
|
|
15
|
-
- Removes the runner from the edit DataModel once the playtest ends.
|
|
16
|
-
|
|
17
|
-
Request: `{ type: "runPlaytestScript", payload: { mode: "play" | "run", script, runnerSource, timeoutSec, args? } }`
|
|
18
|
-
Response: `{ type: "scriptComplete", payload: { success, output, returnValues?, error?, code? } }`
|
|
19
|
-
|
|
20
|
-
@class RunPlaytestScriptAction
|
|
21
|
-
]=]
|
|
22
|
-
|
|
23
|
-
local RunPlaytestScriptAction = {}
|
|
24
|
-
|
|
25
|
-
type SendMessage = (message: { [string]: any }) -> ()
|
|
26
|
-
|
|
27
|
-
--[=[
|
|
28
|
-
Registers the `runPlaytestScript` handler. The reply waits for the playtest to
|
|
29
|
-
end, so it needs `sendMessage`.
|
|
30
|
-
]=]
|
|
31
|
-
function RunPlaytestScriptAction.register(router: any, sendMessage: SendMessage?)
|
|
32
|
-
router:setResponseType("runPlaytestScript", "scriptComplete")
|
|
33
|
-
router:register(
|
|
34
|
-
"runPlaytestScript",
|
|
35
|
-
function(payload: { [string]: any }, requestId: string, sessionId: string): { [string]: any }?
|
|
36
|
-
local mode = payload.mode
|
|
37
|
-
if mode ~= "play" and mode ~= "run" then
|
|
38
|
-
error(`Unknown playtest mode: {tostring(mode)}`)
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
local code = payload.script
|
|
42
|
-
local runnerSource = payload.runnerSource
|
|
43
|
-
local timeoutSec = payload.timeoutSec
|
|
44
|
-
if type(code) ~= "string" or type(runnerSource) ~= "string" or type(timeoutSec) ~= "number" then
|
|
45
|
-
error("Missing script, runnerSource or timeoutSec in runPlaytestScript request")
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
local compileErr = RunPlaytestScriptAction._getCompileError(router, code)
|
|
49
|
-
if compileErr then
|
|
50
|
-
return { success = false, error = compileErr, code = "SCRIPT_LOAD_ERROR", output = {} }
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
if not sendMessage then
|
|
54
|
-
error("Running a playtest script requires a sendMessage callback")
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
task.spawn(function()
|
|
58
|
-
local result = RunPlaytestScriptAction._runAsync(mode, code, runnerSource, timeoutSec, payload.args)
|
|
59
|
-
sendMessage({
|
|
60
|
-
type = "scriptComplete",
|
|
61
|
-
sessionId = sessionId,
|
|
62
|
-
requestId = if requestId ~= "" then requestId else nil,
|
|
63
|
-
payload = result,
|
|
64
|
-
})
|
|
65
|
-
end)
|
|
66
|
-
|
|
67
|
-
-- Replied through sendMessage, so the router must not reply as well
|
|
68
|
-
return nil
|
|
69
|
-
end
|
|
70
|
-
)
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
--[[
|
|
74
|
-
Returns why the code does not compile, or nil when it does. Routers from
|
|
75
|
-
older plugins have no Compile, and the edit DataModel always has loadstring.
|
|
76
|
-
]]
|
|
77
|
-
function RunPlaytestScriptAction._getCompileError(router: any, code: string): string?
|
|
78
|
-
local fn, compileErr
|
|
79
|
-
if type(router.Compile) == "function" then
|
|
80
|
-
fn, compileErr = router:Compile(code)
|
|
81
|
-
else
|
|
82
|
-
fn, compileErr = (loadstring :: any)(code)
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
if fn then
|
|
86
|
-
return nil
|
|
87
|
-
end
|
|
88
|
-
return if compileErr then tostring(compileErr) else "Failed to compile script"
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
function RunPlaytestScriptAction._runAsync(
|
|
92
|
-
mode: string,
|
|
93
|
-
code: string,
|
|
94
|
-
runnerSource: string,
|
|
95
|
-
timeoutSec: number,
|
|
96
|
-
args: { string }?
|
|
97
|
-
): { [string]: any }
|
|
98
|
-
local runnerId = game:GetService("HttpService"):GenerateGUID(false)
|
|
99
|
-
|
|
100
|
-
local runner = Instance.new("Script")
|
|
101
|
-
runner.Name = "StudioBridgePlaytestRunner"
|
|
102
|
-
runner.Source = runnerSource
|
|
103
|
-
runner:SetAttribute("RunnerId", runnerId)
|
|
104
|
-
|
|
105
|
-
local codeModule = Instance.new("ModuleScript")
|
|
106
|
-
codeModule.Name = "Code"
|
|
107
|
-
-- Wrapping on the first line keeps a top-level `return` legal and line numbers unchanged
|
|
108
|
-
codeModule.Source = `return function(...) {code}\nend`
|
|
109
|
-
codeModule.Parent = runner
|
|
110
|
-
|
|
111
|
-
runner.Parent = game:GetService("ServerScriptService")
|
|
112
|
-
|
|
113
|
-
local ok, result = pcall(function()
|
|
114
|
-
local studioTestService = game:GetService("StudioTestService") :: any
|
|
115
|
-
local testArgs = {
|
|
116
|
-
studioBridgeRunnerId = runnerId,
|
|
117
|
-
studioBridgeTimeoutSec = timeoutSec,
|
|
118
|
-
studioBridgeScriptArgs = args,
|
|
119
|
-
studioBridgeWaitForPlayer = mode == "play",
|
|
120
|
-
}
|
|
121
|
-
if mode == "play" then
|
|
122
|
-
return studioTestService:ExecutePlayModeAsync(testArgs)
|
|
123
|
-
else
|
|
124
|
-
return studioTestService:ExecuteRunModeAsync(testArgs)
|
|
125
|
-
end
|
|
126
|
-
end)
|
|
127
|
-
|
|
128
|
-
runner:Destroy()
|
|
129
|
-
|
|
130
|
-
if not ok then
|
|
131
|
-
return { success = false, error = `Playtest failed to start: {result}`, output = {} }
|
|
132
|
-
end
|
|
133
|
-
if type(result) ~= "table" then
|
|
134
|
-
return { success = false, error = "Playtest was stopped before the script finished", output = {} }
|
|
135
|
-
end
|
|
136
|
-
return result
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
return RunPlaytestScriptAction
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
--!strict
|
|
2
|
-
--[[
|
|
3
|
-
@class run-playtest-script.spec.lua
|
|
4
|
-
]]
|
|
5
|
-
|
|
6
|
-
local require = require(script.Parent.loader).load(script)
|
|
7
|
-
|
|
8
|
-
local ActionRouter = require("ActionRouter")
|
|
9
|
-
local Jest = require("Jest")
|
|
10
|
-
local RunPlaytestScriptAction = require("run-playtest-script")
|
|
11
|
-
|
|
12
|
-
local describe = Jest.Globals.describe
|
|
13
|
-
local expect = Jest.Globals.expect
|
|
14
|
-
local it = Jest.Globals.it
|
|
15
|
-
|
|
16
|
-
local function dispatch(payload: { [string]: any }): any
|
|
17
|
-
local router = ActionRouter.new()
|
|
18
|
-
RunPlaytestScriptAction.register(router, function() end)
|
|
19
|
-
|
|
20
|
-
return router:Dispatch({
|
|
21
|
-
type = "runPlaytestScript",
|
|
22
|
-
sessionId = "session-1",
|
|
23
|
-
requestId = "req-1",
|
|
24
|
-
payload = payload,
|
|
25
|
-
})
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
describe("runPlaytestScript", function()
|
|
29
|
-
it("should fail a script that does not compile without starting a playtest", function()
|
|
30
|
-
local response = dispatch({ mode = "run", script = "local x = = 1", runnerSource = "", timeoutSec = 10 })
|
|
31
|
-
|
|
32
|
-
expect(response.type).toEqual("scriptComplete")
|
|
33
|
-
expect(response.payload.success).toEqual(false)
|
|
34
|
-
expect(response.payload.code).toEqual("SCRIPT_LOAD_ERROR")
|
|
35
|
-
end)
|
|
36
|
-
|
|
37
|
-
it("should reject an unknown mode", function()
|
|
38
|
-
local response = dispatch({ mode = "nope", script = "return 1", runnerSource = "", timeoutSec = 10 })
|
|
39
|
-
|
|
40
|
-
expect(response.type).toEqual("error")
|
|
41
|
-
expect(response.payload.message).toEqual(expect.stringContaining("Unknown playtest mode"))
|
|
42
|
-
end)
|
|
43
|
-
end)
|