@sasjs/cli 3.27.6 → 3.28.0

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.
@@ -100,14 +100,25 @@ var compressAndSave_1 = require("../../utils/compressAndSave");
100
100
  var loadDependencies_1 = require("../compile/internal/loadDependencies");
101
101
  function build(target) {
102
102
  return __awaiter(this, void 0, void 0, function () {
103
- return __generator(this, function (_a) {
104
- switch (_a.label) {
105
- case 0: return [4 /*yield*/, (0, compile_1.compile)(target)];
103
+ var _a;
104
+ return __generator(this, function (_b) {
105
+ switch (_b.label) {
106
+ case 0:
107
+ _a = process.sasjsConstants.buildDestinationFolder;
108
+ if (!_a) return [3 /*break*/, 2];
109
+ return [4 /*yield*/, (0, utils_1.folderExists)(process.sasjsConstants.buildDestinationFolder)];
106
110
  case 1:
107
- _a.sent();
108
- return [4 /*yield*/, createFinalSasFiles(target)];
111
+ _a = !(_b.sent());
112
+ _b.label = 2;
109
113
  case 2:
110
- _a.sent();
114
+ if (!_a) return [3 /*break*/, 4];
115
+ return [4 /*yield*/, (0, compile_1.compile)(target)];
116
+ case 3:
117
+ _b.sent();
118
+ _b.label = 4;
119
+ case 4: return [4 /*yield*/, createFinalSasFiles(target)];
120
+ case 5:
121
+ _b.sent();
111
122
  return [2 /*return*/];
112
123
  }
113
124
  });
@@ -1,4 +1,4 @@
1
1
  import { Target } from '@sasjs/utils';
2
- export declare function compileSingleFile(target: Target, subCommand: string | undefined, source: string, output: string, insertProgramVar?: boolean): Promise<{
2
+ export declare function compileSingleFile(target: Target, subCommand: string | undefined, source: string, output: string, insertProgramVar?: boolean, currentFolder?: string): Promise<{
3
3
  destinationPath: string;
4
4
  }>;
@@ -46,7 +46,7 @@ var utils_1 = require("@sasjs/utils");
46
46
  var compileFile_1 = require("./internal/compileFile");
47
47
  var identifySasFile_1 = require("./internal/identifySasFile");
48
48
  var loadDependencies_1 = require("./internal/loadDependencies");
49
- function compileSingleFile(target, subCommand, source, output, insertProgramVar) {
49
+ function compileSingleFile(target, subCommand, source, output, insertProgramVar, currentFolder) {
50
50
  var _a;
51
51
  if (subCommand === void 0) { subCommand = 'identify'; }
52
52
  if (insertProgramVar === void 0) { insertProgramVar = false; }
@@ -67,7 +67,7 @@ function compileSingleFile(target, subCommand, source, output, insertProgramVar)
67
67
  throw new Error("'--source' flag is missing (eg '".concat(commandExample, "')"));
68
68
  }
69
69
  source = source.split('/').join(path_1.default.sep);
70
- sourcePath = (0, utils_1.getAbsolutePath)(source, process.currentDir);
70
+ sourcePath = (0, utils_1.getAbsolutePath)(source, currentFolder || process.currentDir);
71
71
  return [4 /*yield*/, validateSourcePath(sourcePath)];
72
72
  case 1:
73
73
  if (!(_c.sent())) {
@@ -74,7 +74,7 @@ describe('saveToCsv', function () {
74
74
  return [4 /*yield*/, (0, utils_1.readFile)(csvFilePath)];
75
75
  case 2:
76
76
  csvContent = _a.sent();
77
- expect(csvContent).toEqual(expect.stringContaining('1,someFlowName,flow1 | flow2,location,success,,'));
77
+ expect(csvContent).toEqual(expect.stringContaining('1,someFlowName,"flow1 | flow2",location,success,,'));
78
78
  return [2 /*return*/];
79
79
  }
80
80
  });
@@ -1,6 +1,6 @@
1
1
  import { TestResults, TestResultCsv } from '../../../types';
2
2
  export declare const saveLog: (outDirectory: string, test: string, log: string, lineBreak?: boolean) => Promise<void>;
3
3
  export declare const saveResultJson: (jsonPath: string, result: TestResults) => Promise<void>;
4
- export declare const saveResultCsv: (csvPath: string, result: TestResults, options?: {}) => Promise<TestResultCsv[]>;
4
+ export declare const saveResultCsv: (csvPath: string, result: TestResults, columns?: string[]) => Promise<TestResultCsv[]>;
5
5
  export declare const saveResultXml: (xmlPath: string, result: TestResults) => Promise<void>;
6
6
  export declare const saveCoverageLcov: (coverageReportPath: string, tests: string[]) => Promise<void>;
@@ -69,7 +69,6 @@ var path_1 = __importDefault(require("path"));
69
69
  var utils_1 = require("@sasjs/utils");
70
70
  var file_1 = require("../../../utils/file");
71
71
  var displayResult_1 = require("../../../utils/displayResult");
72
- var csv_stringify_1 = require("csv-stringify");
73
72
  var types_1 = require("../../../types");
74
73
  var xml_1 = __importDefault(require("xml"));
75
74
  var resultFileName = 'testResults';
@@ -111,18 +110,15 @@ var saveResultJson = function (jsonPath, result) { return __awaiter(void 0, void
111
110
  });
112
111
  }); };
113
112
  exports.saveResultJson = saveResultJson;
114
- var saveResultCsv = function (csvPath, result, options) {
115
- if (options === void 0) { options = {
116
- header: true,
117
- columns: {
118
- test_target: 'test_target',
119
- test_loc: 'test_loc',
120
- sasjs_test_id: 'sasjs_test_id',
121
- test_suite_result: 'test_suite_result',
122
- test_description: 'test_description',
123
- test_url: 'test_url'
124
- }
125
- }; }
113
+ var saveResultCsv = function (csvPath, result, columns) {
114
+ if (columns === void 0) { columns = [
115
+ 'test_target',
116
+ 'test_loc',
117
+ 'sasjs_test_id',
118
+ 'test_suite_result',
119
+ 'test_description',
120
+ 'test_url'
121
+ ]; }
126
122
  return __awaiter(void 0, void 0, void 0, function () {
127
123
  var csvData;
128
124
  return __generator(this, function (_a) {
@@ -149,24 +145,11 @@ var saveResultCsv = function (csvPath, result, options) {
149
145
  return item;
150
146
  });
151
147
  });
152
- return [2 /*return*/, new Promise(function (resolve, reject) {
153
- return (0, csv_stringify_1.stringify)(csvData, options || {}, function (err, output) { return __awaiter(void 0, void 0, void 0, function () {
154
- return __generator(this, function (_a) {
155
- switch (_a.label) {
156
- case 0:
157
- if (err) {
158
- (0, displayResult_1.displayError)(err, 'Error while saving CSV file');
159
- reject(err);
160
- }
161
- return [4 /*yield*/, (0, utils_1.createFile)(csvPath, output).catch(function (err) {
162
- return (0, displayResult_1.displayError)(err, 'Error while creating CSV file.');
163
- })];
164
- case 1:
165
- _a.sent();
166
- return [2 /*return*/, resolve(csvData)];
167
- }
168
- });
169
- }); });
148
+ return [2 /*return*/, (0, utils_1.createCsv)(csvPath, csvData, columns)
149
+ .then(function () { return csvData; })
150
+ .catch(function (err) {
151
+ (0, displayResult_1.displayError)(err, 'Error while creating CSV file');
152
+ throw err;
170
153
  })];
171
154
  });
172
155
  });
@@ -234,7 +234,7 @@ describe('sasjs test', function () {
234
234
  }
235
235
  ]
236
236
  };
237
- expectedResultsCsv = "test_target,test_loc,sasjs_test_id,test_suite_result,test_description,test_url\ntestsetup,tests/testsetup.sas,sasjs_test_id,not provided,,".concat(testUrlLink('testsetup'), "\nexampleprogram,tests/jobs/jobs/exampleprogram.test.sas,sasjs_test_id,not provided,,").concat(testUrlLink('jobs/jobs/exampleprogram.test'), "\nstandalone,tests/jobs/jobs/standalone.test.sas,sasjs_test_id,not provided,,").concat(testUrlLink('jobs/jobs/standalone.test'), "\nexamplemacro,tests/macros/examplemacro.test.sas,sasjs_test_id,PASS,examplemacro test.1 description,").concat(testUrlLink('macros/examplemacro.test'), "\ndostuff,tests/services/admin/dostuff.test.0.sas,sasjs_test_id,FAIL,dostuff 0 test description,").concat(testUrlLink('services/admin/dostuff.test.0'), "\ndostuff,tests/services/admin/dostuff.test.1.sas,sasjs_test_id,PASS,dostuff 1 test description,").concat(testUrlLink('services/admin/dostuff.test.1'), "\ntestteardown,tests/testteardown.sas,sasjs_test_id,not provided,,").concat(testUrlLink('testteardown'), "\n");
237
+ expectedResultsCsv = "test_target,test_loc,sasjs_test_id,test_suite_result,test_description,test_url\ntestsetup,tests/testsetup.sas,sasjs_test_id,not provided,,".concat(testUrlLink('testsetup'), "\nexampleprogram,tests/jobs/jobs/exampleprogram.test.sas,sasjs_test_id,not provided,,").concat(testUrlLink('jobs/jobs/exampleprogram.test'), "\nstandalone,tests/jobs/jobs/standalone.test.sas,sasjs_test_id,not provided,,").concat(testUrlLink('jobs/jobs/standalone.test'), "\nexamplemacro,tests/macros/examplemacro.test.sas,sasjs_test_id,PASS,examplemacro test.1 description,").concat(testUrlLink('macros/examplemacro.test'), "\ndostuff,tests/services/admin/dostuff.test.0.sas,sasjs_test_id,FAIL,dostuff 0 test description,").concat(testUrlLink('services/admin/dostuff.test.0'), "\ndostuff,tests/services/admin/dostuff.test.1.sas,sasjs_test_id,PASS,dostuff 1 test description,").concat(testUrlLink('services/admin/dostuff.test.1'), "\ntestteardown,tests/testteardown.sas,sasjs_test_id,not provided,,").concat(testUrlLink('testteardown'));
238
238
  return [4 /*yield*/, (0, test_1.runTest)(target, undefined, undefined, undefined, true)];
239
239
  case 1:
240
240
  _a.sent();
@@ -359,7 +359,7 @@ describe('sasjs test', function () {
359
359
  }
360
360
  ]
361
361
  };
362
- expectedResultsCsv = "test_target,test_loc,sasjs_test_id,test_suite_result,test_description,test_url\ntestsetup,tests/testsetup.sas,sasjs_test_id,not provided,,".concat(testUrlLink('testsetup'), "\nstandalone,tests/jobs/jobs/standalone.test.sas,sasjs_test_id,not provided,,").concat(testUrlLink('jobs/jobs/standalone.test'), "\ndostuff,tests/services/admin/dostuff.test.0.sas,sasjs_test_id,FAIL,dostuff 0 test description,").concat(testUrlLink('services/admin/dostuff.test.0'), "\ntestteardown,tests/testteardown.sas,sasjs_test_id,not provided,,").concat(testUrlLink('testteardown'), "\n");
362
+ expectedResultsCsv = "test_target,test_loc,sasjs_test_id,test_suite_result,test_description,test_url\ntestsetup,tests/testsetup.sas,sasjs_test_id,not provided,,".concat(testUrlLink('testsetup'), "\nstandalone,tests/jobs/jobs/standalone.test.sas,sasjs_test_id,not provided,,").concat(testUrlLink('jobs/jobs/standalone.test'), "\ndostuff,tests/services/admin/dostuff.test.0.sas,sasjs_test_id,FAIL,dostuff 0 test description,").concat(testUrlLink('services/admin/dostuff.test.0'), "\ntestteardown,tests/testteardown.sas,sasjs_test_id,not provided,,").concat(testUrlLink('testteardown'));
363
363
  return [4 /*yield*/, (0, test_1.runTest)(target, ['jobs/standalone', 'shouldFail', 'services/admin/dostuff.test.0'], outputFolder, movedTestFlow, true)];
364
364
  case 2:
365
365
  _a.sent();
@@ -572,7 +572,7 @@ describe('sasjs test', function () {
572
572
  }
573
573
  ]
574
574
  };
575
- expectedResultsCsv = "test_target,test_loc,sasjs_test_id,test_suite_result,test_description,test_url\ntestsetup,tests/testsetup.sas,sasjs_test_id,not provided,,".concat(testUrlLink('testsetup'), "\nexampleprogram,tests/jobs/jobs/exampleprogram.test.sas,sasjs_test_id,not provided,,").concat(testUrlLink('jobs/jobs/exampleprogram.test'), "\nstandalone,tests/jobs/jobs/standalone.test.sas,sasjs_test_id,not provided,,").concat(testUrlLink('jobs/jobs/standalone.test'), "\nexamplemacro,tests/macros/examplemacro.test.sas,sasjs_test_id,PASS,examplemacro test.1 description,").concat(testUrlLink('macros/examplemacro.test'), "\nshouldFail,tests/macros/shouldFail.test.sas,sasjs_test_id,not provided,,").concat(testUrlLink('macros/shouldFail.test'), "\ndostuff,tests/services/admin/dostuff.test.0.sas,sasjs_test_id,FAIL,dostuff 0 test description,").concat(testUrlLink('services/admin/dostuff.test.0'), "\ndostuff,tests/services/admin/dostuff.test.1.sas,sasjs_test_id,PASS,dostuff 1 test description,").concat(testUrlLink('services/admin/dostuff.test.1'), "\ntestteardown,tests/testteardown.sas,sasjs_test_id,not provided,,").concat(testUrlLink('testteardown'), "\n");
575
+ expectedResultsCsv = "test_target,test_loc,sasjs_test_id,test_suite_result,test_description,test_url\ntestsetup,tests/testsetup.sas,sasjs_test_id,not provided,,".concat(testUrlLink('testsetup'), "\nexampleprogram,tests/jobs/jobs/exampleprogram.test.sas,sasjs_test_id,not provided,,").concat(testUrlLink('jobs/jobs/exampleprogram.test'), "\nstandalone,tests/jobs/jobs/standalone.test.sas,sasjs_test_id,not provided,,").concat(testUrlLink('jobs/jobs/standalone.test'), "\nexamplemacro,tests/macros/examplemacro.test.sas,sasjs_test_id,PASS,examplemacro test.1 description,").concat(testUrlLink('macros/examplemacro.test'), "\nshouldFail,tests/macros/shouldFail.test.sas,sasjs_test_id,not provided,,").concat(testUrlLink('macros/shouldFail.test'), "\ndostuff,tests/services/admin/dostuff.test.0.sas,sasjs_test_id,FAIL,dostuff 0 test description,").concat(testUrlLink('services/admin/dostuff.test.0'), "\ndostuff,tests/services/admin/dostuff.test.1.sas,sasjs_test_id,PASS,dostuff 1 test description,").concat(testUrlLink('services/admin/dostuff.test.1'), "\ntestteardown,tests/testteardown.sas,sasjs_test_id,not provided,,").concat(testUrlLink('testteardown'));
576
576
  return [4 /*yield*/, (0, test_1.runTest)(target, undefined, undefined, undefined, true)];
577
577
  case 1:
578
578
  _a.sent();
package/package.json CHANGED
@@ -53,10 +53,9 @@
53
53
  "@sasjs/adapter": "4.1.3",
54
54
  "@sasjs/core": "4.45.4",
55
55
  "@sasjs/lint": "2.2.2",
56
- "@sasjs/utils": "2.52.0",
56
+ "@sasjs/utils": "3.0.1",
57
57
  "adm-zip": "0.5.9",
58
58
  "chalk": "4.1.2",
59
- "csv-stringify": "6.2.4",
60
59
  "dotenv": "10.0.0",
61
60
  "esm": "3.2.25",
62
61
  "find": "0.3.0",
@@ -101,5 +100,5 @@
101
100
  "typescript": "4.5.4",
102
101
  "util": "0.12.4"
103
102
  },
104
- "version": "3.27.6"
103
+ "version": "3.28.0"
105
104
  }