Basically I have a file called: ```.env``` which ...
# help
g
Basically I have a file called:
Copy code
.env
which has value:
Copy code
BASIC_AUTH=Hello:world
That was in my top level folder meaning in here
f
Let's start a thread to keep the main channel clean
g
Sure thing 😁
I added some more info in #763105090679865354
f
So I remember that my
.env
variables didn't map over to
Cypress.config("env")
automatically in v9. Hence the snippet There must be something, somewhere, that was performing that action
TBH I wouldn't get too hung up on it. Add the snippet, or pass the variable to the run command via
CYPRESS_
, so for your case it would be
CYPRESS_BASIC_AUTH
.
g
u mean to change the variable name in .env to CYPRESS_BASIC_AUTH?
f
I think that would work?
g
Will try! one momento
Should I then call
Copy code
const splitAuth = Cypress.env('BASIC_AUTH').split(':');
or CYPRESS_BASIC_AUTH?
Nope 😦
f
Cypress.env("BASIC_AUTH")
would be the one. Remember to close and re-run cypress as well. Env vars won't be loaded in automatically
g
Perhaps I need to do something in my cypress.config.ts file?
Oh i will re-try that
nope, didnt work with re-trying cypress neither 😦
I mean I can perhaps do teamviewer if that would be easier for you?
f
and you fully closed it down and ran the run command again in the terminal?
g
think we could save quite alot of time then 😄
yeah, I even closed the terminal
and reopened it
f
Nah, I can't put any more time into this, I'm afraid. Am working (not a Cypress employee) and dealing with a puppy throwing a tantrum Only other option I can see is to add the snippet
g
Oh lord 😦 I can try the snippet but that follows back with an error saying:
ahhhhhhhh
im so freaking stupid
I do actually have a plugin/index.ts
that converts the .env
that seems to be broken somehow
f
Not stupid. It's one of those things you forget about once you get it working 🙂
g
so now the million dollar question is
why its broken in first place ;P
f
Do you have this included in your
cypress.config.js
?
Copy code
setupNodeEvents(on, config) {
      return require("./cypress/plugins/index.js")(on, config);
    },
g
I do not
f
(and it'd be
.ts
in your case)
Odd. that should have been handled by the migration assistant
g
looks like it just added empty setupNode for me
f
That's something for #974362106822545429 . If you import your plugins there, it should work
g
will add that, just need to figure out becvause I believe rqeuire is for JS
and for TS its....
i forgot ;p
I came back yesterday to cypress after 2 months pause
f
haha, can't help you there. I'm JS through and through
But anyhow. New error message = progress 🙂
g
its all good 😄 atleast I know
where the issue is!
f
I'll leave you to it now, if that's cool with you? Let me know when you've got it figured out
g
Of course 😄 will do that
5 Views