I am receiving this error message: "Exceeded timeout of 10000 ms for a test. when i run integrations tests in my project.
The timeout value is 10000 cause I changed this value when call request() method passing by parameter in line 13, but this error persist even increase timeout.
describe('Body parser Middleware',() => {
test('', async() => {
// app.post('/test_body_parser',(req,res) => {
// res.send(req.body)
// })
await request(app)
.post('/test_body_parser')
.send({name: 'xxx'})
.expect({name: 'xxx'})
},10000)
})
I'm suspicious that there is something related to versions of some dependency in my project, maybe related to version of supertest with typescript or mongodb version, i dont know. [this is my package.json in my project] (https://i.stack.imgur.com/16053.png)
"scripts": {
"start": "sucrase-node src/main/server.ts ",
"test": "jest --passWithNoTests --silent --noStackTrace --runInBand --detectOpenHandles",
"test:verbose": "jest --passWithNoTests --runInBand",
"test:unit": "npm test -- --watch -c jest-unit-config.js",
"test:integration": "npm test -- --watch -c jest-integration-config.js --detectOpenHandles --forceExit",
"test:staged": "npm test -- --findRelatedTests",
"test:ci": "npm test -- --coverage",
"clear_jest": "jest --clearCache"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@shelf/jest-mongodb": "^4.2.0",
"@types/bcrypt": "^3.0.1",
"@types/jest": "^26.0.20",
"@types/mongodb": "^3.6.20",
"@types/node": "^14.14.20",
"@types/supertest": "^6.0.2",
"@types/validator": "^13.1.3",
"@typescript-eslint/eslint-plugin": "^4.12.0",
"eslint": "^7.17.0",
"eslint-config-standard-with-typescript": "^19.0.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.1.0",
"git-commit-msg-linter": "^3.0.0",
"husky": "^4.3.7",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.7.0",
"lint-staged": "^10.5.3",
"sucrase": "^3.35.0",
"supertest": "^6.3.4",
"ts-jest": "^29.1.2",
"typescript": "^4.5.5"
},
"dependencies": {
"bcrypt": "^5.0.1",
"express": "^4.18.3",
"mongodb": "^6.4.0",
"validator": "^13.5.2"
}
}
if someone already get this error message and fix it, help me please.
Already try update typescrip to latest 5.4.2, but the problem persist. Already increase the timout value when call request Already updated node version to v20.11.1 in aplication with nvm, and try with version 18 and 16 but nothing