• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

snatalenko / node-cqrs / 22745197368

06 Mar 2026 01:43AM UTC coverage: 95.287% (+0.9%) from 94.396%
22745197368

Pull #28

github

web-flow
Merge dd3952cc7 into 828e39903
Pull Request #28: TypeScript and event dispatching pipeline refactoring

428 of 528 branches covered (81.06%)

1043 of 1091 new or added lines in 65 files covered. (95.6%)

3 existing lines in 2 files now uncovered.

1294 of 1358 relevant lines covered (95.29%)

31.11 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.31
/src/in-memory/InMemoryLock.ts
1
import type { IViewLocker } from '../interfaces/IViewLocker.js';
2
import { Deferred } from '../utils/index.ts';
19✔
3

4
export class InMemoryLock implements IViewLocker {
19✔
5

6
        #lockMarker: Deferred<void> | undefined;
7

8
        /**
9
         * Indicates if lock is acquired
10
         */
11
        get locked(): boolean {
12
                return !!this.#lockMarker;
62✔
13
        }
14

15
        get ready(): boolean {
NEW
16
                return !this.locked;
×
17
        }
18

19
        /**
20
         * Acquire the lock on the current instance.
21
         * Resolves when the lock is successfully acquired
22
         */
23
        async lock(): Promise<boolean> {
24
                while (this.locked)
16✔
25
                        await this.once('ready');
1✔
26

27
                this.#lockMarker = new Deferred();
16✔
28
                return this.locked;
16✔
29
        }
30

31
        /**
32
         * Release the lock acquired earlier
33
         */
34
        async unlock(): Promise<void> {
35
                this.#lockMarker?.resolve();
28✔
36
                this.#lockMarker = undefined;
28✔
37
        }
38

39
        /**
40
         * Wait until the lock is released.
41
         * Resolves immediately if the lock is not acquired
42
         */
43
        once(event: 'ready'): Promise<void> {
44
                if (event !== 'ready')
8✔
45
                        throw new TypeError(`Unexpected event type: ${event}`);
1✔
46

47
                return this.#lockMarker?.promise ?? Promise.resolve();
7✔
48
        }
49
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc