From 0bf2d3a948cbeb017df671880d25a752b40c21d6 Mon Sep 17 00:00:00 2001 From: Teemu Lindborg Date: Wed, 6 Feb 2019 14:33:58 +0200 Subject: [PATCH] Capturing the object using _this to reference the object correctly inside write --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index c29ef63..06caf0c 100644 --- a/index.js +++ b/index.js @@ -6,6 +6,7 @@ var util = require('util'), var BrowserStackReporter = function(baseReporter, config, options = {}) { + var _this = this this.baseReporter = baseReporter this.config = config this.options = options @@ -69,8 +70,8 @@ var BrowserStackReporter = function(baseReporter, config, options = {}) { function write(filename, xml) { var outputDir = "." - if (this.options && typeof this.options.outputDir == 'string') { - outputDir = this.options.outputDir + if (_this.options && typeof _this.options.outputDir == 'string') { + outputDir = _this.options.outputDir } outputDir = `${outputDir}/browserstack-reports`