Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'testcafe' is not recognized as the name of a cmdlet, function, script file, or operable program

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

like image 486
rk2019 Avatar asked Aug 26 '19 07:08

rk2019


People also ask

How do I install Testcafe code in Visual Studio?

To install it, use the npm install testcafe command. For Mac OS, add TestCafe to dependencies in your package. json file. Your project should contain TestCafe modules in node_modules\testcafe\... .


1 Answers

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.

like image 161
Roman Eremin Avatar answered Oct 27 '22 11:10

Roman Eremin