diff --git a/commands.js b/commands.js
index eba0041671d815f167cbe56314da90287838c735..d0551021ff30ff2660a645b2d2dcb0445a0c8370 100644
--- a/commands.js
+++ b/commands.js
@@ -1,14 +1,10 @@
 Cypress.Commands.overwrite('visit', (originalFn, url, options) => {
-    options = {};
     if (Cypress.env('basicauth_user') != null) {
-        options = {
-            auth : {
-                username: Cypress.env('basicauth_user'),
-                password: Cypress.env('basicauth_pass')
-            }
+        options.auth = {
+            username: Cypress.env('basicauth_user'),
+            password: Cypress.env('basicauth_pass')
         };
     }
-
     return originalFn(url, options);
 });