Issue tracker error when running chai tests in shell

I just wrote my first chai test for the issue tracker project and when i try to run the tests with npm run in the shell I get an error. I looked over my code for an hour have tried other peoples but everytime i run the tests I get an error. I think there must be some kind of bug.

here is my test code:



const chaiHttp = require('chai-http');
const chai = require('chai');
const assert = chai.assert;
const server = require('../server');

chai.use(chaiHttp);

suite('Functional Tests', function() {

suite('tests for routes', function() {
/*#1*/
test('Create an issue with every field: POST request ', function (done) {
chai
.request(server)
.post('/api/issues/test')
.send({issue_title: 'title', issue_text: 'text', created_by: 'cm', assigned_to: 'cm', status_text: 'text 2', open: true})
    .end(function(err, res) {
      assert.equal(res.status, 200)
      assert.equal(res.body.issue_title, 'title')
      assert.equal(res.body.issue_text, 'text')
      assert.equal(res.body.created_by, 'cm')
      assert.equal(res.body.assigned_to, 'cm')
      assert.equal(res.body.status_text, 'text 2')
      assert.equal(res.body.open, true)
      
    done()
    })
  })



})
  
})

this is the error that i get:

  1. Uncaught error outside test suite

0 passing (3ms)
1 failing

  1. Uncaught error outside test suite:
    Uncaught Error: listen EADDRINUSE: address already in use :::3000
    at Server.setupListenHandle [as _listen2] (node:net:1485:16)
    at listenInCluster (node:net:1533:12)
    at Server.listen (node:net:1621:7)
    at Function.listen (node_modules/express/lib/application.js:618:24)
    at Object. (server.js:50:22)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions…js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object. (tests/2_functional-tests.js:4:16)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions…js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at /home/runner/boilerplate-project-issuetracker/node_modules/yargs/lib/command.js:241:49

~/boilerplate-project-issuetracker$

here is the replit:

boilerplate-project-issuetracker - Replit

There is no bug, the server is in use. Use the required environment variable for the tests NODE_ENV=test (secret on Replit)

Oh ok I only thought I needed that when I was submitting the final tests. Thats the only time I needed it on the last project but I guess that error was there; it was able to show the test results on that project though. I should have been able to figure out that one