@@ -1,5 +1,6 @@
11mod tester;
22
3+use std::process::{Command, Stdio};
34use tester::BatTester;
45
56static STYLES: &'static [&'static str] = &[
@@ -24,6 +25,17 @@ static STYLES: &'static [&'static str] = &[
2425
2526#[test]
2627fn test_snapshots() {
28+ let status = Command::new("git")
29+ .arg("rev-parse")
30+ .stdout(Stdio::null())
31+ .stderr(Stdio::null())
32+ .status();
33+
34+ if !status.map(|s| s.success()).unwrap_or(false) {
35+ // Git not available or not a git repository. Skipping snapshot test.
36+ return;
37+ }
38+
2739 let bat_tester = BatTester::new();
2840
2941 for style in STYLES {