Run all tests on their own directories

This allows running figwheel on main folder, without node_modules from
tests messing the environment.
This commit is contained in:
Juho Teperi 2017-10-13 15:02:10 +03:00
parent 46d0e9d701
commit 14c43e066f
52 changed files with 10904 additions and 27 deletions

2
.gitignore vendored
View File

@ -19,3 +19,5 @@ outsite/bundle.js
outsite/bundle.min.js outsite/bundle.min.js
node_modules node_modules
pre-render pre-render
test-environments/*/outsite

View File

@ -7,32 +7,7 @@ dependencies:
override: override:
- lein deps - lein deps
- npm install -g karma-cli - npm install -g karma-cli
- npm install - ./prepare-tests.sh
test: test:
override: override:
# Cljsjs - browser - ./run-tests.sh
- rm -rf node_modules/react node_modules/react-dom node_modules/create-react-class node_modules/@cljs-oss
- lein with-profile test do clean, doo chrome-headless client once
- test -f out/cljsjs/react/development/react.inc.js
# Cljsjs - browser - React 16
- lein with-profile react-16,test do clean, doo chrome-headless client once
- test -f out/cljsjs/react/development/react.inc.js
# Cljsjs - Production build - Browser
- lein with-profile prod-test do clean, doo chrome-headless client once
# Node Modules - Browser
- npm install
- lein with-profile test do clean, doo chrome-headless client once
- test -f out/node_modules/react/react.js
# Node Modules - Node Target
- lein with-profile node-test do clean, doo node client once
- test ! -f out/node_modules/react/index.js
- grep "reagent.impl.template.node\$module\$react = require('react')" out/reagent/impl/template.js
# Node Modules - Browser - React 16
- npm install react@16.0.0 react-dom@16.0.0
- lein with-profile test do clean, doo chrome-headless client once
- test -f out/node_modules/react/index.js

8
prepare-tests.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
for env in test-environments/*; do
(
cd "$env"
npm install
)
done

33
run-tests.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
# Kill all subshells with ctrl-c
trap "kill 0" SIGINT
reset='\033[0m'
blue='\033[0;34m'
red='\033[0;31m'
EXIT=0
for env in test-environments/*; do
FAIL=0
name=$(basename "$env")
(
cd "$env"
echo -e "$blue##"
echo -e "## TESTING $name"
echo -e "##$reset"
echo
./test.sh
)
[[ $? != "0" ]] && FAIL=1
if [[ $FAIL != "0" ]]; then
echo
echo -e "$red!! FAIL $name$reset"
EXIT=1
fi
echo
echo
done
exit $EXIT

View File

@ -0,0 +1 @@
../../demo

View File

@ -0,0 +1 @@
../../examples

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
{
"dependencies": {
"@cljs-oss/module-deps": "1.1.1",
"create-react-class": "^15.6.2",
"react": "^16.0.0",
"react-dom": "^16.0.0"
},
"devDependencies": {
"karma": "^1.7.1",
"karma-chrome-launcher": "^2.2.0",
"karma-cljs-test": "^0.1.0"
}
}

View File

@ -0,0 +1 @@
../../project.clj

View File

@ -0,0 +1 @@
../../src

View File

@ -0,0 +1 @@
../../test

View File

@ -0,0 +1,4 @@
#!/bin/bash
set -ex
lein with-profile test do clean, doo chrome-headless client once
test -f out/node_modules/react/index.js

View File

@ -0,0 +1 @@
../../demo

View File

@ -0,0 +1 @@
../../examples

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
{
"dependencies": {
"@cljs-oss/module-deps": "1.1.1",
"create-react-class": "^15.6.2",
"react": "^15.6.2",
"react-dom": "^15.6.2"
},
"devDependencies": {
"karma": "^1.7.1",
"karma-chrome-launcher": "^2.2.0",
"karma-cljs-test": "^0.1.0"
}
}

View File

@ -0,0 +1 @@
../../project.clj

View File

@ -0,0 +1 @@
../../src

View File

@ -0,0 +1 @@
../../test

View File

@ -0,0 +1,4 @@
#!/bin/bash
set -ex
lein with-profile test do clean, doo chrome-headless client once
test -f out/node_modules/react/react.js

View File

@ -0,0 +1 @@
../../demo

View File

@ -0,0 +1 @@
../../examples

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
../browser-umd/package.json

View File

@ -0,0 +1 @@
../../project.clj

View File

@ -0,0 +1 @@
../../src

View File

@ -0,0 +1 @@
../../test

View File

@ -0,0 +1,3 @@
#!/bin/bash
set -ex
lein with-profile prod-test do clean, doo chrome-headless client once

View File

@ -0,0 +1 @@
../../demo

View File

@ -0,0 +1 @@
../../examples

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
../browser-umd/package.json

View File

@ -0,0 +1 @@
../../project.clj

View File

@ -0,0 +1 @@
../../src

View File

@ -0,0 +1 @@
../../test

View File

@ -0,0 +1,4 @@
#!/bin/bash
set -ex
lein with-profile react-16,test do clean, doo chrome-headless client once
test -f out/cljsjs/react/development/react.inc.js

View File

@ -0,0 +1 @@
../../demo

View File

@ -0,0 +1 @@
../../examples

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
{
"devDependencies": {
"karma": "^1.7.1",
"karma-chrome-launcher": "^2.2.0",
"karma-cljs-test": "^0.1.0"
}
}

View File

@ -0,0 +1 @@
../../project.clj

View File

@ -0,0 +1 @@
../../src

View File

@ -0,0 +1 @@
../../test

View File

@ -0,0 +1,4 @@
#!/bin/bash
set -ex
lein with-profile test do clean, doo chrome-headless client once
test -f out/cljsjs/react/development/react.inc.js

1
test-environments/node/demo Symbolic link
View File

@ -0,0 +1 @@
../../demo

View File

@ -0,0 +1 @@
../../examples

2041
test-environments/node/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
{
"dependencies": {
"@cljs-oss/module-deps": "1.1.1",
"create-react-class": "^15.6.2",
"react": "^15.6.2",
"react-dom": "^15.6.2"
},
"devDependencies": {
"karma": "^1.7.1",
"karma-chrome-launcher": "^2.2.0",
"karma-cljs-test": "^0.1.0"
}
}

View File

@ -0,0 +1 @@
../../project.clj

1
test-environments/node/src Symbolic link
View File

@ -0,0 +1 @@
../../src

1
test-environments/node/test Symbolic link
View File

@ -0,0 +1 @@
../../test

5
test-environments/node/test.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
set -ex
lein with-profile node-test do clean, doo node client once
test ! -f out/node_modules/react/index.js
grep "reagent.impl.template.node\$module\$react = require('react')" out/reagent/impl/template.js