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

overlookmotel / livepack / 3834342779

pending completion
3834342779

push

github

overlookmotel
Instrumentation check WIP 2

2774 of 2992 branches covered (92.71%)

Branch coverage included in aggregate %.

12678 of 14206 relevant lines covered (89.24%)

5728.1 hits per line

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

56.25
/lib/shared/assertBug.js
1
/* --------------------
31✔
2
 * livepack module
31✔
3
 * Assertion function for bugs
31✔
4
 * ------------------*/
31✔
5

31✔
6
'use strict';
31✔
7

31✔
8
// Modules
31✔
9
const {isFunction} = require('is-it-type');
31✔
10

31✔
11
// Exports
31✔
12

31✔
13
/**
31✔
14
 * Assert with error message including request to file an issue in Livepack repo.
31✔
15
 * Use this function for sanity checks - conditions which should never arise if everything is working.
31✔
16
 * @param {*} condition - Condition - if falsy, error will be thrown
31✔
17
 * @param {string} [message] - Error message
31✔
18
 * @param {string} [explanation] - Further context for error
31✔
19
 * @param {Function} [getDiagnostics] - Function to run to get diagnostic details
31✔
20
 * @throws {Error} - If assertion fails
31✔
21
 * @returns {undefined}
31✔
22
 */
31✔
23
module.exports = function assertBug(condition, message, explanation, getDiagnostics) {
31✔
24
        if (condition) return;
56,617✔
25

×
26
        if (!message) message = 'Unknown error';
×
27
        if (isFunction(explanation)) {
×
28
                getDiagnostics = explanation;
×
29
                explanation = null;
×
30
        }
×
31

×
32
        let helpMsg = `${message}.\n`;
×
33
        if (explanation) helpMsg += `${explanation}.\n`;
×
34
        helpMsg += 'This is likely a bug in Livepack.\nPlease raise an issue at https://github.com/overlookmotel/livepack/issues';
×
35
        if (getDiagnostics) {
×
36
                helpMsg += ' including the following details:\n';
×
37
                helpMsg += getDiagnostics();
×
38
        }
×
39

×
40
        console.error(helpMsg); // eslint-disable-line no-console
×
41

×
42
        const err = new Error(message);
×
43
        Error.captureStackTrace(err, assertBug);
×
44
        throw err;
×
45
};
31✔
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

© 2025 Coveralls, Inc