Skip to content

Commit 398882d

Browse files
committed
fix: add serial attribute to legend tests to prevent race condition
The legend tests modify the HOME environment variable which can cause race conditions when tests run in parallel. Adding #[serial] ensures these tests run sequentially.
1 parent a625684 commit 398882d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/status.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@ pub fn render_status_json(entries: &[StatusEntry]) -> Result<String, serde_json:
554554
mod tests {
555555
use super::*;
556556
use crate::api::{PullRequest, PullRequestStatus};
557+
use serial_test::serial;
557558
use tempfile::TempDir;
558559

559560
// === StatusBit tests ===
@@ -905,6 +906,7 @@ mod tests {
905906
}
906907

907908
#[test]
909+
#[serial]
908910
fn test_should_show_legend_first_run() {
909911
with_temp_home(|_| {
910912
// First call should return true and create the file
@@ -913,6 +915,7 @@ mod tests {
913915
}
914916

915917
#[test]
918+
#[serial]
916919
fn test_should_show_legend_subsequent_run() {
917920
with_temp_home(|home| {
918921
// Create the legend file

0 commit comments

Comments
 (0)