Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51668f3cdd |
No files matched your search
+22
-26
@@ -11,7 +11,7 @@ use crate::parser::{
|
||||
emit_degradation_warning, emit_passthrough_warning, extract_json_object, truncate_passthrough,
|
||||
FormatMode, OutputParser, ParseResult, TestFailure, TestResult, TokenFormatter,
|
||||
};
|
||||
use crate::Commands;
|
||||
use std::process::Command;
|
||||
|
||||
/// Vitest JSON output structures (tool-specific format)
|
||||
#[derive(Debug, Deserialize)]
|
||||
@@ -204,32 +204,28 @@ fn extract_failures_regex(output: &str) -> Vec<TestFailure> {
|
||||
failures
|
||||
}
|
||||
|
||||
pub fn run_test(command: &Commands, args: &[String], verbose: u8) -> Result<i32> {
|
||||
let timer = tracking::TimedExecution::start();
|
||||
pub fn run_vitest(args: &[String], verbose: u8) -> Result<i32> {
|
||||
let mut cmd = package_manager_exec("vitest");
|
||||
cmd
|
||||
// Force non-watch mode
|
||||
.arg("run")
|
||||
// Enable JSON structured output
|
||||
.arg("--reporter=json");
|
||||
run_framework_test("vitest", cmd, args, verbose)
|
||||
}
|
||||
|
||||
let (framework, mut cmd) = match command {
|
||||
Commands::Vitest { .. } => {
|
||||
let framework = "vitest";
|
||||
let mut cmd = package_manager_exec(framework);
|
||||
cmd
|
||||
// Force non-watch mode
|
||||
.arg("run")
|
||||
// Enable JSON structured output
|
||||
.arg("--reporter=json");
|
||||
(framework, cmd)
|
||||
}
|
||||
Commands::Jest { .. } => {
|
||||
let framework = "jest";
|
||||
let mut cmd = package_manager_exec(framework);
|
||||
cmd
|
||||
// Force non-watch mode
|
||||
.arg("--no-watch")
|
||||
// Enable JSON structured output
|
||||
.arg("--json");
|
||||
(framework, cmd)
|
||||
}
|
||||
_ => unreachable!(),
|
||||
};
|
||||
pub fn run_jest(args: &[String], verbose: u8) -> Result<i32> {
|
||||
let mut cmd = package_manager_exec("jest");
|
||||
cmd
|
||||
// Force non-watch mode
|
||||
.arg("--no-watch")
|
||||
// Enable JSON structured output
|
||||
.arg("--json");
|
||||
run_framework_test("jest", cmd, args, verbose)
|
||||
}
|
||||
|
||||
fn run_framework_test(framework: &str, mut cmd: Command, args: &[String], verbose: u8) -> Result<i32> {
|
||||
let timer = tracking::TimedExecution::start();
|
||||
|
||||
for arg in args {
|
||||
if arg == "run"
|
||||
|
||||
@@ -1294,7 +1294,7 @@ pub fn estimate_tokens(text: &str) -> usize {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
/// ```ignore
|
||||
/// use rtk::tracking::TimedExecution;
|
||||
///
|
||||
/// let timer = TimedExecution::start();
|
||||
|
||||
+1
-1
@@ -141,7 +141,7 @@ pub fn format_cpt(cpt: f64) -> String {
|
||||
/// ```
|
||||
/// use rtk::utils::join_with_overflow;
|
||||
/// let items = vec!["a".to_string(), "b".to_string()];
|
||||
/// assert_eq!(join_with_overflow(&items, 5, 3, "items"), "a\nb\n... +2 more items");
|
||||
/// assert_eq!(join_with_overflow(&items, 5, 3, "items"), "a\nb\n… +2 more items");
|
||||
/// assert_eq!(join_with_overflow(&items, 2, 3, "items"), "a\nb");
|
||||
/// ```
|
||||
pub fn join_with_overflow(items: &[String], total: usize, max: usize, label: &str) -> String {
|
||||
|
||||
+2
-3
@@ -1990,9 +1990,8 @@ fn run_cli() -> Result<i32> {
|
||||
0
|
||||
}
|
||||
|
||||
Commands::Jest { ref args } | Commands::Vitest { ref args } => {
|
||||
vitest_cmd::run_test(&cli.command, args, cli.verbose)?
|
||||
}
|
||||
Commands::Vitest { ref args } => vitest_cmd::run_vitest(args, cli.verbose)?,
|
||||
Commands::Jest { ref args } => vitest_cmd::run_jest(args, cli.verbose)?,
|
||||
|
||||
Commands::Prisma { command } => match command {
|
||||
PrismaCommands::Generate { args } => {
|
||||
|
||||
Reference in new issue
Block a user