https://cypress.io logo
I'm having an issue setting my mailosaur API key i...
# e2e-testing
l
I'm having an issue setting my mailosaur API key in the
config.ts
. If I hard code the string
MAILOSAUR_API_KEY: <"my-api-key">
my tests work just fine. But I need to put all apikeys and such in a separate
cypress.env.json
. Referencing the mailosaur server ID in test code works just fine. When I hard code the apikey string the tests work just fine. To be super clear this works:
Copy code
env: {
  MAILOSAUR_API_KEY: "<my-api-key>",
},
I want this to work:
Copy code
env: {
  MAILOSAUR_API_KEY: Cypress.env("mailosaurApiKey"),
},
Or this:
Copy code
env: {
  MAILOSAUR_API_KEY: `${Cypress.env("mailosaurApiKey")}`,
},
But the last two do not work.
I get this error.
Copy code
Your configFile is invalid
This is what shows up in the CLI
Copy code
Missing baseUrl in compilerOptions. tsconfig-paths will be skipped
I very much have a baseUrl in the config file. I thought perhaps it was reading them out of order, so I put the apikey in
e2e
and
env
and vice versa.
Still doesn't work.