Run cd submission && pnpm dlx jest@29.6.2
.../.bin/store/v3/tmp/dlx-2157           | Progress: resolved 1, reused 0, downloaded 0, added 0
.../.bin/store/v3/tmp/dlx-2157           |  WARN  deprecated glob@7.2.3
.../.bin/store/v3/tmp/dlx-2157           |  WARN  deprecated inflight@1.0.6
.../.bin/store/v3/tmp/dlx-2157           | Progress: resolved 178, reused 175, downloaded 0, added 0
.../.bin/store/v3/tmp/dlx-2157           | +274 +++++++++++++++++++++++++++
.../.bin/store/v3/tmp/dlx-2157           | Progress: resolved 275, reused 274, downloaded 0, added 274, done
FAIL test/index.test.js
  ● Test suite failed to run

    Cannot find module 'firebase/app' from 'test/index.test.js'

      1 | const fs = require('fs');
    > 2 | const { initializeApp } = require('firebase/app');
        |                           ^
      3 | const { getFirestore, collection, doc, getDoc, setDoc, connectFirestoreEmulator, terminate } = require('firebase/firestore');
      4 | const { scan, shellFiles, dependencyCount, restrictJavascript, restrictPython } = require('@sliit-foss/bashaway');
      5 |

      at Resolver._throwModNotFoundError (../../../../setup-pnpm/node_modules/.bin/store/v3/tmp/dlx-2157/node_modules/.pnpm/jest-resolve@29.7.0/node_modules/jest-resolve/build/resolver.js:427:11)
      at Object.require (test/index.test.js:2:27)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.362 s
Ran all test suites.
 ERROR  Command failed with exit code 1: jest

pnpm: Command failed with exit code 1: jest
    at makeError (/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@8.0.0/node_modules/pnpm/dist/pnpm.cjs:24235:17)
    at handlePromise (/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@8.0.0/node_modules/pnpm/dist/pnpm.cjs:24806:33)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.handler [as dlx] (/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@8.0.0/node_modules/pnpm/dist/pnpm.cjs:212227:7)
    at async /home/runner/setup-pnpm/node_modules/.pnpm/pnpm@8.0.0/node_modules/pnpm/dist/pnpm.cjs:221559:21
    at async main (/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@8.0.0/node_modules/pnpm/dist/pnpm.cjs:221526:34)
    at async runPnpm (/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@8.0.0/node_modules/pnpm/dist/pnpm.cjs:221781:5)
    at async /home/runner/setup-pnpm/node_modules/.pnpm/pnpm@8.0.0/node_modules/pnpm/dist/pnpm.cjs:221773:7
Error: Process completed with exit code 1.


#!/bin/bash

# Check if pnpm is installed, if not, install it
if ! command -v pnpm &> /dev/null; then
    echo "pnpm not found. Installing pnpm..."
    npm install -g pnpm
fi

# Check if Firebase CLI is installed, if not, install it
if ! command -v firebase &> /dev/null; then
    echo "Firebase CLI not found. Installing Firebase CLI..."
    pnpm add -g firebase-tools
fi

# Create a temporary directory for the Firebase project
TMP_DIR="firebase_emulator"
mkdir -p "$TMP_DIR"
cd "$TMP_DIR"

# Initialize a Firebase project if firebase.json does not exist
if [ ! -f "firebase.json" ]; then
    firebase init emulators --project demo-project --force <<EOF
y
EOF

    # Configure firebase.json to run only Firestore emulator on port 9000
    cat <<EOT > firebase.json
{
  "emulators": {
    "firestore": {
      "port": 9000
    }
  },
  "firestore": {
    "rules": "firestore.rules"
  }
}
EOT

    # Create an empty firestore.rules file
    touch firestore.rules
fi

# Install necessary Firebase dependencies
pnpm add firebase@9.6.1

# Start the Firebase emulators
firebase emulators:start --only firestore --project demo-project