summaryrefslogtreecommitdiffstats
path: root/node_modules/console-browserify/test/static
diff options
context:
space:
mode:
authorGravatar Piotr Russ <mail@pruss.it> 2020-11-16 00:10:28 +0100
committerGravatar Piotr Russ <mail@pruss.it> 2020-11-16 00:10:28 +0100
commite06ec920f7a5d784e674c4c4b4e6d1da3dc7391d (patch)
tree55713f725f77b44ebfec86e4eec3ce33e71458ca /node_modules/console-browserify/test/static
downloadwebsite_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.gz
website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.bz2
website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.zip
api, login, auth
Diffstat (limited to 'node_modules/console-browserify/test/static')
-rw-r--r--node_modules/console-browserify/test/static/index.html12
-rw-r--r--node_modules/console-browserify/test/static/test-adapter.js53
2 files changed, 65 insertions, 0 deletions
diff --git a/node_modules/console-browserify/test/static/index.html b/node_modules/console-browserify/test/static/index.html
new file mode 100644
index 0000000..dd55012
--- /dev/null
+++ b/node_modules/console-browserify/test/static/index.html
@@ -0,0 +1,12 @@
+<!doctype html>
+<html>
+<head>
+ <meta http-equiv="x-ua-compatible" content="IE=8" >
+ <title>TAPE Example</title>
+ <script src="/testem.js"></script>
+ <script src="test-adapter.js"></script>
+ <script src="bundle.js"></script>
+</head>
+<body>
+</body>
+</html>
diff --git a/node_modules/console-browserify/test/static/test-adapter.js b/node_modules/console-browserify/test/static/test-adapter.js
new file mode 100644
index 0000000..8b4c12d
--- /dev/null
+++ b/node_modules/console-browserify/test/static/test-adapter.js
@@ -0,0 +1,53 @@
+(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 {
+ console.error("failure", m)
+
+ results.failed++
+ }
+
+ results.total++
+
+ // console.log("emitted test", test)
+ socket.emit('test-result', test)
+ results.tests.push(test)
+ } else if (msg === '# ok' || msg.match(/^# tests \d+/)){
+ // console.log("emitted all test")
+ socket.emit('all-test-results', results)
+ }
+
+ // return false if you want to prevent the console message from
+ // going to the console
+ // return false
+ }
+ }
+}())