From a55b7d71cee0c7ba28964162de5253d8f31b3a52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Thu, 24 May 2018 00:06:02 +0200 Subject: [PATCH] Nuke old testing setup --- .travis.yml | 2 +- Makefile | 16 --------- script/phantomjs | 36 ------------------- script/saucelabs | 66 ----------------------------------- script/saucelabs-api | 31 ---------------- script/test | 9 ----- test/.gitignore | 1 - test/.jshintrc | 19 ---------- test/mocha-phantomjs-hooks.js | 8 ----- test/test-worker.html | 45 ------------------------ test/test.html | 64 --------------------------------- 11 files changed, 1 insertion(+), 296 deletions(-) delete mode 100755 script/phantomjs delete mode 100755 script/saucelabs delete mode 100755 script/saucelabs-api delete mode 100755 script/test delete mode 100644 test/.gitignore delete mode 100644 test/.jshintrc delete mode 100644 test/mocha-phantomjs-hooks.js delete mode 100644 test/test-worker.html delete mode 100644 test/test.html diff --git a/.travis.yml b/.travis.yml index 72211b8..03d500e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ before_script: - sh -e /etc/init.d/xvfb start cache: directories: - - phantomjs + - node_modules deploy: provider: npm email: mislav.marohnic@gmail.com diff --git a/Makefile b/Makefile index d532c4d..23ec291 100644 --- a/Makefile +++ b/Makefile @@ -12,20 +12,4 @@ node_modules/: clean: rm -rf ./bower_components ./node_modules -ifeq ($(shell uname -s),Darwin) -sauce_connect/bin/sc: - wget https://saucelabs.com/downloads/sc-4.3.16-osx.zip - unzip sc-4.3.16-osx.zip - mv sc-4.3.16-osx sauce_connect - rm sc-4.3.16-osx.zip -else -sauce_connect/bin/sc: - mkdir -p sauce_connect - curl -fsSL http://saucelabs.com/downloads/sc-4.3.16-linux.tar.gz | tar xz -C sauce_connect --strip-components 1 -endif - -phantomjs/bin/phantomjs: - mkdir -p phantomjs - wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 -O- | tar xj -C phantomjs --strip-components 1 - .PHONY: clean lint test diff --git a/script/phantomjs b/script/phantomjs deleted file mode 100755 index 935a7fa..0000000 --- a/script/phantomjs +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -set -e - -port=3900 - -# Find next available port -while lsof -i :$((++port)) >/dev/null; do true; done - -# Spin a test server in the background -node ./script/server $port &>/dev/null & -server_pid=$! -trap "kill $server_pid" INT EXIT - -STATUS=0 - -reporter=dot -[ -z "$CI" ] || reporter=spec - -if [ -n "$TRAVIS" ]; then - make phantomjs/bin/phantomjs - export PATH="$PWD/phantomjs/bin:$PATH" -fi - -run() { - phantomjs ./node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js \ - "$1" $reporter "{\"useColors\":true, \"hooks\":\"$PWD/test/mocha-phantomjs-hooks.js\"}" \ - || STATUS=$? -} - -[ -z "$CI" ] || echo "phantomjs $(phantomjs -v)" - -run "http://localhost:$port/" -run "http://localhost:$port/test/test-worker.html" - -exit $STATUS diff --git a/script/saucelabs b/script/saucelabs deleted file mode 100755 index 8c99620..0000000 --- a/script/saucelabs +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash - -set -e - -port=8080 - -# Spin a test server in the background -node ./script/server $port &>/dev/null & -server_pid=$! -trap "kill $server_pid" INT EXIT - -make sauce_connect/bin/sc -sauce_ready="${TMPDIR:-/tmp}/sauce-ready.$$" -sauce_connect/bin/sc -u "$SAUCE_USERNAME" -k "$SAUCE_ACCESS_KEY" \ - -i "$TRAVIS_JOB_NUMBER" -l sauce_connect.log -f "$sauce_ready" &>/dev/null & -sauce_pid=$! -trap "kill $sauce_pid" INT EXIT - -sauce_waited=0 -while [ ! -f "$sauce_ready" ]; do - if [ "$sauce_waited" -gt 60000 ]; then - echo "sauce_connect failed to start within 60 seconds" >&2 - exit 1 - fi - sleep .01 - sauce_waited=$((sauce_waited + 10)) -done -echo "sauce_connect started within $sauce_waited ms" -rm -f "$sauce_ready" - -job="$(./script/saucelabs-api --raw "js-tests" <&2 - exit 1 - fi - grep -q "^completed: true" <<<"$result" && break - echo -n "." -done - -echo - -awk ' - /result\.tests:/ { tests+=$(NF) } - /result\.passes:/ { passes+=$(NF) } - /result\.pending:/ { pending+=$(NF) } - /result\.failures:/ { failures+=$(NF) } - /\.url:/ { print $(NF) } - END { - printf "%d passed, %d pending, %d failures\n", passes, pending, failures - if (failures > 0 || tests != passes + pending || tests == 0) exit 1 - } -' <<<"$result" diff --git a/script/saucelabs-api b/script/saucelabs-api deleted file mode 100755 index 344c320..0000000 --- a/script/saucelabs-api +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -set -e -set -o pipefail - -raw="" -if [ "$1" = "--raw" ]; then - raw="1" - shift 1 -fi - -endpoint="$1" - -curl -fsS -X POST "https://saucelabs.com/rest/v1/$SAUCE_USERNAME/${endpoint}" \ - -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" \ - -H "Content-Type: application/json" -d "@-" | \ -{ - if [ -n "$raw" ]; then - cat - else - ruby -rjson -e ' - dump = lambda do |obj, ns| - case obj - when Array then obj.each_with_index { |v, i| dump.call(v, [ns, i]) } - when Hash then obj.each { |k, v| dump.call(v, [ns, k]) } - else puts "%s: %s" % [ ns.flatten.compact.join("."), obj.to_s ] - end - end - dump.call JSON.parse(STDIN.read), nil - ' - fi -} diff --git a/script/test b/script/test deleted file mode 100755 index bc471d4..0000000 --- a/script/test +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -set -e - -if [ -n "$SAUCE_BROWSER" ]; then - ./script/saucelabs -else - ./script/phantomjs -fi diff --git a/test/.gitignore b/test/.gitignore deleted file mode 100644 index e6011a5..0000000 --- a/test/.gitignore +++ /dev/null @@ -1 +0,0 @@ -server.pid diff --git a/test/.jshintrc b/test/.jshintrc deleted file mode 100644 index 300079e..0000000 --- a/test/.jshintrc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../.jshintrc", - "es3": false, - "strict": false, - "sub": true, - "globals": { - "fetch": false, - "Headers": false, - "Request": false, - "Response": false, - "mocha": false, - "chai": false, - "suite": false, - "setup": false, - "suiteSetup": false, - "test": false, - "assert": false - } -} diff --git a/test/mocha-phantomjs-hooks.js b/test/mocha-phantomjs-hooks.js deleted file mode 100644 index 659d9b4..0000000 --- a/test/mocha-phantomjs-hooks.js +++ /dev/null @@ -1,8 +0,0 @@ -exports.beforeStart = function(context) { - var originalResourceError = context.page.onResourceError - context.page.onResourceError = function(resErr) { - if (!/\/boom$/.test(resErr.url)) { - originalResourceError(resErr) - } - } -} diff --git a/test/test-worker.html b/test/test-worker.html deleted file mode 100644 index 71c259f..0000000 --- a/test/test-worker.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - Fetch Worker Tests - - - -
- - - - - - diff --git a/test/test.html b/test/test.html deleted file mode 100644 index eea0df3..0000000 --- a/test/test.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - Fetch Tests - - - -
- - - - - - - - - - - - - -