prvi
This commit is contained in:
50
ZpcBulletinBoard/wwwroot/lib/popper/client/mocha/client.js
Normal file
50
ZpcBulletinBoard/wwwroot/lib/popper/client/mocha/client.js
Normal 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
|
||||
}
|
||||
}
|
||||
3130
ZpcBulletinBoard/wwwroot/lib/popper/client/mocha/client.min.js
vendored
Normal file
3130
ZpcBulletinBoard/wwwroot/lib/popper/client/mocha/client.min.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
17
ZpcBulletinBoard/wwwroot/lib/popper/client/mocha/index.html
Normal file
17
ZpcBulletinBoard/wwwroot/lib/popper/client/mocha/index.html
Normal 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>
|
||||
15
ZpcBulletinBoard/wwwroot/lib/popper/client/mocha/logs.html
Normal file
15
ZpcBulletinBoard/wwwroot/lib/popper/client/mocha/logs.html
Normal 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>
|
||||
Reference in New Issue
Block a user