Allow modules to specific their own acceptance tests

This commit is contained in:
James Allen 2017-11-24 17:40:24 +00:00
parent 2bc0f666ba
commit 5e0fc24c1a
4 changed files with 21 additions and 21 deletions

View file

@ -36,17 +36,30 @@ test: test_unit test_acceptance
test_unit: docker-shared.yml
docker-compose -f docker-compose.yml ${DOCKER_COMPOSE_FLAGS} run --rm test_unit npm run test:unit -- ${MOCHA_ARGS}
test_acceptance: test_acceptance_start_service test_acceptance_run test_acceptance_stop_service
test_acceptance: test_acceptance_app test_acceptance_modules
test_acceptance_start_service: docker-shared.yml
test_acceptance_app: test_acceptance_app_start_service test_acceptance_app_run test_acceptance_app_stop_service
test_acceptance_app_start_service: docker-shared.yml
docker-compose -f docker-compose.yml ${DOCKER_COMPOSE_FLAGS} up -d test_acceptance
test_acceptance_stop_service: docker-shared.yml
test_acceptance_app_stop_service: docker-shared.yml
docker-compose -f docker-compose.yml ${DOCKER_COMPOSE_FLAGS} stop test_acceptance redis mongo
test_acceptance_run: docker-shared.yml
test_acceptance_app_run: docker-shared.yml
docker-compose -f docker-compose.yml ${DOCKER_COMPOSE_FLAGS} exec -T test_acceptance npm run test:acceptance -- ${MOCHA_ARGS}
test_acceptance_modules: docker-shared.yml
for dir in modules/*; \
do \
if [ -e $$dir/makefile ]; then \
(make test_acceptance_module MODULE=$$dir) \
fi \
done
test_acceptance_module: docker-shared.yml
cd $(MODULE) && make test_acceptance
.PHONY:
all add install update test test_unit test_acceptance \
test_acceptance_start_service test_acceptance_stop_service \

View file

@ -1,18 +1,4 @@
#!/bin/bash
set -e;
MOCHA="node_modules/.bin/mocha --recursive --reporter spec --timeout 15000"
$MOCHA "$@" test/acceptance/js
# TODO: Module acceptance tests are hard to get working,
# because they typically require the server to be instantiated
# with a different config.
# for dir in modules/*;
# do
# if [ -d $dir/test/acceptance/js ]; then
# $MOCHA "$@" $dir/test/acceptance/js
# fi
# done
$MOCHA "$@"

View file

@ -9,7 +9,7 @@ for module in listdir("modules/"):
if module[0] != '.':
if isfile(join("modules", module, 'index.coffee')):
volumes.append(join("modules", module, 'index.coffee'))
for directory in ['app/coffee', 'app/views', 'public/coffee', 'test/unit/coffee', 'test/acceptance/coffee']:
for directory in ['app/coffee', 'app/views', 'public/coffee', 'test/unit/coffee', 'test/acceptance/coffee', 'test/acceptance/config']:
if isdir(join("modules", module, directory)):
volumes.append(join("modules", module, directory))

View file

@ -12,7 +12,8 @@
"scripts": {
"test:acceptance:wait_for_app": "echo 'Waiting for app to be accessible' && while (! curl -s -o /dev/null localhost:3000/status) do sleep 1; done",
"test:acceptance:run": "bin/acceptance_test $@",
"test:acceptance": "npm run compile:acceptance_tests && npm run test:acceptance:wait_for_app && npm run test:acceptance:run -- $@",
"test:acceptance:dir": "npm run compile:acceptance_tests && npm run test:acceptance:wait_for_app && npm run test:acceptance:run -- $@",
"test:acceptance": "npm run test:acceptance:dir test/acceptance/js",
"test:unit": "npm run compile:app && npm run compile:unit_tests && bin/unit_test $@",
"compile:unit_tests": "bin/compile_unit_tests",
"compile:acceptance_tests": "bin/compile_acceptance_tests",