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

visgl / luma.gl / 23357510199

20 Mar 2026 06:40PM UTC coverage: 58.158% (+5.9%) from 52.213%
23357510199

push

github

web-flow
chore: Run tests on src instead of dist (#2555)

3021 of 6029 branches covered (50.11%)

Branch coverage included in aggregate %.

7102 of 11377 relevant lines covered (62.42%)

243.33 hits per line

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

70.59
/modules/webgl/src/utils/load-script.ts
1
// luma.gl
2
// SPDX-License-Identifier: MIT
3
// Copyright (c) vis.gl contributors
4

5
/**
6
 * Load a script (identified by an url). When the url returns, the
7
 * content of this file is added into a new script element, attached to the DOM (body element)
8
 * @param scriptUrl defines the url of the script to laod
9
 * @param scriptId defines the id of the script element
10
 */
11
export async function loadScript(scriptUrl: string, scriptId?: string): Promise<Event> {
12
  const head = document.getElementsByTagName('head')[0];
45✔
13
  if (!head) {
45!
14
    throw new Error('loadScript');
×
15
  }
16

17
  const script = document.createElement('script');
45✔
18
  script.setAttribute('type', 'text/javascript');
45✔
19
  script.setAttribute('src', scriptUrl);
45✔
20
  if (scriptId) {
45!
21
    script.id = scriptId;
×
22
  }
23

24
  return new Promise((resolve, reject) => {
45✔
25
    script.onload = resolve;
45✔
26
    script.onerror = error =>
45✔
27
      reject(new Error(`Unable to load script '${scriptUrl}': ${error as string}`));
×
28
    head.appendChild(script);
45✔
29
  });
30
}
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