From 26d5be6d15ab320464f6c91e655d7d1ebb33b897 Mon Sep 17 00:00:00 2001 From: Matt Kantor Date: Sat, 5 Dec 2020 14:55:06 -0800 Subject: [PATCH] Improve an error message for snapshot tests. --- tests/lib/mod.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/lib/mod.rs b/tests/lib/mod.rs index e9e3e21..a46bd7a 100644 --- a/tests/lib/mod.rs +++ b/tests/lib/mod.rs @@ -13,6 +13,7 @@ use std::env; use std::ffi::OsStr; use std::hash::Hasher; use std::net::SocketAddr; +use std::path::Path; use std::process::{Child, Command, Output, Stdio}; use std::str; use std::thread; @@ -251,14 +252,20 @@ async fn render_multiple_ways_for_snapshots( // behavior of the get command and HTTP request is // different enough to be considered a bug. else { + let sample_name = content_directory + .root() + .strip_prefix(sample_path(".")) + .unwrap_or(Path::new("unknown")) + .display(); panic!( - "Rendering {} as {} produced different results when done via server and get command!\n \ + "Rendering {} from {} as {} produced different results when done via server and get command!\n \ get command exit code: {}\n \ get command stdout: {}\n \ get command stderr: {}\n \ HTTP status code: {}\n \ HTTP response body: {}\n", route, + sample_name, accept, get_command_output.status, if get_command_output.stdout.len() > 64 {