From 4e084e212d75ebc91f8978c3476a934ca38899fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Og=C3=B3rek?= Date: Thu, 8 Feb 2018 12:28:30 +0100 Subject: [PATCH] fix: Restore console methods after calling uninstall --- Gruntfile.js | 9 ++++----- src/raven.js | 8 ++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index c2971b5cddbc..15378a4bfe54 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -80,14 +80,14 @@ module.exports = function(grunt) { }); // Transpile all test scripts - tests.forEach(function (test) { + tests.forEach(function(test) { var config = { input: { input: test }, output: { file: path.join('build', path.basename(test)), - name: path.basename(test, '.js'), + name: path.basename(test, '.js') } }; @@ -288,18 +288,17 @@ module.exports = function(grunt) { // Build tasks grunt.registerTask('_prep', ['gitinfo', 'version']); grunt.registerTask('build.test', ['_prep', 'rollup:core', 'rollup:tests']); - grunt.registerTask('build.core', ['_prep', 'rollup:core', 'sri:dist']); + grunt.registerTask('build.core', ['_prep', 'rollup:core']); grunt.registerTask('build.plugins', [ '_prep', 'generate-plugin-combinations', 'rollup:plugins', 'rollup:pluginCombinations', - 'sri:dist', 'sri:build' ]); grunt.registerTask('build', ['build.core', 'build.plugins', 'uglify']); - grunt.registerTask('dist', ['clean', 'build', 'copy:dist']); + grunt.registerTask('dist', ['clean', 'build', 'copy:dist', 'sri:dist']); // Test tasks grunt.registerTask('test:ci', ['config:ci', 'build:test']); diff --git a/src/raven.js b/src/raven.js index 918192ae389f..3a8f0c2c5d04 100644 --- a/src/raven.js +++ b/src/raven.js @@ -392,6 +392,7 @@ Raven.prototype = { this._unpatchFunctionToString(); this._restoreBuiltIns(); + this._restoreConsole(); Error.stackTraceLimit = this._originalErrorStackTraceLimit; this._isRavenInstalled = false; @@ -1383,6 +1384,13 @@ Raven.prototype = { } }, + _restoreConsole: function() { + // eslint-disable-next-line guard-for-in + for (var method in this._originalConsoleMethods) { + this._originalConsole[method] = this._originalConsoleMethods[method]; + } + }, + _drainPlugins: function() { var self = this;