Skip to content

Commit d3cce80

Browse files
authored
fix(logging): relax ThrottledAnalytics two-session test (#1667)
Because file system operations are not guaranteed to complete in the order in which they were started, this test was previously flaky. It seems in line with the goals of the test to just allow either session to “win” the lock file, so do that instead.
1 parent 7961b74 commit d3cce80

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/logging/src/analytics-helpers.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,12 @@ describe('analytics helpers', function () {
219219

220220
expect(events).to.have.lengthOf(4);
221221
expect(
222-
events.filter((e) => e[0] === 'track').map((e) => e[1].event)
223-
).to.deep.eq(['hi', 'hi', 'hi']);
222+
events
223+
.filter((e) => e[0] === 'track')
224+
.map((e) => e[1].event)
225+
.join(',')
226+
// can't be fully sure which instance 'won' the lock because fs operations are inherently subject to race conditions
227+
).to.match(/^(hi,hi,hi|bye,bye,bye)$/);
224228
});
225229
});
226230
});

0 commit comments

Comments
 (0)