Run front end tests in CI

This commit is contained in:
James Allen 2017-12-14 09:32:38 +00:00
parent d84580f12d
commit d7a26e27e5
6 changed files with 21 additions and 18 deletions

View file

@ -71,16 +71,9 @@ pipeline {
}
}
stage('Unit Tests') {
stage('Test') {
steps {
sh 'make clean install' // Removes js files, so do before compile
sh 'make test_unit MOCHA_ARGS="--reporter=tap"'
}
}
stage('Acceptance Tests') {
steps {
sh 'make test_acceptance MOCHA_ARGS="--reporter=tap"'
sh 'make ci'
}
}
@ -155,6 +148,10 @@ pipeline {
}
post {
always {
sh 'make ci_clean'
}
failure {
mail(from: "${EMAIL_ALERT_FROM}",
to: "${EMAIL_ALERT_TO}",

View file

@ -16,9 +16,10 @@ add_dev: docker-shared.yml
$(NPM) install --save-dev ${P}
install: docker-shared.yml
bin/generate_volumes_file
$(NPM) install
clean:
clean: ci_clean
rm -f app.js
rm -rf app/js
rm -rf test/unit/js
@ -30,9 +31,8 @@ clean:
rm -rf $$dir/test/unit/js; \
rm -rf $$dir/test/acceptance/js; \
done
# Regenerate docker-shared.yml - not stictly a 'clean',
# but lets `make clean install` work nicely
bin/generate_volumes_file
ci_clean:
# Deletes node_modules volume
docker-compose down --volumes
@ -40,11 +40,14 @@ clean:
docker-shared.yml:
bin/generate_volumes_file
test: test_unit test_acceptance
test: test_unit test_frontend test_acceptance
test_unit: docker-shared.yml
docker-compose ${DOCKER_COMPOSE_FLAGS} run --rm test_unit npm -q run test:unit -- ${MOCHA_ARGS}
test_frontend: docker-shared.yml
docker-compose ${DOCKER_COMPOSE_FLAGS} run --rm test_unit npm -q run test:frontend -- ${MOCHA_ARGS}
test_acceptance: test_acceptance_app test_acceptance_modules
test_acceptance_app: test_acceptance_app_start_service test_acceptance_app_run test_acceptance_app_stop_service
@ -71,7 +74,9 @@ test_acceptance_modules: docker-shared.yml
test_acceptance_module: docker-shared.yml
cd $(MODULE) && make test_acceptance
ci: install test
.PHONY:
all add install update test test_unit test_acceptance \
all add install update test test_unit test_unit_frontend test_acceptance \
test_acceptance_start_service test_acceptance_stop_service \
test_acceptance_run
test_acceptance_run ci ci_clean

View file

@ -24,6 +24,7 @@ services:
- ./app/views:/app/app/views:ro
- ./config:/app/config
- ./test/unit/coffee:/app/test/unit/coffee:ro
- ./test/unit_frontend/coffee:/app/test/unit_frontend/coffee:ro
- ./test/acceptance/coffee:/app/test/acceptance/coffee:ro
- ./test/acceptance/files:/app/test/acceptance/files:ro
- ./test/smoke/coffee:/app/test/smoke/coffee:ro

View file

@ -15,9 +15,9 @@
"test:acceptance:dir": "npm -q run compile:acceptance_tests && npm -q run test:acceptance:wait_for_app && npm -q run test:acceptance:run -- $@",
"test:acceptance": "npm -q run test:acceptance:dir -- $@ test/acceptance/js",
"test:unit": "npm -q run compile:backend && npm -q run compile:unit_tests && bin/unit_test $@",
"test:frontend_unit": "npm -q run compile:frontend && npm -q run compile:frontend_unit_tests && bin/frontend_unit_test $@",
"test:frontend": "npm -q run compile:frontend && npm -q run compile:frontend_tests && bin/frontend_test $@",
"compile:unit_tests": "bin/compile_unit_tests",
"compile:frontend_unit_tests": "bin/compile_frontend_unit_tests",
"compile:frontend_tests": "bin/compile_frontend_tests",
"compile:acceptance_tests": "bin/compile_acceptance_tests",
"compile:frontend": "bin/compile_frontend",
"compile:backend": "bin/compile_backend",