0

I have the following in my test file. I’m trying to use env variables on my scripts then send the value thru commandline.

const MYURL = process.env.URL;
console.log(MYURL)

In the commandline when I run the following:

URL=Test.com npx playwright test

I get an error message:

The term ‘URL=Test.com’ is not recognized as the name of the cmdlet..etc.

sarthak
  • 500
  • 9
  • 19
Dovahkiin
  • 1
  • 1

1 Answers1

0

Because you use bash syntax in Powershell. Powershell does not set env variables like var=value, so this syntax won't work.

You probably need to read something like this to figure out the right syntax for Powershell.

pavelsaman
  • 7,399
  • 1
  • 14
  • 32
  • I'm new to Playwright and I'm not familiar with environment variables. I tried $Env:URL ="test.com" and got the same result. – Dovahkiin Oct 20 '21 at 15:39