This commit is contained in:
2025-05-12 05:38:44 +09:00
parent dced21c3f8
commit 6d78bfa46e
8120 changed files with 1161564 additions and 0 deletions

View File

@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>TAPE Example</title>
<script src="/testem.js"></script>
<script src="test-adapter.js"></script>
<script src="bundle.js"></script>
</head>
<body>
</body>
</html>

View File

@ -0,0 +1,49 @@
(function () {
var Testem = window.Testem
var regex = /^((?:not )?ok) (\d+) (.+)$/
Testem.useCustomAdapter(tapAdapter)
function tapAdapter(socket){
var results = {
failed: 0
, passed: 0
, total: 0
, tests: []
}
socket.emit('tests-start')
Testem.handleConsoleMessage = function(msg){
var m = msg.match(regex)
if (m) {
var passed = m[1] === 'ok'
var test = {
passed: passed ? 1 : 0,
failed: passed ? 0 : 1,
total: 1,
id: m[2],
name: m[3],
items: []
}
if (passed) {
results.passed++
} else {
results.failed++
}
results.total++
socket.emit('test-result', test)
results.tests.push(test)
} else if (msg === '# ok' || msg.match(/^# tests \d+/)){
socket.emit('all-test-results', results)
}
// return false if you want to prevent the console message from
// going to the console
// return false
}
}
}())