-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unsuccessful attempt to run karma in continous mode
in watch mode, karmas's web server does not wait for cljs compiler to finish writing generated files, corrupts its own cache and starts serving corrupted files.
- Loading branch information
Showing
6 changed files
with
63 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(ns meld.core-tests | ||
(:require-macros [plastic.logging :refer [log info warn error group group-end]] | ||
[cljs.test :refer [deftest is testing]]) | ||
(:require [meld.core :as core])) | ||
|
||
(deftest meld-core-sample | ||
(testing "testing meld" | ||
(is (= 1 9)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
(ns plastic.suites.all-tests | ||
[:require [plastic.test.sample]]) | ||
[:require [plastic.test.sample] | ||
[plastic.suites.meld-tests]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(ns plastic.suites.meld-tests | ||
[:require [meld.core-tests]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# http://stackoverflow.com/a/32566506/84283 | ||
kill_childs() { | ||
local pid="${1}" | ||
local self="${2:-false}" | ||
|
||
if children="$(pgrep -P "$pid")"; then | ||
for child in $children; do | ||
kill_childs "$child" true | ||
done | ||
fi | ||
|
||
if [ "$self" == true ]; then | ||
kill -s SIGTERM "$pid" || (sleep 10 && kill -9 "$pid" &) | ||
fi | ||
} | ||
|
||
# http://superuser.com/a/917073/8244 | ||
wait_file() { | ||
local file="$1"; shift | ||
local wait_seconds="${1:-10}"; shift # 10 seconds as default timeout | ||
|
||
until test $((wait_seconds--)) -eq 0 -o -f "$file" ; do sleep 1; done | ||
|
||
((++wait_seconds)) | ||
} | ||
|
||
echo "THIS SCRIPT DOES NOT WORK RELIABLY" | ||
echo "karmas's web server does not wait for cljs compiler to finish writing of files, corrupts its own cache and starts serving corrupted files." | ||
|
||
|
||
trap 'echo "killing child processes: $(jobs -p)..." && kill_childs $(jobs -p)' EXIT | ||
|
||
# ensure we start in cljs project root | ||
cd "$(dirname "${BASH_SOURCE[0]}")"; cd ../cljs | ||
|
||
lein clean | ||
lein cljsbuild auto test & | ||
|
||
compiler_output="resources/test/.build/test/plastic.js" | ||
|
||
wait_file $compiler_output 120 || { | ||
echo "compiler output file missing after waiting for $? seconds: '$$compiler_output'" | ||
echo "check for errors/misconfiguration of: lein cljsbuild auto test" | ||
exit 1 | ||
} | ||
|
||
../node_modules/karma/bin/karma start ../karma/dev.conf.js |