diff --git a/scripts/ci.sh b/scripts/ci.sh index 448c1c91f..bf34cd337 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -20,7 +20,7 @@ runTest () { echo $files - MOCHA_PARALLEL=true parallel -t -j $jobs --retries $retries \ + parallel -t -j $jobs --retries $retries \ npm run mocha -- -c --timeout 30000 --exit --require ts-node/register --require tsconfig-paths/register --bail \ ::: $files } @@ -35,9 +35,9 @@ if [ "$1" = "misc" ]; then feedsFiles=$(findTestFiles server/tests/feeds) helperFiles=$(findTestFiles server/tests/helpers) pluginsFiles=$(findTestFiles server/tests/plugins) - miscFiles=server/tests/client.ts server/tests/misc-endpoints.ts + miscFiles="server/tests/client.ts server/tests/misc-endpoints.ts" - TS_NODE_FILES=true runTest 2 $feedsFiles $helperFiles $pluginsFiles $miscFiles + TS_NODE_FILES=true MOCHA_PARALLEL=true runTest 2 $feedsFiles $helperFiles $pluginsFiles $miscFiles elif [ "$1" = "cli" ]; then npm run build:server npm run setup:cli @@ -52,14 +52,14 @@ elif [ "$1" = "api-1" ]; then notificationsFiles=$(findTestFiles server/tests/api/notifications) searchFiles=$(findTestFiles server/tests/api/search) - runTest 2 $notificationsFiles $searchFiles $checkParamFiles + MOCHA_PARALLEL=true runTest 2 $notificationsFiles $searchFiles $checkParamFiles elif [ "$1" = "api-2" ]; then npm run build:server serverFiles=$(findTestFiles server/tests/api/server) usersFiles=$(findTestFiles server/tests/api/users) - runTest 2 $serverFiles $usersFiles + MOCHA_PARALLEL=true runTest 2 $serverFiles $usersFiles elif [ "$1" = "api-3" ]; then npm run build:server @@ -73,7 +73,7 @@ elif [ "$1" = "api-4" ]; then redundancyFiles=$(findTestFiles server/tests/api/redundancy) activitypubFiles=$(findTestFiles server/tests/api/activitypub) - TS_NODE_FILES=true runTest 2 $activitypubFiles $redundancyFiles $activitypubFiles + MOCHA_PARALLEL=true TS_NODE_FILES=true runTest 2 $activitypubFiles $redundancyFiles $activitypubFiles elif [ "$1" = "external-plugins" ]; then npm run build:server diff --git a/scripts/reset-password.ts b/scripts/reset-password.ts index bf6535cea..6372095d6 100755 --- a/scripts/reset-password.ts +++ b/scripts/reset-password.ts @@ -21,7 +21,7 @@ initDatabaseModels(true) }) .then(user => { if (!user) { - console.error('User unknown.') + console.error('Unknown user.') process.exit(-1) } diff --git a/server/tests/client.ts b/server/tests/client.ts index 648d46414..2d8468c06 100644 --- a/server/tests/client.ts +++ b/server/tests/client.ts @@ -163,8 +163,10 @@ describe('Test a client controllers', function () { .set('Accept', 'text/html') .expect(200) - const expectedLink = '` expect(res.text).to.contain(expectedLink) diff --git a/server/tests/misc-endpoints.ts b/server/tests/misc-endpoints.ts index 32b035c9e..3d0224323 100644 --- a/server/tests/misc-endpoints.ts +++ b/server/tests/misc-endpoints.ts @@ -122,7 +122,7 @@ describe('Test misc endpoints', function () { }) expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') - expect(res.text).to.contain('http://localhost:9001/about/instance') + expect(res.text).to.contain('http://localhost:' + server.port + '/about/instance') }) it('Should get the empty cached sitemap', async function () { @@ -133,7 +133,7 @@ describe('Test misc endpoints', function () { }) expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') - expect(res.text).to.contain('http://localhost:9001/about/instance') + expect(res.text).to.contain('http://localhost:' + server.port + '/about/instance') }) it('Should add videos, channel and accounts and get sitemap', async function () { @@ -156,17 +156,17 @@ describe('Test misc endpoints', function () { }) expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') - expect(res.text).to.contain('http://localhost:9001/about/instance') + expect(res.text).to.contain('http://localhost:' + server.port + '/about/instance') expect(res.text).to.contain('video 1') expect(res.text).to.contain('video 2') expect(res.text).to.not.contain('video 3') - expect(res.text).to.contain('http://localhost:9001/video-channels/channel1') - expect(res.text).to.contain('http://localhost:9001/video-channels/channel2') + expect(res.text).to.contain('http://localhost:' + server.port + '/video-channels/channel1') + expect(res.text).to.contain('http://localhost:' + server.port + '/video-channels/channel2') - expect(res.text).to.contain('http://localhost:9001/accounts/user1') - expect(res.text).to.contain('http://localhost:9001/accounts/user2') + expect(res.text).to.contain('http://localhost:' + server.port + '/accounts/user1') + expect(res.text).to.contain('http://localhost:' + server.port + '/accounts/user2') }) }) diff --git a/shared/extra-utils/cli/cli.ts b/shared/extra-utils/cli/cli.ts index 54d05e9c6..c62e170bb 100644 --- a/shared/extra-utils/cli/cli.ts +++ b/shared/extra-utils/cli/cli.ts @@ -3,7 +3,7 @@ import { exec } from 'child_process' import { ServerInfo } from '../server/servers' function getEnvCli (server?: ServerInfo) { - return `NODE_ENV=test NODE_APP_INSTANCE=${server.serverNumber}` + return `NODE_ENV=test NODE_APP_INSTANCE=${server.internalServerNumber}` } async function execCLI (command: string) {