Is it possible to run NodeBB locally (e.g. localhost:4567) and run npm test at the same time?


  • When I have my local NodeBB installation up and running on localhost in my browser I tried running the tests via npm test.

    It looks like the tests are attempting to start another NodeBB process and failing to do so, because I've already started it. Here is the error that I get:

    0 passing (4s)
    1 failing

    1) "before all" hook in "{root}":
       Uncaught Error: listen EADDRINUSE: address already in use 0.0.0.0:4567
        at Server.setupListenHandle [as _listen2] (net.js:1309:16)
        at listenInCluster (net.js:1357:12)
        at doListen (net.js:1496:7)
        at processTicksAndRejections (internal/process/task_queues.js:85:21)
    

    Is it possible to run NodeBB in the browser and run the tests at the same time, or do I have to stop NodeBB first before running npm test?

    Thank you.

  • Global Moderator

    I've never thought to do both at the same time.

    You might be able to do both if you specify a non-default port in config.json

    "port": 8080
    

    Or something


  • Thanks for your reply. I don't suppose it's necessary to run both at the same time. Am I right in assuming that all the testing is done with a headless version of NodeBB that runs for the lifetime of the tests?

  • GNU/Linux Admin

    That's correct, you set it up with a mock database, and npm test inserts its own testing data and cleans up after itself when it's done. No need to have NodeBB running for the testing suite to run.

Suggested Topics

  • 3
  • 4
  • 3
  • 5
  • 1
| |