From 4c8ef0ec684f5dd1856ec751420b1e85369fd1bf Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 21 Oct 2019 16:24:06 +0200 Subject: [PATCH] Add tsconfig-paths registration to mocha --- scripts/ci.sh | 4 ++-- scripts/test.sh | 2 +- server/tests/api/ci-1.sh | 2 +- server/tests/api/ci-2.sh | 5 +++-- server/tests/api/ci-3.sh | 2 +- server/tests/api/ci-4.sh | 5 +++-- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/scripts/ci.sh b/scripts/ci.sh index 1819f73dd..c023ddf98 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -11,7 +11,7 @@ killall -q peertube || true if [ "$1" = "misc" ]; then npm run build -- --light-fr - mocha --timeout 5000 --exit --require ts-node/register --bail server/tests/client.ts \ + mocha --timeout 5000 --exit --require ts-node/register --require tsconfig-paths/register --bail server/tests/client.ts \ server/tests/feeds/index.ts \ server/tests/misc-endpoints.ts \ server/tests/helpers/index.ts \ @@ -19,7 +19,7 @@ if [ "$1" = "misc" ]; then elif [ "$1" = "cli" ]; then npm run build:server CC=gcc-4.9 CXX=g++-4.9 npm run setup:cli - mocha --timeout 5000 --exit --require ts-node/register --bail server/tests/cli/index.ts + mocha --timeout 5000 --exit --require ts-node/register --require tsconfig-paths/register --bail server/tests/cli/index.ts elif [ "$1" = "api-1" ]; then npm run build:server sh ./server/tests/api/ci-1.sh 2 diff --git a/scripts/test.sh b/scripts/test.sh index 1b6b29b66..8961ddd7e 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -7,4 +7,4 @@ npm run setup:cli npm run ci -- lint -mocha --exit --require ts-node/register/type-check --bail server/tests/index.ts +mocha --exit --require ts-node/register/type-check --require tsconfig-paths/register --bail server/tests/index.ts diff --git a/server/tests/api/ci-1.sh b/server/tests/api/ci-1.sh index 90ffd568b..faa440785 100644 --- a/server/tests/api/ci-1.sh +++ b/server/tests/api/ci-1.sh @@ -6,5 +6,5 @@ checkParamFiles=$(find server/tests/api/check-params -type f | grep -v index.ts notificationsFiles=$(find server/tests/api/notifications -type f | grep -v index.ts | xargs echo) searchFiles=$(find server/tests/api/search -type f | grep -v index.ts | xargs echo) -MOCHA_PARALLEL=true npm run mocha -- --timeout 30000 --exit --require ts-node/register --bail \ +MOCHA_PARALLEL=true npm run mocha -- --timeout 30000 --exit --require ts-node/register --require tsconfig-paths/register --bail \ $notificationsFiles $searchFiles $checkParamFiles diff --git a/server/tests/api/ci-2.sh b/server/tests/api/ci-2.sh index 16ab585e9..52c839d12 100644 --- a/server/tests/api/ci-2.sh +++ b/server/tests/api/ci-2.sh @@ -5,5 +5,6 @@ set -eu serverFiles=$(find server/tests/api/server -type f | grep -v index.ts | xargs echo) usersFiles=$(find server/tests/api/users -type f | grep -v index.ts | xargs echo) -MOCHA_PARALLEL=true npm run mocha-parallel-tests -- --max-parallel $1 --timeout 30000 --exit --require ts-node/register --bail \ - $serverFiles $usersFiles +MOCHA_PARALLEL=true npm run mocha-parallel-tests -- --max-parallel $1 --timeout 30000 --exit \ + --require ts-node/register --require tsconfig-paths/register --bail \ + $serverFiles $usersFiles diff --git a/server/tests/api/ci-3.sh b/server/tests/api/ci-3.sh index 7aeea7fcb..ae5bb735a 100644 --- a/server/tests/api/ci-3.sh +++ b/server/tests/api/ci-3.sh @@ -4,5 +4,5 @@ set -eu videosFiles=$(find server/tests/api/videos -type f | grep -v index.ts | xargs echo) -npm run mocha -- --timeout 30000 --exit --require ts-node/register --bail \ +npm run mocha -- --timeout 30000 --exit --require ts-node/register --require tsconfig-paths/register --bail \ $videosFiles diff --git a/server/tests/api/ci-4.sh b/server/tests/api/ci-4.sh index 74809e1ad..22785cf33 100644 --- a/server/tests/api/ci-4.sh +++ b/server/tests/api/ci-4.sh @@ -5,5 +5,6 @@ set -eu redundancyFiles=$(find server/tests/api/redundancy -type f | grep -v index.ts | xargs echo) activitypubFiles=$(find server/tests/api/activitypub -type f | grep -v index.ts | xargs echo) -MOCHA_PARALLEL=true npm run mocha-parallel-tests -- --max-parallel $1 --timeout 30000 --exit --require ts-node/register --bail \ - $redundancyFiles $activitypubFiles +MOCHA_PARALLEL=true npm run mocha-parallel-tests -- --max-parallel $1 --timeout 30000 --exit \ + --require ts-node/register --require tsconfig-paths/register --bail \ + $redundancyFiles $activitypubFiles