jest-roblox-assassin 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 evil bocchi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # jest-roblox assassin
2
+
3
+ jestrbx is a CLI tool for running Jest-style tests against Roblox places, wrapping the Roblox Jest runtime and rewriting results for local source paths. It is designed to integrate with roblox-ts and Rojo workflows, providing a familiar Jest experience for Roblox game development.
4
+
5
+ ## Features
6
+ - Runs Jest tests inside Roblox places using the JestCore runtime
7
+ - Maps Roblox datamodel paths back to local workspace files for readable output
8
+ - Supports custom and built-in Jest reporters
9
+ - CLI options are dynamically pulled from Roblox Jest docs
10
+ - Integrates with roblox-ts, Rojo, and standard TypeScript workflows
11
+ - Handles source mapping for .ts, .tsx, .lua, and .luau files
12
+ - Filters tests by name or path
13
+ - Supports parallel execution through `--maxWorkers`
14
+
15
+ ## Getting Started
16
+
17
+ ### Prerequisites
18
+ - Node.js (v16+ recommended)
19
+ - roblox-ts and Rojo (for TypeScript workflows)
20
+
21
+ ### Installation
22
+ Clone this repository and install dependencies:
23
+
24
+ ```sh
25
+ npm install
26
+ ```
27
+
28
+ ### Usage
29
+ Run tests against a Roblox place file:
30
+
31
+ ```sh
32
+ npx jestrbx --place path/to/place.rbxl
33
+ ```
34
+
35
+ #### Common CLI Options
36
+ - `--place <file>`: Path to the Roblox place file (required)
37
+ - `--project <dir>`: Path to the Rojo project file (optional)
38
+ - `--config <file>`: Path to a Jest config file. This is usually used to specify reporter options (optional)
39
+ - `--testNamePattern <pattern>`: Filter tests by name
40
+ - `--reporters <reporter>`: Use custom or built-in reporters
41
+ - `--maxWorkers <num>`: Number of worker threads to use for parallel test execution
42
+
43
+ For a full list of options, run:
44
+
45
+ ```sh
46
+ npx jestrbx --help
47
+ ```
48
+
49
+ ### Example Project
50
+ See the `demo/` directory for a sample roblox-ts project with Jest specs:
51
+ - `demo/src/jest.config.ts`: Jest config
52
+ - `demo/src/setup.luau`: Setup script
53
+ - `demo/src/__tests__/`: Test specs
54
+
55
+ Build and test with:
56
+
57
+ ```sh
58
+ cd demo
59
+ npm run build # Builds with roblox-ts and Rojo
60
+ npm test # Runs tests with jest-roblox-assassin
61
+ ```
62
+
63
+ ## License
64
+ MIT
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "jest-roblox-assassin",
3
+ "version": "1.0.0",
4
+ "description": "Delightful Roblox testing.",
5
+ "license": "MIT",
6
+ "author": "evilbocchi",
7
+ "type": "module",
8
+ "main": "src/index.js",
9
+ "bin": {
10
+ "jestrbx": "src/cli.js"
11
+ },
12
+ "repository": {
13
+ "url": "https://github.com/Unreal-Works/jest-roblox-assassin.git",
14
+ "type": "git"
15
+ },
16
+ "scripts": {
17
+ "test": "vitest run",
18
+ "test:watch": "vitest",
19
+ "test:ui": "vitest --ui",
20
+ "test:coverage": "vitest run --coverage",
21
+ "demo": "cd demo && npm run test"
22
+ },
23
+ "dependencies": {
24
+ "@jest/reporters": "^30.2.0",
25
+ "chalk": "^5.6.2",
26
+ "commander": "^14.0.2",
27
+ "rbxluau": "^1.7.0"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "^25.0.3",
31
+ "@vitest/coverage-v8": "^4.0.16",
32
+ "@vitest/ui": "^4.0.16",
33
+ "dotenv": "^17.2.3",
34
+ "vitest": "^4.0.16"
35
+ }
36
+ }
package/src/cache.js ADDED
@@ -0,0 +1,19 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { fileURLToPath } from "url";
4
+
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = path.dirname(__filename);
7
+
8
+ /**
9
+ * Ensures that the .cache directory exists with a .gitignore file.
10
+ * @returns {string} The path to the .cache directory.
11
+ */
12
+ export function ensureCache() {
13
+ const CACHE_FOLDER_PATH = path.join(__dirname, "..", ".cache");
14
+ if (!fs.existsSync(CACHE_FOLDER_PATH)) {
15
+ fs.mkdirSync(CACHE_FOLDER_PATH, { recursive: true });
16
+ fs.writeFileSync(path.join(CACHE_FOLDER_PATH, ".gitignore"), `*`);
17
+ }
18
+ return CACHE_FOLDER_PATH;
19
+ }