TypeError: _app.app.close is not a function using jest 27.5.1
I have a test which is failing on Jest 27.5.1 (with babel-jest at the same version) with this error
I have a test which is failing on Jest 27.5.1 (with babel-jest at the same version) with this error
I’m testing using sinon with axios.
Runs a function before any of the tests in this file run. If the function returns a promise or is a generator, Jest waits for that promise to resolve before running tests.
I’m using Passport.js for authentication (local strategy) and testing with Mocha and Supertest.
Is there any way to directly access the req
object in supertest
, while/after the request is being tested? I want to test my passport
strategies, so I want to check req.user
, req.session
, and perhaps others. I know I can test page redirects or flash, as those are what my strategies do, but it seems useful to see if there is a user on the req
object, as well. If I do this, I can also check how many users there are at any one time.
found the following hint on how to test middleware in express:
https://github.com/visionmedia/express/blob/master/test/req.xhr.js
I was wondering why my tests were always passing. Until I noticed that when i copied the test from express they behaved the same. I tried screwing them up but they keep passing:
https://github.com/visionmedia/express/blob/master/test/req.xhr.js
I am writing an integration test for a REST API protected by a jwt
.
One API operation POST /user/token
is returning a jwt
given a username
and a password
and this token is then used for a list of operations such as:
I am testing an express API with supertest.
I’m using Passport.js for authentication (Facebook strategy) and testing with Mocha and Supertest. How can I create a session and make authenticated requests with Supertest for Facebook strategy?