Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ jobs:
token: ${{ steps.app-token.outputs.token }}

- name: Update latest tag
env:
TAG_NAME: ${{ needs.release-please.outputs.tag_name }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -fa latest -m "Latest stable release (${{ needs.release-please.outputs.tag_name }})"
git tag -fa latest -m "Latest stable release ($TAG_NAME)"
git push origin latest --force
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ readme = "README.md"
keywords = ["cli", "llm", "token", "filter", "productivity"]
categories = ["command-line-utilities", "development-tools"]

[lib]
name = "rtk"
path = "src/lib.rs"

[[bin]]
name = "rtk"
path = "src/main.rs"

[dependencies]
clap = { version = "4", features = ["derive"] }
anyhow = "1.0"
Expand Down
27 changes: 11 additions & 16 deletions src/cmds/js/vitest_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ use crate::parser::{
emit_degradation_warning, emit_passthrough_warning, extract_json_object, truncate_passthrough,
FormatMode, OutputParser, ParseResult, TestFailure, TestResult, TokenFormatter,
};
use crate::Commands;
/// Which JS test framework to run.
pub enum JsTestFramework {
Vitest,
Jest,
}

/// Vitest JSON output structures (tool-specific format)
#[derive(Debug, Deserialize)]
Expand Down Expand Up @@ -204,31 +208,22 @@ fn extract_failures_regex(output: &str) -> Vec<TestFailure> {
failures
}

pub fn run_test(command: &Commands, args: &[String], verbose: u8) -> Result<i32> {
pub fn run_test(fw: JsTestFramework, args: &[String], verbose: u8) -> Result<i32> {
let timer = tracking::TimedExecution::start();

let (framework, mut cmd) = match command {
Commands::Vitest { .. } => {
let (framework, mut cmd) = match fw {
JsTestFramework::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");
cmd.arg("run").arg("--reporter=json");
(framework, cmd)
}
Commands::Jest { .. } => {
JsTestFramework::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");
cmd.arg("--no-watch").arg("--json");
(framework, cmd)
}
_ => unreachable!(),
};

for arg in args {
Expand Down
2 changes: 1 addition & 1 deletion src/core/tracking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ pub fn estimate_tokens(text: &str) -> usize {
///
/// # Examples
///
/// ```no_run
/// ```ignore
/// use rtk::tracking::TimedExecution;
///
/// let timer = TimedExecution::start();
Expand Down
Loading