Skip to content

Commit

Permalink
Add debug output for function tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sbutz committed Nov 27, 2023
1 parent bd8a475 commit b2eba01
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
33 changes: 18 additions & 15 deletions .github/workflows/deploy-on-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,39 @@ on:
branches:
- master
jobs:
client_deploy:
firestore_deploy:
runs-on: ubuntu-latest
env:
working-directory: ./client
working-directory: ./firestore
steps:
- uses: actions/checkout@v3
- run: npm ci && npm run build
- run: npm run deploy
working-directory: ${{env.working-directory}}
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_POOLSCORE_1973 }}'
channelId: live
projectId: poolscore-1973

firestore_deploy:
functions_deploy:
needs: firestore_deploy
runs-on: ubuntu-latest
env:
working-directory: ./firestore
working-directory: ./functions
steps:
- uses: actions/checkout@v3
- run: npm deploy
- run: npm ci && npm run build
working-directory: ${{env.working-directory}}
- run: npm run deploy

function_deploy:
client_deploy:
needs: [firestore_deploy, functions_deploy]
runs-on: ubuntu-latest
env:
working-directory: ./functions
working-directory: ./client
steps:
- uses: actions/checkout@v3
- run: npm ci && npm run build
working-directory: ${{env.working-directory}}
- run: npm deploy
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_POOLSCORE_1973 }}'
channelId: live
projectId: poolscore-1973

2 changes: 1 addition & 1 deletion functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"predeploy": "npm run build",
"deploy": "npx firebase-tools deploy --force --only functions",
"pretest": "npm run build",
"test": "npx firebase-tools emulators:exec --only 'functions,firestore,auth' 'npx jest'",
"test": "npx firebase-tools --debug emulators:exec --only 'functions,firestore,auth' 'npx jest'",
"test:watch": "concurrently --kill-others \"npm:build:watch\" \"npx firebase-tools emulators:exec 'npx jest --watch'\""
},
"engines": {
Expand Down
7 changes: 5 additions & 2 deletions functions/src/createToken.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ const firebaseConfig = {
projectId: process.env.GCLOUD_PROJECT,
apiKey: "test-key",
};

console.log(firebaseConfig);
console.log(process.env);
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
connectAuthEmulator(auth, "http://localhost:9099", {disableWarnings: true});
connectAuthEmulator(auth, "http://127.0.0.1:9099", {disableWarnings: true});
const functions = getFunctions(app);
connectFunctionsEmulator(functions, "localhost", 5001);
connectFunctionsEmulator(functions, "127.0.0.1", 5001);
const createToken = httpsCallable(functions, "table-createtoken");
const createJWT = httpsCallable(functions, "table-createjwt");

Expand Down

0 comments on commit b2eba01

Please sign in to comment.