prvi
This commit is contained in:
64
ZpcBulletinBoard/wwwroot/lib/popper/client/tape/client.js
Normal file
64
ZpcBulletinBoard/wwwroot/lib/popper/client/tape/client.js
Normal file
@@ -0,0 +1,64 @@
|
||||
const debounce = require('utilise/debounce')
|
||||
, escape = require('utilise/escape')
|
||||
, noop = require('utilise/noop')
|
||||
, raw = require('utilise/raw')
|
||||
, to = require('utilise/to')
|
||||
, core = require('rijs.core')
|
||||
, data = require('rijs.data')
|
||||
, sync = require('rijs.sync')
|
||||
|
||||
const ripple = sync(data(core()))
|
||||
, con = window.console
|
||||
, log = con ? Function.prototype.bind.call(con.log, con) : noop
|
||||
|
||||
var html = ''
|
||||
, running = true
|
||||
, failures = 0
|
||||
, passes = 0
|
||||
, tests = 0
|
||||
, name = 'All Tests'
|
||||
, output = raw('pre')
|
||||
|
||||
// send tests-starting signal
|
||||
ripple.send('results', 'SAVE', {
|
||||
stats: { running }
|
||||
, 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)
|
||||
}
|
||||
})
|
||||
|
||||
// stream results back
|
||||
var update = debounce(500)(function(){
|
||||
const stats = { running, tests, passes, failures }
|
||||
, suites = [{ name, failures, total: tests }]
|
||||
|
||||
output.innerHTML = html
|
||||
ripple.send('results', 'SAVE', { stats, suites, html })
|
||||
})
|
||||
|
||||
// listen on log
|
||||
;(window.console = window.console || {}).log = function(){
|
||||
const line = to.arr(arguments).join(' ')
|
||||
html += escape(line) + '\n'
|
||||
|
||||
if (-1 === includes('# tests')(line)) running = false
|
||||
if (-1 === includes('ok ')(line)) { passes++; tests++ }
|
||||
if (-1 === includes('not ok ')(line)) { failures++; tests++ }
|
||||
|
||||
if (line.match(/^(?!.*\[ri\/)/)) update()
|
||||
log.apply(console, arguments)
|
||||
}
|
||||
3173
ZpcBulletinBoard/wwwroot/lib/popper/client/tape/client.min.js
vendored
Normal file
3173
ZpcBulletinBoard/wwwroot/lib/popper/client/tape/client.min.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
15
ZpcBulletinBoard/wwwroot/lib/popper/client/tape/index.html
Normal file
15
ZpcBulletinBoard/wwwroot/lib/popper/client/tape/index.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta charset="utf-8">
|
||||
<title>Popper Agent (Tape)</title>
|
||||
<!-- { extra scripts } -->
|
||||
<script src="/utilise.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre></pre>
|
||||
</body>
|
||||
</html>
|
||||
<script src="/tape/client.min.js"></script>
|
||||
<script src="/tests.js"></script>
|
||||
13
ZpcBulletinBoard/wwwroot/lib/popper/client/tape/logs.html
Normal file
13
ZpcBulletinBoard/wwwroot/lib/popper/client/tape/logs.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Popper Results Page (Tape)</title>
|
||||
<script src="/ripple.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<code>
|
||||
<logs-view data="results"></logs-view>
|
||||
<pre id="output"></pre>
|
||||
</code>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user