Skip to content

Commit

Permalink
test: disable analytics in patch failure test
Browse files Browse the repository at this point in the history
  • Loading branch information
grnd authored and Danny Grander committed Aug 29, 2016
1 parent d9523bc commit 3d6b20b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/protect-fail.test.js
Expand Up @@ -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
Expand All @@ -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',
Expand Down Expand Up @@ -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();
});
});

0 comments on commit 3d6b20b

Please sign in to comment.