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

overlookmotel / livepack / 7309490893

23 Dec 2023 05:09PM UTC coverage: 90.151% (-0.4%) from 90.525%
7309490893

push

github

overlookmotel
Rename top level `require` functions in CommonJS WIP

4693 of 5075 branches covered (0.0%)

Branch coverage included in aggregate %.

30 of 68 new or added lines in 4 files covered. (44.12%)

36 existing lines in 2 files now uncovered.

12479 of 13973 relevant lines covered (89.31%)

8656.4 hits per line

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

94.12
/lib/init/getScopeId.js
1
/* --------------------
62✔
2
 * livepack module
62✔
3
 * Function to get unique scope ID, with other static method attached.
62✔
4
 * ------------------*/
62✔
5

62✔
6
'use strict';
62✔
7

62✔
8
const {defineProperty, defineProperties, getOwnPropertyDescriptors} = Object;
62✔
9

62✔
10
// Exports
62✔
11

62✔
12
module.exports = getScopeId;
62✔
13

62✔
14
/**
62✔
15
 * Get unique scope ID.
62✔
16
 * @returns {number} - Scope ID
62✔
17
 */
62✔
18
function getScopeId() {
100,356✔
19
        return nextScopeId++; // eslint-disable-line no-use-before-define
100,356✔
20
}
100,356✔
21

62✔
22
let nextScopeId = 1;
62✔
23

62✔
24
// Add additional static methods
62✔
25
getScopeId.toRest = toRest;
62✔
26
getScopeId.renameRequireAlias = renameRequireAlias;
62✔
27

62✔
28
/**
62✔
29
 * Convert object to array.
62✔
30
 * Used for instrumenting rest param in functions.
62✔
31
 * @param {Object} obj - Object
62✔
32
 * @returns {Array} - Array
62✔
33
 */
62✔
34
function toRest(obj) {
32✔
35
        return defineProperties([], getOwnPropertyDescriptors(obj));
32✔
36
}
32✔
37

62✔
38
/**
62✔
39
 * Set name property of a function to 'require'.
62✔
40
 * @param {Function} req - Function
62✔
41
 * @returns {Function} - Input function
62✔
42
 */
62✔
NEW
43
function renameRequireAlias(req) {
×
NEW
44
        return defineProperty(req, 'name', {value: 'require'});
×
NEW
45
}
×
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