lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README | LICENSE

commit d5d70f754949f6452721e793f78ebe6d36b1604d
parent 1eceb627f224d8c3047eb52b5b752c5a74d1e395
Author: triesap <tyson@radroots.org>
Date:   Tue, 17 Feb 2026 16:02:32 +0000

tests: remove ts-rs export dir env fallback


- write ts-rs constant exports to ./bindings for deterministic test output
- drop env imports in events and identity test modules
- rewrite runtime env lookup with explicit match-return none handling
- keep behavior unchanged while simplifying optional env parsing

Diffstat:
Mevents/src/kinds.rs | 5++---
Mevents/src/listing.rs | 5++---
Midentity/src/username.rs | 5++---
Mruntime/src/tracing.rs | 5++++-
4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/events/src/kinds.rs b/events/src/kinds.rs @@ -128,7 +128,7 @@ pub const fn request_kind_for_result_kind(kind: u32) -> Option<u32> { #[cfg(all(test, feature = "ts-rs", feature = "std"))] mod kinds_constants_tests { use super::*; - use std::{env, fs, path::Path}; + use std::{fs, path::Path}; const KIND_EXPORTS: &[(&str, u32)] = &[ ("KIND_PROFILE", KIND_PROFILE), @@ -197,8 +197,7 @@ mod kinds_constants_tests { #[test] fn export_kind_constants() { - let out_dir = env::var("TS_RS_EXPORT_DIR").unwrap_or_else(|_| "./bindings".to_string()); - let path = Path::new(&out_dir).join("kinds.ts"); + let path = Path::new("./bindings").join("kinds.ts"); if let Some(parent) = path.parent() { fs::create_dir_all(parent).expect("create ts export dir"); } diff --git a/events/src/listing.rs b/events/src/listing.rs @@ -251,7 +251,7 @@ pub struct RadrootsListingImageSize { #[cfg(all(test, feature = "ts-rs", feature = "std"))] mod constants_tests { use super::RADROOTS_LISTING_PRODUCT_TAG_KEYS; - use std::{env, fs, path::Path}; + use std::{fs, path::Path}; fn listing_product_tag_keys_literal() -> String { let mut out = String::from("["); @@ -269,8 +269,7 @@ mod constants_tests { #[test] fn export_listing_product_tag_keys_const() { - let out_dir = env::var("TS_RS_EXPORT_DIR").unwrap_or_else(|_| "./bindings".to_string()); - let path = Path::new(&out_dir).join("constants.ts"); + let path = Path::new("./bindings").join("constants.ts"); if let Some(parent) = path.parent() { fs::create_dir_all(parent).expect("create ts export dir"); } diff --git a/identity/src/username.rs b/identity/src/username.rs @@ -90,12 +90,11 @@ mod tests { #[cfg(all(test, feature = "ts-rs", feature = "std"))] mod constants_tests { use super::*; - use std::{env, fs, path::Path}; + use std::{fs, path::Path}; #[test] fn export_username_constants() { - let out_dir = env::var("TS_RS_EXPORT_DIR").unwrap_or_else(|_| "./bindings".to_string()); - let path = Path::new(&out_dir).join("constants.ts"); + let path = Path::new("./bindings").join("constants.ts"); if let Some(parent) = path.parent() { fs::create_dir_all(parent).expect("create ts export dir"); } diff --git a/runtime/src/tracing.rs b/runtime/src/tracing.rs @@ -47,7 +47,10 @@ fn log_name_from_exe() -> Option<String> { } fn env_value(key: &str) -> Option<String> { - let value = std::env::var(key).ok()?; + let value = match std::env::var(key) { + Ok(value) => value, + Err(_) => return None, + }; let trimmed = value.trim(); if trimmed.is_empty() { None