7

I'm trying to run testcafe chrome tests/ -e to execute my test but it throws an error saying

"testcafe: The term 'testcafe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try 
again.
At line:1 char:1
+ testcafe chrome tests/ -e
+ ~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (testcafe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException"

added testcafe locally to project

I'm using Visual Studio Code as IDE and PowerShell terminal for executing commands

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
rk2019
  • 73
  • 1
  • 4

1 Answers1

7

Locally installed packages are not automatically added to the search path. Modern npm has npx command.

npx testcafe chrome tests/ -e

should do what you need.

Alternatively you can add your command to npm scripts section as suggested in the documentation.

Take a look at this question: How to use package installed locally in node_modules? for the full discussion.

Roman Eremin
  • 1,431
  • 8
  • 10
  • Thanks Roman!! npx command worked for me but i am unable to connect to URL in my corp network { "resource": "XXX/Automation/package.json", "owner": "_generated_diagnostic_collection_name_#0", "code": "768", "severity": 4, "message": "Problems loading reference 'https://schemastore.azurewebsites.net/schemas/json/package.json': unable to verify the first certificate", "startLineNumber": 1, "startColumn": 1, "endLineNumber": 1, "endColumn": 2 } – rk2019 Aug 29 '19 at 01:27
  • 1
    Please submit a new question, so community can see it – Roman Eremin Aug 30 '19 at 08:20