blaze-performance-tester 1.0.7 → 1.0.8

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.
Files changed (3) hide show
  1. package/dist/cli.js +33 -70
  2. package/package.json +1 -1
  3. package/readme +27 -29
package/dist/cli.js CHANGED
@@ -1,74 +1,37 @@
1
1
  #!/usr/bin/env node
2
-
3
- // index.js
4
- import { createRequire } from "module";
5
- var require2 = createRequire(import.meta.url);
6
- var nativeBinding = require2("./blaze.win32-x64-msvc.node");
7
- var runBlazeCore = nativeBinding.runBlazeCore;
2
+ #!/usr/bin/env node
8
3
 
9
4
  // cli.ts
10
- import * as esbuild from "esbuild";
11
- import * as path from "node:path";
12
- async function main() {
13
- const args = process.argv.slice(2);
14
- if (args.length < 3) {
15
- console.log("\u274C Missing arguments! Usage: npx tsx cli.ts <script> <vus> <seconds>");
16
- process.exit(1);
17
- }
18
- const targetScript = path.resolve(process.cwd(), args[0]);
19
- const bundled = await esbuild.build({
20
- entryPoints: [targetScript],
21
- bundle: true,
22
- format: "iife",
23
- write: false,
24
- target: "es2020"
25
- });
26
- console.log(`\u{1F525} [Blaze] Injecting load tests using Blaze metrics aggregation engine...`);
27
- const metrics = runBlazeCore(
28
- bundled.outputFiles[0].text,
29
- parseInt(args[1], 10),
30
- parseInt(args[2], 10)
31
- );
32
- const samples = metrics.allRequests;
33
- const totalRequests = samples.length;
34
- if (totalRequests === 0) {
35
- console.log("\u26A0\uFE0F No requests were completed successfully.");
36
- return;
37
- }
38
- const latencies = samples.map((s) => s.latencyMs).sort((a, b) => a - b);
39
- const totalErrors = samples.filter((s) => !s.isSuccess).length;
40
- const sum = latencies.reduce((acc, v) => acc + v, 0);
41
- const avg = sum / totalRequests;
42
- const min = latencies[0];
43
- const max = latencies[latencies.length - 1];
44
- const getPercentile = (p) => {
45
- const index = Math.ceil(p / 100 * latencies.length) - 1;
46
- return latencies[Math.max(0, index)];
47
- };
48
- const p50 = getPercentile(50);
49
- const p90 = getPercentile(90);
50
- const p95 = getPercentile(95);
51
- const p99 = getPercentile(99);
52
- const realSec = metrics.totalDurationMs / 1e3;
53
- const throughput = totalRequests / realSec;
54
- const errorRate = totalErrors / totalRequests * 100;
55
- console.log("\n\u{1F4CA} ==================== Blaze Performance Report ====================");
56
- console.log(` Target Script: ${args[0]}`);
57
- console.log(` Active VUs: ${args[1]} parallel threads`);
58
- console.log(` Elapsed Time: ${realSec.toFixed(2)} seconds`);
59
- console.log("-----------------------------------------------------------------------------");
60
- console.log(` Samples (Requests): ${totalRequests}`);
61
- console.log(` Throughput Rate: ${throughput.toFixed(2)} req/sec`);
62
- console.log(` Error Rate: ${errorRate.toFixed(2)}% (${totalErrors} failed)`);
63
- console.log("-----------------------------------------------------------------------------");
64
- console.log("\u{1F4C8} Latency Statistics (ms):");
65
- console.log(` \u2514\u2500\u2500 Minimum: ${min.toFixed(2)} ms`);
66
- console.log(` \u2514\u2500\u2500 Average: ${avg.toFixed(2)} ms`);
67
- console.log(` \u2514\u2500\u2500 Median (50%): ${p50.toFixed(2)} ms`);
68
- console.log(` \u2514\u2500\u2500 90th %ile: ${p90.toFixed(2)} ms`);
69
- console.log(` \u2514\u2500\u2500 95th %ile: ${p95.toFixed(2)} ms`);
70
- console.log(` \u2514\u2500\u2500 99th %ile: ${p99.toFixed(2)} ms`);
71
- console.log(` \u2514\u2500\u2500 Maximum: ${max.toFixed(2)} ms`);
72
- console.log("=============================================================================\n");
5
+ import fs from "node:fs";
6
+ import path from "node:path";
7
+ import { createRequire } from "node:module";
8
+ var require2 = createRequire(import.meta.url);
9
+ var nativeBinding = require2("./index.js");
10
+ var args = process.argv.slice(2);
11
+ if (args.length < 3) {
12
+ console.error("\x1B[31m\u274C Missing arguments!\x1B[0m");
13
+ console.error("Usage: \x1B[36mnpx blaze-performance-tester <script-path> <vus> <duration-seconds>\x1B[0m");
14
+ process.exit(1);
15
+ }
16
+ var targetScript = args[0];
17
+ var vusCount = parseInt(args[1], 10);
18
+ var durationSeconds = parseInt(args[2], 10);
19
+ var targetScriptPath = path.resolve(process.cwd(), targetScript);
20
+ if (!fs.existsSync(targetScriptPath)) {
21
+ console.error(`\x1B[31m\u274C Target workload script not found at:\x1B[0m ${targetScriptPath}`);
22
+ process.exit(1);
23
+ }
24
+ var currentWorkingDirectory = process.cwd();
25
+ var resultsFolder = path.join(currentWorkingDirectory, "results");
26
+ if (!fs.existsSync(resultsFolder)) {
27
+ fs.mkdirSync(resultsFolder, { recursive: true });
28
+ }
29
+ var csvOutputPath = path.join(resultsFolder, "summary_report.csv");
30
+ console.log(`\x1B[35m\u{1F525} Blaze Performance Tester Initialized... \x1B[0m`);
31
+ console.log(`\u26A1 Spawning \x1B[32m${vusCount}\x1B[0m Virtual Users for \x1B[32m${durationSeconds}s\x1B[0m against scenario script.`);
32
+ try {
33
+ nativeBinding.runBlazeCore(targetScriptPath, vusCount, durationSeconds, csvOutputPath);
34
+ } catch (error) {
35
+ console.error("\x1B[31m\u{1F4A5} Critical Native Core Execution Error:\x1B[0m", error);
36
+ process.exit(1);
73
37
  }
74
- main().catch(console.error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blaze-performance-tester",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "A high-performance, multi-threaded load testing engine built with Rust and QuickJS.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/readme CHANGED
@@ -1,3 +1,4 @@
1
+ Markdown
1
2
  # 🔥 Blaze Performance Tester
2
3
 
3
4
  Blaze is an ultra-high-performance, multi-threaded load testing framework built with **Rust** and **QuickJS** (via `rquickjs`). It provides parallel virtual user execution by isolating JavaScript evaluation environments into dedicated native OS threads, delivering raw network speed and JMeter-style telemetry metrics with minimal footprint.
@@ -10,7 +11,7 @@ Blaze is an ultra-high-performance, multi-threaded load testing framework built
10
11
  * **Native HTTP Execution Sockets:** Exposes a global `http_get()` binding inside JavaScript that routes network calls directly through Rust's high-speed `reqwest` stack.
11
12
  * **JMeter-Style Telemetry Aggregation:** Computes live data snapshots including throughput rates, error tallies, and crucial latency percentiles ($p50$, $p90$, $p95$, $p99$).
12
13
  * **Real-Time Terminal Progress Updates:** Keeps you updated via a live terminal countdown ticker while heavy parallel workloads run.
13
- * **CSV Result Archiver:** Automatically records every workload run into structured `.csv` reports inside the `results/` folder for data charting.
14
+ * **Zero-Configuration CSV Archiver:** Automatically records data into structured `.csv` reports inside a `results/` folder created dynamically wherever you invoke the command.
14
15
 
15
16
  ---
16
17
 
@@ -19,17 +20,17 @@ Blaze is an ultra-high-performance, multi-threaded load testing framework built
19
20
  ```text
20
21
  blaze-performance-tester/
21
22
  ├── dist/ # Compiled Distribution Assets
22
- │ ├── cli.js # Bundled CLI Wrapper Script
23
+ │ ├── cli.js # Bundled CLI Core
23
24
  │ ├── index.js # Generated Native NAPI-RS Bridges
24
- └── index.d.ts # TypeScript Type Structure Mappings
25
- ├── results/ # Aggregated Report Output Artifacts
26
- │ └── summary_report.csv # JMeter-style CSV performance dump
25
+ ├── index.d.ts # TypeScript Type Structure Mappings
26
+ │ └── blaze.*.node # Compiled Native Rust Binary
27
27
  ├── src/
28
28
  │ └── lib.rs # Multi-Threaded Rust Concurrency Core
29
29
  ├── tests/ # Dedicated Folder for Performance Scripts
30
- │ └── demo-load-test.ts # Scenario Workload Script
30
+ │ └── test-script.ts # Scenario Workload Script
31
+ ├── bin.js # Anti-Hijack Executable Gateway for Windows WSH
31
32
  ├── cli.ts # CLI Orchestration & Metrics Wrapper
32
- ├── package.json # Node Dependency Pipeline
33
+ ├── package.json # Node Dependency & Build Script Pipeline
33
34
  └── Cargo.toml # Rust Native Compilation Flags
34
35
  📦 Compilation & Installation
35
36
  Prerequisites
@@ -43,25 +44,27 @@ Setup & Build
43
44
  Clone the repository, download dependencies, and compile the native binary distribution bundle:
44
45
 
45
46
  Bash
46
- # Install node dependencies
47
+ # Install package dependencies
47
48
  npm install
48
49
 
49
- # Compile the native Rust modules and bundle the TypeScript CLI wrapper
50
+ # Compile the native Rust modules, copy binaries, and bundle the ESM CLI wrapper
50
51
  npm run build
51
52
  🏃 Run Performance Workloads
52
- To run a performance test script, call the core execution runner by passing your target test file, the number of parallel virtual users (VUs), and the test duration in seconds:
53
+ Blaze can be executed globally from any terminal folder via npx without needing global system mutations.
53
54
 
54
- Bash
55
- # Usage: npx tsx cli.ts <script-path> <vus> <duration-seconds>
56
- npx tsx cli.ts tests/demo-load-test.ts 10 5
57
- Writing a Workload Script (tests/demo-load-test.ts)
58
- Your scripts have access to the injected, native http_get global socket binding:
55
+ To run a test, navigate to your target project folder, create your script file, and call the runner passing the script path, the number of concurrent Virtual Users (VUs), and the test duration in seconds:
56
+
57
+ DOS
58
+ # Usage: npx blaze-performance-tester <script-path> <vus> <duration-seconds>
59
+ npx blaze-performance-tester tests/test-script.ts 10 5
60
+ Writing a Workload Script (tests/test-script.ts)
61
+ Your script workloads have instant access to the injected high-speed global native socket binding:
59
62
 
60
63
  TypeScript
61
64
  // Call the high-speed native network layer directly
62
65
  const status = http_get("[https://jsonplaceholder.typicode.com/posts/1](https://jsonplaceholder.typicode.com/posts/1)");
63
66
 
64
- // The engine automatically registers response times and error states!
67
+ // The native Rust engine automatically handles response times and error states!
65
68
  📊 Sample Performance Output Report
66
69
  When your test finishes running, Blaze renders a clean telemetry report right in your terminal and saves a copy to disk:
67
70
 
@@ -81,17 +84,12 @@ Plaintext
81
84
  └── Maximum: 12.40 ms
82
85
  =============================================================================
83
86
  💾 Aggregated metrics saved to: .\results\summary_report.csv
84
- 🧙 Interactive Scaffolding Wizard (create-blaze-tester)
85
- We provide a companion initializer utility to quickly set up new projects with an organized workspace folder structure.
86
-
87
- To execute the setup wizard out of an empty workspace directory, run:
88
-
89
- Bash
90
- npm init blaze-tester
91
- This interactive prompt automatically:
92
-
93
- Provisions a dedicated tests/ directory.
87
+ 📂 Where are results stored?
88
+ Blaze captures execution contexts using process.cwd(). The moment a test run completes successfully, a new directory is instantly written inside the user's active terminal directory:
94
89
 
95
- Injects an example boilerplate script file (demo-load-test.ts).
96
-
97
- Appends test runner shortcut hooks directly into your local package.json.
90
+ Plaintext
91
+ your-active-directory/
92
+ ├── tests/
93
+ │ └── test-script.ts
94
+ └── results/ <-- Generated Automatically
95
+ └── summary_report.csv <-- Contains Raw Timestamp, Latency, Status, and Success Flags