Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

Fix benchmark environment lookup in ESM (#1337)

Ryanbaa3d0b4462b9a
diff --git a/v3/@claude-flow/performance/__tests__/benchmark.test.ts b/v3/@claude-flow/performance/__tests__/benchmark.test.ts
new file mode 100644
index 0000000000..d1248f9c50
--- /dev/null
+++ b/v3/@claude-flow/performance/__tests__/benchmark.test.ts
@@ -0,0 +1,30 @@
+import { describe, expect, it } from 'vitest';
+
+import { BenchmarkRunner } from '../src/framework/benchmark';
+
+describe('BenchmarkRunner', () => {
+ it('collects environment info without CommonJS require', async () => {
+ const runner = new BenchmarkRunner('esm-benchmark-suite');
+
+ const suite = await runner.runAll([
+ {
+ name: 'noop',
+ fn: () => {},
+ options: {
+ iterations: 1,
+ warmup: 0,
+ minRuns: 1,
+ targetTime: 1,
+ },
+ },
+ ]);
+
+ expect(suite.environment).toMatchObject({
+ nodeVersion: process.version,
+ platform: process.platform,
+ arch: process.arch,
+ });
+ expect(suite.environment.cpus).toBeGreaterThan(0);
+ expect(suite.environment.memory).toBeGreaterThan(0);
+ });
+});
diff --git a/v3/@claude-flow/performance/src/framework/benchmark.ts b/v3/@claude-flow/performance/src/framework/benchmark.ts
index a14b92723a..cb86a0ce36 100644
--- a/v3/@claude-flow/performance/src/framework/benchmark.ts
+++ b/v3/@claude-flow/performance/src/framework/benchmark.ts
@@ -16,6 +16,7 @@
*/
import { performance, PerformanceObserver } from 'perf_hooks';
+import os from 'node:os';
// ============================================================================
// Types and Interfaces
@@ -367,7 +368,6 @@ export class BenchmarkRunner {
* Get environment information
*/
private getEnvironmentInfo(): EnvironmentInfo {
- const os = require('os');
return {
nodeVersion: process.version,
platform: process.platform,