Browse Source

fix: return path from netLog.stopLogging (#21989)

Co-authored-by: Jeremy Apthorp <[email protected]>
trop[bot] 5 years ago
parent
commit
6cf8abc3b3
2 changed files with 4 additions and 2 deletions
  1. 2 1
      lib/browser/api/session.js
  2. 2 1
      spec-main/api-net-log-spec.ts

+ 2 - 1
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')

+ 2 - 1
spec-main/api-net-log-spec.ts

@@ -69,7 +69,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')
   })