@sasjs/cli 3.7.8 → 3.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -259,11 +259,11 @@ function deployToSasViya(deployScriptName, target, isLocal, linesToExecute, logF
259
259
  * for printing web app url on console.
260
260
  */
261
261
  function deployToSas9(deployScriptName, target, linesToExecute, logFolder, streamConfig) {
262
- var _a, _b, _c, _d;
262
+ var _a, _b, _c, _d, _e;
263
263
  return __awaiter(this, void 0, void 0, function () {
264
- var username, password, sas9CredentialsError, sasjs, executionResult, appLoc, webAppStreamUrl;
265
- return __generator(this, function (_e) {
266
- switch (_e.label) {
264
+ var username, password, sas9CredentialsError, sasjs, completedWithError, executionResult, logContent, logFilePath, appLoc, webAppStreamUrl;
265
+ return __generator(this, function (_f) {
266
+ switch (_f.label) {
267
267
  case 0:
268
268
  if (target.authConfigSas9) {
269
269
  username = target.authConfigSas9.userName;
@@ -284,6 +284,7 @@ function deployToSas9(deployScriptName, target, linesToExecute, logFolder, strea
284
284
  appLoc: target.appLoc,
285
285
  serverType: target.serverType
286
286
  });
287
+ completedWithError = false;
287
288
  return [4 /*yield*/, sasjs
288
289
  .executeScriptSAS9(linesToExecute, username, password)
289
290
  .catch(function (err) {
@@ -292,30 +293,35 @@ function deployToSas9(deployScriptName, target, linesToExecute, logFolder, strea
292
293
  if (err && err.errorCode === 404) {
293
294
  (0, utils_1.displaySasjsRunnerError)(username);
294
295
  }
296
+ completedWithError = true;
297
+ return err;
295
298
  })];
296
299
  case 1:
297
- executionResult = _e.sent();
298
- if (!executionResult) return [3 /*break*/, 5];
299
- if (!logFolder) return [3 /*break*/, 3];
300
- return [4 /*yield*/, (0, utils_2.createFile)(path_1.default.join(logFolder, "".concat(deployScriptName.replace('.sas', ''), ".log")), executionResult !== null && executionResult !== void 0 ? executionResult : '')];
300
+ executionResult = _f.sent();
301
+ if (!executionResult) {
302
+ return [2 /*return*/, (_a = process.logger) === null || _a === void 0 ? void 0 : _a.error('Error getting execution log')];
303
+ }
304
+ if (!logFolder) {
305
+ return [2 /*return*/, (_b = process.logger) === null || _b === void 0 ? void 0 : _b.error('Unable to create log file.')];
306
+ }
307
+ logContent = completedWithError
308
+ ? executionResult.result
309
+ : executionResult;
310
+ logFilePath = path_1.default.join(logFolder, "".concat(deployScriptName.replace('.sas', ''), ".log"));
311
+ return [4 /*yield*/, (0, utils_2.createFile)(logFilePath, logContent !== null && logContent !== void 0 ? logContent : '')];
301
312
  case 2:
302
- _e.sent();
303
- (_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("Deployment completed! Log is available at ".concat(path_1.default.join(logFolder, "".concat(deployScriptName.replace('.sas', ''), ".log"))));
304
- return [3 /*break*/, 4];
305
- case 3:
306
- (_b = process.logger) === null || _b === void 0 ? void 0 : _b.error('Unable to create log file.');
307
- _e.label = 4;
308
- case 4:
313
+ _f.sent();
314
+ if (completedWithError) {
315
+ (_c = process.logger) === null || _c === void 0 ? void 0 : _c.error("Deployment failed with errors! Log is available at ".concat(logFilePath));
316
+ throw new Error("Deployment failed.");
317
+ }
318
+ (_d = process.logger) === null || _d === void 0 ? void 0 : _d.success("Deployment completed! Log is available at ".concat(logFilePath));
309
319
  if (streamConfig === null || streamConfig === void 0 ? void 0 : streamConfig.streamWeb) {
310
320
  appLoc = target.appLoc.replace(/\ /g, '%20');
311
321
  webAppStreamUrl = "".concat(target.serverUrl, "/SASStoredProcess/?_PROGRAM=").concat(appLoc, "/services/").concat(streamConfig.streamServiceName);
312
- (_c = process.logger) === null || _c === void 0 ? void 0 : _c.info("Web app is available at ".concat(webAppStreamUrl));
322
+ (_e = process.logger) === null || _e === void 0 ? void 0 : _e.info("Web app is available at ".concat(webAppStreamUrl));
313
323
  }
314
- return [3 /*break*/, 6];
315
- case 5:
316
- (_d = process.logger) === null || _d === void 0 ? void 0 : _d.error('Error getting execution log');
317
- _e.label = 6;
318
- case 6: return [2 /*return*/];
324
+ return [2 /*return*/];
319
325
  }
320
326
  });
321
327
  });
@@ -225,13 +225,14 @@ function runTest(target, testRegExps, outDirectory, flowSourcePath) {
225
225
  printTestUrl = function () { return process.logger.info("Test URL: ".concat(testUrl)); };
226
226
  printTestUrl();
227
227
  handleRes = function (res) { return __awaiter(_this, void 0, void 0, function () {
228
- var lineBreak, existingTestTarget, existingTestTarget;
228
+ var lineBreak, test_results, existingTestTarget, existingTestTarget;
229
229
  var _a, _b;
230
230
  return __generator(this, function (_c) {
231
231
  switch (_c.label) {
232
232
  case 0:
233
233
  lineBreak = true;
234
- if (!res.result) {
234
+ test_results = (_a = res.result) === null || _a === void 0 ? void 0 : _a.test_results;
235
+ if (!test_results) {
235
236
  (0, displayResult_1.displayError)({}, "Job did not return a response, to debug click ".concat(testUrl));
236
237
  printCodeExample();
237
238
  lineBreak = false;
@@ -258,8 +259,6 @@ function runTest(target, testRegExps, outDirectory, flowSourcePath) {
258
259
  });
259
260
  }
260
261
  }
261
- if (!((_a = res.result) === null || _a === void 0 ? void 0 : _a.test_results))
262
- lineBreak = false;
263
262
  if (!res.log) return [3 /*break*/, 2];
264
263
  return [4 /*yield*/, (0, saveOutput_1.saveLog)(outDirectory, test, res.log, lineBreak)];
265
264
  case 1:
package/package.json CHANGED
@@ -47,8 +47,8 @@
47
47
  "access": "public"
48
48
  },
49
49
  "dependencies": {
50
- "@sasjs/adapter": "3.7.4",
51
- "@sasjs/core": "4.9.2",
50
+ "@sasjs/adapter": "3.7.6",
51
+ "@sasjs/core": "4.9.3",
52
52
  "@sasjs/lint": "1.11.2",
53
53
  "@sasjs/utils": "2.36.0",
54
54
  "chalk": "4.1.2",
@@ -94,5 +94,5 @@
94
94
  "typescript": "4.5.4",
95
95
  "util": "0.12.4"
96
96
  },
97
- "version": "3.7.8"
97
+ "version": "3.7.9"
98
98
  }