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

visgl / loaders.gl / 24139120841

08 Apr 2026 01:53PM UTC coverage: 65.319% (+30.2%) from 35.137%
24139120841

push

github

web-flow
chore: Replace puppeteer with playwright (#3350)

14216 of 18890 branches covered (75.26%)

Branch coverage included in aggregate %.

3 of 3 new or added lines in 1 file covered. (100.0%)

3248 existing lines in 369 files now uncovered.

73509 of 115413 relevant lines covered (63.69%)

5763.45 hits per line

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

67.59
/modules/schema-utils/src/lib/utils/async-queue.ts
1
// From https://github.com/rauschma/async-iter-demo/tree/master/src under MIT license
135✔
2
// http://2ality.com/2016/10/asynchronous-iteration.html
60✔
3

1✔
4
class ArrayQueue<T> extends Array<T> {
1✔
5
  enqueue(value: T) {
40✔
6
    // Add at the end
137✔
7
    return this.push(value);
40✔
8
  }
40✔
9
  dequeue(): T {
40✔
10
    // Remove first element
62✔
11
    return this.shift() as T;
62✔
12
  }
40✔
13
}
40✔
14

40✔
15
export default class AsyncQueue<T> {
40!
UNCOV
16
  private _values: ArrayQueue<T | Error>;
✔
17
  private _settlers: ArrayQueue<{resolve: (value: any) => void; reject: (reason?: any) => void}>;
40✔
18
  private _closed: boolean;
×
UNCOV
19

×
UNCOV
20
  constructor() {
✔
21
    // enqueues > dequeues
40✔
22
    this._values = new ArrayQueue<T>();
39✔
23
    // dequeues > enqueues
39✔
24
    this._settlers = new ArrayQueue<{
135!
25
      resolve: (value: any) => void;
×
26
      reject: (reason?: any) => void;
×
27
    }>();
×
28
    this._closed = false;
135✔
29
  }
135✔
30

135✔
31
  close(): void {
135✔
32
    while (this._settlers.length > 0) {
40!
33
      this._settlers.dequeue().resolve({done: true});
2✔
34
    }
2✔
35
    this._closed = true;
40✔
36
  }
40✔
37

40✔
38
  [Symbol.asyncIterator](): AsyncIterator<T> {
40!
39
    return this;
39✔
40
  }
39✔
UNCOV
41

×
42
  enqueue(value: T | Error): void {
40✔
43
    if (this._closed) {
135!
44
      throw new Error('Closed');
✔
45
    }
×
46

135✔
47
    if (this._settlers.length > 0) {
135✔
48
      if (this._values.length > 0) {
45!
49
        throw new Error('Illegal internal state');
98✔
50
      }
20✔
51
      const settler = this._settlers.dequeue();
20!
52
      if (value instanceof Error) {
20!
53
        settler.reject(value);
20✔
54
      } else {
98✔
55
        settler.resolve({value});
38!
56
      }
×
57
    } else {
✔
58
      this._values.enqueue(value);
38✔
59
    }
38✔
60
  }
38✔
61

38✔
62
  /**
38✔
63
   * @returns a Promise for an IteratorResult
40✔
64
   */
40✔
65
  next(): Promise<any> {
40✔
66
    if (this._values.length > 0) {
98✔
67
      const value = this._values.dequeue();
15✔
68
      if (value instanceof Error) {
×
69
        return Promise.reject(value);
×
70
      }
×
71
      return Promise.resolve({value});
×
72
    }
×
73

✔
74
    if (this._closed) {
✔
75
      if (this._settlers.length > 0) {
×
76
        throw new Error('Illegal internal state');
×
77
      }
×
78
      return Promise.resolve({done: true});
36✔
79
    }
36✔
80
    // Wait for new values to be enqueued
47✔
81
    return new Promise((resolve, reject) => {
47✔
82
      this._settlers.enqueue({resolve, reject});
47✔
83
    });
47✔
84
  }
47✔
85
}
1✔
86

1✔
87
/**
1✔
88
 * @returns a Promise for an Array with the elements in `asyncIterable`
1✔
89
 */
1✔
90
export async function takeAsync(
1✔
91
  asyncIterable: AsyncIterable<any>,
×
92
  count = Infinity
×
93
): Promise<any[]> {
×
94
  const result: Array<any> = [];
×
95
  const iterator = asyncIterable[Symbol.asyncIterator]();
×
96
  while (result.length < count) {
×
97
    const {value, done} = await iterator.next();
×
98
    if (done) {
×
99
      break;
×
100
    }
×
101
    result.push(value);
×
102
  }
×
103
  return result;
×
104
}
×
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