codi-test-framework
Advanced tools
Comparing version 1.0.14 to 1.0.15
118
browser.js
@@ -368,70 +368,68 @@ var __defProp = Object.defineProperty; | ||
function codepenLogging() { | ||
var console2 = function() { | ||
var following = false, pre = document.createElement("pre"), code = document.createElement("code"); | ||
pre.appendChild(code); | ||
document.body.appendChild(pre); | ||
var originalConsole = { | ||
log: window.console.log, | ||
info: window.console.info, | ||
warn: window.console.warn, | ||
error: window.console.error | ||
}; | ||
window.console = { | ||
clear, | ||
follow, | ||
log: function(...args) { | ||
print("debug", ...args); | ||
originalConsole.log(...args); | ||
}, | ||
info: function(...args) { | ||
print("info", ...args); | ||
originalConsole.info(...args); | ||
}, | ||
warn: function(...args) { | ||
print("warn", ...args); | ||
originalConsole.warn(...args); | ||
}, | ||
error: function(...args) { | ||
print("error", ...args); | ||
originalConsole.error(...args); | ||
} | ||
}; | ||
function clear() { | ||
while (code.hasChildNodes()) { | ||
code.removeChild(code.lastChild); | ||
} | ||
var following = false, pre = document.createElement("pre"), code = document.createElement("code"); | ||
pre.appendChild(code); | ||
document.body.appendChild(pre); | ||
var originalConsole = { | ||
log: window.console.log, | ||
info: window.console.info, | ||
warn: window.console.warn, | ||
error: window.console.error | ||
}; | ||
function clear() { | ||
while (code.hasChildNodes()) { | ||
code.removeChild(code.lastChild); | ||
} | ||
function follow() { | ||
following = true; | ||
} | ||
function print(className, ...objects) { | ||
let s = objects.map((obj) => { | ||
if (typeof obj === "string") { | ||
return obj; | ||
} else { | ||
try { | ||
return JSON.stringify(obj); | ||
} catch (e) { | ||
return String(obj); | ||
} | ||
} | ||
function follow() { | ||
following = true; | ||
} | ||
function print(className, ...objects) { | ||
let s = objects.map((obj) => { | ||
if (typeof obj === "string") { | ||
return obj; | ||
} else { | ||
try { | ||
return JSON.stringify(obj); | ||
} catch (e) { | ||
return String(obj); | ||
} | ||
}).join(" "); | ||
s = s.replace(/\[\d{1,2}m/g, ""); | ||
var span = document.createElement("span"), text = document.createTextNode(s + "\n"); | ||
span.setAttribute("class", className); | ||
span.appendChild(text); | ||
code.appendChild(span); | ||
if (following) { | ||
scrollToBottom(); | ||
} | ||
}).join(" "); | ||
s = s.replace(/\[\d{1,2}m/g, ""); | ||
var span = document.createElement("span"), text = document.createTextNode(s + "\n"); | ||
span.setAttribute("class", className); | ||
span.appendChild(text); | ||
code.appendChild(span); | ||
if (following) { | ||
scrollToBottom(); | ||
} | ||
function scrollToBottom() { | ||
window.scrollTo(0, document.body.scrollHeight); | ||
} | ||
function scrollToBottom() { | ||
window.scrollTo(0, document.body.scrollHeight); | ||
} | ||
window.console = { | ||
clear, | ||
follow, | ||
log: function(...args) { | ||
print("debug", ...args); | ||
originalConsole.log(...args); | ||
}, | ||
info: function(...args) { | ||
print("info", ...args); | ||
originalConsole.info(...args); | ||
}, | ||
warn: function(...args) { | ||
print("warn", ...args); | ||
originalConsole.warn(...args); | ||
}, | ||
error: function(...args) { | ||
print("error", ...args); | ||
originalConsole.error(...args); | ||
} | ||
return window.console; | ||
}(); | ||
}; | ||
return window.console; | ||
} | ||
// src/_codi.js | ||
var version = "v1.0.14"; | ||
var version = "v1.0.15"; | ||
var codi = { | ||
@@ -438,0 +436,0 @@ describe, |
{ | ||
"name": "codi-test-framework", | ||
"version": "1.0.14", | ||
"version": "1.0.15", | ||
"description": "A simple test framework for JavaScript", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -13,3 +13,3 @@ import assertions from "./assertions/_assertions.js"; | ||
const version = 'v1.0.14'; | ||
const version = 'v1.0.15'; | ||
@@ -16,0 +16,0 @@ // Create the codi object to hold all exports |
@@ -1,85 +0,83 @@ | ||
// Console implementation | ||
// console-implementation.js | ||
export function codepenLogging() { | ||
var console = (function () { | ||
var following = false, | ||
pre = document.createElement('pre'), | ||
code = document.createElement('code'); | ||
var following = false, | ||
pre = document.createElement('pre'), | ||
code = document.createElement('code'); | ||
pre.appendChild(code); | ||
document.body.appendChild(pre); | ||
pre.appendChild(code); | ||
document.body.appendChild(pre); | ||
// Capture the original console methods | ||
var originalConsole = { | ||
log: window.console.log, | ||
info: window.console.info, | ||
warn: window.console.warn, | ||
error: window.console.error | ||
}; | ||
// Capture the original console methods | ||
var originalConsole = { | ||
log: window.console.log, | ||
info: window.console.info, | ||
warn: window.console.warn, | ||
error: window.console.error | ||
}; | ||
// Override the global console | ||
window.console = { | ||
clear: clear, | ||
follow: follow, | ||
log: function (...args) { | ||
print('debug', ...args); | ||
originalConsole.log(...args); | ||
}, | ||
info: function (...args) { | ||
print('info', ...args); | ||
originalConsole.info(...args); | ||
}, | ||
warn: function (...args) { | ||
print('warn', ...args); | ||
originalConsole.warn(...args); | ||
}, | ||
error: function (...args) { | ||
print('error', ...args); | ||
originalConsole.error(...args); | ||
} | ||
}; | ||
function clear() { | ||
while (code.hasChildNodes()) { | ||
code.removeChild(code.lastChild); | ||
} | ||
function clear() { | ||
while (code.hasChildNodes()) { | ||
code.removeChild(code.lastChild); | ||
} | ||
} | ||
function follow() { | ||
following = true; | ||
} | ||
function follow() { | ||
following = true; | ||
} | ||
function print(className, ...objects) { | ||
let s = objects.map(obj => { | ||
if (typeof obj === 'string') { | ||
return obj; | ||
} else { | ||
try { | ||
return JSON.stringify(obj); | ||
} catch (e) { | ||
return String(obj); | ||
} | ||
function print(className, ...objects) { | ||
let s = objects.map(obj => { | ||
if (typeof obj === 'string') { | ||
return obj; | ||
} else { | ||
try { | ||
return JSON.stringify(obj); | ||
} catch (e) { | ||
return String(obj); | ||
} | ||
}).join(' '); | ||
} | ||
}).join(' '); | ||
// Remove only the ANSI escape sequences while keeping the text | ||
s = s.replace(/\[\d{1,2}m/g, ''); | ||
// Remove only the ANSI escape sequences while keeping the text | ||
s = s.replace(/\[\d{1,2}m/g, ''); | ||
var span = document.createElement('span'), | ||
text = document.createTextNode(s + '\n'); | ||
var span = document.createElement('span'), | ||
text = document.createTextNode(s + '\n'); | ||
span.setAttribute('class', className); | ||
span.appendChild(text); | ||
code.appendChild(span); | ||
span.setAttribute('class', className); | ||
span.appendChild(text); | ||
code.appendChild(span); | ||
if (following) { | ||
scrollToBottom(); | ||
} | ||
if (following) { | ||
scrollToBottom(); | ||
} | ||
} | ||
function scrollToBottom() { | ||
window.scrollTo(0, document.body.scrollHeight); | ||
function scrollToBottom() { | ||
window.scrollTo(0, document.body.scrollHeight); | ||
} | ||
// Override the global console | ||
window.console = { | ||
clear: clear, | ||
follow: follow, | ||
log: function (...args) { | ||
print('debug', ...args); | ||
originalConsole.log(...args); | ||
}, | ||
info: function (...args) { | ||
print('info', ...args); | ||
originalConsole.info(...args); | ||
}, | ||
warn: function (...args) { | ||
print('warn', ...args); | ||
originalConsole.warn(...args); | ||
}, | ||
error: function (...args) { | ||
print('error', ...args); | ||
originalConsole.error(...args); | ||
} | ||
}; | ||
return window.console; | ||
}()); | ||
return window.console; | ||
} |
// Import and run tests | ||
import * as codi from 'https://esm.sh/codi-test-framework@1.0.13'; | ||
import * as codi from 'https://esm.sh/codi-test-framework@1.0.14'; | ||
codi.codepenLogging(); | ||
// Main test execution | ||
@@ -5,0 +7,0 @@ await codi.runWebTestFunction(async () => { |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
55741
1466