From 7081a7ec3c6418dfcc10036aa2624f9ade6d7330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Sun, 1 Dec 2019 13:04:56 +0100 Subject: [PATCH] Better script organization --- docker/scripts/test-setup.sh | 2 ++ package.json | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docker/scripts/test-setup.sh b/docker/scripts/test-setup.sh index 876285b7..9d735d9a 100644 --- a/docker/scripts/test-setup.sh +++ b/docker/scripts/test-setup.sh @@ -8,5 +8,7 @@ source /src/nodejs-install.sh git clone https://github.com/CartoDB/cartodb-postgresql.git cd cartodb-postgresql && make && make install && cd .. +cp config/environments/test.js.example config/environments/test.js + npm ci npm test diff --git a/package.json b/package.json index d2057269..7a44b133 100644 --- a/package.json +++ b/package.json @@ -82,11 +82,16 @@ "pretest:setup": "npm run lint", "test:setup": "NODE_ENV=test node test setup", "pretest": "npm run test:setup", - "test": "NODE_ENV=test mocha -t 5000 --exit --recursive test/acceptance test/integration test/unit", + "test": "npm run test:all", + "test:all": "npm run test:unit && npm run test:integration && npm run test:acceptance", + "test:acceptance": "NODE_ENV=test mocha -t 5000 --exit --recursive test/acceptance", + "test:integration": "NODE_ENV=test mocha -t 5000 --exit --recursive test/integration", + "test:unit": "NODE_ENV=test mocha -t 5000 --exit --recursive test/unit", "posttest": "npm run test:teardown", "test:teardown": "NODE_ENV=test node test teardown", - "cover": "npm run test:setup && nyc --reporter=lcov mocha -t 5000 --exit --recursive test/acceptance test/integration test/unit && npm run test:teardown", - "pretest:docker": "cp config/environments/test.js.example config/environments/test.js", + "precover": "npm run test:setup", + "cover": "NODE_ENV=test nyc --reporter=lcov npm run test:all", + "postcover": "npm run test:teardown", "test:docker": "docker run -e \"NODEJS_VERSION=$NODE_VERSION\" -v `pwd`:/srv $DOCKER_IMAGE bash docker/scripts/test-setup.sh && docker ps --filter status=dead --filter status=exited -aq | xargs docker rm -v", "docker:bash": "docker run -it -v `pwd`:/srv $DOCKER_IMAGE bash" },