ITADN

Migrate existing comm tests to protocol-level tests

#1074Openlionel- 创建于 2026-03-02
L
lionel-commented
In recent PRs we've started using the `DummyArkFrontend` infrastructure for protocol-level tests of comms: - https://github.com/posit-dev/ark/pull/1052 (variables) - https://github.com/posit-dev/ark/pull/1060 (data explorer and variables) - https://github.com/posit-dev/ark/pull/1067 (plots) These tests are much nicer and effective than the old comm-based legacy tests because: - They exercise the whole kernel. This means that there is no need to simulate environment changed events after modifying the global env, which requires knowing a deeper knowledge of how internals work to produce a meaningful test (see https://github.com/posit-dev/ark/blob/239ee7e4d98101348fab833d1d668fd5a8d86b0b/crates/ark/tests/variables.rs#L116). We can let the normal operation of the kernel generate this sort of events. - It allows testing comms in conjunction with DAP and LSP operations and state. For instance the DAP now triggers comm-visible events, and it's nice to exercise these paths. - Inputs to the tests can be modelled after user requests, such as executing R code in the console. Compare to how we simulate global environment changes for Variables pane tests: https://github.com/posit-dev/ark/blob/239ee7e4d98101348fab833d1d668fd5a8d86b0b/crates/ark/tests/variables.rs#L109-L113 Before doing that though, we should solve https://github.com/posit-dev/ark/issues/689. This will allow comms to behave deterministically and tested with sequential assertions that are much stronger than fuzzy matching of events.
0 条评论