1

I'm using WebStorm for Salesforce Commerce Cloud development. I have the Salesforce B2C Commerce Cloud plugin installed and it's all working when using 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.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! app_custom_radup@0.0.1 test: `sgmf-scripts --test test/unit/**/*.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the app_custom_radup@0.0.1 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Radu Popescu\AppData\Roaming\npm-cache\_logs\2021-06-18T11_58_20_148Z-debug.log

Any help would be great!

Thanks!

LazyOne
  • 158,824
  • 45
  • 388
  • 391
  • 1
    No idea how you are using that command ... but based on the error message it is clearly (for me) caused by the space in your user name folder (`Radu Popescu` in `C:\Users\Radu Popescu\...`). Perhaps you can change the user name (folder name actually) somehow? – LazyOne Jun 18 '21 at 12:19
  • Just for reference: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360010873220-Webstorm-Salesforce-Commerce-Cloud-Testing-Error-C-Users-is-not-recognized-as-an-internal-or-external-command – lena Jun 18 '21 at 15:03
  • That was the problem, the test script didn't escape the space from the username in the path. Thanks for the help! – Radu Popescu Jun 19 '21 at 13:54

0 Answers0