Why an error “connect ECONNREFUSED 127.0.0.1:8080” occurs when testing firestore rules with npm

I wanted to test a firestore rule. Below is firestore.rules. I wanted to check that these security rules are valid. Then I tried to use jest and firebase testing. However when executing “npm test”, an error, “connect ECONNREFUSED 127.0.0.1:8080” occured.

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /clubUsers/{uid} {
      allow read: if request.auth != null
        && request.auth.uid == uid;
      allow create: if request.auth != null
        && request.auth.uid == uid;   
      allow update: if request.auth != null
        && request.auth.uid == uid;  
    }
  }
}

And my test script is here.

const firebase = require('@firebase/testing/');
const fs = require('fs');

const project_id = "PROJECT ID";

describe("testing firestore rules", () => {

    beforeAll(
        async () => {
            await firebase.loadFirestoreRules({
                projectId: project_id,
                rules: fs.readFileSync('../../firestore.rules', 'utf8'),
            });
        }
    );

    afterEach(
        async () => {
            await firebase.clearFirestoreData({ projectId: project_id });
        }
    );

    afterAll(
        async () => {
            await Promise.all(
                firebase.apps().map((app) => app.delete())
            );
        }
    );

    function authedApp(auth) {
        return firebase.initializeTestApp({
            projectId: project_id,
            auth: auth,
        }).firestore();
    }

    describe("testing get and write", () => {

        test("testing get", async () => {
            const db = authedApp({ uid: 'UID' });
            const message = db.collection("clubUsers").doc("UID");
            await firebase.assertSucceeds(message.get());
        })

        test("testing write", async () => {
            const db = authedApp({ uid: "UID" });
            const message = db.collection("clubUsers").doc("UID");
            await firebase.assertSucceeds(
                message.set({ text: "hoge" })
            );
        })
    })

})

I tried the test while firebase emulator is opened.

I checked what is using port 8080 by executing sudo lsof -P -i:8080 on terminal.
However, nothing has used port 8080.