@sasjs/cli 3.0.0 → 3.0.1
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.
|
@@ -43,13 +43,14 @@ var types_1 = require("@sasjs/utils/types");
|
|
|
43
43
|
var error_1 = require("@sasjs/utils/error");
|
|
44
44
|
var loadDependencies_1 = require("./loadDependencies");
|
|
45
45
|
var getServerType_1 = require("./getServerType");
|
|
46
|
+
var compileTestFile_1 = require("./compileTestFile");
|
|
46
47
|
function compileServiceFile(target, filePath, macroFolders, programFolders, programVar) {
|
|
47
48
|
if (programVar === void 0) { programVar = ''; }
|
|
48
49
|
return __awaiter(this, void 0, void 0, function () {
|
|
49
50
|
var dependencies, serverType, preCode;
|
|
50
51
|
return __generator(this, function (_a) {
|
|
51
52
|
switch (_a.label) {
|
|
52
|
-
case 0: return [4 /*yield*/, loadDependencies_1.loadDependencies(target, filePath, macroFolders, programFolders)];
|
|
53
|
+
case 0: return [4 /*yield*/, loadDependencies_1.loadDependencies(target, filePath, macroFolders, programFolders, compileTestFile_1.isTestFile(filePath) ? 'test' : undefined)];
|
|
53
54
|
case 1:
|
|
54
55
|
dependencies = _a.sent();
|
|
55
56
|
return [4 /*yield*/, getServerType_1.getServerType(target)];
|
|
@@ -66,7 +66,7 @@ describe('compileTestFile', function () {
|
|
|
66
66
|
}, utils_1.ServerType.SasViya);
|
|
67
67
|
var target = new utils_1.Target(__assign(__assign({}, temp.toJson()), { jobConfig: {
|
|
68
68
|
jobFolders: [path_1.default.join('sasjs', 'jobs')]
|
|
69
|
-
} }));
|
|
69
|
+
}, macroFolders: ['sasjs/macros'] }));
|
|
70
70
|
var sasjsPath;
|
|
71
71
|
var testBody;
|
|
72
72
|
var buildPath;
|
|
@@ -151,6 +151,9 @@ describe('compileTestFile', function () {
|
|
|
151
151
|
_a.sent();
|
|
152
152
|
return [4 /*yield*/, testContent(path_1.default.join('testteardown.sas'))];
|
|
153
153
|
case 5:
|
|
154
|
+
_a.sent();
|
|
155
|
+
return [4 /*yield*/, testContent(path_1.default.join('macros', 'testMacro.test.sas'))];
|
|
156
|
+
case 6:
|
|
154
157
|
_a.sent();
|
|
155
158
|
return [2 /*return*/];
|
|
156
159
|
}
|
|
@@ -236,6 +239,7 @@ describe('compileTestFile', function () {
|
|
|
236
239
|
expectedTestFlow = {
|
|
237
240
|
tests: [
|
|
238
241
|
['tests', 'jobs', 'jobs', 'testJob.test.sas'].join('/'),
|
|
242
|
+
['tests', 'macros', 'testMacro.test.sas'].join('/'),
|
|
239
243
|
['tests', 'services', 'services', 'admin', 'random.test.sas'].join('/'),
|
|
240
244
|
['tests', 'services', 'services', 'admin', 'random.test.0.sas'].join('/')
|
|
241
245
|
].sort(),
|
|
@@ -290,6 +294,11 @@ describe('compileTestFile', function () {
|
|
|
290
294
|
'test',
|
|
291
295
|
'standalone'
|
|
292
296
|
],
|
|
297
|
+
[
|
|
298
|
+
['tests', 'macros', 'testMacro.test.sas'].join('/'),
|
|
299
|
+
'test',
|
|
300
|
+
'standalone'
|
|
301
|
+
],
|
|
293
302
|
[
|
|
294
303
|
['tests', 'services', 'services', 'admin', 'random.test.sas'].join('/'),
|
|
295
304
|
'test',
|
|
@@ -313,9 +322,9 @@ describe('compileTestFile', function () {
|
|
|
313
322
|
return [4 /*yield*/, compile_1.compile(target)];
|
|
314
323
|
case 1:
|
|
315
324
|
_a.sent();
|
|
316
|
-
expect(process.logger.info).toHaveBeenCalledTimes(
|
|
317
|
-
expect(process.logger.info).toHaveBeenNthCalledWith(
|
|
318
|
-
expect(process.logger.info).toHaveBeenNthCalledWith(
|
|
325
|
+
expect(process.logger.info).toHaveBeenCalledTimes(15);
|
|
326
|
+
expect(process.logger.info).toHaveBeenNthCalledWith(13, "Test coverage:");
|
|
327
|
+
expect(process.logger.info).toHaveBeenNthCalledWith(14, "Services coverage: 0/4 (" + chalk_1.default.greenBright('0%') + ")");
|
|
319
328
|
expect(process.logger.info).toHaveBeenLastCalledWith("Overall coverage: 0/4 (" + chalk_1.default.greenBright('0%') + ")");
|
|
320
329
|
return [2 /*return*/];
|
|
321
330
|
}
|
|
@@ -348,6 +357,9 @@ var copyTestFiles = function (appName) { return __awaiter(void 0, void 0, void 0
|
|
|
348
357
|
_a.sent();
|
|
349
358
|
return [4 /*yield*/, utils_1.copy(path_1.default.join(__dirname, 'testFiles', 'jobs'), path_1.default.join(__dirname, appName, 'sasjs', 'jobs'))];
|
|
350
359
|
case 3:
|
|
360
|
+
_a.sent();
|
|
361
|
+
return [4 /*yield*/, utils_1.copy(path_1.default.join(__dirname, 'testFiles', 'macros'), path_1.default.join(__dirname, appName, 'sasjs', 'macros'))];
|
|
362
|
+
case 4:
|
|
351
363
|
_a.sent();
|
|
352
364
|
return [2 /*return*/];
|
|
353
365
|
}
|
package/package.json
CHANGED