Gathering detailed insights and metrics for supertest-session-as-promised
Gathering detailed insights and metrics for supertest-session-as-promised
Gathering detailed insights and metrics for supertest-session-as-promised
Gathering detailed insights and metrics for supertest-session-as-promised
Persistent sessions for supertest
npm install supertest-session-as-promised
Typescript
Module System
Node Version
NPM Version
64.5
Supply Chain
97
Quality
73.5
Maintenance
50
Vulnerability
100
License
JavaScript (100%)
Total Downloads
6,110
Last Day
1
Last Week
2
Last Month
8
Last Year
105
NOASSERTION License
1 Stars
51 Commits
2 Watchers
1 Branches
1 Contributors
Updated on Jul 11, 2015
Minified
Minified + Gzipped
Latest Version
1.0.2
Package Id
supertest-session-as-promised@1.0.2
Size
4.14 kB
NPM Version
2.10.1
Node Version
0.12.4
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
0%
2
Compared to previous week
Last Month
-46.7%
8
Compared to previous month
Last Year
4%
105
Compared to previous year
3
Session wrapper around supertest; forked to use supertest-as-promised.
References:
$ npm test
Require supertest-session
and pass in the test application:
var Session = require('supertest-session')({
app: require('../../path/to/app')
});
You can set environmental variables by including an envs
object:
var Session = require('supertest-session')({
app: require('../../path/to/app'),
envs: { NODE_ENV: 'development' }
});
Set up a session:
before(function () {
this.sess = new Session();
});
after(function () {
this.sess.destroy();
});
And set some expectations:
it('should fail accessing a restricted page', function (done) {
this.sess.get('/restricted')
.expect(401)
.end(done)
});
it('should sign in', function (done) {
this.sess.post('/signin')
.send({ username: 'foo', password: 'password' })
.expect(200)
.end(done);
});
it('should get a restricted page', function (done) {
this.sess.get('/restricted')
.expect(200)
.end(done)
});
The cookies attached to the session may be retrieved from session.cookies
at any time, for instance to inspect the contents of the current session in an external store.
it('should set session details correctly', function (done) {
var sessionCookie = _.find(sess.cookies, function (cookie) {
return _.has(cookie, 'connect.sid');
});
memcached.get(sessionCookie['connect.sid'], function (err, session) {
session.user.name.should.eq('Foobar');
done();
});
});
By default, supertest-session authenticates using session cookies. If your app
uses a custom strategy to restore sessions, you can provide before
and after
hooks to adjust the request and inspect the response:
var Session = require('supertest-session-as-promised')({
app: require('../../path/to/app'),
before: function (req) {
req.set('authorization', 'Basic aGVsbG86d29ybGQK');
}
});
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-06-09
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More