UNPKG

668 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const config_1 = require("./config");
4exports.default = {
5 warn(func, msg, url) {
6 if (!config_1.default().ignoreWarnings && typeof console === 'object' && console.warn) {
7 console.warn(`Warning: testdouble.js - ${func} - ${msg}${withUrl(url)}`);
8 }
9 },
10 error(func, msg, url) {
11 if (!config_1.default().suppressErrors) {
12 throw new Error(`Error: testdouble.js - ${func} - ${msg}${withUrl(url)}`);
13 }
14 },
15 fail(msg) {
16 throw new Error(msg);
17 }
18};
19var withUrl = (url) => url != null
20 ? ` (see: ${url} )`
21 : '';