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
1 change: 1 addition & 0 deletions hermes/tests/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ fn ui() {
unsafe { std::env::set_var("HERMES_UI_TEST_MODE", "true") };

let mut config = Config::rustc(PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/ui"));
config.program.args.push("--diagnostic-width=100".into());

let args = Args::test().unwrap();
config.with_args(&args);
Expand Down
18 changes: 16 additions & 2 deletions tools/ui-runner/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,22 @@ fn main() {
// Ignoring `RUSTFLAGS` and specifying our own flags here makes these
// tests more reproducible.

// FIXME: These seem to have no effect (ie, rustc seems to still discover
// the real terminal width).
// The `--diagnostic-width` flag is the most reliable way to ensure that
// rustc's error messages are wrapped at a consistent width. This avoids
// flakiness in UI tests where the output might otherwise depend on the
// terminal width of the environment in which the tests are run.
//
// However, this flag was only stabilized in Rust 1.70.0 (and was unstable
// starting in 1.62.0), so we only pass it if we're not on our MSRV
// toolchain (which is 1.56.0).
if toolchain_meta_name != "msrv" {
config.program.args.push("--diagnostic-width=100".into());
}

// These environment variables are usually respected by CLI tools (including
// rustc) to determine the terminal width. As of this writing, rustc sometimes
// ignores them and discovers the real terminal width anyway; the
// `--diagnostic-width` flag above is more reliable.
config.program.envs.push(("TERM".into(), Some("dumb".into())));
config.program.envs.push(("COLUMNS".into(), Some("100".into())));

Expand Down
Loading