Skip to content

Commit

Permalink
Switches integration tests to package firebase-tools (#5625)
Browse files Browse the repository at this point in the history
* Switches integration tests to package firebase-tools instead of npm i && npm link

* Make executable

* PR fixes

* pack to the correct location
  • Loading branch information
joehan committed Mar 29, 2023
1 parent 4f947cf commit 616e9f6
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 18 deletions.
21 changes: 21 additions & 0 deletions scripts/clean-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -e

function cleanup() {
echo "Cleaning up artifacts..."
rm -rf ./clean
echo "Artifacts deleted."
}

trap cleanup EXIT

echo "Running clean-publish --without-publish, as we would before publishing to npm..."
npx clean-publish --without-publish --before-script ./scripts/clean-shrinkwrap.sh --temp-dir clean
echo "Ran clean-publish --without-publish."
echo "Packaging cleaned firebase-tools..."
cd ./clean
PACKED=$(npm pack --pack-destination ./ | tail -n 1)
echo "Packaged firebase-tools to $PACKED."
echo "Installing clean-packaged firebase-tools..."
npm install -g $PACKED
echo "Installed clean-packaged firebase-tools."
2 changes: 1 addition & 1 deletion scripts/emulator-import-export-tests/run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

source scripts/set-default-credentials.sh
./scripts/npm-link.sh
./scripts/clean-install.sh

npx mocha --exit scripts/emulator-import-export-tests/tests.ts
2 changes: 1 addition & 1 deletion scripts/extensions-deploy-tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
set -e # Immediately exit on failure

# Globally link the CLI for the testing framework
./scripts/npm-link.sh
./scripts/clean-install.sh

mocha scripts/extensions-deploy-tests/tests.ts
2 changes: 1 addition & 1 deletion scripts/extensions-emulator-tests/run.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

source scripts/set-default-credentials.sh
./scripts/npm-link.sh
./scripts/clean-install.sh

(
cd scripts/extensions-emulator-tests/functions
Expand Down
2 changes: 1 addition & 1 deletion scripts/frameworks-tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ echo "Running with Application Creds: ${GOOGLE_APPLICATION_CREDENTIALS}"
echo "Target project: ${FBTOOLS_TARGET_PROJECT}"

echo "Installing firebase-tools..."
./scripts/npm-link.sh
./scripts/clean-install.sh
echo "Installed firebase-tools: $(which firebase)"

echo "Enabling experiment..."
Expand Down
2 changes: 1 addition & 1 deletion scripts/functions-deploy-tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e # Immediately exit on failure

# Globally link the CLI for the testing framework
./scripts/npm-link.sh
./scripts/clean-install.sh

# Create a secret for testing if it doesn't exist
firebase functions:secrets:get TOP --project $GCLOUD_PROJECT || (echo secret | firebase functions:secrets:set --data-file=- TOP --project $GCLOUD_PROJECT -f)
Expand Down
2 changes: 1 addition & 1 deletion scripts/functions-discover-tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -euxo pipefail # bash strict mode
IFS=$'\n\t'

# Globally link the CLI for the testing framework
./scripts/npm-link.sh
./scripts/clean-install.sh

# Unlock internal commands for discovering functions in a project.
firebase experiments:enable internaltesting
Expand Down
2 changes: 1 addition & 1 deletion scripts/hosting-tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ TEMP_DIR="$(mktemp -d)"
echo "Created temp directory: ${TEMP_DIR}"

echo "Installing firebase-tools..."
./scripts/npm-link.sh
./scripts/clean-install.sh
echo "Installed firebase-tools: $(which firebase)"

echo "Initializing temp directory..."
Expand Down
7 changes: 0 additions & 7 deletions scripts/npm-link.sh

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/storage-deploy-tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ TEMP_DIR="$(mktemp -d)"
echo "Created temp directory: ${TEMP_DIR}"

echo "Installing firebase-tools..."
./scripts/npm-link.sh
./scripts/clean-install.sh
echo "Installed firebase-tools: $(which firebase)"

echo "Initializing temp directory..."
Expand Down
2 changes: 1 addition & 1 deletion scripts/storage-emulator-integration/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e # Immediately exit on failure

# Globally link the CLI for the testing framework
./scripts/npm-link.sh
./scripts/clean-install.sh

# Set application default credentials.
source scripts/set-default-credentials.sh
Expand Down
2 changes: 1 addition & 1 deletion scripts/triggers-end-to-end-tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function cleanup() {
trap cleanup EXIT

source scripts/set-default-credentials.sh
./scripts/npm-link.sh
./scripts/clean-install.sh

for dir in triggers v1 v2; do
(
Expand Down
2 changes: 1 addition & 1 deletion scripts/webframeworks-deploy-tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e # Immediately exit on failure

# Globally link the CLI for the testing framework
./scripts/npm-link.sh
./scripts/clean-install.sh

(cd scripts/webframeworks-deploy-tests/hosting; npm i; npm run build)

Expand Down

0 comments on commit 616e9f6

Please sign in to comment.