From 3d6b20bde862f2d225437d80b04a2e6044ce4707 Mon Sep 17 00:00:00 2001 From: Danny Grander Date: Mon, 29 Aug 2016 19:25:46 +0300 Subject: [PATCH] test: disable analytics in patch failure test --- test/protect-fail.test.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/protect-fail.test.js b/test/protect-fail.test.js index acf9da7d3c1..aaad5548677 100644 --- a/test/protect-fail.test.js +++ b/test/protect-fail.test.js @@ -4,6 +4,7 @@ var fs = require('fs'); var thenfs = require('then-fs'); var test = require('tape'); var Promise = require('es6-promise').Promise; // jshint ignore:line +var snyk = require('../lib'); test('bad patch file does not apply', function (t) { // check the target file first @@ -12,6 +13,9 @@ test('bad patch file does not apply', function (t) { var semver = fs.readFileSync(dir + '/semver.js', 'utf8'); t.ok('original semver loaded'); + var old = snyk.config.get('disable-analytics'); + snyk.config.set('disable-analytics', '1'); + applyPatch(root + '/363ce409-2d19-46da-878a-e059df2d39bb.snyk-patch', { source: dir, name: 'semver', @@ -42,6 +46,11 @@ test('bad patch file does not apply', function (t) { console.log(e); t.fail('clean up failed'); }).then(function () { + if (old === undefined) { + snyk.config.del('disable-analytics'); + } else { + snyk.config.set('disable-analytics', old); + } t.end(); }); });