blaze-performance-tester 1.1.12 → 1.1.15

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/dist/cli.js CHANGED
@@ -1,17 +1,10 @@
1
1
  // cli.ts
2
- import fs from "node:fs";
3
- import path from "node:path";
4
- import { fileURLToPath } from "node:url";
2
+ import path from "path";
3
+ import { fileURLToPath, pathToFileURL } from "url";
5
4
  var __filename = fileURLToPath(import.meta.url);
6
5
  var __dirname = path.dirname(__filename);
7
6
  var indexPath = path.resolve(__dirname, "../index.js");
8
- var nativeBinding;
9
- if (fs.existsSync(indexPath)) {
10
- nativeBinding = await import(`file://${indexPath}`);
11
- } else {
12
- console.error(`\x1B[31m\u274C Critical: Blaze entry module not found at ${indexPath}\x1B[0m`);
13
- process.exit(1);
14
- }
7
+ var { runBlazeCore } = await import(pathToFileURL(indexPath).href);
15
8
  var args = process.argv.slice(2);
16
9
  if (args.length < 3) {
17
10
  console.error("Usage: npx blaze-performance-tester <script-path> <vus> <duration-seconds>");
@@ -21,19 +14,12 @@ var targetScript = args[0];
21
14
  var vusCount = parseInt(args[1], 10);
22
15
  var durationSeconds = parseInt(args[2], 10);
23
16
  var targetScriptPath = path.resolve(process.cwd(), targetScript);
24
- if (!fs.existsSync(targetScriptPath)) {
25
- console.error(`\x1B[31m\u274C Target workload script not found at:\x1B[0m ${targetScriptPath}`);
26
- process.exit(1);
27
- }
28
- var resultsFolder = path.join(process.cwd(), "results");
29
- if (!fs.existsSync(resultsFolder)) {
30
- fs.mkdirSync(resultsFolder, { recursive: true });
31
- }
32
- var csvOutputPath = path.join(resultsFolder, "summary_report.csv");
33
- console.log(`\x1B[33m\u{1F525} [Blaze] Injecting load tests using Blaze metrics aggregation engine...\x1B[0m
17
+ var csvOutputPath = path.join(process.cwd(), "summary_report.csv");
18
+ console.log(`
19
+ \u{1F525} [Blaze] Injecting load tests using Blaze metrics aggregation engine...
34
20
  `);
35
21
  try {
36
- const metrics = nativeBinding.runBlazeCore(targetScriptPath, vusCount, durationSeconds, csvOutputPath);
22
+ const metrics = runBlazeCore(targetScriptPath, vusCount, durationSeconds, csvOutputPath);
37
23
  const actualDurationSec = (metrics.execution_duration_ms || 0) / 1e3;
38
24
  const throughput = (metrics.total_requests / (actualDurationSec || 1)).toFixed(2);
39
25
  const errorRate = (metrics.failed_requests / (metrics.total_requests || 1) * 100).toFixed(2);
@@ -42,20 +28,14 @@ try {
42
28
  console.log(` Active VUs: ${vusCount} parallel threads`);
43
29
  console.log(` Elapsed Time: ${actualDurationSec.toFixed(2)} seconds`);
44
30
  console.log(`-----------------------------------------------------------------------------`);
45
- console.log(` Samples (Requests): ${metrics.total_requests ?? 0}`);
31
+ console.log(` Samples (Requests): ${metrics.total_requests}`);
46
32
  console.log(` Throughput Rate: ${throughput} req/sec`);
47
- console.log(` Error Rate: ${errorRate}% (${metrics.failed_requests ?? 0} failed)`);
33
+ console.log(` Error Rate: ${errorRate}% (${metrics.failed_requests} failed)`);
48
34
  console.log(`-----------------------------------------------------------------------------`);
49
35
  console.log(`\u{1F4C8} Latency Statistics (ms):`);
50
- console.log(` \u251C\u2500\u2500 Minimum: ${(metrics.min_latency_ms ?? 0).toFixed(2)} ms`);
51
- console.log(` \u251C\u2500\u2500 Average: ${(metrics.avg_latency_ms ?? 0).toFixed(2)} ms`);
52
- console.log(` \u251C\u2500\u2500 Median (50%): ${(metrics.p50_latency_ms ?? 0).toFixed(2)} ms`);
53
- console.log(` \u251C\u2500\u2500 90th %ile: ${(metrics.p90_latency_ms ?? 0).toFixed(2)} ms`);
54
- console.log(` \u251C\u2500\u2500 95th %ile: ${(metrics.p95_latency_ms ?? 0).toFixed(2)} ms`);
55
- console.log(` \u251C\u2500\u2500 99th %ile: ${(metrics.p99_latency_ms ?? 0).toFixed(2)} ms`);
56
- console.log(` \u2514\u2500\u2500 Maximum: ${(metrics.max_latency_ms ?? 0).toFixed(2)} ms`);
36
+ console.log(` \u251C\u2500\u2500 Average: ${metrics.avg_latency_ms.toFixed(2)} ms`);
37
+ console.log(` \u2514\u2500\u2500 Maximum: ${metrics.max_latency_ms.toFixed(2)} ms`);
57
38
  console.log(`=============================================================================`);
58
39
  } catch (error) {
59
- console.error("\n\x1B[31m\u{1F4A5} Critical Native Core Execution Error:\x1B[0m", error);
60
- process.exit(1);
40
+ console.error("Execution error:", error);
61
41
  }
package/dist/index.js CHANGED
@@ -1,19 +1,5 @@
1
- import { createRequire } from 'node:module';
2
- import path from 'node:path';
3
- import { fileURLToPath } from 'node:url';
1
+ const { runBlazeCore } = require('./blaze.win32-x64-msvc.node');
4
2
 
5
- const __filename = fileURLToPath(import.meta.url);
6
- const __dirname = path.dirname(__filename);
7
- const require = createRequire(import.meta.url);
8
-
9
- // Force an absolute lookup path directly to the packaged location
10
- const nativeBinaryPath = path.resolve(__dirname, './blaze.win32-x64-msvc.node');
11
-
12
- let nativeBinding = null;
13
- try {
14
- nativeBinding = require(nativeBinaryPath);
15
- } catch (e) {
16
- throw new Error(`Blaze Engine failed to load native binary at ${nativeBinaryPath}. Internal Error: ${e.message}`);
17
- }
18
-
19
- export const runBlazeCore = nativeBinding.runBlazeCore;
3
+ module.exports = {
4
+ runBlazeCore
5
+ };
package/index.js CHANGED
@@ -1,19 +1,5 @@
1
- import { createRequire } from 'node:module';
2
- import path from 'node:path';
3
- import { fileURLToPath } from 'node:url';
1
+ const { runBlazeCore } = require('./blaze.win32-x64-msvc.node');
4
2
 
5
- const __filename = fileURLToPath(import.meta.url);
6
- const __dirname = path.dirname(__filename);
7
- const require = createRequire(import.meta.url);
8
-
9
- // Force an absolute lookup path directly to the packaged location
10
- const nativeBinaryPath = path.resolve(__dirname, './blaze.win32-x64-msvc.node');
11
-
12
- let nativeBinding = null;
13
- try {
14
- nativeBinding = require(nativeBinaryPath);
15
- } catch (e) {
16
- throw new Error(`Blaze Engine failed to load native binary at ${nativeBinaryPath}. Internal Error: ${e.message}`);
17
- }
18
-
19
- export const runBlazeCore = nativeBinding.runBlazeCore;
3
+ module.exports = {
4
+ runBlazeCore
5
+ };
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blaze-performance-tester",
3
- "version": "1.1.12",
3
+ "version": "1.1.15",
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",