Webstorm Salesforce Commerce Cloud Testing Error - 'C:\Users\...' is not recognized as an internal or external command

Hi all,

I'm using Webstorm for Salesforce Commerce Cloud development, I have the Salesforce B2C Commerce Cloud plugin installed and it's all working when usinf sgmf-scripts(npm run compile:scss, npm run compile:js) except for the unit testing script. When I type npm run test I get " 'C:\Users\...' is not recognized as an internal or external command".I can't get to the bottom of it, maybe someone here can help.

Here's my package.json:

{
"name": "app_custom_radup",
"version": "0.0.1",
"description": "New overlay cartridge",
"main": "index.js",
"engines": {
"node": "^12.0.0"
},
"scripts": {
"test": "sgmf-scripts --test test/unit/**/*.js",
"cover": "sgmf-scripts --cover 'test/unit'",
"test:integration": "sgmf-scripts --integration 'test/integration/**/*.js'",
"test:acceptance:custom": "npx codeceptjs run --plugins retryFailedStep --profile",
"test:acceptance:deep": "npx codeceptjs run --plugins retryFailedStep --grep '(?=.*)^(?!.*@mobile)^(?!.*@tablet)^(?!.*@pageDesigner)' --profile",
"test:acceptance:smoke": "npx codeceptjs run --plugins retryFailedStep --grep @happyPath --profile",
"test:acceptance:pagedesigner": "npx codeceptjs run --plugins retryFailedStep --grep @pageDesigner --profile",
"test:acceptance:desktop": "npx codeceptjs run --plugins retryFailedStep --grep '(?=.*)^(?!.*@mobile)^(?!.*@tablet)^(?!.*@pageDesigner)^(?!.*@deepTest)' --profile",
"test:acceptance:mobile": "npx codeceptjs run --plugins retryFailedStep --profile sauce:phone --grep @mobile",
"test:acceptance:tablet": "npx codeceptjs run --plugins retryFailedStep --profile sauce:tablet --grep @tablet",
"test:acceptance:parallel": "npx codeceptjs run-multiple parallel --plugins retryFailedStep --profile",
"test:acceptance:multibrowsers": "npx codeceptjs run-multiple multibrowsers --plugins retryFailedStep --profile",
"test:acceptance:report": "./node_modules/.bin/allure serve test/acceptance/report",
"bdd:snippets": "./node_modules/.bin/codeceptjs bdd:snippets --path",
"compile:scss": "sgmf-scripts --compile css",
"compile:js": "sgmf-scripts --compile js",
"compile:fonts": "node bin/Makefile compileFonts",
"build": "npm run compile:js && npm run compile:fonts && npm run compile:scss",
"lint": "npm run lint:css && npm run lint:js",
"lint:css": "sgmf-scripts --lint css",
"lint:js": "sgmf-scripts --lint js",
"init:isml": "./node_modules/.bin/isml-linter --init",
"lint:isml": "./node_modules/.bin/isml-linter",
"build:isml": "./node_modules/.bin/isml-linter --build",
"fix:isml": "./node_modules/.bin/isml-linter --autofix",
"upload": "sgmf-scripts --upload",
"uploadCartridge": "sgmf-scripts --uploadCartridge app_custom_radup",
"watch": "sgmf-scripts --watch",
"watch:static": "sgmf-scripts --watch static",
"release": "node bin/Makefile release --"
},
"repository": {
"type": "git",
"url": "git+https://github.com/SalesforceCommerceCloud/storefront-reference-architecture.git"
},
"author": "Ilya Volodin <ivolodin@demandware.com>",
"license": "ISC",
"homepage": "https://github.com/SalesforceCommerceCloud/storefront-reference-architecture",
"devDependencies": {
"@babel/core": "^7.14.6",
"@babel/plugin-proposal-object-rest-spread": "^7.14.5",
"@babel/preset-env": "^7.14.5",
"@tridnguyen/config": "^2.3.1",
"@wdio/sauce-service": "^5.14.0",
"@wdio/selenium-standalone-service": "^5.13.2",
"allure-commandline": "^2.13.0",
"appium": "^1.21.0",
"babel-core": "^6.26.3",
"babel-loader": "^8.0.6",
"babel-preset-env": "^1.7.0",
"browserslist": "^4.16.6",
"chai": "^4.3.4",
"chai-subset": "^1.6.0",
"chalk": "^1.1.3",
"cheerio": "0.22.0",
"cldr-data": "^32.0.1",
"codeceptjs": "^2.3.2",
"codeceptjs-cucumber": "^2.0.10",
"codeceptjs-saucehelper": "^1.4.0",
"codeceptjs-saucelabs": "^2.0.6",
"codeceptjs-shared": "^2.0.6",
"cross-env": "^7.0.3",
"css-loader": "^0.28.11",
"debug": "^4.1.1",
"deepmerge": "^3.3.0",
"eslint": "^3.19.0",
"eslint-config-airbnb-base": "^5.0.3",
"eslint-plugin-import": "^1.16.0",
"eslint-plugin-sitegenesis": "~1.0.0",
"globalize": "^1.4.2",
"husky": "^4.2.5",
"isml-linter": "^5.35.3",
"istanbul": "^0.4.5",
"lodash": "^4.17.15",
"minimist": "^1.2.0",
"mocha": "^9.0.1",
"mocha-junit-reporter": "^1.23.1",
"moment-timezone": "^0.5.26",
"node-sass": "^4.12.0",
"postcss-loader": "^2.1.6",
"properties-parser": "^0.3.1",
"proxyquire": "1.7.4",
"request-promise": "^4.2.4",
"sass-loader": "^7.3.1",
"selenium-standalone": "^6.24.0",
"sgmf-scripts": "^2.4.1",
"shelljs": "^0.8.3",
"should": "^13.2.3",
"sinon": "^1.17.7",
"style-loader": "^0.21.0",
"stylelint": "^8.4.0",
"stylelint-config-standard": "^17.0.0",
"stylelint-scss": "^2.5.0",
"url": "^0.11.0",
"wdio-sauce-service": "^0.4.14",
"webdriverio": "^5.14.5",
"xml2js": "^0.4.22"
},
"dependencies": {
"babel": "^6.23.0",
"bootstrap": "^5.0.1",
"browserslist": "^4.16.6",
"chai-http": "^4.3.0",
"cleave.js": "^1.5.3",
"extract-text-webpack-plugin": "^3.0.2",
"flag-icon-css": "^2.9.0",
"font-awesome": "^4.7.0",
"jquery": "^3.5.1",
"next": "^11.0.0",
"nyc": "^15.1.0"
},
"browserslist": [
"defaults",
"not IE 11",
"maintained node versions"
],
"packageName": "app_custom_radup",
"babel": {
"presets": [
"env"
]
},
"husky": {
"hooks": {
"pre-commit": "npm run lint",
"pre-push": "npm run test"
}
},
"paths": {
"base": "../storefront-reference-architecture/cartridges/app_storefront_base/"
}
}

And the error when running npm run test:

C:\Users\Radu Popescu\WebstormProjects\SFRA\radup\node_modules\.bin\_mocha "test/unit/**/*.js" --reporter spec
'C:\Users\Radu' is not recognized as an internal or external command,
operable program or batch file.

Any help would be more than welcomed!

Thanks!

4 comments
Comment actions Permalink

And what is a result of running the same script outside of the IDE, in the system terminal? Looks like sgmf-scripts --test can't handle spaces in your path

0
Comment actions Permalink

Hi Elena,

That was the issue, thanks for the hint, but now I get another error when running the test:

Cannot find module 'dw/svc/LocalServiceRegistry' - this module comes from the External Library attached to the project and is in the Salesforce B2C Commerce plugin. How can I make sure it loads an external library module?

Thanks!

0
Comment actions Permalink

>this module comes from the External Library attached to the project and is in the Salesforce B2C Commerce plugin.

How did you attach it, where is this module stored on your disk?

JavaScript libraries set up in Settings | Languages & Frameworks | JavaScript | Libraries are only used by the IDE for coding assistance, they aren't normally available in runtime (unless you have them properly installed in your project). To get the module loaded by Node.js through require() call, you have to install it in your project

0
Comment actions Permalink

Hi Elena,

It's all good now, fixed the issue with proxyquire for a mock call to the desired module.

Thanks for the help!

1

Please sign in to leave a comment.