@isentinel/jest-roblox 0.1.0 → 0.1.1
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 +39 -83
- package/dist/cli.mjs +1 -1
- package/dist/sea/jest-roblox +0 -0
- package/dist/sea-entry.cjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">jest-roblox-cli</h1>
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://www.npmx.dev/package/@isentinel/jest-roblox"><img src="https://img.shields.io/npm/v/@isentinel/jest-roblox" alt="npm version"></a>
|
|
5
|
+
<a href="https://github.com/christopher-buss/jest-roblox-cli/actions/workflows/ci.yaml"><img src="https://github.com/christopher-buss/jest-roblox-cli/actions/workflows/ci.yaml/badge.svg" alt="CI"></a>
|
|
6
|
+
<a href="https://github.com/christopher-buss/jest-roblox-cli/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT"></a>
|
|
7
|
+
</p>
|
|
6
8
|
|
|
7
9
|
|
|
8
|
-
Run your
|
|
9
|
-
terminal.
|
|
10
|
+
Run your roblox-ts and Luau tests inside Roblox, get results in your terminal.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## Why?
|
|
16
|
-
|
|
17
|
-
Roblox code can only run inside the Roblox engine. Standard test runners
|
|
18
|
-
can't access the Roblox API. This tool bridges that gap by running tests in a
|
|
19
|
-
real Roblox session and piping results back to your terminal.
|
|
12
|
+
<p align="center">
|
|
13
|
+
<img src="assets/cli-example.png" alt="jest-roblox-cli output" width="700">
|
|
14
|
+
</p>
|
|
20
15
|
|
|
21
16
|
- roblox-ts and pure Luau
|
|
22
17
|
- Source-mapped errors (Luau line numbers back to `.ts` files)
|
|
23
|
-
- Code coverage
|
|
18
|
+
- Code coverage (via [Lute](https://github.com/luau-lang/lute) instrumentation)
|
|
24
19
|
- Two backends: Open Cloud (remote) and Studio (local)
|
|
20
|
+
- Multiple output formatters (human, agent, JSON, GitHub Actions)
|
|
21
|
+
|
|
22
|
+
> [!NOTE]
|
|
23
|
+
> roblox-ts projects currently require
|
|
24
|
+
> [@isentinel/roblox-ts](https://npmx.dev/package/@isentinel/roblox-ts) for
|
|
25
|
+
> source maps and coverage support.
|
|
25
26
|
|
|
26
27
|
## Install
|
|
27
28
|
|
|
@@ -41,7 +42,7 @@ rokit add christopher-buss/jest-roblox-cli
|
|
|
41
42
|
|
|
42
43
|
```
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
Limitations vs the npm package:
|
|
45
46
|
|
|
46
47
|
- `--typecheck` and `--typecheckOnly` are not available
|
|
47
48
|
- `.ts` config files are not supported (use `.json`, `.js`, or `.mjs`)
|
|
@@ -82,6 +83,7 @@ jest-roblox -t "should spawn"
|
|
|
82
83
|
|
|
83
84
|
# Filter by file path
|
|
84
85
|
jest-roblox --testPathPattern player
|
|
86
|
+
jest-roblox --testPathPattern="modifiers|define\\.spec|triggers"
|
|
85
87
|
|
|
86
88
|
# Use a specific backend
|
|
87
89
|
jest-roblox --backend studio
|
|
@@ -90,12 +92,6 @@ jest-roblox --backend open-cloud
|
|
|
90
92
|
# Collect coverage
|
|
91
93
|
jest-roblox --coverage
|
|
92
94
|
|
|
93
|
-
# Output JSON results
|
|
94
|
-
jest-roblox --formatters json --outputFile results.json
|
|
95
|
-
|
|
96
|
-
# Short output for AI tools
|
|
97
|
-
jest-roblox --formatters agent
|
|
98
|
-
|
|
99
95
|
# Save game output (print/warn/error) to file
|
|
100
96
|
jest-roblox --gameOutput game-logs.txt
|
|
101
97
|
|
|
@@ -145,7 +141,7 @@ Precedence: CLI flags > config file > extended config > defaults.
|
|
|
145
141
|
### Coverage fields
|
|
146
142
|
|
|
147
143
|
> [!IMPORTANT]
|
|
148
|
-
> Coverage requires [Lute](https://github.com/
|
|
144
|
+
> Coverage requires [Lute](https://github.com/luau-lang/lute) to be installed and
|
|
149
145
|
> on your `PATH`. Lute parses Luau ASTs so the CLI can insert coverage probes.
|
|
150
146
|
|
|
151
147
|
| Field | What it does | Default |
|
|
@@ -171,29 +167,23 @@ export default defineConfig({
|
|
|
171
167
|
projects: [
|
|
172
168
|
{
|
|
173
169
|
test: defineProject({
|
|
174
|
-
displayName: { name: "
|
|
175
|
-
include: ["
|
|
170
|
+
displayName: { name: "client", color: "magenta" },
|
|
171
|
+
include: ["**/*.spec.ts"],
|
|
176
172
|
mockDataModel: true,
|
|
177
|
-
outDir: "out
|
|
173
|
+
outDir: "out/src/client",
|
|
178
174
|
}),
|
|
179
175
|
},
|
|
180
176
|
{
|
|
181
177
|
test: defineProject({
|
|
182
|
-
displayName: { name: "
|
|
183
|
-
include: ["
|
|
184
|
-
|
|
185
|
-
outDir: "out-test/test",
|
|
178
|
+
displayName: { name: "server", color: "white" },
|
|
179
|
+
include: ["**/*.spec.ts"],
|
|
180
|
+
outDir: "out/src/server",
|
|
186
181
|
}),
|
|
187
182
|
},
|
|
188
183
|
],
|
|
189
184
|
});
|
|
190
185
|
```
|
|
191
186
|
|
|
192
|
-
Available per-project fields: `displayName`, `include`, `exclude`, `testMatch`,
|
|
193
|
-
`testRegex`, `testPathIgnorePatterns`, `setupFiles`, `setupFilesAfterEnv`,
|
|
194
|
-
`testTimeout`, `slowTestThreshold`, `testEnvironment`, `snapshotFormat`,
|
|
195
|
-
`outDir`, `root`, and the Jest mock flags (`clearMocks`, `resetMocks`, etc.).
|
|
196
|
-
|
|
197
187
|
### Full example
|
|
198
188
|
|
|
199
189
|
```typescript
|
|
@@ -233,7 +223,18 @@ You need these environment variables:
|
|
|
233
223
|
### Studio (local)
|
|
234
224
|
|
|
235
225
|
Connects to Roblox Studio over WebSocket. Faster than Open Cloud (no upload
|
|
236
|
-
step), but Studio must be open with the plugin running.
|
|
226
|
+
step), but Studio must be open with the plugin running. Studio doesn't expose which place is open, so
|
|
227
|
+
multiple concurrent projects aren't supported yet.
|
|
228
|
+
|
|
229
|
+
Install the plugin with [Drillbit](https://github.com/jacktabscode/drillbit):
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
drillbit install christopher-buss/jest-roblox-cli
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Or download `JestRobloxRunner.rbxm` from the
|
|
236
|
+
[latest release](https://github.com/christopher-buss/jest-roblox-cli/releases)
|
|
237
|
+
and drop it into your Studio plugins folder.
|
|
237
238
|
|
|
238
239
|
## CLI flags
|
|
239
240
|
|
|
@@ -290,54 +291,9 @@ Default `testMatch` patterns (configurable):
|
|
|
290
291
|
- Luau: `*.spec.lua`, `*.test.lua`, `*.spec.luau`, `*.test.luau`
|
|
291
292
|
- Type tests: `*.spec-d.ts`, `*.test-d.ts`
|
|
292
293
|
|
|
293
|
-
## Project structure
|
|
294
|
-
|
|
295
|
-
```text
|
|
296
|
-
jest-roblox-cli/
|
|
297
|
-
├── bin/ CLI entry point
|
|
298
|
-
├── src/
|
|
299
|
-
│ ├── backends/ Open Cloud and Studio backends
|
|
300
|
-
│ ├── config/ Config loading and validation
|
|
301
|
-
│ ├── coverage/ Coverage instrumentation pipeline
|
|
302
|
-
│ ├── formatters/ Output formatters (default, agent, JSON, GitHub Actions)
|
|
303
|
-
│ ├── highlighter/ Luau syntax highlighting
|
|
304
|
-
│ ├── reporter/ Result parsing and validation
|
|
305
|
-
│ ├── source-mapper/ Luau-to-TypeScript error mapping
|
|
306
|
-
│ ├── snapshot/ Snapshot file handling
|
|
307
|
-
│ ├── typecheck/ Type test runner
|
|
308
|
-
│ ├── types/ Shared type definitions
|
|
309
|
-
│ └── utils/ Helpers (glob, hash, cache, paths)
|
|
310
|
-
├── luau/ Luau code that runs inside Roblox
|
|
311
|
-
├── plugin/ Roblox Studio WebSocket plugin
|
|
312
|
-
└── test/ Test fixtures and mocks
|
|
313
|
-
```
|
|
314
|
-
|
|
315
294
|
## Contributing
|
|
316
295
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
```bash
|
|
320
|
-
pnpm build # Full build
|
|
321
|
-
pnpm watch # Watch mode
|
|
322
|
-
pnpm typecheck # Check types
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
### Test
|
|
326
|
-
|
|
327
|
-
```bash
|
|
328
|
-
vitest run # All tests
|
|
329
|
-
vitest run src/formatters # One folder
|
|
330
|
-
vitest run src/cli.spec.ts # One file
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
### Lint
|
|
334
|
-
|
|
335
|
-
```bash
|
|
336
|
-
eslint .
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
> [!IMPORTANT]
|
|
340
|
-
> 100% test coverage is enforced. Write tests first. Every PR must maintain full coverage.
|
|
296
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
341
297
|
|
|
342
298
|
## License
|
|
343
299
|
|
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.1.
|
|
26
|
+
var version = "0.1.1";
|
|
27
27
|
//#endregion
|
|
28
28
|
//#region src/backends/auto.ts
|
|
29
29
|
var StudioWithFallback = class {
|
package/dist/sea/jest-roblox
CHANGED
|
Binary file
|
package/dist/sea-entry.cjs
CHANGED
|
@@ -7640,7 +7640,7 @@ function f$9() {
|
|
|
7640
7640
|
var C$5 = f$9();
|
|
7641
7641
|
//#endregion
|
|
7642
7642
|
//#region package.json
|
|
7643
|
-
var version = "0.1.
|
|
7643
|
+
var version = "0.1.1";
|
|
7644
7644
|
//#endregion
|
|
7645
7645
|
//#region node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/stream.js
|
|
7646
7646
|
var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|