I ran mocha tests in node.js. The following are the details related to it [includes the error]
github actions workflow: default node js github actions
name: Node.js CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm test
package.json
{
"name": "node",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "mocha ./**/*.test.js --exit",
"dev": "nodemon server.js",
"start": "node server.js",
"debug": "nodemon --inspect=0.0.0.0:9229 server.js"
},
"keywords": [],
"author": "Pragati Bhattad <pragatibhattad1610@gmail.com>",
"license": "ISC",
"dependencies": {
"bcrypt": "^5.0.0",
"compression": "^1.7.4",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.18.1",
"express-rate-limit": "^5.2.3",
"express-validator": "^6.14.2",
"jsonpath": "^1.1.1",
"jsonwebtoken": "^8.5.1",
"morgan": "^1.10.0",
"pg": "^8.5.1",
"pg-hstore": "^2.3.3",
"sequelize": "^6.3.5",
"uuid4": "^2.0.2",
"winston": "^3.3.3"
},
"devDependencies": {
"chai": "^4.2.0",
"chai-http": "^4.3.0",
"mocha": "^7.2.0",
"nodemon": "^2.0.6"
}
}
Error:
Error: getaddrinfo EAI_AGAIN undefined
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26)
This error is under each test case
Kindly help me out with this query
The tests use localhost as the url to test on ..I have used the url as http://localhost:8080
. If that is what is causing the issue on github actions
The following solutions didn't work for my case