@sasjs/cli 6.5.0 → 6.7.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/README.md +2 -1
- package/build/commands/build/build.js +66 -29
- package/build/commands/build/spec/build.spec.js +31 -1
- package/build/commands/compile/compile.js +168 -33
- package/build/commands/compile/compileCommand.js +1 -1
- package/build/commands/compile/internal/checkCompileStatus.js +30 -11
- package/build/commands/compile/internal/compileFile.js +16 -7
- package/build/commands/compile/internal/compileManifest.d.ts +36 -0
- package/build/commands/compile/internal/compileManifest.js +610 -0
- package/build/commands/compile/internal/index.d.ts +2 -0
- package/build/commands/compile/internal/index.js +2 -0
- package/build/commands/compile/internal/passThrough.d.ts +12 -0
- package/build/commands/compile/internal/passThrough.js +17 -0
- package/build/commands/compile/internal/spec/compileTestFile.spec.js +9 -6
- package/build/commands/compile/spec/checkCompileStatus.spec.d.ts +1 -0
- package/build/commands/compile/spec/checkCompileStatus.spec.js +221 -0
- package/build/commands/compile/spec/compileCommand.spec.js +9 -2
- package/build/commands/compile/spec/compileManifest.spec.d.ts +1 -0
- package/build/commands/compile/spec/compileManifest.spec.js +401 -0
- package/build/commands/compile/spec/passThrough.spec.d.ts +1 -0
- package/build/commands/compile/spec/passThrough.spec.js +160 -0
- package/build/commands/deploy/spec/cbd.spec.js +11 -7
- package/build/commands/help/help.js +10 -0
- package/build/commands/index.d.ts +1 -0
- package/build/commands/index.js +3 -1
- package/build/commands/logcheck/collectLogs.d.ts +60 -0
- package/build/commands/logcheck/collectLogs.js +386 -0
- package/build/commands/logcheck/logCheckConfig.d.ts +72 -0
- package/build/commands/logcheck/logCheckConfig.js +283 -0
- package/build/commands/logcheck/logcheckCommand.d.ts +6 -0
- package/build/commands/logcheck/logcheckCommand.js +200 -0
- package/build/commands/logcheck/processLogCheck.d.ts +44 -0
- package/build/commands/logcheck/processLogCheck.js +242 -0
- package/build/commands/logcheck/renderLogCheck.d.ts +128 -0
- package/build/commands/logcheck/renderLogCheck.js +423 -0
- package/build/commands/logcheck/spec/collectLogs.spec.d.ts +1 -0
- package/build/commands/logcheck/spec/collectLogs.spec.js +477 -0
- package/build/commands/logcheck/spec/logCheckConfig.spec.d.ts +1 -0
- package/build/commands/logcheck/spec/logCheckConfig.spec.js +323 -0
- package/build/commands/logcheck/spec/logcheckCommand.spec.d.ts +1 -0
- package/build/commands/logcheck/spec/logcheckCommand.spec.js +360 -0
- package/build/commands/logcheck/spec/processLogCheck.spec.d.ts +1 -0
- package/build/commands/logcheck/spec/processLogCheck.spec.js +354 -0
- package/build/commands/logcheck/spec/renderLogCheck.spec.d.ts +1 -0
- package/build/commands/logcheck/spec/renderLogCheck.spec.js +426 -0
- package/build/commands/logcheck/types.d.ts +98 -0
- package/build/commands/logcheck/types.js +14 -0
- package/build/commands/testing/spec/testing.spec.js +8 -2
- package/build/types/command/commandAliases.js +1 -0
- package/build/types/command/commandFactory.js +2 -0
- package/build/types/command/returnCode.d.ts +2 -1
- package/build/types/command/returnCode.js +4 -0
- package/package.json +3 -3
|
@@ -375,7 +375,7 @@ describe('compileTestFile', function () {
|
|
|
375
375
|
});
|
|
376
376
|
}); });
|
|
377
377
|
it('should not log 0/0 coverage', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
378
|
-
var
|
|
378
|
+
var loggedLines;
|
|
379
379
|
return __generator(this, function (_a) {
|
|
380
380
|
switch (_a.label) {
|
|
381
381
|
case 0:
|
|
@@ -383,11 +383,14 @@ describe('compileTestFile', function () {
|
|
|
383
383
|
return [4 /*yield*/, (0, compile_1.compile)(target)];
|
|
384
384
|
case 1:
|
|
385
385
|
_a.sent();
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
expect(
|
|
386
|
+
loggedLines = process.logger.info.mock.calls.map(function (call) { return String(call[0]); });
|
|
387
|
+
// The intent is the absence of a 0/0 line, not a particular number of
|
|
388
|
+
// log calls - asserting a total turns every future log line into a
|
|
389
|
+
// failure of this test.
|
|
390
|
+
expect(loggedLines.some(function (line) { return line.includes('0/0'); })).toBeFalse();
|
|
391
|
+
expect(loggedLines).toContain('Test coverage:');
|
|
392
|
+
expect(loggedLines).toContain("Services coverage: 0/4 (".concat(chalk_1.default.greenBright('0%'), ")"));
|
|
393
|
+
expect(loggedLines).toContain("Overall coverage: 0/4 (".concat(chalk_1.default.greenBright('0%'), ")"));
|
|
391
394
|
return [2 /*return*/];
|
|
392
395
|
}
|
|
393
396
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
45
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
46
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
47
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
48
|
+
function step(op) {
|
|
49
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
50
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
51
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
52
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
53
|
+
switch (op[0]) {
|
|
54
|
+
case 0: case 1: t = op; break;
|
|
55
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
56
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
57
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
58
|
+
default:
|
|
59
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
60
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
61
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
62
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
63
|
+
if (t[2]) _.ops.pop();
|
|
64
|
+
_.trys.pop(); continue;
|
|
65
|
+
}
|
|
66
|
+
op = body.call(thisArg, _);
|
|
67
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
68
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
72
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
73
|
+
};
|
|
74
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
75
|
+
var path_1 = __importDefault(require("path"));
|
|
76
|
+
var getAllFoldersModule = __importStar(require("../internal/getAllFolders"));
|
|
77
|
+
var compareFoldersModule = __importStar(require("../internal/compareFolders"));
|
|
78
|
+
var compileManifestModule = __importStar(require("../internal/compileManifest"));
|
|
79
|
+
var utils_1 = require("../../../utils");
|
|
80
|
+
var checkCompileStatus_1 = require("../internal/checkCompileStatus");
|
|
81
|
+
jest.mock('../internal/getAllFolders');
|
|
82
|
+
jest.mock('../internal/compareFolders');
|
|
83
|
+
jest.mock('../internal/compileManifest');
|
|
84
|
+
describe('checkCompileStatus', function () {
|
|
85
|
+
var target = { name: 'test' };
|
|
86
|
+
var folderMatch = { equal: true, reason: '' };
|
|
87
|
+
beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
88
|
+
return __generator(this, function (_a) {
|
|
89
|
+
switch (_a.label) {
|
|
90
|
+
case 0: return [4 /*yield*/, (0, utils_1.setConstants)(false)];
|
|
91
|
+
case 1:
|
|
92
|
+
_a.sent();
|
|
93
|
+
return [2 /*return*/];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}); });
|
|
97
|
+
beforeEach(function () {
|
|
98
|
+
jest.resetAllMocks();
|
|
99
|
+
jest
|
|
100
|
+
.spyOn(getAllFoldersModule, 'getAllFolders')
|
|
101
|
+
.mockImplementation(function () { return Promise.resolve(['/app/sasjs/services']); });
|
|
102
|
+
jest
|
|
103
|
+
.spyOn(compareFoldersModule, 'compareFolders')
|
|
104
|
+
.mockImplementation(function () { return Promise.resolve(folderMatch); });
|
|
105
|
+
jest
|
|
106
|
+
.spyOn(compileManifestModule, 'getManifestFolders')
|
|
107
|
+
.mockImplementation(function () { return Promise.resolve([]); });
|
|
108
|
+
jest
|
|
109
|
+
.spyOn(compileManifestModule, 'getManifestStamps')
|
|
110
|
+
.mockImplementation(function () { return Promise.resolve([]); });
|
|
111
|
+
jest
|
|
112
|
+
.spyOn(compileManifestModule, 'getChangedFiles')
|
|
113
|
+
.mockImplementation(function () { return Promise.resolve([]); });
|
|
114
|
+
});
|
|
115
|
+
it('reports a build folder that does not exist', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
116
|
+
var previous, result;
|
|
117
|
+
return __generator(this, function (_a) {
|
|
118
|
+
switch (_a.label) {
|
|
119
|
+
case 0:
|
|
120
|
+
previous = process.sasjsConstants.buildDestinationFolder;
|
|
121
|
+
process.sasjsConstants.buildDestinationFolder = path_1.default.join(__dirname, 'cli-tests-no-such-build-folder');
|
|
122
|
+
return [4 /*yield*/, (0, checkCompileStatus_1.checkCompileStatus)(target)];
|
|
123
|
+
case 1:
|
|
124
|
+
result = _a.sent();
|
|
125
|
+
expect(result.compiled).toBe(false);
|
|
126
|
+
expect(result.message).toContain("doesn't exist");
|
|
127
|
+
process.sasjsConstants.buildDestinationFolder = previous;
|
|
128
|
+
return [2 /*return*/];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}); });
|
|
132
|
+
it('says the project is compiled when the folders match and nothing changed', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
133
|
+
var result;
|
|
134
|
+
return __generator(this, function (_a) {
|
|
135
|
+
switch (_a.label) {
|
|
136
|
+
case 0: return [4 /*yield*/, (0, checkCompileStatus_1.checkCompileStatus)(target)];
|
|
137
|
+
case 1:
|
|
138
|
+
result = _a.sent();
|
|
139
|
+
expect(result.compiled).toBe(true);
|
|
140
|
+
return [2 /*return*/];
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}); });
|
|
144
|
+
it('names only the services side when the services are missing', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
145
|
+
var result;
|
|
146
|
+
return __generator(this, function (_a) {
|
|
147
|
+
switch (_a.label) {
|
|
148
|
+
case 0:
|
|
149
|
+
jest
|
|
150
|
+
.spyOn(getAllFoldersModule, 'getAllFolders')
|
|
151
|
+
.mockImplementation(function (_target, type) {
|
|
152
|
+
return Promise.resolve([
|
|
153
|
+
type === 'job' ? '/app/sasjs/jobs' : '/app/sasjs/services'
|
|
154
|
+
]);
|
|
155
|
+
});
|
|
156
|
+
jest
|
|
157
|
+
.spyOn(compareFoldersModule, 'compareFolders')
|
|
158
|
+
.mockImplementation(function (source) {
|
|
159
|
+
return Promise.resolve(source.includes('services')
|
|
160
|
+
? { equal: false, reason: 'Files missing from build: getdata.sas' }
|
|
161
|
+
: folderMatch);
|
|
162
|
+
});
|
|
163
|
+
return [4 /*yield*/, (0, checkCompileStatus_1.checkCompileStatus)(target)];
|
|
164
|
+
case 1:
|
|
165
|
+
result = _a.sent();
|
|
166
|
+
expect(result.compiled).toBe(false);
|
|
167
|
+
expect(result.message).toContain('Missing Services:');
|
|
168
|
+
expect(result.message).not.toContain('Missing jobs:');
|
|
169
|
+
return [2 /*return*/];
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}); });
|
|
173
|
+
it('names only the jobs side when the jobs are missing', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
174
|
+
var result;
|
|
175
|
+
return __generator(this, function (_a) {
|
|
176
|
+
switch (_a.label) {
|
|
177
|
+
case 0:
|
|
178
|
+
jest
|
|
179
|
+
.spyOn(getAllFoldersModule, 'getAllFolders')
|
|
180
|
+
.mockImplementation(function (_target, type) {
|
|
181
|
+
return Promise.resolve([
|
|
182
|
+
type === 'job' ? '/app/sasjs/jobs' : '/app/sasjs/services'
|
|
183
|
+
]);
|
|
184
|
+
});
|
|
185
|
+
jest
|
|
186
|
+
.spyOn(compareFoldersModule, 'compareFolders')
|
|
187
|
+
.mockImplementation(function (source) {
|
|
188
|
+
return Promise.resolve(source.includes('jobs')
|
|
189
|
+
? { equal: false, reason: 'Subfolders missing from build: nightly' }
|
|
190
|
+
: folderMatch);
|
|
191
|
+
});
|
|
192
|
+
return [4 /*yield*/, (0, checkCompileStatus_1.checkCompileStatus)(target)];
|
|
193
|
+
case 1:
|
|
194
|
+
result = _a.sent();
|
|
195
|
+
expect(result.compiled).toBe(false);
|
|
196
|
+
expect(result.message).toContain('Missing jobs:');
|
|
197
|
+
expect(result.message).not.toContain('Missing Services:');
|
|
198
|
+
return [2 /*return*/];
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}); });
|
|
202
|
+
it('reports the files that changed since the last compile', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
203
|
+
var result;
|
|
204
|
+
return __generator(this, function (_a) {
|
|
205
|
+
switch (_a.label) {
|
|
206
|
+
case 0:
|
|
207
|
+
jest
|
|
208
|
+
.spyOn(compileManifestModule, 'getChangedFiles')
|
|
209
|
+
.mockImplementation(function () {
|
|
210
|
+
return Promise.resolve(['/app/sasjs/services/getdata.sas']);
|
|
211
|
+
});
|
|
212
|
+
return [4 /*yield*/, (0, checkCompileStatus_1.checkCompileStatus)(target)];
|
|
213
|
+
case 1:
|
|
214
|
+
result = _a.sent();
|
|
215
|
+
expect(result.compiled).toBe(false);
|
|
216
|
+
expect(result.message).toContain('Changed since the last compile: /app/sasjs/services/getdata.sas');
|
|
217
|
+
return [2 /*return*/];
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
}); });
|
|
221
|
+
});
|
|
@@ -185,10 +185,17 @@ describe('CompileCommand', function () {
|
|
|
185
185
|
case 0:
|
|
186
186
|
args = __spreadArray(__spreadArray([], __read(defaultArgs), false), ['compile', '-t', 'test'], false);
|
|
187
187
|
command = new compileCommand_1.CompileCommand(args);
|
|
188
|
-
return [4 /*yield*/, command.execute()
|
|
188
|
+
return [4 /*yield*/, command.execute()
|
|
189
|
+
// The command no longer forces a recompile: checkCompileStatus compares a
|
|
190
|
+
// content manifest, so an unchanged project is skipped and a changed one is
|
|
191
|
+
// recompiled without the caller passing anything.
|
|
192
|
+
];
|
|
189
193
|
case 1:
|
|
190
194
|
_a.sent();
|
|
191
|
-
|
|
195
|
+
// The command no longer forces a recompile: checkCompileStatus compares a
|
|
196
|
+
// content manifest, so an unchanged project is skipped and a changed one is
|
|
197
|
+
// recompiled without the caller passing anything.
|
|
198
|
+
expect(compileModule.compile).toHaveBeenCalledWith(target);
|
|
192
199
|
return [2 /*return*/];
|
|
193
200
|
}
|
|
194
201
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|