imperative icon indicating copy to clipboard operation
imperative copied to clipboard

"Unexpected Command Error:" in ImperativeExpect.toBeDefinedAndNonBlank() if a non-string is passed in.

Open KevinLoesch1 opened this issue 2 years ago • 0 comments

If a non-string is passed in to the ImperativeExpect.toBeDefinedAndNonBlank() function, the call will fail with a "Unexpected Command Error". This was discovered when I passed a job ID without prefixing it with JOB on the zowe job view asc command.

Message: item.trim is not a function Stack: TypeError: item.trim is not a function at Function.toBeDefinedAndNonBlank (C:\zowe\git\zowe-cli\node_modules\@zowe\imperative\lib\expect\src\ImperativeExpect.js:213:18) at Function.<anonymous> (C:\zowe\git\zowe-cli\packages\zosjobs\lib\GetJobs.js:106:43) at Generator.next (<anonymous>) at C:\zowe\git\zowe-cli\packages\zosjobs\lib\GetJobs.js:18:71 at new Promise (<anonymous>) at __awaiter (C:\zowe\git\zowe-cli\packages\zosjobs\lib\GetJobs.js:14:12) at Function.getJob (C:\zowe\git\zowe-cli\packages\zosjobs\lib\GetJobs.js:104:16) at AllSpoolContentHandler.<anonymous> (C:\zowe\git\zowe-cli\packages\cli\lib\zosjobs\view\all-spool-content\AllSpoolContent.handler.js:40:63) at Generator.next (<anonymous>) at C:\zowe\git\zowe-cli\packages\cli\lib\zosjobs\view\all-spool-content\AllSpoolContent.handler.js:18:71

Converting Item to a string first inside the function will correct the problem.

KevinLoesch1 avatar Jul 22 '22 18:07 KevinLoesch1