This commit is contained in:
David Štaleker
2024-02-23 12:56:54 +01:00
parent 18bac3de1c
commit 28d1630749
1388 changed files with 558637 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
const core = require('rijs.core')
, data = require('rijs.data')
, sync = require('rijs.sync')
const ripple = sync(data(core()))
, all = require('utilise/all')
, raw = require('utilise/raw')
, to = require('utilise/to')
, con = window.console
// send tests-starting signal
ripple.send('results', 'SAVE', {
stats: { running: true }
, suites: []
, html: 'Test in progress..'
})
// proxy errors back to terminal
// window.onerror = (message, url, linenumber) =>
// ripple.io.emit('global err', message, url, linenumber)
// proxy console logs back to terminal
;['log', 'info', 'warn', 'error', 'debug'].map(m => {
if (!con || !con[m]) return; // ie
const sup = Function.prototype.bind.call(con[m], con)
window.console[m] = function(){
const args = to.arr(arguments)
// ripple.io.emit('console', m, args.map(d => d))
sup.apply && sup.apply(con, arguments)
}
})
// send final results back
window.finish = function(){
const stats = this.stats
stats.running = false
ripple.send('results', 'SAVE', {
stats
, suites: all('#mocha-report > .suite').map(suite)
, html: raw('#mocha').innerHTML
})
}
function suite(s){
return {
name: raw('h1', s).textContent
, total: '' + all('.test', s).length
, failures: '' + all('.fail', s).length
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Popper Agent (Mocha)</title>
<link rel="stylesheet" href="/mocha.css" />
<!-- { extra scripts } -->
<script src="/mocha/client.min.js"></script>
<script src="/mocha.js"></script>
<script>mocha.setup("bdd")</script>
<script src="/tests.js"></script>
</head>
<body>
<div id="mocha"></div>
<script>mocha.run().on('end', finish)</script>
</body>
</html>

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Popper Results Page (Mocha)</title>
<link rel="stylesheet" href="/mocha.css" />
<script src="/ripple.min.js"></script>
<script src="/mocha.js"></script>
</head>
<body>
<div id="mocha">
<logs-view data="results"></logs-view>
<div id="output"></div>
</div>
</body>
</html>