@cyclonedx/cdxgen 8.1.9 → 8.2.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.
- package/README.md +1 -0
- package/binary.js +3 -1
- package/docker.js +21 -3
- package/index.js +146 -7
- package/package.json +1 -1
- package/server.js +1 -1
- package/utils.js +207 -5
- package/utils.test.js +266 -90
package/utils.test.js
CHANGED
|
@@ -73,7 +73,7 @@ test("finds license id from name", () => {
|
|
|
73
73
|
test("parse gradle dependencies", () => {
|
|
74
74
|
expect(utils.parseGradleDep(null)).toEqual({});
|
|
75
75
|
let parsedList = utils.parseGradleDep(
|
|
76
|
-
fs.readFileSync("./test/gradle-dep.out",
|
|
76
|
+
fs.readFileSync("./test/gradle-dep.out", { encoding: "utf-8" })
|
|
77
77
|
);
|
|
78
78
|
expect(parsedList.pkgList.length).toEqual(34);
|
|
79
79
|
expect(parsedList.dependenciesList.length).toEqual(34);
|
|
@@ -87,7 +87,7 @@ test("parse gradle dependencies", () => {
|
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
parsedList = utils.parseGradleDep(
|
|
90
|
-
fs.readFileSync("./test/data/gradle-android-dep.out",
|
|
90
|
+
fs.readFileSync("./test/data/gradle-android-dep.out", { encoding: "utf-8" })
|
|
91
91
|
);
|
|
92
92
|
expect(parsedList.pkgList.length).toEqual(106);
|
|
93
93
|
expect(parsedList.dependenciesList.length).toEqual(106);
|
|
@@ -116,7 +116,7 @@ test("parse gradle dependencies", () => {
|
|
|
116
116
|
version: "1.7.0"
|
|
117
117
|
});
|
|
118
118
|
parsedList = utils.parseGradleDep(
|
|
119
|
-
fs.readFileSync("./test/data/gradle-out1.dep",
|
|
119
|
+
fs.readFileSync("./test/data/gradle-out1.dep", { encoding: "utf-8" })
|
|
120
120
|
);
|
|
121
121
|
expect(parsedList.pkgList.length).toEqual(90);
|
|
122
122
|
expect(parsedList.dependenciesList.length).toEqual(90);
|
|
@@ -126,20 +126,99 @@ test("parse gradle dependencies", () => {
|
|
|
126
126
|
version: "2.2.0.RELEASE",
|
|
127
127
|
qualifiers: { type: "jar" }
|
|
128
128
|
});
|
|
129
|
+
|
|
130
|
+
parsedList = utils.parseGradleDep(
|
|
131
|
+
fs.readFileSync("./test/data/gradle-rich1.dep", { encoding: "utf-8" })
|
|
132
|
+
);
|
|
133
|
+
expect(parsedList.pkgList.length).toEqual(5);
|
|
134
|
+
expect(parsedList.pkgList[parsedList.pkgList.length - 1]).toEqual({
|
|
135
|
+
group: "ch.qos.logback",
|
|
136
|
+
name: "logback-core",
|
|
137
|
+
qualifiers: { type: "jar" },
|
|
138
|
+
version: "1.4.5"
|
|
139
|
+
});
|
|
140
|
+
parsedList = utils.parseGradleDep(
|
|
141
|
+
fs.readFileSync("./test/data/gradle-rich2.dep", { encoding: "utf-8" })
|
|
142
|
+
);
|
|
143
|
+
expect(parsedList.pkgList.length).toEqual(3);
|
|
144
|
+
expect(parsedList.pkgList).toEqual([
|
|
145
|
+
{
|
|
146
|
+
group: "",
|
|
147
|
+
name: "root",
|
|
148
|
+
qualifiers: { type: "jar" },
|
|
149
|
+
type: "maven",
|
|
150
|
+
version: "latest"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
group: "io.appium",
|
|
154
|
+
name: "java-client",
|
|
155
|
+
qualifiers: { type: "jar" },
|
|
156
|
+
version: "8.1.1"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
group: "org.seleniumhq.selenium",
|
|
160
|
+
name: "selenium-support",
|
|
161
|
+
qualifiers: { type: "jar" },
|
|
162
|
+
version: "4.5.0"
|
|
163
|
+
}
|
|
164
|
+
]);
|
|
165
|
+
parsedList = utils.parseGradleDep(
|
|
166
|
+
fs.readFileSync("./test/data/gradle-rich3.dep", { encoding: "utf-8" })
|
|
167
|
+
);
|
|
168
|
+
expect(parsedList.pkgList.length).toEqual(2);
|
|
169
|
+
expect(parsedList.pkgList).toEqual([
|
|
170
|
+
{
|
|
171
|
+
group: "",
|
|
172
|
+
name: "root",
|
|
173
|
+
version: "latest",
|
|
174
|
+
type: "maven",
|
|
175
|
+
qualifiers: { type: "jar" }
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
group: "org.seleniumhq.selenium",
|
|
179
|
+
name: "selenium-remote-driver",
|
|
180
|
+
version: "4.5.0",
|
|
181
|
+
qualifiers: { type: "jar" }
|
|
182
|
+
}
|
|
183
|
+
]);
|
|
184
|
+
parsedList = utils.parseGradleDep(
|
|
185
|
+
fs.readFileSync("./test/data/gradle-rich4.dep", { encoding: "utf-8" })
|
|
186
|
+
);
|
|
187
|
+
expect(parsedList.pkgList.length).toEqual(2);
|
|
188
|
+
expect(parsedList.pkgList).toEqual([
|
|
189
|
+
{
|
|
190
|
+
group: "",
|
|
191
|
+
name: "root",
|
|
192
|
+
version: "latest",
|
|
193
|
+
type: "maven",
|
|
194
|
+
qualifiers: { type: "jar" }
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
group: "org.seleniumhq.selenium",
|
|
198
|
+
name: "selenium-api",
|
|
199
|
+
version: "4.5.0",
|
|
200
|
+
qualifiers: { type: "jar" }
|
|
201
|
+
}
|
|
202
|
+
]);
|
|
203
|
+
parsedList = utils.parseGradleDep(
|
|
204
|
+
fs.readFileSync("./test/data/gradle-rich5.dep", { encoding: "utf-8" })
|
|
205
|
+
);
|
|
206
|
+
expect(parsedList.pkgList.length).toEqual(68);
|
|
207
|
+
expect(parsedList.dependenciesList.length).toEqual(69);
|
|
129
208
|
});
|
|
130
209
|
|
|
131
210
|
test("parse gradle projects", () => {
|
|
132
211
|
expect(utils.parseGradleProjects(null)).toEqual([]);
|
|
133
212
|
let proj_list = utils.parseGradleProjects(
|
|
134
|
-
fs.readFileSync("./test/data/gradle-projects.out",
|
|
213
|
+
fs.readFileSync("./test/data/gradle-projects.out", { encoding: "utf-8" })
|
|
135
214
|
);
|
|
136
215
|
expect(proj_list.length).toEqual(9);
|
|
137
216
|
});
|
|
138
217
|
|
|
139
218
|
test("parse maven tree", () => {
|
|
140
|
-
expect(utils.parseMavenTree(null)).toEqual(
|
|
219
|
+
expect(utils.parseMavenTree(null)).toEqual({});
|
|
141
220
|
let parsedList = utils.parseMavenTree(
|
|
142
|
-
fs.readFileSync("./test/data/sample-mvn-tree.txt",
|
|
221
|
+
fs.readFileSync("./test/data/sample-mvn-tree.txt", { encoding: "utf-8" })
|
|
143
222
|
);
|
|
144
223
|
expect(parsedList.pkgList.length).toEqual(59);
|
|
145
224
|
expect(parsedList.dependenciesList.length).toEqual(59);
|
|
@@ -173,7 +252,9 @@ test("parse maven tree", () => {
|
|
|
173
252
|
]
|
|
174
253
|
});
|
|
175
254
|
parsedList = utils.parseMavenTree(
|
|
176
|
-
fs.readFileSync("./test/data/mvn-dep-tree-simple.txt",
|
|
255
|
+
fs.readFileSync("./test/data/mvn-dep-tree-simple.txt", {
|
|
256
|
+
encoding: "utf-8"
|
|
257
|
+
})
|
|
177
258
|
);
|
|
178
259
|
expect(parsedList.pkgList.length).toEqual(27);
|
|
179
260
|
expect(parsedList.dependenciesList.length).toEqual(27);
|
|
@@ -284,7 +365,7 @@ test("parseGoModData", async () => {
|
|
|
284
365
|
"sha256-6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg="
|
|
285
366
|
};
|
|
286
367
|
dep_list = await utils.parseGoModData(
|
|
287
|
-
fs.readFileSync("./test/gomod/go.mod",
|
|
368
|
+
fs.readFileSync("./test/gomod/go.mod", { encoding: "utf-8" }),
|
|
288
369
|
gosumMap
|
|
289
370
|
);
|
|
290
371
|
expect(dep_list.length).toEqual(4);
|
|
@@ -326,7 +407,7 @@ test("parseGoSumData", async () => {
|
|
|
326
407
|
let dep_list = await utils.parseGoModData(null);
|
|
327
408
|
expect(dep_list).toEqual([]);
|
|
328
409
|
dep_list = await utils.parseGosumData(
|
|
329
|
-
fs.readFileSync("./test/gomod/go.sum",
|
|
410
|
+
fs.readFileSync("./test/gomod/go.sum", { encoding: "utf-8" })
|
|
330
411
|
);
|
|
331
412
|
expect(dep_list.length).toEqual(4);
|
|
332
413
|
expect(dep_list[0]).toEqual({
|
|
@@ -364,7 +445,7 @@ test("parseGoSumData", async () => {
|
|
|
364
445
|
|
|
365
446
|
test("parse go list dependencies", async () => {
|
|
366
447
|
let dep_list = await utils.parseGoListDep(
|
|
367
|
-
fs.readFileSync("./test/data/golist-dep.txt",
|
|
448
|
+
fs.readFileSync("./test/data/golist-dep.txt", { encoding: "utf-8" }),
|
|
368
449
|
{}
|
|
369
450
|
);
|
|
370
451
|
expect(dep_list.length).toEqual(8);
|
|
@@ -377,11 +458,11 @@ test("parse go list dependencies", async () => {
|
|
|
377
458
|
|
|
378
459
|
test("parse go mod why dependencies", () => {
|
|
379
460
|
let pkg_name = utils.parseGoModWhy(
|
|
380
|
-
fs.readFileSync("./test/data/gomodwhy.txt",
|
|
461
|
+
fs.readFileSync("./test/data/gomodwhy.txt", { encoding: "utf-8" })
|
|
381
462
|
);
|
|
382
463
|
expect(pkg_name).toEqual("github.com/mailgun/mailgun-go/v4");
|
|
383
464
|
pkg_name = utils.parseGoModWhy(
|
|
384
|
-
fs.readFileSync("./test/data/gomodwhynot.txt",
|
|
465
|
+
fs.readFileSync("./test/data/gomodwhynot.txt", { encoding: "utf-8" })
|
|
385
466
|
);
|
|
386
467
|
expect(pkg_name).toBeUndefined();
|
|
387
468
|
});
|
|
@@ -391,7 +472,7 @@ test("parseGopkgData", async () => {
|
|
|
391
472
|
let dep_list = await utils.parseGopkgData(null);
|
|
392
473
|
expect(dep_list).toEqual([]);
|
|
393
474
|
dep_list = await utils.parseGopkgData(
|
|
394
|
-
fs.readFileSync("./test/gopkg/Gopkg.lock",
|
|
475
|
+
fs.readFileSync("./test/gopkg/Gopkg.lock", { encoding: "utf-8" })
|
|
395
476
|
);
|
|
396
477
|
expect(dep_list.length).toEqual(36);
|
|
397
478
|
expect(dep_list[0]).toEqual({
|
|
@@ -407,7 +488,7 @@ test("parseGopkgData", async () => {
|
|
|
407
488
|
|
|
408
489
|
test("parse go version data", async () => {
|
|
409
490
|
let dep_list = await utils.parseGoVersionData(
|
|
410
|
-
fs.readFileSync("./test/data/goversion.txt",
|
|
491
|
+
fs.readFileSync("./test/data/goversion.txt", { encoding: "utf-8" }),
|
|
411
492
|
{}
|
|
412
493
|
);
|
|
413
494
|
expect(dep_list.length).toEqual(125);
|
|
@@ -419,7 +500,7 @@ test("parse go version data", async () => {
|
|
|
419
500
|
license: undefined
|
|
420
501
|
});
|
|
421
502
|
dep_list = await utils.parseGoVersionData(
|
|
422
|
-
fs.readFileSync("./test/data/goversion2.txt",
|
|
503
|
+
fs.readFileSync("./test/data/goversion2.txt", { encoding: "utf-8" }),
|
|
423
504
|
{}
|
|
424
505
|
);
|
|
425
506
|
expect(dep_list.length).toEqual(149);
|
|
@@ -435,7 +516,7 @@ test("parse go version data", async () => {
|
|
|
435
516
|
test("parse cargo lock", async () => {
|
|
436
517
|
expect(await utils.parseCargoData(null)).toEqual([]);
|
|
437
518
|
dep_list = await utils.parseCargoData(
|
|
438
|
-
fs.readFileSync("./test/Cargo.lock",
|
|
519
|
+
fs.readFileSync("./test/Cargo.lock", { encoding: "utf-8" })
|
|
439
520
|
);
|
|
440
521
|
expect(dep_list.length).toEqual(224);
|
|
441
522
|
expect(dep_list[0]).toEqual({
|
|
@@ -446,7 +527,7 @@ test("parse cargo lock", async () => {
|
|
|
446
527
|
"sha384-6a07677093120a02583717b6dd1ef81d8de1e8d01bd226c83f0f9bdf3e56bb3a"
|
|
447
528
|
});
|
|
448
529
|
dep_list = await utils.parseCargoData(
|
|
449
|
-
fs.readFileSync("./test/data/Cargom.lock",
|
|
530
|
+
fs.readFileSync("./test/data/Cargom.lock", { encoding: "utf-8" })
|
|
450
531
|
);
|
|
451
532
|
expect(dep_list.length).toEqual(242);
|
|
452
533
|
expect(dep_list[0]).toEqual({
|
|
@@ -461,7 +542,7 @@ test("parse cargo lock", async () => {
|
|
|
461
542
|
test("parse cargo toml", async () => {
|
|
462
543
|
expect(await utils.parseCargoTomlData(null)).toEqual([]);
|
|
463
544
|
dep_list = await utils.parseCargoTomlData(
|
|
464
|
-
fs.readFileSync("./test/data/Cargo1.toml",
|
|
545
|
+
fs.readFileSync("./test/data/Cargo1.toml", { encoding: "utf-8" })
|
|
465
546
|
);
|
|
466
547
|
expect(dep_list.length).toEqual(4);
|
|
467
548
|
expect(dep_list).toEqual([
|
|
@@ -471,7 +552,7 @@ test("parse cargo toml", async () => {
|
|
|
471
552
|
{ name: "cfg-if", version: "0.1.8" }
|
|
472
553
|
]);
|
|
473
554
|
dep_list = await utils.parseCargoTomlData(
|
|
474
|
-
fs.readFileSync("./test/data/Cargo2.toml",
|
|
555
|
+
fs.readFileSync("./test/data/Cargo2.toml", { encoding: "utf-8" })
|
|
475
556
|
);
|
|
476
557
|
expect(dep_list.length).toEqual(3);
|
|
477
558
|
expect(dep_list).toEqual([
|
|
@@ -487,7 +568,7 @@ test("parse cargo toml", async () => {
|
|
|
487
568
|
test("parse cargo auditable data", async () => {
|
|
488
569
|
expect(await utils.parseCargoAuditableData(null)).toEqual([]);
|
|
489
570
|
dep_list = await utils.parseCargoAuditableData(
|
|
490
|
-
fs.readFileSync("./test/data/cargo-auditable.txt",
|
|
571
|
+
fs.readFileSync("./test/data/cargo-auditable.txt", { encoding: "utf-8" })
|
|
491
572
|
);
|
|
492
573
|
expect(dep_list.length).toEqual(32);
|
|
493
574
|
expect(dep_list[0]).toEqual({
|
|
@@ -527,7 +608,7 @@ test("get crates metadata", async () => {
|
|
|
527
608
|
test("parse pub lock", async () => {
|
|
528
609
|
expect(await utils.parsePubLockData(null)).toEqual([]);
|
|
529
610
|
dep_list = await utils.parsePubLockData(
|
|
530
|
-
fs.readFileSync("./test/data/pubspec.lock",
|
|
611
|
+
fs.readFileSync("./test/data/pubspec.lock", { encoding: "utf-8" })
|
|
531
612
|
);
|
|
532
613
|
expect(dep_list.length).toEqual(26);
|
|
533
614
|
expect(dep_list[0]).toEqual({
|
|
@@ -535,7 +616,7 @@ test("parse pub lock", async () => {
|
|
|
535
616
|
version: "2.8.2"
|
|
536
617
|
});
|
|
537
618
|
dep_list = await utils.parsePubYamlData(
|
|
538
|
-
fs.readFileSync("./test/data/pubspec.yaml",
|
|
619
|
+
fs.readFileSync("./test/data/pubspec.yaml", { encoding: "utf-8" })
|
|
539
620
|
);
|
|
540
621
|
expect(dep_list.length).toEqual(1);
|
|
541
622
|
expect(dep_list[0]).toEqual({
|
|
@@ -574,7 +655,7 @@ test("get dart metadata", async () => {
|
|
|
574
655
|
test("parse cabal freeze", async () => {
|
|
575
656
|
expect(await utils.parseCabalData(null)).toEqual([]);
|
|
576
657
|
dep_list = await utils.parseCabalData(
|
|
577
|
-
fs.readFileSync("./test/data/cabal.project.freeze",
|
|
658
|
+
fs.readFileSync("./test/data/cabal.project.freeze", { encoding: "utf-8" })
|
|
578
659
|
);
|
|
579
660
|
expect(dep_list.length).toEqual(24);
|
|
580
661
|
expect(dep_list[0]).toEqual({
|
|
@@ -582,7 +663,7 @@ test("parse cabal freeze", async () => {
|
|
|
582
663
|
version: "0.11.3"
|
|
583
664
|
});
|
|
584
665
|
dep_list = await utils.parseCabalData(
|
|
585
|
-
fs.readFileSync("./test/data/cabal-2.project.freeze",
|
|
666
|
+
fs.readFileSync("./test/data/cabal-2.project.freeze", { encoding: "utf-8" })
|
|
586
667
|
);
|
|
587
668
|
expect(dep_list.length).toEqual(366);
|
|
588
669
|
expect(dep_list[0]).toEqual({
|
|
@@ -594,7 +675,7 @@ test("parse cabal freeze", async () => {
|
|
|
594
675
|
test("parse conan data", async () => {
|
|
595
676
|
expect(await utils.parseConanLockData(null)).toEqual([]);
|
|
596
677
|
dep_list = await utils.parseConanLockData(
|
|
597
|
-
fs.readFileSync("./test/data/conan.lock",
|
|
678
|
+
fs.readFileSync("./test/data/conan.lock", { encoding: "utf-8" })
|
|
598
679
|
);
|
|
599
680
|
expect(dep_list.length).toEqual(3);
|
|
600
681
|
expect(dep_list[0]).toEqual({
|
|
@@ -603,7 +684,7 @@ test("parse conan data", async () => {
|
|
|
603
684
|
});
|
|
604
685
|
|
|
605
686
|
dep_list = await utils.parseConanData(
|
|
606
|
-
fs.readFileSync("./test/data/conanfile.txt",
|
|
687
|
+
fs.readFileSync("./test/data/conanfile.txt", { encoding: "utf-8" })
|
|
607
688
|
);
|
|
608
689
|
expect(dep_list.length).toEqual(3);
|
|
609
690
|
expect(dep_list[0]).toEqual({
|
|
@@ -615,7 +696,7 @@ test("parse conan data", async () => {
|
|
|
615
696
|
test("parse clojure data", () => {
|
|
616
697
|
expect(utils.parseLeiningenData(null)).toEqual([]);
|
|
617
698
|
let dep_list = utils.parseLeiningenData(
|
|
618
|
-
fs.readFileSync("./test/data/project.clj",
|
|
699
|
+
fs.readFileSync("./test/data/project.clj", { encoding: "utf-8" })
|
|
619
700
|
);
|
|
620
701
|
expect(dep_list.length).toEqual(14);
|
|
621
702
|
expect(dep_list[0]).toEqual({
|
|
@@ -624,7 +705,7 @@ test("parse clojure data", () => {
|
|
|
624
705
|
version: "2.9.9-SNAPSHOT"
|
|
625
706
|
});
|
|
626
707
|
dep_list = utils.parseLeiningenData(
|
|
627
|
-
fs.readFileSync("./test/data/project.clj.1",
|
|
708
|
+
fs.readFileSync("./test/data/project.clj.1", { encoding: "utf-8" })
|
|
628
709
|
);
|
|
629
710
|
expect(dep_list.length).toEqual(17);
|
|
630
711
|
expect(dep_list[0]).toEqual({
|
|
@@ -633,7 +714,7 @@ test("parse clojure data", () => {
|
|
|
633
714
|
version: "1.9.0"
|
|
634
715
|
});
|
|
635
716
|
dep_list = utils.parseLeiningenData(
|
|
636
|
-
fs.readFileSync("./test/data/project.clj.2",
|
|
717
|
+
fs.readFileSync("./test/data/project.clj.2", { encoding: "utf-8" })
|
|
637
718
|
);
|
|
638
719
|
expect(dep_list.length).toEqual(49);
|
|
639
720
|
expect(dep_list[0]).toEqual({
|
|
@@ -642,7 +723,7 @@ test("parse clojure data", () => {
|
|
|
642
723
|
version: "2.1.6"
|
|
643
724
|
});
|
|
644
725
|
dep_list = utils.parseEdnData(
|
|
645
|
-
fs.readFileSync("./test/data/deps.edn",
|
|
726
|
+
fs.readFileSync("./test/data/deps.edn", { encoding: "utf-8" })
|
|
646
727
|
);
|
|
647
728
|
expect(dep_list.length).toEqual(20);
|
|
648
729
|
expect(dep_list[0]).toEqual({
|
|
@@ -651,7 +732,7 @@ test("parse clojure data", () => {
|
|
|
651
732
|
version: "1.10.3"
|
|
652
733
|
});
|
|
653
734
|
dep_list = utils.parseEdnData(
|
|
654
|
-
fs.readFileSync("./test/data/deps.edn.1",
|
|
735
|
+
fs.readFileSync("./test/data/deps.edn.1", { encoding: "utf-8" })
|
|
655
736
|
);
|
|
656
737
|
expect(dep_list.length).toEqual(11);
|
|
657
738
|
expect(dep_list[0]).toEqual({
|
|
@@ -660,7 +741,7 @@ test("parse clojure data", () => {
|
|
|
660
741
|
version: "1.11.0-beta1"
|
|
661
742
|
});
|
|
662
743
|
dep_list = utils.parseEdnData(
|
|
663
|
-
fs.readFileSync("./test/data/deps.edn.2",
|
|
744
|
+
fs.readFileSync("./test/data/deps.edn.2", { encoding: "utf-8" })
|
|
664
745
|
);
|
|
665
746
|
expect(dep_list.length).toEqual(5);
|
|
666
747
|
expect(dep_list[0]).toEqual({
|
|
@@ -669,7 +750,7 @@ test("parse clojure data", () => {
|
|
|
669
750
|
version: "1.2.1"
|
|
670
751
|
});
|
|
671
752
|
dep_list = utils.parseCljDep(
|
|
672
|
-
fs.readFileSync("./test/data/clj-tree.txt",
|
|
753
|
+
fs.readFileSync("./test/data/clj-tree.txt", { encoding: "utf-8" })
|
|
673
754
|
);
|
|
674
755
|
expect(dep_list.length).toEqual(253);
|
|
675
756
|
expect(dep_list[0]).toEqual({
|
|
@@ -679,7 +760,7 @@ test("parse clojure data", () => {
|
|
|
679
760
|
});
|
|
680
761
|
|
|
681
762
|
dep_list = utils.parseLeinDep(
|
|
682
|
-
fs.readFileSync("./test/data/lein-tree.txt",
|
|
763
|
+
fs.readFileSync("./test/data/lein-tree.txt", { encoding: "utf-8" })
|
|
683
764
|
);
|
|
684
765
|
expect(dep_list.length).toEqual(47);
|
|
685
766
|
expect(dep_list[0]).toEqual({
|
|
@@ -692,7 +773,7 @@ test("parse clojure data", () => {
|
|
|
692
773
|
test("parse mix lock data", async () => {
|
|
693
774
|
expect(await utils.parseMixLockData(null)).toEqual([]);
|
|
694
775
|
dep_list = await utils.parseMixLockData(
|
|
695
|
-
fs.readFileSync("./test/data/mix.lock",
|
|
776
|
+
fs.readFileSync("./test/data/mix.lock", { encoding: "utf-8" })
|
|
696
777
|
);
|
|
697
778
|
expect(dep_list.length).toEqual(16);
|
|
698
779
|
expect(dep_list[0]).toEqual({
|
|
@@ -700,7 +781,7 @@ test("parse mix lock data", async () => {
|
|
|
700
781
|
version: "1.7.0"
|
|
701
782
|
});
|
|
702
783
|
dep_list = await utils.parseMixLockData(
|
|
703
|
-
fs.readFileSync("./test/data/mix.lock.1",
|
|
784
|
+
fs.readFileSync("./test/data/mix.lock.1", { encoding: "utf-8" })
|
|
704
785
|
);
|
|
705
786
|
expect(dep_list.length).toEqual(23);
|
|
706
787
|
expect(dep_list[0]).toEqual({
|
|
@@ -712,7 +793,7 @@ test("parse mix lock data", async () => {
|
|
|
712
793
|
test("parse github actions workflow data", async () => {
|
|
713
794
|
expect(await utils.parseGitHubWorkflowData(null)).toEqual([]);
|
|
714
795
|
dep_list = await utils.parseGitHubWorkflowData(
|
|
715
|
-
fs.readFileSync("./.github/workflows/nodejs.yml",
|
|
796
|
+
fs.readFileSync("./.github/workflows/nodejs.yml", { encoding: "utf-8" })
|
|
716
797
|
);
|
|
717
798
|
expect(dep_list.length).toEqual(3);
|
|
718
799
|
expect(dep_list[0]).toEqual({
|
|
@@ -721,16 +802,18 @@ test("parse github actions workflow data", async () => {
|
|
|
721
802
|
version: "v3"
|
|
722
803
|
});
|
|
723
804
|
dep_list = await utils.parseGitHubWorkflowData(
|
|
724
|
-
fs.readFileSync("./.github/workflows/repotests.yml",
|
|
805
|
+
fs.readFileSync("./.github/workflows/repotests.yml", { encoding: "utf-8" })
|
|
725
806
|
);
|
|
726
|
-
expect(dep_list.length).toEqual(
|
|
807
|
+
expect(dep_list.length).toEqual(5);
|
|
727
808
|
expect(dep_list[0]).toEqual({
|
|
728
809
|
group: "actions",
|
|
729
810
|
name: "checkout",
|
|
730
811
|
version: "v3"
|
|
731
812
|
});
|
|
732
813
|
dep_list = await utils.parseGitHubWorkflowData(
|
|
733
|
-
fs.readFileSync("./.github/workflows/app-release.yml",
|
|
814
|
+
fs.readFileSync("./.github/workflows/app-release.yml", {
|
|
815
|
+
encoding: "utf-8"
|
|
816
|
+
})
|
|
734
817
|
);
|
|
735
818
|
expect(dep_list.length).toEqual(4);
|
|
736
819
|
});
|
|
@@ -738,7 +821,7 @@ test("parse github actions workflow data", async () => {
|
|
|
738
821
|
test("parse cs pkg data", async () => {
|
|
739
822
|
expect(await utils.parseCsPkgData(null)).toEqual([]);
|
|
740
823
|
const dep_list = await utils.parseCsPkgData(
|
|
741
|
-
fs.readFileSync("./test/data/packages.config",
|
|
824
|
+
fs.readFileSync("./test/data/packages.config", { encoding: "utf-8" })
|
|
742
825
|
);
|
|
743
826
|
expect(dep_list.length).toEqual(21);
|
|
744
827
|
expect(dep_list[0]).toEqual({
|
|
@@ -751,7 +834,7 @@ test("parse cs pkg data", async () => {
|
|
|
751
834
|
test("parse cs pkg data 2", async () => {
|
|
752
835
|
expect(await utils.parseCsPkgData(null)).toEqual([]);
|
|
753
836
|
const dep_list = await utils.parseCsPkgData(
|
|
754
|
-
fs.readFileSync("./test/data/packages2.config",
|
|
837
|
+
fs.readFileSync("./test/data/packages2.config", { encoding: "utf-8" })
|
|
755
838
|
);
|
|
756
839
|
expect(dep_list.length).toEqual(1);
|
|
757
840
|
expect(dep_list[0]).toEqual({
|
|
@@ -764,7 +847,7 @@ test("parse cs pkg data 2", async () => {
|
|
|
764
847
|
test("parse cs proj", async () => {
|
|
765
848
|
expect(await utils.parseCsProjData(null)).toEqual([]);
|
|
766
849
|
const dep_list = await utils.parseCsProjData(
|
|
767
|
-
fs.readFileSync("./test/sample.csproj",
|
|
850
|
+
fs.readFileSync("./test/sample.csproj", { encoding: "utf-8" })
|
|
768
851
|
);
|
|
769
852
|
expect(dep_list.length).toEqual(5);
|
|
770
853
|
expect(dep_list[0]).toEqual({
|
|
@@ -777,7 +860,7 @@ test("parse cs proj", async () => {
|
|
|
777
860
|
test("parse project.assets.json", async () => {
|
|
778
861
|
expect(await utils.parseCsProjAssetsData(null)).toEqual([]);
|
|
779
862
|
const dep_list = await utils.parseCsProjAssetsData(
|
|
780
|
-
fs.readFileSync("./test/data/project.assets.json",
|
|
863
|
+
fs.readFileSync("./test/data/project.assets.json", { encoding: "utf-8" })
|
|
781
864
|
);
|
|
782
865
|
expect(dep_list.length).toEqual(142);
|
|
783
866
|
expect(dep_list[0]).toEqual({
|
|
@@ -792,7 +875,7 @@ test("parse project.assets.json", async () => {
|
|
|
792
875
|
test("parse packages.lock.json", async () => {
|
|
793
876
|
expect(await utils.parseCsPkgLockData(null)).toEqual([]);
|
|
794
877
|
const dep_list = await utils.parseCsPkgLockData(
|
|
795
|
-
fs.readFileSync("./test/data/packages.lock.json",
|
|
878
|
+
fs.readFileSync("./test/data/packages.lock.json", { encoding: "utf-8" })
|
|
796
879
|
);
|
|
797
880
|
expect(dep_list.length).toEqual(14);
|
|
798
881
|
expect(dep_list[0]).toEqual({
|
|
@@ -805,7 +888,7 @@ test("parse packages.lock.json", async () => {
|
|
|
805
888
|
test("parse .net cs proj", async () => {
|
|
806
889
|
expect(await utils.parseCsProjData(null)).toEqual([]);
|
|
807
890
|
const dep_list = await utils.parseCsProjData(
|
|
808
|
-
fs.readFileSync("./test/data/sample-dotnet.csproj",
|
|
891
|
+
fs.readFileSync("./test/data/sample-dotnet.csproj", { encoding: "utf-8" })
|
|
809
892
|
);
|
|
810
893
|
expect(dep_list.length).toEqual(19);
|
|
811
894
|
expect(dep_list[0]).toEqual({
|
|
@@ -1131,7 +1214,7 @@ test("parseYarnLock", async () => {
|
|
|
1131
1214
|
}
|
|
1132
1215
|
]
|
|
1133
1216
|
});
|
|
1134
|
-
|
|
1217
|
+
expect(parsedList.dependenciesList.length).toEqual(56);
|
|
1135
1218
|
identMap = utils.yarnLockToIdentMap(
|
|
1136
1219
|
fs.readFileSync("./test/data/yarn_locks/yarn.lock", "utf8")
|
|
1137
1220
|
);
|
|
@@ -1246,6 +1329,7 @@ test("parseYarnLock", async () => {
|
|
|
1246
1329
|
});
|
|
1247
1330
|
parsedList = await utils.parseYarnLock("./test/data/yarn_locks/yarn4.lock");
|
|
1248
1331
|
expect(parsedList.pkgList.length).toEqual(1);
|
|
1332
|
+
expect(parsedList.dependenciesList.length).toEqual(1);
|
|
1249
1333
|
parsedList = await utils.parseYarnLock("./test/data/yarn_locks/yarn-at.lock");
|
|
1250
1334
|
expect(parsedList.pkgList.length).toEqual(4);
|
|
1251
1335
|
expect(parsedList.dependenciesList.length).toEqual(4);
|
|
@@ -1326,7 +1410,7 @@ test("parseComposerLock", () => {
|
|
|
1326
1410
|
|
|
1327
1411
|
test("parseGemfileLockData", async () => {
|
|
1328
1412
|
let deps = await utils.parseGemfileLockData(
|
|
1329
|
-
fs.readFileSync("./test/data/Gemfile.lock",
|
|
1413
|
+
fs.readFileSync("./test/data/Gemfile.lock", { encoding: "utf-8" })
|
|
1330
1414
|
);
|
|
1331
1415
|
expect(deps.length).toEqual(140);
|
|
1332
1416
|
expect(deps[0]).toEqual({
|
|
@@ -1337,7 +1421,7 @@ test("parseGemfileLockData", async () => {
|
|
|
1337
1421
|
|
|
1338
1422
|
test("parseGemspecData", async () => {
|
|
1339
1423
|
let deps = await utils.parseGemspecData(
|
|
1340
|
-
fs.readFileSync("./test/data/xmlrpc.gemspec",
|
|
1424
|
+
fs.readFileSync("./test/data/xmlrpc.gemspec", { encoding: "utf-8" })
|
|
1341
1425
|
);
|
|
1342
1426
|
expect(deps.length).toEqual(1);
|
|
1343
1427
|
expect(deps[0]).toEqual({
|
|
@@ -1351,14 +1435,15 @@ test("parseGemspecData", async () => {
|
|
|
1351
1435
|
test("parse requirements.txt", async () => {
|
|
1352
1436
|
jest.setTimeout(120000);
|
|
1353
1437
|
let deps = await utils.parseReqFile(
|
|
1354
|
-
fs.readFileSync(
|
|
1355
|
-
"
|
|
1356
|
-
|
|
1357
|
-
)
|
|
1438
|
+
fs.readFileSync("./test/data/requirements.comments.txt", {
|
|
1439
|
+
encoding: "utf-8"
|
|
1440
|
+
})
|
|
1358
1441
|
);
|
|
1359
1442
|
expect(deps.length).toEqual(31);
|
|
1360
1443
|
deps = await utils.parseReqFile(
|
|
1361
|
-
fs.readFileSync("./test/data/requirements.freeze.txt",
|
|
1444
|
+
fs.readFileSync("./test/data/requirements.freeze.txt", {
|
|
1445
|
+
encoding: "utf-8"
|
|
1446
|
+
})
|
|
1362
1447
|
);
|
|
1363
1448
|
expect(deps.length).toEqual(113);
|
|
1364
1449
|
expect(deps[0]).toEqual({
|
|
@@ -1371,18 +1456,18 @@ test("parse requirements.txt", async () => {
|
|
|
1371
1456
|
test("parse poetry.lock", async () => {
|
|
1372
1457
|
jest.setTimeout(120000);
|
|
1373
1458
|
let deps = await utils.parsePoetrylockData(
|
|
1374
|
-
fs.readFileSync("./test/data/poetry.lock",
|
|
1459
|
+
fs.readFileSync("./test/data/poetry.lock", { encoding: "utf-8" })
|
|
1375
1460
|
);
|
|
1376
1461
|
expect(deps.length).toEqual(31);
|
|
1377
1462
|
deps = await utils.parsePoetrylockData(
|
|
1378
|
-
fs.readFileSync("./test/data/poetry1.lock",
|
|
1463
|
+
fs.readFileSync("./test/data/poetry1.lock", { encoding: "utf-8" })
|
|
1379
1464
|
);
|
|
1380
1465
|
expect(deps.length).toEqual(67);
|
|
1381
1466
|
});
|
|
1382
1467
|
|
|
1383
1468
|
test("parse wheel metadata", () => {
|
|
1384
1469
|
let deps = utils.parseBdistMetadata(
|
|
1385
|
-
fs.readFileSync("./test/data/METADATA",
|
|
1470
|
+
fs.readFileSync("./test/data/METADATA", { encoding: "utf-8" })
|
|
1386
1471
|
);
|
|
1387
1472
|
expect(deps.length).toEqual(1);
|
|
1388
1473
|
expect(deps[0]).toEqual({
|
|
@@ -1394,10 +1479,9 @@ test("parse wheel metadata", () => {
|
|
|
1394
1479
|
repository: { url: "https://github.com/adrienverge/yamllint" }
|
|
1395
1480
|
});
|
|
1396
1481
|
deps = utils.parseBdistMetadata(
|
|
1397
|
-
fs.readFileSync(
|
|
1398
|
-
"
|
|
1399
|
-
|
|
1400
|
-
)
|
|
1482
|
+
fs.readFileSync("./test/data/mercurial-5.5.2-py3.8.egg-info", {
|
|
1483
|
+
encoding: "utf-8"
|
|
1484
|
+
})
|
|
1401
1485
|
);
|
|
1402
1486
|
expect(deps.length).toEqual(1);
|
|
1403
1487
|
expect(deps[0]).toEqual({
|
|
@@ -1431,7 +1515,7 @@ test("parse pipfile.lock with hashes", async () => {
|
|
|
1431
1515
|
jest.setTimeout(120000);
|
|
1432
1516
|
let deps = await utils.parsePiplockData(
|
|
1433
1517
|
JSON.parse(
|
|
1434
|
-
fs.readFileSync("./test/data/Pipfile.lock",
|
|
1518
|
+
fs.readFileSync("./test/data/Pipfile.lock", { encoding: "utf-8" })
|
|
1435
1519
|
)
|
|
1436
1520
|
);
|
|
1437
1521
|
expect(deps.length).toEqual(46);
|
|
@@ -1457,7 +1541,7 @@ test("parse nupkg file", async () => {
|
|
|
1457
1541
|
|
|
1458
1542
|
test("parse bazel skyframe", () => {
|
|
1459
1543
|
let deps = utils.parseBazelSkyframe(
|
|
1460
|
-
fs.readFileSync("./test/data/bazel/bazel-state.txt",
|
|
1544
|
+
fs.readFileSync("./test/data/bazel/bazel-state.txt", { encoding: "utf-8" })
|
|
1461
1545
|
);
|
|
1462
1546
|
expect(deps.length).toEqual(16);
|
|
1463
1547
|
expect(deps[0].name).toEqual("guava");
|
|
@@ -1465,7 +1549,7 @@ test("parse bazel skyframe", () => {
|
|
|
1465
1549
|
|
|
1466
1550
|
test("parse bazel build", () => {
|
|
1467
1551
|
let projs = utils.parseBazelBuild(
|
|
1468
|
-
fs.readFileSync("./test/data/bazel/BUILD",
|
|
1552
|
+
fs.readFileSync("./test/data/bazel/BUILD", { encoding: "utf-8" })
|
|
1469
1553
|
);
|
|
1470
1554
|
expect(projs.length).toEqual(2);
|
|
1471
1555
|
expect(projs[0]).toEqual("java-maven-lib");
|
|
@@ -1473,7 +1557,7 @@ test("parse bazel build", () => {
|
|
|
1473
1557
|
|
|
1474
1558
|
test("parse helm charts", async () => {
|
|
1475
1559
|
let dep_list = await utils.parseHelmYamlData(
|
|
1476
|
-
fs.readFileSync("./test/data/Chart.yaml",
|
|
1560
|
+
fs.readFileSync("./test/data/Chart.yaml", { encoding: "utf-8" })
|
|
1477
1561
|
);
|
|
1478
1562
|
expect(dep_list.length).toEqual(3);
|
|
1479
1563
|
expect(dep_list[0]).toEqual({
|
|
@@ -1485,10 +1569,9 @@ test("parse helm charts", async () => {
|
|
|
1485
1569
|
}
|
|
1486
1570
|
});
|
|
1487
1571
|
dep_list = await utils.parseHelmYamlData(
|
|
1488
|
-
fs.readFileSync(
|
|
1489
|
-
"
|
|
1490
|
-
|
|
1491
|
-
)
|
|
1572
|
+
fs.readFileSync("./test/data/prometheus-community-index.yaml", {
|
|
1573
|
+
encoding: "utf-8"
|
|
1574
|
+
})
|
|
1492
1575
|
);
|
|
1493
1576
|
expect(dep_list.length).toEqual(1836);
|
|
1494
1577
|
expect(dep_list[0]).toEqual({
|
|
@@ -1505,25 +1588,25 @@ test("parse helm charts", async () => {
|
|
|
1505
1588
|
|
|
1506
1589
|
test("parse container spec like files", async () => {
|
|
1507
1590
|
let dep_list = await utils.parseContainerSpecData(
|
|
1508
|
-
fs.readFileSync("./test/data/docker-compose.yml",
|
|
1591
|
+
fs.readFileSync("./test/data/docker-compose.yml", { encoding: "utf-8" })
|
|
1509
1592
|
);
|
|
1510
1593
|
expect(dep_list.length).toEqual(4);
|
|
1511
1594
|
dep_list = await utils.parseContainerSpecData(
|
|
1512
|
-
fs.readFileSync("./test/data/docker-compose-ng.yml",
|
|
1595
|
+
fs.readFileSync("./test/data/docker-compose-ng.yml", { encoding: "utf-8" })
|
|
1513
1596
|
);
|
|
1514
1597
|
expect(dep_list.length).toEqual(8);
|
|
1515
1598
|
expect(dep_list[0]).toEqual({
|
|
1516
1599
|
service: "frontend"
|
|
1517
1600
|
});
|
|
1518
1601
|
dep_list = await utils.parseContainerSpecData(
|
|
1519
|
-
fs.readFileSync("./test/data/docker-compose-cr.yml",
|
|
1602
|
+
fs.readFileSync("./test/data/docker-compose-cr.yml", { encoding: "utf-8" })
|
|
1520
1603
|
);
|
|
1521
1604
|
expect(dep_list.length).toEqual(14);
|
|
1522
1605
|
expect(dep_list[0]).toEqual({
|
|
1523
1606
|
service: "crapi-identity"
|
|
1524
1607
|
});
|
|
1525
1608
|
dep_list = await utils.parseContainerSpecData(
|
|
1526
|
-
fs.readFileSync("./test/data/tekton-task.yml",
|
|
1609
|
+
fs.readFileSync("./test/data/tekton-task.yml", { encoding: "utf-8" })
|
|
1527
1610
|
);
|
|
1528
1611
|
expect(dep_list.length).toEqual(2);
|
|
1529
1612
|
expect(dep_list[0]).toEqual({
|
|
@@ -1531,7 +1614,7 @@ test("parse container spec like files", async () => {
|
|
|
1531
1614
|
"docker.io/amazon/aws-cli:2.0.52@sha256:1506cec98a7101c935176d440a14302ea528b8f92fcaf4a6f1ea2d7ecef7edc4"
|
|
1532
1615
|
});
|
|
1533
1616
|
dep_list = await utils.parseContainerSpecData(
|
|
1534
|
-
fs.readFileSync("./test/data/postgrescluster.yaml",
|
|
1617
|
+
fs.readFileSync("./test/data/postgrescluster.yaml", { encoding: "utf-8" })
|
|
1535
1618
|
);
|
|
1536
1619
|
expect(dep_list.length).toEqual(6);
|
|
1537
1620
|
expect(dep_list[0]).toEqual({
|
|
@@ -1539,49 +1622,49 @@ test("parse container spec like files", async () => {
|
|
|
1539
1622
|
"registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-14.5-1"
|
|
1540
1623
|
});
|
|
1541
1624
|
dep_list = await utils.parseContainerSpecData(
|
|
1542
|
-
fs.readFileSync("./test/data/deployment.yaml",
|
|
1625
|
+
fs.readFileSync("./test/data/deployment.yaml", { encoding: "utf-8" })
|
|
1543
1626
|
);
|
|
1544
1627
|
expect(dep_list.length).toEqual(2);
|
|
1545
1628
|
expect(dep_list[0]).toEqual({
|
|
1546
1629
|
image: "node-typescript-example"
|
|
1547
1630
|
});
|
|
1548
1631
|
dep_list = await utils.parseContainerSpecData(
|
|
1549
|
-
fs.readFileSync("./test/data/skaffold.yaml",
|
|
1632
|
+
fs.readFileSync("./test/data/skaffold.yaml", { encoding: "utf-8" })
|
|
1550
1633
|
);
|
|
1551
1634
|
expect(dep_list.length).toEqual(6);
|
|
1552
1635
|
expect(dep_list[0]).toEqual({
|
|
1553
1636
|
image: "leeroy-web"
|
|
1554
1637
|
});
|
|
1555
1638
|
dep_list = await utils.parseContainerSpecData(
|
|
1556
|
-
fs.readFileSync("./test/data/skaffold-ms.yaml",
|
|
1639
|
+
fs.readFileSync("./test/data/skaffold-ms.yaml", { encoding: "utf-8" })
|
|
1557
1640
|
);
|
|
1558
1641
|
expect(dep_list.length).toEqual(22);
|
|
1559
1642
|
expect(dep_list[0]).toEqual({
|
|
1560
1643
|
image: "emailservice"
|
|
1561
1644
|
});
|
|
1562
1645
|
dep_list = await utils.parseContainerSpecData(
|
|
1563
|
-
fs.readFileSync("./test/data/emailservice.yaml",
|
|
1646
|
+
fs.readFileSync("./test/data/emailservice.yaml", { encoding: "utf-8" })
|
|
1564
1647
|
);
|
|
1565
1648
|
expect(dep_list.length).toEqual(2);
|
|
1566
1649
|
expect(dep_list[0]).toEqual({
|
|
1567
1650
|
image: "emailservice"
|
|
1568
1651
|
});
|
|
1569
1652
|
dep_list = await utils.parseContainerSpecData(
|
|
1570
|
-
fs.readFileSync("./test/data/redis.yaml",
|
|
1653
|
+
fs.readFileSync("./test/data/redis.yaml", { encoding: "utf-8" })
|
|
1571
1654
|
);
|
|
1572
1655
|
expect(dep_list.length).toEqual(2);
|
|
1573
1656
|
expect(dep_list[0]).toEqual({
|
|
1574
1657
|
image: "redis:alpine"
|
|
1575
1658
|
});
|
|
1576
1659
|
dep_list = await utils.parseContainerSpecData(
|
|
1577
|
-
fs.readFileSync("./test/data/adservice.yaml",
|
|
1660
|
+
fs.readFileSync("./test/data/adservice.yaml", { encoding: "utf-8" })
|
|
1578
1661
|
);
|
|
1579
1662
|
expect(dep_list.length).toEqual(2);
|
|
1580
1663
|
expect(dep_list[0]).toEqual({
|
|
1581
1664
|
image: "gcr.io/google-samples/microservices-demo/adservice:v0.4.1"
|
|
1582
1665
|
});
|
|
1583
1666
|
dep_list = await utils.parseContainerSpecData(
|
|
1584
|
-
fs.readFileSync("./test/data/kustomization.yaml",
|
|
1667
|
+
fs.readFileSync("./test/data/kustomization.yaml", { encoding: "utf-8" })
|
|
1585
1668
|
);
|
|
1586
1669
|
expect(dep_list.length).toEqual(22);
|
|
1587
1670
|
expect(dep_list[0]).toEqual({
|
|
@@ -1592,7 +1675,7 @@ test("parse container spec like files", async () => {
|
|
|
1592
1675
|
test("parse cloudbuild data", async () => {
|
|
1593
1676
|
expect(await utils.parseCloudBuildData(null)).toEqual([]);
|
|
1594
1677
|
dep_list = await utils.parseCloudBuildData(
|
|
1595
|
-
fs.readFileSync("./test/data/cloudbuild.yaml",
|
|
1678
|
+
fs.readFileSync("./test/data/cloudbuild.yaml", { encoding: "utf-8" })
|
|
1596
1679
|
);
|
|
1597
1680
|
expect(dep_list.length).toEqual(1);
|
|
1598
1681
|
expect(dep_list[0]).toEqual({
|
|
@@ -1612,10 +1695,9 @@ test("parse privado files", () => {
|
|
|
1612
1695
|
|
|
1613
1696
|
test("parse openapi spec files", async () => {
|
|
1614
1697
|
let aservice = await utils.parseOpenapiSpecData(
|
|
1615
|
-
fs.readFileSync(
|
|
1616
|
-
"
|
|
1617
|
-
|
|
1618
|
-
)
|
|
1698
|
+
fs.readFileSync("./test/data/openapi/openapi-spec.json", {
|
|
1699
|
+
encoding: "utf-8"
|
|
1700
|
+
})
|
|
1619
1701
|
);
|
|
1620
1702
|
expect(aservice.length).toEqual(1);
|
|
1621
1703
|
expect(aservice[0]).toEqual({
|
|
@@ -1667,10 +1749,9 @@ test("parse openapi spec files", async () => {
|
|
|
1667
1749
|
authenticated: true
|
|
1668
1750
|
});
|
|
1669
1751
|
aservice = await utils.parseOpenapiSpecData(
|
|
1670
|
-
fs.readFileSync(
|
|
1671
|
-
"
|
|
1672
|
-
|
|
1673
|
-
)
|
|
1752
|
+
fs.readFileSync("./test/data/openapi/openapi-oai.yaml", {
|
|
1753
|
+
encoding: "utf-8"
|
|
1754
|
+
})
|
|
1674
1755
|
);
|
|
1675
1756
|
expect(aservice.length).toEqual(1);
|
|
1676
1757
|
expect(aservice[0]).toEqual({
|
|
@@ -1704,3 +1785,98 @@ test("parse openapi spec files", async () => {
|
|
|
1704
1785
|
authenticated: false
|
|
1705
1786
|
});
|
|
1706
1787
|
});
|
|
1788
|
+
|
|
1789
|
+
test("parse swift deps files", () => {
|
|
1790
|
+
expect(utils.parseSwiftJsonTree(null, "./test/data/swift-deps.json")).toEqual(
|
|
1791
|
+
{}
|
|
1792
|
+
);
|
|
1793
|
+
let retData = utils.parseSwiftJsonTree(
|
|
1794
|
+
fs.readFileSync("./test/data/swift-deps.json", { encoding: "utf-8" }),
|
|
1795
|
+
"./test/data/swift-deps.json"
|
|
1796
|
+
);
|
|
1797
|
+
expect(retData.pkgList.length).toEqual(5);
|
|
1798
|
+
expect(retData.pkgList[0]).toEqual({
|
|
1799
|
+
group: "swift-markdown",
|
|
1800
|
+
name: "swift-markdown",
|
|
1801
|
+
version: "unspecified",
|
|
1802
|
+
properties: [
|
|
1803
|
+
{ name: "SrcPath", value: "/Volumes/Work/sandbox/swift-markdown" },
|
|
1804
|
+
{ name: "SrcFile", value: "./test/data/swift-deps.json" }
|
|
1805
|
+
],
|
|
1806
|
+
"bom-ref": "pkg:application/swift-markdown/swift-markdown@unspecified"
|
|
1807
|
+
});
|
|
1808
|
+
expect(retData.dependenciesList.length).toEqual(5);
|
|
1809
|
+
expect(retData.dependenciesList[0]).toEqual({
|
|
1810
|
+
ref: "pkg:application/swift-markdown/swift-markdown@unspecified",
|
|
1811
|
+
dependsOn: [
|
|
1812
|
+
"pkg:swift/swift-cmark/cmark-gfm@unspecified",
|
|
1813
|
+
"pkg:swift/swift-argument-parser/swift-argument-parser@1.0.3",
|
|
1814
|
+
"pkg:swift/swift-docc-plugin/SwiftDocCPlugin@1.1.0"
|
|
1815
|
+
]
|
|
1816
|
+
});
|
|
1817
|
+
expect(retData.dependenciesList[retData.dependenciesList.length - 1]).toEqual(
|
|
1818
|
+
{
|
|
1819
|
+
ref: "pkg:swift/swift-docc-symbolkit/SymbolKit@1.0.0",
|
|
1820
|
+
dependsOn: []
|
|
1821
|
+
}
|
|
1822
|
+
);
|
|
1823
|
+
retData = utils.parseSwiftJsonTree(
|
|
1824
|
+
fs.readFileSync("./test/data/swift-deps1.json", { encoding: "utf-8" }),
|
|
1825
|
+
"./test/data/swift-deps.json"
|
|
1826
|
+
);
|
|
1827
|
+
expect(retData.pkgList.length).toEqual(5);
|
|
1828
|
+
expect(retData.pkgList[0]).toEqual({
|
|
1829
|
+
group: "swift-certificates",
|
|
1830
|
+
name: "swift-certificates",
|
|
1831
|
+
version: "unspecified",
|
|
1832
|
+
properties: [
|
|
1833
|
+
{
|
|
1834
|
+
name: "SrcPath",
|
|
1835
|
+
value: "/Volumes/Work/sandbox/swift-certificates"
|
|
1836
|
+
},
|
|
1837
|
+
{ name: "SrcFile", value: "./test/data/swift-deps.json" }
|
|
1838
|
+
],
|
|
1839
|
+
"bom-ref":
|
|
1840
|
+
"pkg:application/swift-certificates/swift-certificates@unspecified"
|
|
1841
|
+
});
|
|
1842
|
+
expect(retData.dependenciesList).toEqual([
|
|
1843
|
+
{
|
|
1844
|
+
ref: "pkg:application/swift-certificates/swift-certificates@unspecified",
|
|
1845
|
+
dependsOn: ["pkg:swift/swift-crypto/swift-crypto@2.4.0"]
|
|
1846
|
+
},
|
|
1847
|
+
{
|
|
1848
|
+
ref: "pkg:swift/swift-crypto/swift-crypto@2.4.0",
|
|
1849
|
+
dependsOn: ["pkg:swift/swift-asn1/swift-asn1@0.7.0"]
|
|
1850
|
+
},
|
|
1851
|
+
{
|
|
1852
|
+
ref: "pkg:swift/swift-asn1/swift-asn1@0.7.0",
|
|
1853
|
+
dependsOn: ["pkg:swift/swift-docc-plugin/SwiftDocCPlugin@1.1.0"]
|
|
1854
|
+
},
|
|
1855
|
+
{
|
|
1856
|
+
ref: "pkg:swift/swift-docc-plugin/SwiftDocCPlugin@1.1.0",
|
|
1857
|
+
dependsOn: ["pkg:swift/swift-docc-symbolkit/SymbolKit@1.0.0"]
|
|
1858
|
+
},
|
|
1859
|
+
{
|
|
1860
|
+
ref: "pkg:swift/swift-docc-symbolkit/SymbolKit@1.0.0",
|
|
1861
|
+
dependsOn: []
|
|
1862
|
+
}
|
|
1863
|
+
]);
|
|
1864
|
+
let pkgList = utils.parseSwiftResolved("./test/data/Package.resolved");
|
|
1865
|
+
expect(pkgList.length).toEqual(4);
|
|
1866
|
+
expect(pkgList[0]).toEqual({
|
|
1867
|
+
name: "swift-argument-parser",
|
|
1868
|
+
group: "",
|
|
1869
|
+
version: "1.0.3",
|
|
1870
|
+
properties: [{ name: "SrcFile", value: "./test/data/Package.resolved" }],
|
|
1871
|
+
repository: { url: "https://github.com/apple/swift-argument-parser" }
|
|
1872
|
+
});
|
|
1873
|
+
pkgList = utils.parseSwiftResolved("./test/data/Package2.resolved");
|
|
1874
|
+
expect(pkgList.length).toEqual(4);
|
|
1875
|
+
expect(pkgList[0]).toEqual({
|
|
1876
|
+
name: "swift-argument-parser",
|
|
1877
|
+
group: "",
|
|
1878
|
+
version: "1.2.2",
|
|
1879
|
+
properties: [{ name: "SrcFile", value: "./test/data/Package2.resolved" }],
|
|
1880
|
+
repository: { url: "https://github.com/apple/swift-argument-parser.git" }
|
|
1881
|
+
});
|
|
1882
|
+
});
|