Search code examples
npmplaywrightnpm-scripts

playwright cannot find tests if run from package script


If i run this

//terminal

> npx playwright test --grep '@slow' --workers=1

all is ok

BUT if i run

//package. json

"scripts": {
  "test": "npx playwright test --grep '@slow' --workers=1"

//terminal

npm run test

I get - Error: no tests found.


Solution

  • Use one of the following scripts

    "test": "npx playwright test --grep \"@slow\" --workers=1"
    "test": "npx playwright test --grep @slow --workers=1"