From 1c6d8f5af6ad4d9b1b4d4747dbea328b63def980 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Fri, 31 Jan 2020 10:43:02 -0800 Subject: [PATCH] fix: return path from netLog.stopLogging (#21985) --- lib/browser/api/session.js | 3 ++- spec-main/api-net-log-spec.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/browser/api/session.js b/lib/browser/api/session.js index 9c0588640602..347b9a6028f2 100644 --- a/lib/browser/api/session.js +++ b/lib/browser/api/session.js @@ -36,8 +36,9 @@ NetLog.prototype.startLogging = function (path, ...args) { const _originalStopLogging = NetLog.prototype.stopLogging NetLog.prototype.stopLogging = function () { + const logPath = this._currentlyLoggingPath this._currentlyLoggingPath = null - return _originalStopLogging.call(this) + return _originalStopLogging.call(this).then(() => logPath) } const currentlyLoggingPathDeprecated = deprecate.warnOnce('currentlyLoggingPath') diff --git a/spec-main/api-net-log-spec.ts b/spec-main/api-net-log-spec.ts index 1db275504dab..03eefb1e3b26 100644 --- a/spec-main/api-net-log-spec.ts +++ b/spec-main/api-net-log-spec.ts @@ -71,7 +71,8 @@ describe('netLog module', () => { expect(testNetLog().currentlyLoggingPath).to.equal(dumpFileDynamic) - await testNetLog().stopLogging() + const path = await testNetLog().stopLogging() + expect(path).to.equal(dumpFileDynamic) expect(fs.existsSync(dumpFileDynamic)).to.be.true('currently logging') })