@isentinel/jest-roblox 0.2.3 → 0.2.4

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/README.md CHANGED
@@ -227,6 +227,11 @@ Connects to Roblox Studio over WebSocket. Faster than Open Cloud (no upload
227
227
  step), but Studio must be open with the plugin running. Studio doesn't expose which place is open, so
228
228
  multiple concurrent projects aren't supported yet.
229
229
 
230
+ > [!NOTE]
231
+ > For `--coverage`, prefer `--backend open-cloud` since the coverage output is
232
+ > built to a separate output under `.jest-roblox-coverage/` that is likely not
233
+ > the studio place being served.
234
+
230
235
  Install the plugin with [Drillbit](https://github.com/jacktabscode/drillbit):
231
236
 
232
237
  #### Configuration file
@@ -235,7 +240,7 @@ Create a file named drillbit.toml in your project's directory.
235
240
 
236
241
  ```toml
237
242
  [plugins.jest_roblox]
238
- github = "https://github.com/christopher-buss/jest-roblox-cli/releases/download/v0.2.1/JestRobloxRunner.rbxm"
243
+ github = "https://github.com/christopher-buss/jest-roblox-cli/releases/download/v0.2.4/JestRobloxRunner.rbxm"
239
244
  ```
240
245
 
241
246
  Then run `drillbit` and it will download the plugin and install it in Studio for you.
package/dist/cli.mjs CHANGED
@@ -23,7 +23,7 @@ import istanbulCoverage from "istanbul-lib-coverage";
23
23
  import istanbulReport from "istanbul-lib-report";
24
24
  import istanbulReports from "istanbul-reports";
25
25
  //#region package.json
26
- var version = "0.2.3";
26
+ var version = "0.2.4";
27
27
  //#endregion
28
28
  //#region src/backends/auto.ts
29
29
  var StudioWithFallback = class {
Binary file
@@ -7633,7 +7633,7 @@ function C$5({ force: e } = {}) {
7633
7633
  var y$4 = C$5();
7634
7634
  //#endregion
7635
7635
  //#region package.json
7636
- var version = "0.2.3";
7636
+ var version = "0.2.4";
7637
7637
  //#endregion
7638
7638
  //#region node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/constants.js
7639
7639
  var require_constants$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isentinel/jest-roblox",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Jest-compatible CLI for running roblox-ts tests via Roblox Open Cloud",
5
5
  "keywords": [
6
6
  "jest",
@@ -87,8 +87,8 @@
87
87
  "typescript": "5.9.3",
88
88
  "vitest": "4.1.2",
89
89
  "@isentinel/luau-ast": "0.1.0",
90
- "@isentinel/roblox-runner": "0.1.0",
91
- "@isentinel/rojo-utils": "0.1.0"
90
+ "@isentinel/rojo-utils": "0.1.0",
91
+ "@isentinel/roblox-runner": "0.1.0"
92
92
  },
93
93
  "engines": {
94
94
  "node": ">=24.10.0"
Binary file
@@ -7,6 +7,18 @@ if not RunService:IsRunning() then
7
7
  return
8
8
  end
9
9
 
10
+ local function endWithError(err: string): ()
11
+ local ok, endErr = pcall(function()
12
+ StudioTestService:EndTest({
13
+ jestOutput = HttpService:JSONEncode({ success = false, err = err }),
14
+ gameOutput = "[]",
15
+ })
16
+ end)
17
+ if not ok then
18
+ warn("[jest-roblox] EndTest failed: " .. tostring(endErr))
19
+ end
20
+ end
21
+
10
22
  local testArgs = StudioTestService:GetTestArgs()
11
23
  if testArgs == nil then
12
24
  for _ = 1, 50 do
@@ -18,29 +30,43 @@ if testArgs == nil then
18
30
  end
19
31
  end
20
32
 
21
- if testArgs == nil or testArgs.configs == nil then
33
+ if testArgs == nil then
34
+ endWithError("StudioTestService:GetTestArgs() returned nil after 50 polls (5s)")
35
+ return
36
+ end
37
+
38
+ if testArgs.config == nil or testArgs.config.configs == nil then
39
+ local keysOk, keys = pcall(HttpService.JSONEncode, HttpService, testArgs)
40
+ endWithError(
41
+ "testArgs.config.configs is nil. Keys: " .. (if keysOk then keys else "<unencodable>")
42
+ )
22
43
  return
23
44
  end
24
45
 
46
+ local configs = testArgs.config.configs
47
+
25
48
  local loadStringEnabled = pcall(function()
26
49
  loadstring("return true")
27
50
  end)
28
51
 
29
52
  if not loadStringEnabled then
30
- StudioTestService:EndTest({
31
- jestOutput = HttpService:JSONEncode({
32
- success = false,
33
- err = "LoadString must be enabled in ServerScriptService to run tests",
34
- }),
35
- gameOutput = "[]",
36
- })
53
+ endWithError("LoadString must be enabled in ServerScriptService to run tests")
54
+ return
55
+ end
56
+
57
+ local requireOk, Runner = pcall(require, script.Parent.shared.runner)
58
+ if not requireOk then
59
+ endWithError("Failed to require shared.runner: " .. tostring(Runner))
37
60
  return
38
61
  end
39
62
 
40
- local Runner = require(script.Parent.shared.runner)
41
- local entries = Runner.runProjects(script, testArgs.configs)
63
+ local runOk, entriesOrErr = pcall(Runner.runProjects, script, configs)
64
+ if not runOk then
65
+ endWithError("Runner.runProjects threw: " .. tostring(entriesOrErr))
66
+ return
67
+ end
42
68
 
43
69
  StudioTestService:EndTest({
44
- jestOutput = HttpService:JSONEncode({ entries = entries }),
70
+ jestOutput = HttpService:JSONEncode({ entries = entriesOrErr }),
45
71
  gameOutput = "[]",
46
72
  })