# gpui_macos: Enable gpui/test-support feature for tests \(\#54988\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/d986344da539eb97aaf21eebf9d1d82c52fd1c06)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: d986344da539eb97aaf21eebf9d1d82c52fd1c06

Requested commit: d986344da539eb97aaf21eebf9d1d82c52fd1c06

Commit: d986344da539eb97aaf21eebf9d1d82c52fd1c06

Tree: 1befaf113a490e99ebbaec44746ea3bd19d7e5fa

Author: Richard Feldman

Committer: GitHub

## Message

````
gpui_macos: Enable gpui/test-support feature for tests (#54988)

PR #51415 introduced the `PlatformHeadlessRenderer` trait and
`PlatformWindow::render_to_image` method in `gpui`, both gated on
`#[cfg(any(test, feature = "test-support"))]`, plus corresponding impls
in `gpui_macos` (`window.rs` and `metal_renderer.rs`) gated on the same
cfg.

A dependent crate's `cfg(test)` flag does **not** propagate to its
dependencies. So when `cargo test -p gpui_macos` is run in isolation,
`gpui_macos`'s own `cfg(test)` is true (its impls get compiled) but
`gpui` is just a regular dependency without `test-support` enabled (the
trait and method don't exist), and the build fails:

```
error[E0405]: cannot find trait `PlatformHeadlessRenderer` in crate `gpui`
error[E0407]: method `render_to_image` is not a member of trait `PlatformWindow`
```

The fix is to enable `gpui/test-support` as a dev-dependency, so the
feature is on exactly when `gpui_macos`'s tests are being built.

This bug is latent on `main` — workspace-level `cargo test` typically
pulls in `gpui/test-support` transitively from other crates, masking it.
Running `cargo test -p gpui_macos` alone is what surfaces it.

Release Notes:

- N/A
````

## Parents

- [697f5dde3a02b9db105af1fac4898d370bba4c98](https://git.cafe/gitcafe/zed/commit/697f5dde3a02b9db105af1fac4898d370bba4c98?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/d986344da539eb97aaf21eebf9d1d82c52fd1c06?format=markdown)
