Skip to content

Commit

Permalink
Deprecates config.envs (closes #12)
Browse files Browse the repository at this point in the history
`process.env` mixins were broken as implemented, and they're an easy
addition outside the test helper. We'll discourage their use (in case
anyone was somehow using them).
  • Loading branch information
rjz committed Oct 3, 2015
1 parent 350229f commit 5b39134
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ function serializeCookie (c) {
}, []);
}

function assignEnvs (envs) {
Object.keys(envs).forEach(function(e) {
process.env[e] = envs[e];
});
}

var deprecatedAssignEnvs = util.deprecate(assignEnvs,
'supertest-session env configuration is deprecated and will be removed in next version.');

module.exports = function (config) {

if (!config) config = {};
Expand All @@ -31,9 +40,7 @@ module.exports = function (config) {
this.app = config.app;

if (config.envs && (config.envs instanceof Object)) {
Object.keys(config.envs).forEach(function(e) {
process.env[e] = config.envs[e];
});
deprecatedAssignEnvs(config.envs);
}
}

Expand Down

0 comments on commit 5b39134

Please sign in to comment.