-if [ "$1" = "misc" ]; then
- npm run build -- --light
- TS_NODE_FILES=true 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 \
- server/tests/plugins/index.ts
-elif [ "$1" = "cli" ]; then
+ jobs=$1
+ shift
+
+ files=$@
+
+ echo $files
+
+ joblog="$jobname-ci.log"
+
+ parallel -j $jobs --retries $retries \
+ "echo Trying {} >> $joblog; npm run mocha -- -c --timeout 30000 --exit --bail {}" \
+ ::: $files
+
+ cat "$joblog" | uniq -c
+ rm "$joblog"
+}
+
+findTestFiles () {
+ exception="-not -name index.js"
+
+ if [ ! -z ${2+x} ]; then
+ exception="$exception -not -name $2"
+ fi
+
+ find $1 -type f -name "*.js" $exception | xargs echo
+}
+
+if [ "$1" = "types-package" ]; then
+ npm run generate-types-package 0.0.0
+ npm run tsc -- --noEmit --esModuleInterop packages/types/tests/test.ts
+elif [ "$1" = "client" ]; then
+ npm run build
+
+ feedsFiles=$(findTestFiles ./dist/server/tests/feeds)
+ helperFiles=$(findTestFiles ./dist/server/tests/helpers)
+ libFiles=$(findTestFiles ./dist/server/tests/lib)
+ miscFiles="./dist/server/tests/client.js ./dist/server/tests/misc-endpoints.js"
+ # Not in their own task, they need an index.html
+ pluginFiles="./dist/server/tests/plugins/html-injection.js ./dist/server/tests/api/server/plugins.js"
+
+ MOCHA_PARALLEL=true runTest "$1" $((2*$speedFactor)) $feedsFiles $helperFiles $miscFiles $pluginFiles $libFiles
+elif [ "$1" = "cli-plugin" ]; then