forked from nightwatchjs/nightwatch-plugin-browserstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogSequence.js
More file actions
20 lines (19 loc) · 817 Bytes
/
Copy pathlogSequence.js
File metadata and controls
20 lines (19 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/**
* Per-process monotonic log sequence (SDK-6164).
*
* Every LogCreated log event (TEST_LOG, HTTP, TEST_SCREENSHOT) carries a
* `sequence` integer drawn from this single per-process counter. It gives the
* Test Observability backend a deterministic tiebreaker when two logs share the
* same millisecond `timestamp`: the server sorts by (timestamp, sequence).
*
* The counter is intentionally global-per-process (not scoped per test_run_uuid)
* so that all logs emitted by a worker — across tests, HTTP, and screenshots —
* share one strictly-increasing emission order. Each parallel worker process has
* its own counter starting at 0, matching the ticket's "per-process" design.
*/
let counter = 0;
module.exports = {
next: () => counter++,
// test-only hook
_reset: () => { counter = 0 }
};