Artur Paikin 8 anni fa
parent
commit
15c31c4895
2 ha cambiato i file con 27 aggiunte e 22 eliminazioni
  1. 7 5
      src/core/Core.js
  2. 20 17
      test/acceptance/Driver.js

+ 7 - 5
src/core/Core.js

@@ -38,11 +38,13 @@ export default class Core {
       files: {}
       files: {}
     }
     }
 
 
-    // for debugging and testing
-    global.UppyState = this.state
-    global.uppyLog = global.uppyLog || ''
-    // global.UppyAddFiles = this.addFile.bind(this)
-    global.UppyAddFile = this.addFile.bind(this)
+    if (this.opts.debug) {
+      // for debugging and testing
+      global.UppyState = this.state
+      global.uppyLog = global.uppyLog || ''
+      // global.UppyAddFiles = this.addFile.bind(this)
+      global.UppyAddFile = this.addFile.bind(this)
+    }
   }
   }
 
 
   /**
   /**

+ 20 - 17
test/acceptance/Driver.js

@@ -52,24 +52,27 @@ function collectErrors (driver) {
         '[uppy-log]',
         '[uppy-log]',
         chalk.magenta(uppyLog)
         chalk.magenta(uppyLog)
       ].join(' '))
       ].join(' '))
-
-      // TODO: maybe figure out a way to get errors from all browsers
-      // return driver.executeScript('return window.JSErrorCollector_errors.pump()')
-      //   .then(function (errors) {
-      //     if (!errors || !errors.length) {
-      //       return
-      //     }
-      //     errors.forEach(function (error) {
-      //       console.error([
-      //         '[browser-error]',
-      //         chalk.magenta(error.sourceName),
-      //         chalk.dim('#' + error.lineNumber),
-      //         chalk.red(error.errorMessage)
-      //       ].join(' '))
-      //     })
-      //     return
-      //   })
     })
     })
+    .catch(function (err) {
+      console.log('no uppyLog, that’s fine: ' + err)
+    })
+
+    // TODO: maybe figure out a way to get errors from all browsers
+    // return driver.executeScript('return window.JSErrorCollector_errors.pump()')
+    //   .then(function (errors) {
+    //     if (!errors || !errors.length) {
+    //       return
+    //     }
+    //     errors.forEach(function (error) {
+    //       console.error([
+    //         '[browser-error]',
+    //         chalk.magenta(error.sourceName),
+    //         chalk.dim('#' + error.lineNumber),
+    //         chalk.red(error.errorMessage)
+    //       ].join(' '))
+    //     })
+    //     return
+    //   })
 }
 }
 
 
 function setDriver () {
 function setDriver () {