aboutsummaryrefslogtreecommitdiff
path: root/node_modules/safe-json-parse/test/static
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-06-04 08:51:01 +0200
committerMinteck <contact@minteck.org>2022-06-04 08:51:01 +0200
commit383285ecd5292bf9a825e05904955b937de84cc9 (patch)
tree0a53b6f02c1604b078044567c03dc1b6c944c8c2 /node_modules/safe-json-parse/test/static
downloadequestriadb-383285ecd5292bf9a825e05904955b937de84cc9.tar.gz
equestriadb-383285ecd5292bf9a825e05904955b937de84cc9.tar.bz2
equestriadb-383285ecd5292bf9a825e05904955b937de84cc9.zip
Initial commit
Diffstat (limited to 'node_modules/safe-json-parse/test/static')
-rw-r--r--node_modules/safe-json-parse/test/static/index.html11
-rw-r--r--node_modules/safe-json-parse/test/static/test-adapter.js49
2 files changed, 60 insertions, 0 deletions
diff --git a/node_modules/safe-json-parse/test/static/index.html b/node_modules/safe-json-parse/test/static/index.html
new file mode 100644
index 0000000..60f6ef8
--- /dev/null
+++ b/node_modules/safe-json-parse/test/static/index.html
@@ -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>
diff --git a/node_modules/safe-json-parse/test/static/test-adapter.js b/node_modules/safe-json-parse/test/static/test-adapter.js
new file mode 100644
index 0000000..c512792
--- /dev/null
+++ b/node_modules/safe-json-parse/test/static/test-adapter.js
@@ -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
+ }
+ }
+}())