Commit graph

46 commits

Author SHA1 Message Date
ali
175226bd20
fix: correct loop index calculation in JS performance benchmarking
Loop index now represents how many times all test files ran (batch count)
instead of per-invocation index. Also fixes Date.now() usage when random
seed is active and removes JS-specific workaround in number_of_loops.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 15:32:16 +02:00
Sarthak Agarwal
ce13a6d534
Merge branch 'main' into fix/js-jest30-loop-runner 2026-02-09 21:06:06 +05:30
Sarthak Agarwal
410aca7b83 fix loop count issue among subsequent tests 2026-02-09 20:21:37 +05:30
mohammed ahmed
f800ae3d92
Merge branch 'main' into fix/js-jest30-loop-runner 2026-02-06 17:22:15 +02:00
Sarthak Agarwal
ff7c0f9813 version upgrade to 0.7.1 2026-02-05 22:27:40 +05:30
Sarthak Agarwal
17916ef9fb fix on loop count 2026-02-05 18:07:35 +05:30
mohammedahmed18
017bde1c1f refactor: improve code quality and documentation in loop-runner and capture
Improvements to loop-runner.js:
- Extract isValidJestRunnerPath() helper to reduce code duplication
- Add comprehensive JSDoc comments for Jest version detection
- Improve error messages with more context about detected versions
- Add better documentation for runTests() method
- Add validation for TestRunner class availability in Jest 30

Improvements to capture.js:
- Extract _recordAsyncTiming() helper to reduce duplication
- Add comprehensive JSDoc for _capturePerfAsync() with all parameters
- Improve error handling in async looping (record timing before throwing)
- Enhance shouldStopStability() documentation with algorithm details
- Improve code organization with clearer comments

These changes improve maintainability and debugging without changing behavior.
2026-02-03 21:16:26 +00:00
ali
4157534a26
fix: use getter functions for env var constants in capture.js
After merging main, constants like PERF_STABILITY_CHECK, PERF_MIN_LOOPS,
PERF_LOOP_COUNT were changed to getter functions. Updated all references
in capturePerf and _capturePerfAsync to use the getter function calls.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 22:15:18 +02:00
mohammed ahmed
4c61d08ef9 Merge branch 'main' into fix/js-jest30-loop-runner 2026-02-03 19:18:20 +02:00
ali
04a87cfaec
fix: add Jest 30 support, fix time limit, and fix async function looping
- Add Jest 30 compatibility by detecting version and using TestRunner class
- Resolve jest-runner from project's node_modules instead of codeflash's bundle
- Fix time limit enforcement by using local time tracking instead of shared state
  (Jest runs tests in worker processes, so state isn't shared with runner)
- Integrate stability-based early stopping into capturePerf
- Use plain object instead of Set for stableInvocations to survive Jest module resets
- Fix async function benchmarking: properly loop through iterations using async helper
  (Previously, async functions only got one timing marker due to early return)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 19:04:50 +02:00
Sarthak Agarwal
6384a555df
Merge branch 'main' into fix/jest-xml-path-resolution-monorepo 2026-02-03 20:00:10 +05:30
mohammedahmed18
7f954d1544 refactor: Leverage Python project root detection for jest-runner resolution
Instead of duplicating monorepo detection logic in JavaScript, leverage
the existing Python _find_node_project_root and add _find_monorepo_root
functions. Pass the detected monorepo root via CODEFLASH_MONOREPO_ROOT
environment variable to the loop-runner.

This approach:
- Reuses existing Python project detection logic
- Provides a reliable monorepo root hint to JavaScript
- Maintains fallback directory traversal for edge cases

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-03 14:26:41 +00:00
Sarthak Agarwal
5084ba4b3c update npm package 2026-02-03 19:55:15 +05:30
Sarthak Agarwal
1323df0633 update package to 0.7.0 2026-02-03 19:54:14 +05:30
mohammedahmed18
8223796576 fix: Support Jest runner resolution in monorepos
Added resolveJestRunner() function that walks up the directory tree to
find jest-runner in workspace root node_modules. This fixes the
"jest-runner requires jest-runner to be installed" error when running
in monorepo packages.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-03 12:33:26 +00:00
Sarthak Agarwal
66fadf7ad3 fix: use getter functions for perf env vars to support Vitest module caching
Vitest caches modules and may load capture.js before environment
variables like CODEFLASH_PERF_LOOP_COUNT are set. When these were
read as constants at module load time, they would always return
default values.

This change converts the performance configuration from constants
to getter functions that read environment variables at runtime,
ensuring correct values are used even when the module is cached.

Fixes:
- PERF_LOOP_COUNT always being 1 in Vitest
- PERF_BATCH_SIZE, PERF_MIN_LOOPS, etc. using defaults instead of env values

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 18:02:23 +05:30
Sarthak Agarwal
565b1f59a0 update package to 0.5.0 2026-02-02 23:48:16 +05:30
Sarthak Agarwal
f88b6b7142 vitest perf looping inefficiency 2026-02-02 18:28:04 +05:30
Saurabh Misra
82d9e435ef
Merge branch 'main' into add_vitest_support_to_js 2026-02-01 12:32:09 -08:00
Sarthak Agarwal
aa9b926200
Merge branch 'main' into add_vitest_support_to_js 2026-02-01 03:41:43 +05:30
Kevin Turcios
05711151c2 limit the python version for the postinstall script 2026-01-31 13:53:10 -05:00
Sarthak Agarwal
eb1d27e359 update package to 0.4.0 2026-01-31 20:21:50 +05:30
Sarthak Agarwal
3e7be21e16
Merge branch 'main' into add_vitest_support_to_js 2026-01-31 19:39:03 +05:30
Saurabh Misra
5296dc8321 fix: calculate MAX_BATCHES correctly in Jest loop-runner
Previously, MAX_BATCHES was set to PERF_LOOP_COUNT directly (e.g., 250),
which caused the loop-runner to run 250 batches even though only 25
batches were needed to produce timing data (with BATCH_SIZE=10).

The bug was that timing markers only appeared for the first N batches
(where N = LOOP_COUNT / BATCH_SIZE), and the remaining batches were
wasted overhead.

Fix: Calculate MAX_BATCHES as ceil(LOOP_COUNT / BATCH_SIZE) + 1, capped
at LOOP_COUNT. This ensures only the necessary batches run:
- With LOOP_COUNT=250, BATCH_SIZE=10: MAX_BATCHES = 26 (not 250)

This significantly improves benchmark efficiency by eliminating wasted
Jest passes that don't contribute timing data.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 06:47:01 +00:00
Sarthak Agarwal
4bf664dc39 add vitest runner 2026-01-31 04:29:59 +05:30
Sarthak Agarwal
a29f877df5 publish the 0.3.0 to npm 2026-01-29 23:00:28 +05:30
Sarthak Agarwal
483fa44f36 package installer to e2e test 2026-01-29 14:31:06 +05:30
Sarthak Agarwal
2cc1fb2809 tests for extractor and replacer 2026-01-29 01:27:19 +05:30
Sarthak Agarwal
942bbac356 update to 0.2.0 2026-01-28 18:10:29 +05:30
Sarthak Agarwal
6fa2fb3917 update dependencies for jest-runner used in loop runner 2026-01-28 17:59:20 +05:30
misrasaurabh1
e84a491b5a Merge remote-tracking branch 'origin/multi-language' into multi-language 2026-01-28 01:23:19 -08:00
misrasaurabh1
b8ea15a507 batched looping for lower overhead 2026-01-28 01:23:11 -08:00
Sarthak Agarwal
acf0423761 move package dependencies to codeflash 2026-01-28 11:34:44 +05:30
misrasaurabh1
7b7cc99f3a Implement a real js test looper 2026-01-27 19:44:51 -08:00
misrasaurabh1
beda62cc7a Merge remote-tracking branch 'origin/multi-language' into multi-language 2026-01-27 00:57:17 -08:00
misrasaurabh1
4ba7c6705f remove defaults and global requires 2026-01-27 00:57:10 -08:00
Sarthak Agarwal
653a8f406d fix lock file 2026-01-27 14:24:29 +05:30
misrasaurabh1
698ed3bc21 rename package dir 2026-01-27 00:19:07 -08:00
Sarthak Agarwal
d16e39c528 adding sqlite package as dep 2026-01-27 13:38:34 +05:30
Sarthak Agarwal
c6efaa7d26 rename package to just codeflash 2026-01-27 13:10:24 +05:30
Sarthak Agarwal
0da33805fe uv path fix 2026-01-27 03:16:55 +05:30
Sarthak Agarwal
6b56cdef0e init flow fix for test module path 2026-01-27 03:06:11 +05:30
Sarthak Agarwal
6ff8626338 cleaning old packaging format 2026-01-26 23:46:35 +05:30
Sarthak Agarwal
d6372de85c packaging codeflash 2026-01-26 23:44:57 +05:30
ali
291106c467
jedi references for python only 2026-01-23 15:13:05 +02:00
Sarthak Agarwal
16375b9346 npm package and esmodule and commonjs module changes 2026-01-22 23:16:16 +05:30