@sasjs/cli 3.0.4 → 3.4.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.
- package/build/commands/add/spec/addTarget.spec.js +2 -2
- package/build/commands/compile/internal/compileServiceFile.js +6 -6
- package/build/commands/deploy/spec/cbd.spec.js +2 -2
- package/build/commands/job/internal/execute/viya.js +0 -6
- package/build/commands/job/internal/utils.js +6 -8
- package/build/commands/job/jobCommand.d.ts +1 -0
- package/build/commands/job/jobCommand.js +8 -3
- package/build/commands/job/spec/jobCommand.spec.js +10 -3
- package/build/commands/shared/fetchLogFileContent.js +6 -8
- package/build/commands/testing/internal/saveOutput.d.ts +1 -0
- package/build/commands/testing/internal/saveOutput.js +41 -1
- package/build/commands/testing/spec/testing.spec.server.js +10 -1
- package/build/commands/testing/test.js +6 -2
- package/build/utils/utils.js +1 -5
- package/package.json +3 -3
|
@@ -175,7 +175,7 @@ describe('addTarget', function () {
|
|
|
175
175
|
serverType: utils_1.ServerType.Sasjs,
|
|
176
176
|
name: sasjsTargetName,
|
|
177
177
|
appLoc: '/Public/app',
|
|
178
|
-
serverUrl: process.env.SASJS_SERVER_URL,
|
|
178
|
+
serverUrl: process.env.SASJS_SERVER_URL || '',
|
|
179
179
|
existingTarget: {}
|
|
180
180
|
};
|
|
181
181
|
jest
|
|
@@ -374,7 +374,7 @@ describe('addTarget', function () {
|
|
|
374
374
|
serverType: utils_1.ServerType.Sasjs,
|
|
375
375
|
name: 'server',
|
|
376
376
|
appLoc: '/Public/app/new/location/2',
|
|
377
|
-
serverUrl: process.env.SASJS_SERVER_URL,
|
|
377
|
+
serverUrl: process.env.SASJS_SERVER_URL || '',
|
|
378
378
|
existingTarget: targetJson
|
|
379
379
|
};
|
|
380
380
|
jest
|
|
@@ -101,8 +101,8 @@ function getPreCodeForServicePack(serverType) {
|
|
|
101
101
|
'/* so we provide instead as __program */\n' +
|
|
102
102
|
'%global __program _program;\n' +
|
|
103
103
|
'%let _program=%sysfunc(coalescec(&__program,&_program));\n' +
|
|
104
|
-
'%macro webout(action,ds,dslabel=,fmt=);\n' +
|
|
105
|
-
'%mv_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt)\n' +
|
|
104
|
+
'%macro webout(action,ds,dslabel=,fmt=,missing=NULL);\n' +
|
|
105
|
+
'%mv_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt,missing=&missing)\n' +
|
|
106
106
|
'%mend;\n';
|
|
107
107
|
return [3 /*break*/, 14];
|
|
108
108
|
case 5:
|
|
@@ -119,8 +119,8 @@ function getPreCodeForServicePack(serverType) {
|
|
|
119
119
|
case 8:
|
|
120
120
|
content = _g + _l.sent();
|
|
121
121
|
content +=
|
|
122
|
-
' %macro webout(action,ds,dslabel=,fmt=);\n' +
|
|
123
|
-
' %mm_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt)\n' +
|
|
122
|
+
' %macro webout(action,ds,dslabel=,fmt=,missing=NULL);\n' +
|
|
123
|
+
' %mm_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt,missing=&missing)\n' +
|
|
124
124
|
' %mend;\n';
|
|
125
125
|
return [3 /*break*/, 14];
|
|
126
126
|
case 9:
|
|
@@ -137,8 +137,8 @@ function getPreCodeForServicePack(serverType) {
|
|
|
137
137
|
case 12:
|
|
138
138
|
content = _k + _l.sent();
|
|
139
139
|
content +=
|
|
140
|
-
' %macro webout(action,ds,dslabel=,fmt=);\n' +
|
|
141
|
-
' %ms_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt)\n' +
|
|
140
|
+
' %macro webout(action,ds,dslabel=,fmt=,missing=NULL);\n' +
|
|
141
|
+
' %ms_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt,missing=&missing)\n' +
|
|
142
142
|
' %mend;\n';
|
|
143
143
|
return [3 /*break*/, 14];
|
|
144
144
|
case 13: throw new error_1.ServerTypeError();
|
|
@@ -119,8 +119,8 @@ describe('sasjs cbd with server type SASJS', function () {
|
|
|
119
119
|
return [4 /*yield*/, utils_1.readFile(macroCorePath + "/server/ms_webout.sas")];
|
|
120
120
|
case 7:
|
|
121
121
|
ms_webout = _a.sent();
|
|
122
|
-
webout = ' %macro webout(action,ds,dslabel=,fmt=);\n' +
|
|
123
|
-
' %ms_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt)\n' +
|
|
122
|
+
webout = ' %macro webout(action,ds,dslabel=,fmt=,missing=NULL);\n' +
|
|
123
|
+
' %ms_webout(&action,ds=&ds,dslabel=&dslabel,fmt=&fmt,missing=&missing)\n' +
|
|
124
124
|
' %mend;\n';
|
|
125
125
|
expect(sasjs.deployToSASjs).toHaveBeenCalledWith({
|
|
126
126
|
members: [
|
|
@@ -170,12 +170,6 @@ function executeJobViya(sasjs, authConfig, jobPath, target, waitForJob, output,
|
|
|
170
170
|
if (!result)
|
|
171
171
|
result = true;
|
|
172
172
|
sessionLink = submittedJob.links.find(function (l) { return l.method === 'GET' && l.rel === 'self'; }).href;
|
|
173
|
-
if (!returnStatusOnly) {
|
|
174
|
-
displayResult_1.displaySuccess((waitForJob
|
|
175
|
-
? "Job located at '" + jobPath + "' has been executed.\nJob details"
|
|
176
|
-
: "Job session") +
|
|
177
|
-
(" can be found at " + (target.serverUrl + sessionLink)));
|
|
178
|
-
}
|
|
179
173
|
if (!(output || logFile)) return [3 /*break*/, 20];
|
|
180
174
|
_c.label = 9;
|
|
181
175
|
case 9:
|
|
@@ -46,9 +46,8 @@ var utils_2 = require("../../../utils/utils");
|
|
|
46
46
|
var displayResult_1 = require("../../../utils/displayResult");
|
|
47
47
|
var saveLog = function (logData, logFile, jobPath, returnStatusOnly) { return __awaiter(void 0, void 0, void 0, function () {
|
|
48
48
|
var logPath, folderPath, parentFolderPath, logLines;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
switch (_b.label) {
|
|
49
|
+
return __generator(this, function (_a) {
|
|
50
|
+
switch (_a.label) {
|
|
52
51
|
case 0:
|
|
53
52
|
if (logFile) {
|
|
54
53
|
logPath = logFile;
|
|
@@ -61,17 +60,16 @@ var saveLog = function (logData, logFile, jobPath, returnStatusOnly) { return __
|
|
|
61
60
|
parentFolderPath = folderPath.join(path_1.default.sep);
|
|
62
61
|
return [4 /*yield*/, utils_1.folderExists(parentFolderPath)];
|
|
63
62
|
case 1:
|
|
64
|
-
if (!!(
|
|
63
|
+
if (!!(_a.sent())) return [3 /*break*/, 3];
|
|
65
64
|
return [4 /*yield*/, utils_1.createFolder(parentFolderPath)];
|
|
66
65
|
case 2:
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
_a.sent();
|
|
67
|
+
_a.label = 3;
|
|
69
68
|
case 3:
|
|
70
69
|
logLines = typeof logData === 'object' ? utils_2.parseLogLines(logData) : logData;
|
|
71
|
-
(_a = process.logger) === null || _a === void 0 ? void 0 : _a.info("Creating log file at " + logPath + " .");
|
|
72
70
|
return [4 /*yield*/, utils_1.createFile(logPath, logLines)];
|
|
73
71
|
case 4:
|
|
74
|
-
|
|
72
|
+
_a.sent();
|
|
75
73
|
if (!returnStatusOnly)
|
|
76
74
|
displayResult_1.displaySuccess("Log saved to " + logPath);
|
|
77
75
|
return [2 /*return*/];
|
|
@@ -3,6 +3,7 @@ import { AuthConfig, Target } from '@sasjs/utils';
|
|
|
3
3
|
import { ReturnCode } from '../../types/command';
|
|
4
4
|
import { TargetCommand } from '../../types/command/targetCommand';
|
|
5
5
|
export declare class JobCommand extends TargetCommand {
|
|
6
|
+
private jobSubCommands;
|
|
6
7
|
constructor(args: string[]);
|
|
7
8
|
execute(): Promise<ReturnCode>;
|
|
8
9
|
executeJobSasjs(sasjs: SASjs, target: Target): Promise<ReturnCode>;
|
|
@@ -66,6 +66,7 @@ var execute_1 = require("./internal/execute");
|
|
|
66
66
|
var JobSubCommand;
|
|
67
67
|
(function (JobSubCommand) {
|
|
68
68
|
JobSubCommand["Execute"] = "execute";
|
|
69
|
+
JobSubCommand["Exec"] = "exec";
|
|
69
70
|
})(JobSubCommand || (JobSubCommand = {}));
|
|
70
71
|
var syntax = 'job <subCommand> <jobPath> [options]';
|
|
71
72
|
var usage = 'sasjs job <execute> <jobPath> [options]';
|
|
@@ -123,8 +124,11 @@ var JobCommand = /** @class */ (function (_super) {
|
|
|
123
124
|
__extends(JobCommand, _super);
|
|
124
125
|
function JobCommand(args) {
|
|
125
126
|
var _this = this;
|
|
127
|
+
var jobSubCommands = Object.values(JobSubCommand);
|
|
126
128
|
var subCommand = args[3];
|
|
127
|
-
var parseOptions = subCommand
|
|
129
|
+
var parseOptions = jobSubCommands.includes(subCommand)
|
|
130
|
+
? executeParseOptions
|
|
131
|
+
: {};
|
|
128
132
|
_this = _super.call(this, args, {
|
|
129
133
|
parseOptions: parseOptions,
|
|
130
134
|
usage: usage,
|
|
@@ -132,6 +136,7 @@ var JobCommand = /** @class */ (function (_super) {
|
|
|
132
136
|
examples: examples,
|
|
133
137
|
syntax: syntax
|
|
134
138
|
}) || this;
|
|
139
|
+
_this.jobSubCommands = jobSubCommands;
|
|
135
140
|
return _this;
|
|
136
141
|
}
|
|
137
142
|
JobCommand.prototype.execute = function () {
|
|
@@ -166,7 +171,7 @@ var JobCommand = /** @class */ (function (_super) {
|
|
|
166
171
|
authConfig = _e.sent();
|
|
167
172
|
if (!authConfig)
|
|
168
173
|
return [2 /*return*/, command_1.ReturnCode.InternalError];
|
|
169
|
-
if (!(this.parsed.subCommand
|
|
174
|
+
if (!this.jobSubCommands.includes(this.parsed.subCommand)) return [3 /*break*/, 5];
|
|
170
175
|
return [4 /*yield*/, this.executeJobViya(target, sasjs, authConfig)];
|
|
171
176
|
case 4:
|
|
172
177
|
_c = _e.sent();
|
|
@@ -182,7 +187,7 @@ var JobCommand = /** @class */ (function (_super) {
|
|
|
182
187
|
});
|
|
183
188
|
if (typeof this.parsed.jobPath !== 'string')
|
|
184
189
|
return [2 /*return*/, command_1.ReturnCode.InvalidCommand];
|
|
185
|
-
if (!(this.parsed.subCommand
|
|
190
|
+
if (!this.jobSubCommands.includes(this.parsed.subCommand)) return [3 /*break*/, 9];
|
|
186
191
|
return [4 /*yield*/, this.executeJobSasjs(sasjs, target)];
|
|
187
192
|
case 8:
|
|
188
193
|
_d = _e.sent();
|
|
@@ -362,17 +362,24 @@ var executeCalledWith = function (_a) {
|
|
|
362
362
|
var executeCommandWrapper = function (additionalParams, checkTarget) {
|
|
363
363
|
if (checkTarget === void 0) { checkTarget = true; }
|
|
364
364
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
365
|
-
var args, command, returnCode, targetInfo;
|
|
365
|
+
var subCommand, args, command, returnCode, targetInfo;
|
|
366
366
|
return __generator(this, function (_a) {
|
|
367
367
|
switch (_a.label) {
|
|
368
368
|
case 0:
|
|
369
|
-
|
|
369
|
+
subCommand = 'execute';
|
|
370
|
+
args = __spreadArray(__spreadArray([], __read(defaultArgs)), __read(additionalParams)).map(function (arg) {
|
|
371
|
+
if (arg === 'execute') {
|
|
372
|
+
arg = Math.random() > 0.5 ? 'exec' : arg;
|
|
373
|
+
subCommand = arg;
|
|
374
|
+
}
|
|
375
|
+
return arg;
|
|
376
|
+
});
|
|
370
377
|
command = new jobCommand_1.JobCommand(args);
|
|
371
378
|
return [4 /*yield*/, command.execute()];
|
|
372
379
|
case 1:
|
|
373
380
|
returnCode = _a.sent();
|
|
374
381
|
expect(command.name).toEqual('job');
|
|
375
|
-
expect(command.subCommand).toEqual(
|
|
382
|
+
expect(command.subCommand).toEqual(subCommand);
|
|
376
383
|
if (!checkTarget) return [3 /*break*/, 3];
|
|
377
384
|
return [4 /*yield*/, command.getTargetInfo()];
|
|
378
385
|
case 2:
|
|
@@ -68,28 +68,26 @@ exports.fetchLogFileContent = void 0;
|
|
|
68
68
|
*/
|
|
69
69
|
var fetchLogFileContent = function (sasjs, accessToken, logUrl, logCount) { return __awaiter(void 0, void 0, void 0, function () {
|
|
70
70
|
var logJson, loglimit, start, logChunkJson, _a, _b;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
switch (_d.label) {
|
|
71
|
+
return __generator(this, function (_c) {
|
|
72
|
+
switch (_c.label) {
|
|
74
73
|
case 0:
|
|
75
74
|
logJson = { items: [] };
|
|
76
75
|
loglimit = logCount < 10000 ? logCount : 10000;
|
|
77
76
|
start = 0;
|
|
78
|
-
|
|
77
|
+
_c.label = 1;
|
|
79
78
|
case 1:
|
|
80
|
-
(_c = process.logger) === null || _c === void 0 ? void 0 : _c.info("Fetching logs from line no: " + (start + 1) + " to " + (start + loglimit) + " of " + logCount + ".");
|
|
81
79
|
_b = (_a = JSON).parse;
|
|
82
80
|
return [4 /*yield*/, sasjs.fetchLogFileContent(logUrl + "?start=" + start + "&limit=" + loglimit, accessToken)];
|
|
83
81
|
case 2:
|
|
84
|
-
logChunkJson = _b.apply(_a, [(
|
|
82
|
+
logChunkJson = _b.apply(_a, [(_c.sent())]);
|
|
85
83
|
if (logChunkJson.items.length === 0)
|
|
86
84
|
return [3 /*break*/, 4];
|
|
87
85
|
logJson.items = __spreadArray(__spreadArray([], __read(logJson.items)), __read(logChunkJson.items));
|
|
88
86
|
start += loglimit;
|
|
89
|
-
|
|
87
|
+
_c.label = 3;
|
|
90
88
|
case 3:
|
|
91
89
|
if (start < logCount) return [3 /*break*/, 1];
|
|
92
|
-
|
|
90
|
+
_c.label = 4;
|
|
93
91
|
case 4: return [2 /*return*/, logJson];
|
|
94
92
|
}
|
|
95
93
|
});
|
|
@@ -6,3 +6,4 @@ export declare const saveResultCsv: (outDirectory: string, result: TestResults,
|
|
|
6
6
|
csvPath: string;
|
|
7
7
|
}>;
|
|
8
8
|
export declare const saveResultXml: (outDirectory: string, result: TestResults) => Promise<string>;
|
|
9
|
+
export declare const saveCoverageLcov: (outDirectory: string, tests: string[]) => Promise<string>;
|
|
@@ -60,7 +60,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
60
60
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
61
61
|
};
|
|
62
62
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63
|
-
exports.saveResultXml = exports.saveResultCsv = exports.saveResultJson = exports.saveLog = void 0;
|
|
63
|
+
exports.saveCoverageLcov = exports.saveResultXml = exports.saveResultCsv = exports.saveResultJson = exports.saveLog = void 0;
|
|
64
64
|
var path_1 = __importDefault(require("path"));
|
|
65
65
|
var utils_1 = require("@sasjs/utils");
|
|
66
66
|
var file_1 = require("../../../utils/file");
|
|
@@ -262,3 +262,43 @@ var saveResultXml = function (outDirectory, result) { return __awaiter(void 0, v
|
|
|
262
262
|
});
|
|
263
263
|
}); };
|
|
264
264
|
exports.saveResultXml = saveResultXml;
|
|
265
|
+
var saveCoverageLcov = function (outDirectory, tests) { return __awaiter(void 0, void 0, void 0, function () {
|
|
266
|
+
var testsPrefixRegExp, coverageReport, coveringFile, filePath;
|
|
267
|
+
return __generator(this, function (_a) {
|
|
268
|
+
switch (_a.label) {
|
|
269
|
+
case 0:
|
|
270
|
+
testsPrefixRegExp = new RegExp("^tests/");
|
|
271
|
+
coverageReport = [];
|
|
272
|
+
coveringFile = function (filePath) { return __awaiter(void 0, void 0, void 0, function () {
|
|
273
|
+
return __generator(this, function (_a) {
|
|
274
|
+
switch (_a.label) {
|
|
275
|
+
case 0: return [4 /*yield*/, utils_1.fileExists(path_1.default.join(process.sasjsConstants.buildDestinationFolder, filePath))];
|
|
276
|
+
case 1: return [2 /*return*/, (_a.sent())
|
|
277
|
+
? filePath
|
|
278
|
+
: 'standalone'];
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
}); };
|
|
282
|
+
return [4 /*yield*/, utils_1.asyncForEach(tests, function (test) { return __awaiter(void 0, void 0, void 0, function () {
|
|
283
|
+
var _a, _b, _c;
|
|
284
|
+
return __generator(this, function (_d) {
|
|
285
|
+
switch (_d.label) {
|
|
286
|
+
case 0:
|
|
287
|
+
_b = (_a = coverageReport).push;
|
|
288
|
+
_c = "TN:" + test.split('/').pop() + "\nSF:";
|
|
289
|
+
return [4 /*yield*/, coveringFile(test.replace(testsPrefixRegExp, '').replace(utils_1.testFileRegExp, '.sas'))];
|
|
290
|
+
case 1: return [2 /*return*/, _b.apply(_a, [_c + (_d.sent()) + "\nFNF:1\nFNH:1\nLF:1\nLH:1\nBRF:1\nBRH:1\nend_of_record"])];
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
}); })];
|
|
294
|
+
case 1:
|
|
295
|
+
_a.sent();
|
|
296
|
+
filePath = path_1.default.join(outDirectory, 'coverage.lcov');
|
|
297
|
+
return [4 /*yield*/, utils_1.createFile(filePath, coverageReport.join('\n'))];
|
|
298
|
+
case 2:
|
|
299
|
+
_a.sent();
|
|
300
|
+
return [2 /*return*/, filePath];
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
}); };
|
|
304
|
+
exports.saveCoverageLcov = saveCoverageLcov;
|
|
@@ -99,7 +99,7 @@ describe('sasjs test', function () {
|
|
|
99
99
|
});
|
|
100
100
|
}); });
|
|
101
101
|
it('should execute tests and create result CSV, XML and JSON files using default source and output locations', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
102
|
-
var expectedResultsJson, expectedResultsCsv, resultsFolderPath, resultsJsonPath, resultsJson, resultsCsvPath, parsedResults, resultsCsv, resultsXmlPath, resultsXml, expectedResultsXml;
|
|
102
|
+
var expectedResultsJson, expectedResultsCsv, resultsFolderPath, resultsJsonPath, resultsJson, resultsCsvPath, parsedResults, resultsCsv, resultsXmlPath, resultsXml, expectedResultsXml, coverageLcovPath, expectedCoverageLcov, coverageLcov;
|
|
103
103
|
return __generator(this, function (_a) {
|
|
104
104
|
switch (_a.label) {
|
|
105
105
|
case 0:
|
|
@@ -232,6 +232,15 @@ describe('sasjs test', function () {
|
|
|
232
232
|
resultsXml = resultsXml.replace(/testsuites id="[^ ]*"/gm, "testsuites id=\"\"");
|
|
233
233
|
resultsXml = resultsXml.replace(/testcase id="[^ ]*"/gm, "testcase id=\"\"");
|
|
234
234
|
expect(resultsXml).toEqual(expectedResultsXml);
|
|
235
|
+
coverageLcovPath = path_1.default.join(resultsFolderPath, 'coverage.lcov');
|
|
236
|
+
return [4 /*yield*/, expect(utils_1.fileExists(coverageLcovPath)).resolves.toEqual(true)];
|
|
237
|
+
case 9:
|
|
238
|
+
_a.sent();
|
|
239
|
+
expectedCoverageLcov = "TN:testsetup.sas\nSF:standalone\nFNF:1\nFNH:1\nLF:1\nLH:1\nBRF:1\nBRH:1\nend_of_record\nTN:exampleprogram.test.sas\nSF:jobs/jobs/exampleprogram.sas\nFNF:1\nFNH:1\nLF:1\nLH:1\nBRF:1\nBRH:1\nend_of_record\nTN:standalone.test.sas\nSF:standalone\nFNF:1\nFNH:1\nLF:1\nLH:1\nBRF:1\nBRH:1\nend_of_record\nTN:examplemacro.test.sas\nSF:standalone\nFNF:1\nFNH:1\nLF:1\nLH:1\nBRF:1\nBRH:1\nend_of_record\nTN:shouldFail.test.sas\nSF:standalone\nFNF:1\nFNH:1\nLF:1\nLH:1\nBRF:1\nBRH:1\nend_of_record\nTN:dostuff.test.0.sas\nSF:services/admin/dostuff.sas\nFNF:1\nFNH:1\nLF:1\nLH:1\nBRF:1\nBRH:1\nend_of_record\nTN:dostuff.test.1.sas\nSF:services/admin/dostuff.sas\nFNF:1\nFNH:1\nLF:1\nLH:1\nBRF:1\nBRH:1\nend_of_record\nTN:testteardown.sas\nSF:standalone\nFNF:1\nFNH:1\nLF:1\nLH:1\nBRF:1\nBRH:1\nend_of_record";
|
|
240
|
+
return [4 /*yield*/, utils_1.readFile(coverageLcovPath)];
|
|
241
|
+
case 10:
|
|
242
|
+
coverageLcov = _a.sent();
|
|
243
|
+
expect(coverageLcov).toEqual(expectedCoverageLcov);
|
|
235
244
|
return [2 /*return*/];
|
|
236
245
|
}
|
|
237
246
|
});
|
|
@@ -86,7 +86,7 @@ function runTest(target, testRegExps, outDirectory, flowSourcePath) {
|
|
|
86
86
|
var _a, _b;
|
|
87
87
|
if (testRegExps === void 0) { testRegExps = []; }
|
|
88
88
|
return __awaiter(this, void 0, void 0, function () {
|
|
89
|
-
var testFlowData, testFlow, flow, sasjs, authConfig, username, password, sas9CredentialsError, result, isCodeExamplePrinted, printCodeExample, jsonPath, xmlPath, _c, csvData, csvPath, resultTable, testsCount, passedTestsCount, testsWithResultsCount;
|
|
89
|
+
var testFlowData, testFlow, flow, sasjs, authConfig, username, password, sas9CredentialsError, result, isCodeExamplePrinted, printCodeExample, jsonPath, xmlPath, _c, csvData, csvPath, coverageReportPath, resultTable, testsCount, passedTestsCount, testsWithResultsCount;
|
|
90
90
|
var _this = this;
|
|
91
91
|
return __generator(this, function (_d) {
|
|
92
92
|
switch (_d.label) {
|
|
@@ -205,6 +205,7 @@ function runTest(target, testRegExps, outDirectory, flowSourcePath) {
|
|
|
205
205
|
testUrl = testUrl + "&_contextName=" + encodeURIComponent(target.contextName);
|
|
206
206
|
}
|
|
207
207
|
printTestUrl = function () { return process.logger.info("Test URL: " + testUrl); };
|
|
208
|
+
printTestUrl();
|
|
208
209
|
return [4 /*yield*/, sasjs
|
|
209
210
|
.request(sasJobLocation, {}, { username: username, password: password }, function () {
|
|
210
211
|
displayResult_1.displayError(null, 'Login callback called. Request failed.');
|
|
@@ -247,7 +248,6 @@ function runTest(target, testRegExps, outDirectory, flowSourcePath) {
|
|
|
247
248
|
}
|
|
248
249
|
if (!((_a = res.result) === null || _a === void 0 ? void 0 : _a.test_results))
|
|
249
250
|
lineBreak = false;
|
|
250
|
-
printTestUrl();
|
|
251
251
|
if (!res.log) return [3 /*break*/, 2];
|
|
252
252
|
return [4 /*yield*/, saveOutput_1.saveLog(outDirectory, test, res.log, lineBreak)];
|
|
253
253
|
case 1:
|
|
@@ -328,6 +328,9 @@ function runTest(target, testRegExps, outDirectory, flowSourcePath) {
|
|
|
328
328
|
return [4 /*yield*/, saveOutput_1.saveResultCsv(outDirectory, result)];
|
|
329
329
|
case 7:
|
|
330
330
|
_c = _d.sent(), csvData = _c.csvData, csvPath = _c.csvPath;
|
|
331
|
+
return [4 /*yield*/, saveOutput_1.saveCoverageLcov(outDirectory, flow)];
|
|
332
|
+
case 8:
|
|
333
|
+
coverageReportPath = _d.sent();
|
|
331
334
|
resultTable = {};
|
|
332
335
|
if (Array.isArray(csvData)) {
|
|
333
336
|
csvData.forEach(function (item) {
|
|
@@ -353,6 +356,7 @@ function runTest(target, testRegExps, outDirectory, flowSourcePath) {
|
|
|
353
356
|
testsWithResultsCount = Object.values(resultTable).filter(function (res) { return res.test_suite_result !== types_1.TestResultStatus.notProvided; }).length;
|
|
354
357
|
(_b = process.logger) === null || _b === void 0 ? void 0 : _b.info("Tests provided results: " + (testsWithResultsCount + '/' + testsCount) + " (" + chalk_1.default.greenBright(Math.round((testsWithResultsCount / testsCount) * 100 || 0) + '%') + ")\n Tests that pass: " + (passedTestsCount + '/' + testsWithResultsCount) + " (" + chalk_1.default.greenBright(Math.round((passedTestsCount / testsWithResultsCount) * 100 || 0) + '%') + ")\n ");
|
|
355
358
|
displayResult_1.displaySuccess("Tests execution finished. The results are stored at:\n " + jsonPath + "\n " + csvPath + "\n " + xmlPath);
|
|
359
|
+
displayResult_1.displaySuccess("Tests coverage report:\n " + coverageReportPath);
|
|
356
360
|
return [2 /*return*/];
|
|
357
361
|
}
|
|
358
362
|
});
|
package/build/utils/utils.js
CHANGED
|
@@ -186,11 +186,7 @@ function createApp(folderPath, repoUrl, installDependencies) {
|
|
|
186
186
|
if (installDependencies === void 0) { installDependencies = true; }
|
|
187
187
|
var spinner = ora_1.default("Creating SASjs project in " + folderPath + ".");
|
|
188
188
|
spinner.start();
|
|
189
|
-
var gitBranch = repoUrl.includes('template_sasonly')
|
|
190
|
-
? 'master'
|
|
191
|
-
: repoUrl.includes('template_jobs')
|
|
192
|
-
? 'master'
|
|
193
|
-
: 'main';
|
|
189
|
+
var gitBranch = repoUrl.includes('template_sasonly') ? 'master' : 'main';
|
|
194
190
|
shelljs_1.default.exec("cd \"" + folderPath + "\" && git clone --depth 1 -b " + gitBranch + " " + repoUrl + " .", { silent: true });
|
|
195
191
|
shelljs_1.default.rm('-rf', path_1.default.join(folderPath, '.git'));
|
|
196
192
|
spinner.stop();
|
package/package.json
CHANGED
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@sasjs/adapter": "3.
|
|
53
|
-
"@sasjs/core": "
|
|
52
|
+
"@sasjs/adapter": "3.3.0",
|
|
53
|
+
"@sasjs/core": "^3.8.0",
|
|
54
54
|
"@sasjs/lint": "1.11.2",
|
|
55
55
|
"@sasjs/utils": "2.34.1",
|
|
56
56
|
"chalk": "4.1.2",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"typescript": "4.3.5",
|
|
98
98
|
"util": "0.12.4"
|
|
99
99
|
},
|
|
100
|
-
"version": "3.0
|
|
100
|
+
"version": "3.4.0"
|
|
101
101
|
}
|