The problem I am currently having is that we have a script in our package.json set to run single test files using the following syntax:
"singleTest": "mocha tests/$MATCH"
However, when I attempt to run this in Windows 10 with Powershell I use the following command and get the error shown:
$env:MATCH="01HOME-01FC-T01.js" && npm run singleTest
Error: No test files found: "tests/$MATCH"
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! selenium-js-example@2.0.0 singleTest: `mocha tests/$MATCH`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the selenium-js-example@2.0.0 singleTest script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
It seems as if it is not setting the file name to the variable MATCH at all. I would really appreciate if someone can shed some light on what am I doing wrong or what would be the proper way to run this using Powershell 7.1.
You can chain commands in Powershell by using semicolon. You cannot use && like in bash.
$env:MATCH="01HOME-01FC-T01.js"; npm run singleTest
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.