From 6938ace7ee79ae249294dbf1a58f404d222715ef Mon Sep 17 00:00:00 2001 From: Barry Chen Date: Wed, 8 Jun 2022 16:19:19 -0500 Subject: [PATCH] fix(tests): fix issues w/ running auth-server tests locally Because: - auth-server tests were not passing in local env with default/no configs This commit: - add or pass env vars to get some tests running --- packages/fxa-auth-server/scripts/test-local.sh | 1 + packages/fxa-auth-server/test/scripts/bulk-mailer.js | 1 + packages/fxa-auth-server/test/scripts/delete-account.js | 1 + packages/fxa-auth-server/test/scripts/dump-users.js | 1 + packages/fxa-auth-server/test/scripts/verification-reminders.js | 1 + packages/fxa-auth-server/test/scripts/write-emails-to-disk.js | 1 + 6 files changed, 6 insertions(+) diff --git a/packages/fxa-auth-server/scripts/test-local.sh b/packages/fxa-auth-server/scripts/test-local.sh index c618b57f6a..78d5f162f0 100755 --- a/packages/fxa-auth-server/scripts/test-local.sh +++ b/packages/fxa-auth-server/scripts/test-local.sh @@ -8,6 +8,7 @@ rm -rf .nyc_output if [ -z "$NODE_ENV" ]; then export NODE_ENV=dev; fi; if [ -z "$CORS_ORIGIN" ]; then export CORS_ORIGIN="http://foo,http://bar"; fi; +if [ -z "$FIRESTORE_EMULATOR_HOST" ]; then export FIRESTORE_EMULATOR_HOST="localhost:9090"; fi; DEFAULT_ARGS="--require esbuild-register --recursive --timeout 5000 --exit" diff --git a/packages/fxa-auth-server/test/scripts/bulk-mailer.js b/packages/fxa-auth-server/test/scripts/bulk-mailer.js index a9310c9077..7b0e250ddb 100644 --- a/packages/fxa-auth-server/test/scripts/bulk-mailer.js +++ b/packages/fxa-auth-server/test/scripts/bulk-mailer.js @@ -69,6 +69,7 @@ const DB = require('../../lib/db')(config, log, Token, UnblockCode); const execOptions = { cwd, env: { + ...process.env, NODE_ENV: 'dev', LOG_LEVEL: 'error', AUTH_FIRESTORE_EMULATOR_HOST: 'localhost:9090', diff --git a/packages/fxa-auth-server/test/scripts/delete-account.js b/packages/fxa-auth-server/test/scripts/delete-account.js index 6fd086172a..dc641d4907 100644 --- a/packages/fxa-auth-server/test/scripts/delete-account.js +++ b/packages/fxa-auth-server/test/scripts/delete-account.js @@ -16,6 +16,7 @@ const cwd = path.resolve(__dirname, ROOT_DIR); const execOptions = { cwd, env: { + PATH: process.env.PATH || '', NODE_ENV: 'dev', LOG_LEVEL: 'error', AUTH_FIRESTORE_EMULATOR_HOST: 'localhost:9090', diff --git a/packages/fxa-auth-server/test/scripts/dump-users.js b/packages/fxa-auth-server/test/scripts/dump-users.js index c1d1d3c8c3..8c53db3500 100644 --- a/packages/fxa-auth-server/test/scripts/dump-users.js +++ b/packages/fxa-auth-server/test/scripts/dump-users.js @@ -61,6 +61,7 @@ const DB = require('../../lib/db')(config, log, Token, UnblockCode); const execOptions = { cwd, env: { + ...process.env, NODE_ENV: 'dev', LOG_LEVEL: 'error', AUTH_FIRESTORE_EMULATOR_HOST: 'localhost:9090', diff --git a/packages/fxa-auth-server/test/scripts/verification-reminders.js b/packages/fxa-auth-server/test/scripts/verification-reminders.js index 23d4ff06e8..a01b9f192b 100644 --- a/packages/fxa-auth-server/test/scripts/verification-reminders.js +++ b/packages/fxa-auth-server/test/scripts/verification-reminders.js @@ -16,6 +16,7 @@ const cwd = path.resolve(__dirname, ROOT_DIR); const execOptions = { cwd, env: { + ...process.env, NODE_ENV: 'dev', LOG_LEVEL: 'error', AUTH_FIRESTORE_EMULATOR_HOST: 'localhost:9090', diff --git a/packages/fxa-auth-server/test/scripts/write-emails-to-disk.js b/packages/fxa-auth-server/test/scripts/write-emails-to-disk.js index 0f3bbdd2cd..842d247217 100644 --- a/packages/fxa-auth-server/test/scripts/write-emails-to-disk.js +++ b/packages/fxa-auth-server/test/scripts/write-emails-to-disk.js @@ -18,6 +18,7 @@ const cwd = path.resolve(__dirname, ROOT_DIR); const execOptions = { cwd, env: { + ...process.env, NODE_ENV: 'dev', LOG_LEVEL: 'error', AUTH_FIRESTORE_EMULATOR_HOST: 'localhost:9090',