Skip to content

Commit 44bc4d4

Browse files
Format files for prek
1 parent 9084d65 commit 44bc4d4

5 files changed

Lines changed: 79 additions & 65 deletions

File tree

codeflash/cli_cmds/github_workflow.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -966,9 +966,7 @@ def _customize_java_workflow_content(optimize_yml_content: str, git_root: Path)
966966
return optimize_yml_content.replace("{{ install_dependencies_command }}", install_deps)
967967

968968

969-
def _customize_go_workflow_content(
970-
optimize_yml_content: str, git_root: Path, benchmark_mode: bool = False
971-
) -> str:
969+
def _customize_go_workflow_content(optimize_yml_content: str, git_root: Path, benchmark_mode: bool = False) -> str:
972970
"""Customize workflow content for Go projects."""
973971
from codeflash.cli_cmds.init_go import get_go_dependency_installation_commands, get_go_runtime_setup_steps
974972

codeflash/languages/javascript/support.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,15 +1607,17 @@ def run_tests(
16071607

16081608
# Build Jest command
16091609
test_pattern = "|".join(str(f) for f in test_files)
1610-
cmd = resolve_node_command_list([
1611-
"npx",
1612-
"jest",
1613-
"--reporters=default",
1614-
"--reporters=jest-junit",
1615-
f"--testPathPattern={test_pattern}",
1616-
"--runInBand", # Sequential for deterministic timing
1617-
"--forceExit",
1618-
])
1610+
cmd = resolve_node_command_list(
1611+
[
1612+
"npx",
1613+
"jest",
1614+
"--reporters=default",
1615+
"--reporters=jest-junit",
1616+
f"--testPathPattern={test_pattern}",
1617+
"--runInBand", # Sequential for deterministic timing
1618+
"--forceExit",
1619+
]
1620+
)
16191621

16201622
test_env = env.copy()
16211623
test_env["JEST_JUNIT_OUTPUT_FILE"] = str(junit_xml)

codeflash/languages/javascript/test_runner.py

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -795,14 +795,16 @@ def run_jest_behavioral_tests(
795795
coverage_json_path = coverage_dir / "coverage-final.json" if enable_coverage else None
796796

797797
# Build Jest command
798-
jest_cmd = resolve_node_command_list([
799-
"npx",
800-
"jest",
801-
"--reporters=default",
802-
f"--reporters={CODEFLASH_JEST_REPORTER}",
803-
"--runInBand", # Run tests serially for consistent timing
804-
"--forceExit",
805-
])
798+
jest_cmd = resolve_node_command_list(
799+
[
800+
"npx",
801+
"jest",
802+
"--reporters=default",
803+
f"--reporters={CODEFLASH_JEST_REPORTER}",
804+
"--runInBand", # Run tests serially for consistent timing
805+
"--forceExit",
806+
]
807+
)
806808

807809
# Add Jest config if found - needed for TypeScript transformation
808810
# Uses codeflash-compatible config if project has bundler moduleResolution
@@ -1049,15 +1051,17 @@ def run_jest_benchmarking_tests(
10491051
logger.debug(f"Jest {jest_major_version} detected - using loop-runner for batched looping")
10501052

10511053
# Build Jest command for performance tests
1052-
jest_cmd = resolve_node_command_list([
1053-
"npx",
1054-
"jest",
1055-
"--reporters=default",
1056-
f"--reporters={CODEFLASH_JEST_REPORTER}",
1057-
"--runInBand", # Ensure serial execution
1058-
"--forceExit",
1059-
"--runner=codeflash/loop-runner", # Use custom loop runner for in-process looping
1060-
])
1054+
jest_cmd = resolve_node_command_list(
1055+
[
1056+
"npx",
1057+
"jest",
1058+
"--reporters=default",
1059+
f"--reporters={CODEFLASH_JEST_REPORTER}",
1060+
"--runInBand", # Ensure serial execution
1061+
"--forceExit",
1062+
"--runner=codeflash/loop-runner", # Use custom loop runner for in-process looping
1063+
]
1064+
)
10611065

10621066
# Add Jest config if found - needed for TypeScript transformation
10631067
# Uses codeflash-compatible config if project has bundler moduleResolution
@@ -1225,14 +1229,16 @@ def run_jest_line_profile_tests(
12251229
_ensure_runtime_files(effective_cwd)
12261230

12271231
# Build Jest command for line profiling - simple run without benchmarking loops
1228-
jest_cmd = resolve_node_command_list([
1229-
"npx",
1230-
"jest",
1231-
"--reporters=default",
1232-
f"--reporters={CODEFLASH_JEST_REPORTER}",
1233-
"--runInBand", # Run tests serially for consistent line profiling
1234-
"--forceExit",
1235-
])
1232+
jest_cmd = resolve_node_command_list(
1233+
[
1234+
"npx",
1235+
"jest",
1236+
"--reporters=default",
1237+
f"--reporters={CODEFLASH_JEST_REPORTER}",
1238+
"--runInBand", # Run tests serially for consistent line profiling
1239+
"--forceExit",
1240+
]
1241+
)
12361242

12371243
# Add Jest config if found - needed for TypeScript transformation
12381244
# Uses codeflash-compatible config if project has bundler moduleResolution

codeflash/languages/javascript/tracer_runner.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ def find_trace_runner() -> Optional[Path]:
3636
return local_path
3737

3838
try:
39-
result = subprocess.run(resolve_node_command_list(["npm", "root", "-g"]), capture_output=True, text=True, check=True)
39+
result = subprocess.run(
40+
resolve_node_command_list(["npm", "root", "-g"]), capture_output=True, text=True, check=True
41+
)
4042
global_modules = Path(result.stdout.strip())
4143
global_path = global_modules / "codeflash" / "runtime" / "trace-runner.js"
4244
if global_path.exists():

codeflash/languages/javascript/vitest_runner.py

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -318,15 +318,17 @@ def _build_vitest_behavioral_command(
318318
Command list for subprocess execution.
319319
320320
"""
321-
cmd = resolve_node_command_list([
322-
"npx",
323-
"vitest",
324-
"run", # Single execution (not watch mode)
325-
"--reporter=default",
326-
"--reporter=junit",
327-
"--no-file-parallelism", # Serial execution for deterministic timing
328-
"--pool=forks", # Use child processes so timing markers flow to parent stdout
329-
])
321+
cmd = resolve_node_command_list(
322+
[
323+
"npx",
324+
"vitest",
325+
"run", # Single execution (not watch mode)
326+
"--reporter=default",
327+
"--reporter=junit",
328+
"--no-file-parallelism", # Serial execution for deterministic timing
329+
"--pool=forks", # Use child processes so timing markers flow to parent stdout
330+
]
331+
)
330332

331333
# For monorepos with restrictive vitest configs (e.g., include: test/**/*.test.ts),
332334
# we need to create a custom config that allows all test patterns.
@@ -380,15 +382,17 @@ def _build_vitest_benchmarking_command(
380382
Command list for subprocess execution.
381383
382384
"""
383-
cmd = resolve_node_command_list([
384-
"npx",
385-
"vitest",
386-
"run", # Single execution (not watch mode)
387-
"--reporter=default",
388-
"--reporter=junit",
389-
"--no-file-parallelism", # Serial execution for consistent benchmarking
390-
"--pool=forks", # Use child processes so timing markers flow to parent stdout
391-
])
385+
cmd = resolve_node_command_list(
386+
[
387+
"npx",
388+
"vitest",
389+
"run", # Single execution (not watch mode)
390+
"--reporter=default",
391+
"--reporter=junit",
392+
"--no-file-parallelism", # Serial execution for consistent benchmarking
393+
"--pool=forks", # Use child processes so timing markers flow to parent stdout
394+
]
395+
)
392396

393397
# Use codeflash vitest config to override restrictive include patterns
394398
if project_root:
@@ -806,15 +810,17 @@ def run_vitest_line_profile_tests(
806810
_ensure_runtime_files(effective_cwd)
807811

808812
# Build Vitest command for line profiling - simple run without benchmarking loops
809-
vitest_cmd = resolve_node_command_list([
810-
"npx",
811-
"vitest",
812-
"run",
813-
"--reporter=default",
814-
"--reporter=junit",
815-
"--no-file-parallelism", # Serial execution for consistent line profiling
816-
"--pool=forks", # Use child processes so timing markers flow to parent stdout
817-
])
813+
vitest_cmd = resolve_node_command_list(
814+
[
815+
"npx",
816+
"vitest",
817+
"run",
818+
"--reporter=default",
819+
"--reporter=junit",
820+
"--no-file-parallelism", # Serial execution for consistent line profiling
821+
"--pool=forks", # Use child processes so timing markers flow to parent stdout
822+
]
823+
)
818824

819825
# Use codeflash vitest config to override restrictive include patterns
820826
if effective_cwd:

0 commit comments

Comments
 (0)