Skip to content

Commit 56c4113

Browse files
authored
Support Express.JS 5 (#547)
* Allow Express.JS 5 in peer dependencies * Update package-lock after rebase
1 parent 7a27c31 commit 56c4113

File tree

7 files changed

+2891
-2335
lines changed

7 files changed

+2891
-2335
lines changed

package-lock.json

Lines changed: 943 additions & 755 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@
4545
},
4646
"homepage": "https://github.com/metro-nom/node-expressmocks#readme",
4747
"peerDependencies": {
48-
"express": "^4.0.0",
48+
"express": ">=4.0.0",
4949
"sinon": ">=10.0.0"
5050
},
5151
"devDependencies": {
5252
"@types/chai": "^4.3.4",
5353
"@types/chai-as-promised": "^7.1.5",
5454
"@types/data-driven": "0.0.30",
55-
"@types/express": "^4.17.14",
56-
"@types/serve-static": "^1.15.0",
55+
"@types/express": "^5.0.3",
5756
"@types/mocha": "^10.0.1",
5857
"@types/node": "^20.2.5",
58+
"@types/serve-static": "^1.15.0",
5959
"@types/sinon": "^10.0.13",
6060
"@types/verror": "^1.10.6",
6161
"@typescript-eslint/eslint-plugin": "^5.45.1",
@@ -66,7 +66,7 @@
6666
"eslint": "^8.29.0",
6767
"eslint-config-prettier": "^8.5.0",
6868
"eslint-plugin-prettier": "^4.2.1",
69-
"express": "^4.18.2",
69+
"express": "^5.1.0",
7070
"http-status-codes": "^2.2.0",
7171
"mocha": "^10.1.0",
7272
"nyc": "^17.1.0",

src/ExpressMocksSpec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,14 @@ describe('ExpressMocks', () => {
432432
sinon.assert.calledWith(mocks.res.status, HttpStatus.NOT_FOUND)
433433
})
434434

435+
it('should "accept" handler with rejection that didn\'t call next (new in express 5)', async () => {
436+
await mocks
437+
.test((_, res) => {
438+
return Promise.reject('fail')
439+
})
440+
.should.be.rejectedWith('fail')
441+
})
442+
435443
it('should finish asynchronously, even without RequestHandler that returns a promise', () => {
436444
return mocks
437445
.test((_, res) => {

0 commit comments

Comments
 (0)