From 939d2039fa87e9f3f6f7ed2dfaf99f5aa00e1889 Mon Sep 17 00:00:00 2001 From: Pierre Vanduynslager Date: Tue, 12 Dec 2017 01:58:10 -0500 Subject: [PATCH] test: limit information stored in context Store only objects set in `beforeEach` used in `test`. Avoid logging useless info on test failure. --- test/condition-travis-test.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/condition-travis-test.js b/test/condition-travis-test.js index c16d676..d8f4a34 100644 --- a/test/condition-travis-test.js +++ b/test/condition-travis-test.js @@ -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; @@ -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(); });