Skip to content

Commit e1de241

Browse files
committed
fix: reload network test fixtures each test to prevent shared-ref drain
Clear button mutations on httpProfile/socketProfile in FakeVmServiceWrapper clear the underlying lists in place. Since setUpAll shared the same fixture refs across all tests, a test that taps Clear would leave empty profiles for the next test. Move fixture load to setUp so each test gets fresh instances. Fixes CI failures on test_ddc and test_dart2js.
1 parent 912b2e1 commit e1de241

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

packages/devtools_app/test/screens/network/network_profiler_test.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ void main() {
5252
setUpAll(() {
5353
setGlobal(OfflineDataController, OfflineDataController());
5454
socketProfile = loadSocketProfile();
55-
httpProfile = loadHttpProfile();
56-
setGlobal(IdeTheme, IdeTheme());
5755
setGlobal(
5856
DevToolsEnvironmentParameters,
5957
ExternalDevToolsEnvironmentParameters(),
@@ -65,6 +63,12 @@ void main() {
6563

6664
group('Network Profiler', () {
6765
setUp(() {
66+
// Reload the fixtures for every test. Clearing requests mutates these
67+
// shared profiles in place (FakeVmServiceWrapper clears the same lists
68+
// aliased by _startingRequests/_startingSockets), so a test that taps
69+
// Clear would otherwise leave them empty for the next test.
70+
socketProfile = loadSocketProfile();
71+
httpProfile = loadHttpProfile();
6872
fakeServiceConnection = FakeServiceConnectionManager(
6973
service: FakeServiceManager.createFakeService(
7074
socketProfile: socketProfile,

0 commit comments

Comments
 (0)