Skip to content

Instantly share code, notes, and snippets.

@TerroR75
Last active June 13, 2024 17:23
Show Gist options
  • Save TerroR75/2b4066e4288a930d5d6686548f4c4ac7 to your computer and use it in GitHub Desktop.
Save TerroR75/2b4066e4288a930d5d6686548f4c4ac7 to your computer and use it in GitHub Desktop.
{
"name": "backend",
"version": "1.0.0",
"main": "index.js",
"type": "module",
"scripts": {
"dev": "cross-env NODE_ENV=dev nodemon index.js",
"tests": "mocha --exit"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"@types/node": "^20.14.2",
"node": "^20.14.0"
},
"devDependencies": {
"chai": "^5.1.1",
"chai-http": "^5.0.0",
"cross-env": "^7.0.3",
"mocha": "^10.4.0",
"nodemon": "^3.1.3",
"sinon": "^18.0.0",
"supertest": "^7.0.0"
}
}
import * as chaiModule from "chai";
import chaiHttp from "chai-http";
const chai = chaiModule.use(chaiHttp);
chai.request() // Throws an error "request is not a function" and:
// \node_modules\chai-http\ has a "main" field set to "./index", excluding the full filename and extension to the resolved file at "index.js"
// Automatic extension resolution of the "main" field is deprecated for ES modules.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment