Got it, but it’s ugly, because of Eunit: {node, ... instantiator broken in OTP-28.x , and because of the need to copy the code search path:
-module(node_test).
-include_lib("eunit/include/eunit.hrl").
node_spawn_test_() ->
{node, 'foo', fun({Pid, _}) ->
Node = get_peer_node(Pid),
erpc:call(Node, code, set_path, [code:get_path()]),
{spawn, Node, [
{setup, fun remote_setup/0, [
fun remote/0
]}
]}
end}.
get_peer_node(Pid) ->
gen_server:call(Pid, get_node).
remote_setup() ->
?assertEqual(moo, node()).
remote() ->
?assertEqual(moo, node()).