@sasjs/cli 3.0.1 → 3.1.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/addCredential.d.ts +6 -2
- package/build/commands/add/addCredential.js +79 -47
- package/build/commands/add/addTarget.js +32 -20
- package/build/commands/add/internal/input.d.ts +7 -0
- package/build/commands/add/internal/input.js +53 -8
- package/build/commands/add/spec/addTarget.spec.js +78 -0
- package/build/commands/build/build.js +11 -11
- package/build/commands/build/internal/config.d.ts +1 -1
- package/build/commands/build/internal/config.js +5 -6
- package/build/commands/compile/compile.js +4 -4
- package/build/commands/compile/compileCommand.js +2 -1
- package/build/commands/compile/compileSingleFile.d.ts +1 -1
- package/build/commands/compile/compileSingleFile.js +6 -7
- package/build/commands/compile/internal/compareFolders.js +1 -2
- package/build/commands/compile/internal/compileJobFile.js +1 -1
- package/build/commands/compile/internal/compileServiceFile.js +32 -16
- package/build/commands/compile/internal/compileTestFile.d.ts +0 -2
- package/build/commands/compile/internal/compileTestFile.js +11 -15
- package/build/commands/compile/internal/getAllJobFolders.js +1 -1
- package/build/commands/compile/internal/getAllServiceFolders.js +1 -1
- package/build/commands/compile/internal/loadDependencies.d.ts +2 -3
- package/build/commands/compile/internal/loadDependencies.js +43 -230
- package/build/commands/compile/internal/spec/compileTestFile.spec.js +8 -8
- package/build/commands/compile/spec/compile.spec.js +30 -0
- package/build/commands/compile/spec/compileJobFile.spec.js +3 -3
- package/build/commands/compile/spec/compileServiceFile.spec.js +3 -3
- package/build/commands/compile/spec/loadDependencies.spec.js +37 -37
- package/build/commands/create/spec/reactAppFiles.js +5 -5
- package/build/commands/deploy/deploy.js +1 -1
- package/build/commands/deploy/spec/cbd.spec.js +19 -3
- package/build/commands/docs/generateDocs.js +4 -5
- package/build/commands/docs/internal/getFileInputs.d.ts +1 -1
- package/build/commands/docs/internal/getFileInputs.js +2 -2
- package/build/commands/docs/internal/getFileOutputs.d.ts +1 -1
- package/build/commands/docs/internal/getFileOutputs.js +2 -2
- package/build/commands/docs/internal/getFoldersForDocs.d.ts +1 -1
- package/build/commands/docs/internal/getFoldersForDocs.js +1 -1
- package/build/commands/job/internal/execute/viya.js +0 -6
- package/build/commands/job/internal/utils.js +6 -8
- package/build/commands/request/request.js +2 -2
- package/build/commands/run/run.js +1 -1
- package/build/commands/servicepack/deploy.js +1 -1
- package/build/commands/shared/fetchLogFileContent.js +6 -8
- package/build/commands/testing/test.js +1 -1
- package/build/commands/web/internal/getTags.d.ts +2 -1
- package/build/commands/web/internal/getTags.js +10 -12
- package/build/commands/web/internal/getWebServiceContent.js +1 -2
- package/build/commands/web/internal/sasjsout.d.ts +1 -1
- package/build/commands/web/internal/sasjsout.js +1 -1
- package/build/commands/web/internal/spec/updateLinkTag.spec.d.ts +4 -0
- package/build/commands/web/internal/spec/updateLinkTag.spec.js +32 -0
- package/build/commands/web/internal/updateAllTags.js +33 -8
- package/build/commands/web/internal/updateLinkTag.d.ts +4 -0
- package/build/commands/web/internal/updateLinkTag.js +24 -0
- package/build/commands/web/web.js +12 -13
- package/build/utils/auth.d.ts +10 -4
- package/build/utils/auth.js +17 -15
- package/build/utils/config.d.ts +2 -3
- package/build/utils/config.js +14 -16
- package/build/utils/file.d.ts +0 -6
- package/build/utils/file.js +1 -43
- package/build/utils/setConstants.js +1 -1
- package/build/utils/spec/utils.spec.js +31 -5
- package/build/utils/utils.d.ts +0 -2
- package/build/utils/utils.js +2 -21
- package/package.json +8 -14
- package/CHANGELOG.md +0 -30
- package/build/commands/compile/internal/config.d.ts +0 -25
- package/build/commands/compile/internal/config.js +0 -259
- package/build/commands/compile/spec/getDependencyPaths.spec.d.ts +0 -1
- package/build/commands/compile/spec/getDependencyPaths.spec.js +0 -263
- package/build/commands/compile/spec/getProgramDependencies.spec.d.ts +0 -1
- package/build/commands/compile/spec/getProgramDependencies.spec.js +0 -403
- package/build/commands/shared/dependencies.d.ts +0 -12
- package/build/commands/shared/dependencies.js +0 -332
- package/build/commands/web/internal/updateLinkHref.d.ts +0 -4
- package/build/commands/web/internal/updateLinkHref.js +0 -18
- package/build/utils/spec/utils.spec.server.d.ts +0 -1
- package/build/utils/spec/utils.spec.server.js +0 -72
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
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;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
var utils_1 = require("@sasjs/utils");
|
|
43
|
-
var path_1 = __importDefault(require("path"));
|
|
44
|
-
var utils_2 = require("@sasjs/utils");
|
|
45
|
-
var test_1 = require("../../../utils/test");
|
|
46
|
-
var dependencies_1 = require("../../shared/dependencies");
|
|
47
|
-
describe('getDependencyPaths', function () {
|
|
48
|
-
var appName = "cli-tests-dependency-paths-" + utils_1.generateTimestamp();
|
|
49
|
-
var target = test_1.generateTestTarget(appName, '/Public/app', {
|
|
50
|
-
serviceFolders: [path_1.default.join('sasjs', 'services')],
|
|
51
|
-
initProgram: '',
|
|
52
|
-
termProgram: '',
|
|
53
|
-
macroVars: {}
|
|
54
|
-
}, utils_1.ServerType.SasViya);
|
|
55
|
-
beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
-
return __generator(this, function (_a) {
|
|
57
|
-
switch (_a.label) {
|
|
58
|
-
case 0: return [4 /*yield*/, test_1.createTestMinimalApp(__dirname, target.name)];
|
|
59
|
-
case 1:
|
|
60
|
-
_a.sent();
|
|
61
|
-
return [2 /*return*/];
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}); });
|
|
65
|
-
afterAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
-
return __generator(this, function (_a) {
|
|
67
|
-
switch (_a.label) {
|
|
68
|
-
case 0: return [4 /*yield*/, test_1.removeTestApp(__dirname, target.name)];
|
|
69
|
-
case 1:
|
|
70
|
-
_a.sent();
|
|
71
|
-
return [2 /*return*/];
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}); });
|
|
75
|
-
test('it should recursively get all dependency paths', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
76
|
-
var fileContent, dependenciesList, dependencyPaths;
|
|
77
|
-
return __generator(this, function (_a) {
|
|
78
|
-
switch (_a.label) {
|
|
79
|
-
case 0: return [4 /*yield*/, utils_2.readFile(path_1.default.join(__dirname, './example.sas'))];
|
|
80
|
-
case 1:
|
|
81
|
-
fileContent = _a.sent();
|
|
82
|
-
dependenciesList = [
|
|
83
|
-
'mp_abort.sas',
|
|
84
|
-
'mf_getuniquefileref.sas',
|
|
85
|
-
'mf_getuniquelibref.sas',
|
|
86
|
-
'mf_isblank.sas',
|
|
87
|
-
'mf_mval.sas',
|
|
88
|
-
'mf_trimstr.sas',
|
|
89
|
-
'mf_getplatform.sas',
|
|
90
|
-
'mf_abort.sas',
|
|
91
|
-
'mfv_existfolder.sas',
|
|
92
|
-
'mv_createfolder.sas'
|
|
93
|
-
];
|
|
94
|
-
return [4 /*yield*/, dependencies_1.getDependencyPaths(fileContent)];
|
|
95
|
-
case 2:
|
|
96
|
-
dependencyPaths = _a.sent();
|
|
97
|
-
dependencyPaths.forEach(function (dep) {
|
|
98
|
-
expect(dependenciesList.some(function (x) { return dep.includes(x); })).toBeTruthy();
|
|
99
|
-
});
|
|
100
|
-
return [2 /*return*/];
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}); });
|
|
104
|
-
test('it should get third level dependencies', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
105
|
-
var fileContent, dependenciesList, dependencyPaths;
|
|
106
|
-
return __generator(this, function (_a) {
|
|
107
|
-
switch (_a.label) {
|
|
108
|
-
case 0: return [4 /*yield*/, utils_2.readFile(path_1.default.join(__dirname, './nested-deps.sas'))];
|
|
109
|
-
case 1:
|
|
110
|
-
fileContent = _a.sent();
|
|
111
|
-
dependenciesList = [
|
|
112
|
-
'mf_isblank.sas',
|
|
113
|
-
'mm_createwebservice.sas',
|
|
114
|
-
'mm_createstp.sas',
|
|
115
|
-
'mf_getuser.sas',
|
|
116
|
-
'mm_createfolder.sas',
|
|
117
|
-
'mm_deletestp.sas',
|
|
118
|
-
'mf_nobs.sas',
|
|
119
|
-
'mf_getattrn.sas',
|
|
120
|
-
'mf_abort.sas',
|
|
121
|
-
'mf_verifymacvars.sas',
|
|
122
|
-
'mm_getdirectories.sas',
|
|
123
|
-
'mm_updatestpsourcecode.sas',
|
|
124
|
-
'mp_dropmembers.sas',
|
|
125
|
-
'mm_getservercontexts.sas',
|
|
126
|
-
'mm_getrepos.sas'
|
|
127
|
-
];
|
|
128
|
-
return [4 /*yield*/, dependencies_1.getDependencyPaths(fileContent)];
|
|
129
|
-
case 2:
|
|
130
|
-
dependencyPaths = _a.sent();
|
|
131
|
-
dependenciesList.forEach(function (expectedDep) {
|
|
132
|
-
expect(dependencyPaths.some(function (dep) { return dep.includes(expectedDep); })).toBeTruthy();
|
|
133
|
-
});
|
|
134
|
-
return [2 /*return*/];
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}); });
|
|
138
|
-
test('it should throw an error when a dependency is not found', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
139
|
-
var missingDependencies, missingDependencyFile, fileContent;
|
|
140
|
-
return __generator(this, function (_a) {
|
|
141
|
-
switch (_a.label) {
|
|
142
|
-
case 0:
|
|
143
|
-
missingDependencies = ['foobar.sas', 'foobar2.sas'];
|
|
144
|
-
missingDependencyFile = './missing-dependency.sas';
|
|
145
|
-
return [4 /*yield*/, utils_2.readFile(path_1.default.join(__dirname, missingDependencyFile))];
|
|
146
|
-
case 1:
|
|
147
|
-
fileContent = _a.sent();
|
|
148
|
-
return [4 /*yield*/, expect(dependencies_1.getDependencyPaths(fileContent)).rejects.toEqual("Unable to locate dependencies: " + missingDependencies.join(', '))];
|
|
149
|
-
case 2:
|
|
150
|
-
_a.sent();
|
|
151
|
-
return [2 /*return*/];
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
}); });
|
|
155
|
-
test('it should ignore non-sas dependencies', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
156
|
-
var fileContent, dependenciesList, dependencyPaths;
|
|
157
|
-
return __generator(this, function (_a) {
|
|
158
|
-
switch (_a.label) {
|
|
159
|
-
case 0: return [4 /*yield*/, utils_2.readFile(path_1.default.join(__dirname, './non-sas-dependency.sas'))];
|
|
160
|
-
case 1:
|
|
161
|
-
fileContent = _a.sent();
|
|
162
|
-
dependenciesList = [
|
|
163
|
-
'mp_abort.sas',
|
|
164
|
-
'mf_getuniquefileref.sas',
|
|
165
|
-
'mf_getuniquelibref.sas',
|
|
166
|
-
'mf_isblank.sas',
|
|
167
|
-
'mf_mval.sas',
|
|
168
|
-
'mf_trimstr.sas',
|
|
169
|
-
'mf_getplatform.sas',
|
|
170
|
-
'mf_abort.sas',
|
|
171
|
-
'mfv_existfolder.sas',
|
|
172
|
-
'mv_createfolder.sas'
|
|
173
|
-
];
|
|
174
|
-
return [4 /*yield*/, expect(dependencies_1.getDependencyPaths(fileContent)).resolves.not.toThrow()];
|
|
175
|
-
case 2:
|
|
176
|
-
_a.sent();
|
|
177
|
-
return [4 /*yield*/, dependencies_1.getDependencyPaths(fileContent)];
|
|
178
|
-
case 3:
|
|
179
|
-
dependencyPaths = _a.sent();
|
|
180
|
-
dependencyPaths.forEach(function (dep) {
|
|
181
|
-
expect(dependenciesList.some(function (x) { return dep.includes(x); })).toBeTruthy();
|
|
182
|
-
});
|
|
183
|
-
return [2 /*return*/];
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
}); });
|
|
187
|
-
test('it should prioritise overridden dependencies', function () {
|
|
188
|
-
var dependencyNames = ['mf_abort.sas'];
|
|
189
|
-
var mfAbortPath = path_1.default.join('sas', 'macros', 'mf_abort.sas');
|
|
190
|
-
var dependencyPaths = [
|
|
191
|
-
path_1.default.join('node_modules', '@sasjs', 'core', 'core', 'mf_abort.sas'),
|
|
192
|
-
mfAbortPath
|
|
193
|
-
];
|
|
194
|
-
var result = dependencies_1.prioritiseDependencyOverrides(dependencyNames, dependencyPaths);
|
|
195
|
-
expect(result).toEqual([mfAbortPath]);
|
|
196
|
-
});
|
|
197
|
-
test('it should prioritise overridden dependencies, if both are non-core', function () {
|
|
198
|
-
var dependencyNames = ['mf_abort.sas'];
|
|
199
|
-
var mfAbortPath = path_1.default.join('sas', 'macros', 'mf_abort.sas');
|
|
200
|
-
var dependencyPaths = [
|
|
201
|
-
mfAbortPath,
|
|
202
|
-
path_1.default.join('sas', 'macros2', 'mf_abort.sas')
|
|
203
|
-
];
|
|
204
|
-
var result = dependencies_1.prioritiseDependencyOverrides(dependencyNames, dependencyPaths, ['macros', 'macros2']);
|
|
205
|
-
expect(result).toEqual([mfAbortPath]);
|
|
206
|
-
});
|
|
207
|
-
test('it should prioritise overridden dependencies with windows file paths', function () {
|
|
208
|
-
var dependencyNames = ['mf_abort.sas'];
|
|
209
|
-
var dependencyPaths = [
|
|
210
|
-
'node_modules\\@sasjs\\core\\core\\mf_abort.sas',
|
|
211
|
-
'sas\\macros\\mf_abort.sas'
|
|
212
|
-
];
|
|
213
|
-
var result = dependencies_1.prioritiseDependencyOverrides(dependencyNames, dependencyPaths, [], '\\');
|
|
214
|
-
expect(result).toEqual(['sas\\macros\\mf_abort.sas']);
|
|
215
|
-
});
|
|
216
|
-
test('it should prioritise overridden dependencies provided specific macros', function () {
|
|
217
|
-
var dependencyNames = ['mf_abort.sas'];
|
|
218
|
-
var mfAbortPath = path_1.default.join('sas', 'sas9macros', 'mf_abort.sas');
|
|
219
|
-
var dependencyPaths = [
|
|
220
|
-
path_1.default.join('node_modules', '@sasjs', 'core', 'core', 'mf_abort.sas'),
|
|
221
|
-
mfAbortPath,
|
|
222
|
-
path_1.default.join('sas', 'macros', 'mf_abort.sas')
|
|
223
|
-
];
|
|
224
|
-
var result = dependencies_1.prioritiseDependencyOverrides(dependencyNames, dependencyPaths, ['sas9macros']);
|
|
225
|
-
expect(result).toEqual([mfAbortPath]);
|
|
226
|
-
});
|
|
227
|
-
test("it should prioritise overridden dependencies, if specific 'macroLoc' was provided, but macro at such 'macroLoc' is not present", function () {
|
|
228
|
-
var dependencyNames = ['mf_abort.sas'];
|
|
229
|
-
var mfAbortPath = path_1.default.join('sas', 'macros', 'mf_abort.sas');
|
|
230
|
-
var dependencyPaths = [
|
|
231
|
-
path_1.default.join('node_modules', '@sasjs', 'core', 'core', 'mf_abort.sas'),
|
|
232
|
-
mfAbortPath
|
|
233
|
-
];
|
|
234
|
-
var result = dependencies_1.prioritiseDependencyOverrides(dependencyNames, dependencyPaths, ['sas9macros']);
|
|
235
|
-
expect(result).toEqual([mfAbortPath]);
|
|
236
|
-
});
|
|
237
|
-
test('it should prioritise overridden dependencies and remove extra dependencies, if specific macros were provided', function () {
|
|
238
|
-
var dependencyNames = ['mf_abort.sas'];
|
|
239
|
-
var mfAbortPath = path_1.default.join('sas', 'sas9macros', 'mf_abort.sas');
|
|
240
|
-
var dependencyPaths = [
|
|
241
|
-
path_1.default.join('node_modules', '@sasjs', 'core', 'core', 'mf_abort.sas'),
|
|
242
|
-
path_1.default.join('sas', 'sasviyamacros', 'mf_abort.sas'),
|
|
243
|
-
mfAbortPath,
|
|
244
|
-
path_1.default.join('sas', 'macros2', 'mf_abort.sas'),
|
|
245
|
-
path_1.default.join('sas', 'macros', 'mf_abort.sas')
|
|
246
|
-
];
|
|
247
|
-
var result = dependencies_1.prioritiseDependencyOverrides(dependencyNames, dependencyPaths, ['sas9macros']);
|
|
248
|
-
expect(result).toEqual([mfAbortPath]);
|
|
249
|
-
});
|
|
250
|
-
test('it should prioritise overridden dependencies and remove duplicated dependencies, if specific macros were provided', function () {
|
|
251
|
-
var dependencyNames = ['mf_abort.sas'];
|
|
252
|
-
var mfAbortPath = path_1.default.join('sas', 'sas9macros', 'mf_abort.sas');
|
|
253
|
-
var dependencyPaths = [
|
|
254
|
-
path_1.default.join('node_modules', '@sasjs', 'core', 'core', 'mf_abort.sas'),
|
|
255
|
-
mfAbortPath,
|
|
256
|
-
mfAbortPath,
|
|
257
|
-
path_1.default.join('sas', 'macros', 'mf_abort.sas'),
|
|
258
|
-
path_1.default.join('sas', 'macros', 'mf_abort.sas')
|
|
259
|
-
];
|
|
260
|
-
var result = dependencies_1.prioritiseDependencyOverrides(dependencyNames, dependencyPaths, ['sas9macros']);
|
|
261
|
-
expect(result).toEqual([mfAbortPath]);
|
|
262
|
-
});
|
|
263
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,403 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
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;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
var path_1 = __importDefault(require("path"));
|
|
43
|
-
var utils_1 = require("@sasjs/utils");
|
|
44
|
-
var dependencies_1 = require("../../shared/dependencies");
|
|
45
|
-
var utils_2 = require("../../../utils");
|
|
46
|
-
process.projectDir = path_1.default.join(process.cwd());
|
|
47
|
-
describe('getProgramDependencies', function () {
|
|
48
|
-
beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
49
|
-
return __generator(this, function (_a) {
|
|
50
|
-
switch (_a.label) {
|
|
51
|
-
case 0: return [4 /*yield*/, utils_2.setConstants()];
|
|
52
|
-
case 1:
|
|
53
|
-
_a.sent();
|
|
54
|
-
return [2 /*return*/];
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}); });
|
|
58
|
-
var expectedLines = [
|
|
59
|
-
'filename TEST temp;',
|
|
60
|
-
'data _null_;',
|
|
61
|
-
'file TEST lrecl=32767;',
|
|
62
|
-
"put '%put ''Hello, world!'';';",
|
|
63
|
-
'run;'
|
|
64
|
-
];
|
|
65
|
-
test('it should get all program dependencies', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
-
var filePath, fileContent, dependencies, actualLines;
|
|
67
|
-
return __generator(this, function (_a) {
|
|
68
|
-
switch (_a.label) {
|
|
69
|
-
case 0:
|
|
70
|
-
filePath = path_1.default.join(__dirname, './example.sas');
|
|
71
|
-
return [4 /*yield*/, utils_1.readFile(filePath)];
|
|
72
|
-
case 1:
|
|
73
|
-
fileContent = _a.sent();
|
|
74
|
-
return [4 /*yield*/, dependencies_1.getProgramDependencies(fileContent, [path_1.default.join(__dirname, 'programs')], filePath)];
|
|
75
|
-
case 2:
|
|
76
|
-
dependencies = _a.sent();
|
|
77
|
-
actualLines = dependencies.split('\n');
|
|
78
|
-
expect(actualLines).toEqual(expectedLines);
|
|
79
|
-
return [2 /*return*/];
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}); });
|
|
83
|
-
test('it should choose the first dependency when there are duplicates', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
84
|
-
var filePath, fileContent, dependencies, actualLines;
|
|
85
|
-
return __generator(this, function (_a) {
|
|
86
|
-
switch (_a.label) {
|
|
87
|
-
case 0:
|
|
88
|
-
filePath = path_1.default.join(__dirname, './duplicates.sas');
|
|
89
|
-
return [4 /*yield*/, utils_1.readFile(filePath)];
|
|
90
|
-
case 1:
|
|
91
|
-
fileContent = _a.sent();
|
|
92
|
-
return [4 /*yield*/, dependencies_1.getProgramDependencies(fileContent, [path_1.default.join(__dirname, 'programs')], filePath)];
|
|
93
|
-
case 2:
|
|
94
|
-
dependencies = _a.sent();
|
|
95
|
-
actualLines = dependencies.split('\n');
|
|
96
|
-
expect(actualLines).toEqual(expectedLines);
|
|
97
|
-
return [2 /*return*/];
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}); });
|
|
101
|
-
test('it should handle duplicate filenames with different extensions', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
102
|
-
var filePath, fileContent, expectedOutput, dependencies, actualLines;
|
|
103
|
-
return __generator(this, function (_a) {
|
|
104
|
-
switch (_a.label) {
|
|
105
|
-
case 0:
|
|
106
|
-
filePath = path_1.default.join(__dirname, './duplicates-extensions.sas');
|
|
107
|
-
return [4 /*yield*/, utils_1.readFile(filePath)];
|
|
108
|
-
case 1:
|
|
109
|
-
fileContent = _a.sent();
|
|
110
|
-
expectedOutput = [
|
|
111
|
-
'filename TEST temp;',
|
|
112
|
-
'data _null_;',
|
|
113
|
-
'file TEST lrecl=32767;',
|
|
114
|
-
"put '%put ''Hello, world!'';';",
|
|
115
|
-
'run;',
|
|
116
|
-
'filename TEST2 temp;',
|
|
117
|
-
'data _null_;',
|
|
118
|
-
'file TEST2 lrecl=32767;',
|
|
119
|
-
"put 'proc sql;';",
|
|
120
|
-
"put 'quit;';",
|
|
121
|
-
'run;'
|
|
122
|
-
];
|
|
123
|
-
return [4 /*yield*/, dependencies_1.getProgramDependencies(fileContent, [path_1.default.join(__dirname, 'programs')], filePath)];
|
|
124
|
-
case 2:
|
|
125
|
-
dependencies = _a.sent();
|
|
126
|
-
actualLines = dependencies.split('\n');
|
|
127
|
-
expect(actualLines).toEqual(expectedOutput);
|
|
128
|
-
return [2 /*return*/];
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}); });
|
|
132
|
-
test('it should throw an error when a fileref is not specified', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
133
|
-
var filePath, fileContent;
|
|
134
|
-
return __generator(this, function (_a) {
|
|
135
|
-
switch (_a.label) {
|
|
136
|
-
case 0:
|
|
137
|
-
filePath = path_1.default.join(__dirname, './missing-fileref.sas');
|
|
138
|
-
return [4 /*yield*/, utils_1.readFile(filePath)];
|
|
139
|
-
case 1:
|
|
140
|
-
fileContent = _a.sent();
|
|
141
|
-
return [4 /*yield*/, expect(dependencies_1.getProgramDependencies(fileContent, [path_1.default.join(__dirname, 'programs')], filePath)).rejects.toThrow("SAS Program test.sas is missing fileref. Please specify SAS program dependencies in the format: @li <filename> <fileref>")];
|
|
142
|
-
case 2:
|
|
143
|
-
_a.sent();
|
|
144
|
-
return [2 /*return*/];
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}); });
|
|
148
|
-
});
|
|
149
|
-
describe('validateFileRef', function () {
|
|
150
|
-
beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
151
|
-
return __generator(this, function (_a) {
|
|
152
|
-
switch (_a.label) {
|
|
153
|
-
case 0: return [4 /*yield*/, utils_2.setConstants()];
|
|
154
|
-
case 1:
|
|
155
|
-
_a.sent();
|
|
156
|
-
return [2 /*return*/];
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
}); });
|
|
160
|
-
test('it should return true for a file ref containing characters', function () {
|
|
161
|
-
var fileRef = 'TEST';
|
|
162
|
-
expect(dependencies_1.validateFileRef(fileRef)).toBeTruthy();
|
|
163
|
-
});
|
|
164
|
-
test('it should return true for a file ref containing characters and underscores', function () {
|
|
165
|
-
var fileRef = 'TES_T';
|
|
166
|
-
expect(dependencies_1.validateFileRef(fileRef)).toBeTruthy();
|
|
167
|
-
});
|
|
168
|
-
test('it should return true for a file ref containing characters, numbers and underscores', function () {
|
|
169
|
-
var fileRef = 'TES_T12';
|
|
170
|
-
expect(dependencies_1.validateFileRef(fileRef)).toBeTruthy();
|
|
171
|
-
});
|
|
172
|
-
test('it should return true for a file ref starting with an underscore', function () {
|
|
173
|
-
var fileRef = '_TES_T12';
|
|
174
|
-
expect(dependencies_1.validateFileRef(fileRef)).toBeTruthy();
|
|
175
|
-
});
|
|
176
|
-
test('it should throw an error when the file ref is longer than 8 chars', function () {
|
|
177
|
-
var fileRef = '_TES_T12435';
|
|
178
|
-
expect(function () { return dependencies_1.validateFileRef(fileRef); }).toThrow('File ref is too long. File refs can have a maximum of 8 characters.');
|
|
179
|
-
});
|
|
180
|
-
test('it should throw an error when the file ref is falsy', function () {
|
|
181
|
-
var fileRef = '';
|
|
182
|
-
expect(function () { return dependencies_1.validateFileRef(fileRef); }).toThrow('Missing file ref.');
|
|
183
|
-
});
|
|
184
|
-
test('it should throw an error when the file ref does not conform to specification', function () {
|
|
185
|
-
var fileRef = '123ASDF';
|
|
186
|
-
expect(function () { return dependencies_1.validateFileRef(fileRef); }).toThrow('Invalid file ref. File refs can only start with a letter or an underscore, and contain only letters, numbers and underscores.');
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
describe('getProgramList', function () {
|
|
190
|
-
beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
191
|
-
return __generator(this, function (_a) {
|
|
192
|
-
switch (_a.label) {
|
|
193
|
-
case 0: return [4 /*yield*/, utils_2.setConstants()];
|
|
194
|
-
case 1:
|
|
195
|
-
_a.sent();
|
|
196
|
-
return [2 /*return*/];
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
}); });
|
|
200
|
-
test('it should get program dependencies when header is lowercase', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
201
|
-
var fileContent, expectedList, actualList;
|
|
202
|
-
return __generator(this, function (_a) {
|
|
203
|
-
switch (_a.label) {
|
|
204
|
-
case 0: return [4 /*yield*/, utils_1.readFile(path_1.default.join(__dirname, './example.sas'))];
|
|
205
|
-
case 1:
|
|
206
|
-
fileContent = _a.sent();
|
|
207
|
-
fileContent = fileContent.replace('SAS Programs', 'sas programs');
|
|
208
|
-
expectedList = [{ fileName: 'test.sas', fileRef: 'TEST' }];
|
|
209
|
-
return [4 /*yield*/, dependencies_1.getProgramList(fileContent)];
|
|
210
|
-
case 2:
|
|
211
|
-
actualList = _a.sent();
|
|
212
|
-
expect(actualList).toEqual(expectedList);
|
|
213
|
-
return [2 /*return*/];
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
}); });
|
|
217
|
-
test('it should get program dependencies when header is uppercase', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
218
|
-
var fileContent, expectedList, actualList;
|
|
219
|
-
return __generator(this, function (_a) {
|
|
220
|
-
switch (_a.label) {
|
|
221
|
-
case 0: return [4 /*yield*/, utils_1.readFile(path_1.default.join(__dirname, './example.sas'))];
|
|
222
|
-
case 1:
|
|
223
|
-
fileContent = _a.sent();
|
|
224
|
-
fileContent = fileContent.replace('SAS Programs', 'SAS PROGRAMS');
|
|
225
|
-
expectedList = [{ fileName: 'test.sas', fileRef: 'TEST' }];
|
|
226
|
-
return [4 /*yield*/, dependencies_1.getProgramList(fileContent)];
|
|
227
|
-
case 2:
|
|
228
|
-
actualList = _a.sent();
|
|
229
|
-
expect(actualList).toEqual(expectedList);
|
|
230
|
-
return [2 /*return*/];
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
}); });
|
|
234
|
-
test('it should get program dependencies when having extra spacing', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
235
|
-
var fileContent, expectedList, actualList;
|
|
236
|
-
return __generator(this, function (_a) {
|
|
237
|
-
switch (_a.label) {
|
|
238
|
-
case 0: return [4 /*yield*/, utils_1.readFile(path_1.default.join(__dirname, './extra-spacing-sas-programs.sas'))];
|
|
239
|
-
case 1:
|
|
240
|
-
fileContent = _a.sent();
|
|
241
|
-
expectedList = [
|
|
242
|
-
{ fileName: 'demotable1.ddl', fileRef: 'FREF1' },
|
|
243
|
-
{ fileName: 'demotable1.sas', fileRef: 'FREF2' }
|
|
244
|
-
];
|
|
245
|
-
return [4 /*yield*/, dependencies_1.getProgramList(fileContent)];
|
|
246
|
-
case 2:
|
|
247
|
-
actualList = _a.sent();
|
|
248
|
-
expect(actualList).toEqual(expectedList);
|
|
249
|
-
return [2 /*return*/];
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
}); });
|
|
253
|
-
test('it should handle empty programs list', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
254
|
-
var fileContent, actualList;
|
|
255
|
-
return __generator(this, function (_a) {
|
|
256
|
-
switch (_a.label) {
|
|
257
|
-
case 0: return [4 /*yield*/, utils_1.readFile(path_1.default.join(__dirname, './empty-list.sas'))];
|
|
258
|
-
case 1:
|
|
259
|
-
fileContent = _a.sent();
|
|
260
|
-
return [4 /*yield*/, dependencies_1.getProgramList(fileContent)];
|
|
261
|
-
case 2:
|
|
262
|
-
actualList = _a.sent();
|
|
263
|
-
expect(actualList).toEqual([]);
|
|
264
|
-
return [2 /*return*/];
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
}); });
|
|
268
|
-
test('it should return empty list when file header is not present', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
269
|
-
var fileContent, actualList;
|
|
270
|
-
return __generator(this, function (_a) {
|
|
271
|
-
switch (_a.label) {
|
|
272
|
-
case 0: return [4 /*yield*/, utils_1.readFile(path_1.default.join(__dirname, './no-header.sas'))];
|
|
273
|
-
case 1:
|
|
274
|
-
fileContent = _a.sent();
|
|
275
|
-
return [4 /*yield*/, dependencies_1.getProgramList(fileContent)];
|
|
276
|
-
case 2:
|
|
277
|
-
actualList = _a.sent();
|
|
278
|
-
expect(actualList).toEqual([]);
|
|
279
|
-
return [2 /*return*/];
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
}); });
|
|
283
|
-
test('it should return programs list when SAS programs are listed first', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
284
|
-
var fileContent, expectedList, actualList;
|
|
285
|
-
return __generator(this, function (_a) {
|
|
286
|
-
switch (_a.label) {
|
|
287
|
-
case 0: return [4 /*yield*/, utils_1.readFile(path_1.default.join(__dirname, './example-reversed.sas'))];
|
|
288
|
-
case 1:
|
|
289
|
-
fileContent = _a.sent();
|
|
290
|
-
expectedList = [{ fileName: 'test.sas', fileRef: 'TEST' }];
|
|
291
|
-
return [4 /*yield*/, dependencies_1.getProgramList(fileContent)];
|
|
292
|
-
case 2:
|
|
293
|
-
actualList = _a.sent();
|
|
294
|
-
expect(actualList).toEqual(expectedList);
|
|
295
|
-
return [2 /*return*/];
|
|
296
|
-
}
|
|
297
|
-
});
|
|
298
|
-
}); });
|
|
299
|
-
test('it should be able to handle extra newlines', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
300
|
-
var fileContent, expectedList, actualList;
|
|
301
|
-
return __generator(this, function (_a) {
|
|
302
|
-
switch (_a.label) {
|
|
303
|
-
case 0: return [4 /*yield*/, utils_1.readFile(path_1.default.join(__dirname, './newlines.sas'))];
|
|
304
|
-
case 1:
|
|
305
|
-
fileContent = _a.sent();
|
|
306
|
-
expectedList = [{ fileName: 'test.sas', fileRef: 'TEST' }];
|
|
307
|
-
return [4 /*yield*/, dependencies_1.getProgramList(fileContent)];
|
|
308
|
-
case 2:
|
|
309
|
-
actualList = _a.sent();
|
|
310
|
-
expect(actualList).toEqual(expectedList);
|
|
311
|
-
return [2 /*return*/];
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
}); });
|
|
315
|
-
test('it should be able to handle irregular spacing', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
316
|
-
var fileContent, expectedList, actualList;
|
|
317
|
-
return __generator(this, function (_a) {
|
|
318
|
-
switch (_a.label) {
|
|
319
|
-
case 0: return [4 /*yield*/, utils_1.readFile(path_1.default.join(__dirname, './spacing.sas'))];
|
|
320
|
-
case 1:
|
|
321
|
-
fileContent = _a.sent();
|
|
322
|
-
expectedList = [
|
|
323
|
-
{ fileName: 'test.sas', fileRef: 'TEST' },
|
|
324
|
-
{ fileName: 'test2.sas', fileRef: 'TEST2' }
|
|
325
|
-
];
|
|
326
|
-
return [4 /*yield*/, dependencies_1.getProgramList(fileContent)];
|
|
327
|
-
case 2:
|
|
328
|
-
actualList = _a.sent();
|
|
329
|
-
expect(actualList).toEqual(expectedList);
|
|
330
|
-
return [2 /*return*/];
|
|
331
|
-
}
|
|
332
|
-
});
|
|
333
|
-
}); });
|
|
334
|
-
test('it should get program dependencies when header is mixed case', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
335
|
-
var fileContent, expectedList, actualList;
|
|
336
|
-
return __generator(this, function (_a) {
|
|
337
|
-
switch (_a.label) {
|
|
338
|
-
case 0: return [4 /*yield*/, utils_1.readFile(path_1.default.join(__dirname, './example.sas'))];
|
|
339
|
-
case 1:
|
|
340
|
-
fileContent = _a.sent();
|
|
341
|
-
fileContent = fileContent.replace('SAS Programs', 'sas PROGRaMS');
|
|
342
|
-
expectedList = [{ fileName: 'test.sas', fileRef: 'TEST' }];
|
|
343
|
-
return [4 /*yield*/, dependencies_1.getProgramList(fileContent)];
|
|
344
|
-
case 2:
|
|
345
|
-
actualList = _a.sent();
|
|
346
|
-
expect(actualList).toEqual(expectedList);
|
|
347
|
-
return [2 /*return*/];
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
}); });
|
|
351
|
-
test('it should choose the first dependency when there are duplicates', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
352
|
-
var fileContent, expectedList, actualList;
|
|
353
|
-
return __generator(this, function (_a) {
|
|
354
|
-
switch (_a.label) {
|
|
355
|
-
case 0: return [4 /*yield*/, utils_1.readFile(path_1.default.join(__dirname, './duplicates.sas'))];
|
|
356
|
-
case 1:
|
|
357
|
-
fileContent = _a.sent();
|
|
358
|
-
expectedList = [{ fileName: 'test.sas', fileRef: 'TEST' }];
|
|
359
|
-
return [4 /*yield*/, dependencies_1.getProgramList(fileContent)];
|
|
360
|
-
case 2:
|
|
361
|
-
actualList = _a.sent();
|
|
362
|
-
expect(actualList).toEqual(expectedList);
|
|
363
|
-
return [2 /*return*/];
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
}); });
|
|
367
|
-
});
|
|
368
|
-
describe('validateProgramsList', function () {
|
|
369
|
-
beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
370
|
-
return __generator(this, function (_a) {
|
|
371
|
-
switch (_a.label) {
|
|
372
|
-
case 0: return [4 /*yield*/, utils_2.setConstants()];
|
|
373
|
-
case 1:
|
|
374
|
-
_a.sent();
|
|
375
|
-
return [2 /*return*/];
|
|
376
|
-
}
|
|
377
|
-
});
|
|
378
|
-
}); });
|
|
379
|
-
test('it should throw an error when filerefs are not unique', function () {
|
|
380
|
-
var programsList = [
|
|
381
|
-
{ fileName: 'test.sas', fileRef: 'TEST' },
|
|
382
|
-
{ fileName: 'test2.sas', fileRef: 'TEST' },
|
|
383
|
-
{ fileName: 'test3.sas', fileRef: 'TEST' }
|
|
384
|
-
];
|
|
385
|
-
expect(function () { return dependencies_1.validateProgramsList(programsList); }).toThrow("The following files have duplicate fileref 'TEST':\ntest2.sas, test3.sas, test.sas\n");
|
|
386
|
-
});
|
|
387
|
-
test('it should recognize non-unique filerefs regardless of case', function () {
|
|
388
|
-
var programsList = [
|
|
389
|
-
{ fileName: 'test.sas', fileRef: 'TEST' },
|
|
390
|
-
{ fileName: 'test2.sas', fileRef: 'test' }
|
|
391
|
-
];
|
|
392
|
-
expect(function () { return dependencies_1.validateProgramsList(programsList); }).toThrow("The following files have duplicate fileref 'TEST':\ntest2.sas, test.sas\n");
|
|
393
|
-
});
|
|
394
|
-
test('it should list all files with non-unique filerefs', function () {
|
|
395
|
-
var programsList = [
|
|
396
|
-
{ fileName: 'test.sas', fileRef: 'TEST' },
|
|
397
|
-
{ fileName: 'test2.sas', fileRef: 'TEST' },
|
|
398
|
-
{ fileName: 'test3.sas', fileRef: 'TEST2' },
|
|
399
|
-
{ fileName: 'test4.sas', fileRef: 'TEST2' }
|
|
400
|
-
];
|
|
401
|
-
expect(function () { return dependencies_1.validateProgramsList(programsList); }).toThrow("The following files have duplicate fileref 'TEST':\ntest2.sas, test.sas\nThe following files have duplicate fileref 'TEST2':\ntest4.sas, test3.sas");
|
|
402
|
-
});
|
|
403
|
-
});
|