Skip to content
This repository has been archived by the owner on Jan 14, 2018. It is now read-only.

Commit

Permalink
test: limit information stored in context
Browse files Browse the repository at this point in the history
Store only objects set in `beforeEach` used in `test`.
Avoid logging useless info on test failure.
  • Loading branch information
pvdlg committed Dec 14, 2017
1 parent 7f54685 commit 939d203
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions test/condition-travis-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import nock from 'nock';
import SemanticReleaseError from '@semantic-release/error';
import authenticate from './helpers/mock-github';

test.beforeEach(t => {
// Save the current process.env
t.context.env = Object.assign({}, process.env);
// Save the current process.env
const envBackup = Object.assign({}, process.env);

test.beforeEach(() => {
// Delete env variables in case they are on the machine running the tests
delete process.env.GH_TOKEN;
delete process.env.GITHUB_TOKEN;
Expand All @@ -21,9 +22,9 @@ test.beforeEach(t => {
delete process.env.TRAVIS_URL;
});

test.afterEach.always(t => {
test.afterEach.always(() => {
// Restore process.env
process.env = Object.assign({}, t.context.env);
process.env = envBackup;
// Reset nock
nock.cleanAll();
});
Expand Down

0 comments on commit 939d203

Please sign in to comment.