Skip to content

Commit affc098

Browse files
authoredDec 16, 2020
Update licenseGlob to allow checking for LICENCE files (#32)
1 parent f376e54 commit affc098

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
LICENCE TEXT
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
LICENSE TEXT

‎src/licenseUtils.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const isSatisfiedLicense = require("spdx-satisfies");
99
const wrap = require("wrap-ansi");
1010
const LicenseError = require("./LicenseError");
1111

12-
const licenseGlob = "LICENSE*";
12+
const licenseGlob = "LICEN@(C|S)E*";
1313
const licenseWrap = 80;
1414

1515
const getLicenseContents = dependencyPath => {
@@ -131,6 +131,7 @@ const writeLicenseInformation = (outputWriter, dependencies) => {
131131

132132
module.exports = {
133133
getLicenseName,
134+
getLicenseContents,
134135
getLicenseInformationForCompilation,
135136
getLicenseViolations,
136137
getSortedLicenseInformation,

‎src/licenseUtils.spec.js

+28-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { getLicenseName } = require("./licenseUtils");
1+
const { getLicenseName, getLicenseContents } = require("./licenseUtils");
22

33
describe("getLicenseName", () => {
44
let pkg;
@@ -61,3 +61,30 @@ describe("getLicenseName", () => {
6161
});
6262
});
6363
});
64+
65+
describe("getLicenseContents", () => {
66+
let licenseContent;
67+
let depPath;
68+
69+
describe("with licen(s)e file", () => {
70+
beforeEach(() => {
71+
depPath = process.cwd() + "/src/__mocks__/module-with-license/";
72+
licenseContent = getLicenseContents(depPath);
73+
});
74+
75+
it("should return text content", () => {
76+
expect(licenseContent).not.toBe(undefined);
77+
});
78+
});
79+
80+
describe("with licen(c)e file", () => {
81+
beforeEach(() => {
82+
depPath = process.cwd() + "/src/__mocks__/module-with-licence/";
83+
licenseContent = getLicenseContents(depPath);
84+
});
85+
86+
it("should return text content", () => {
87+
expect(licenseContent).not.toBe(undefined);
88+
});
89+
});
90+
});

0 commit comments

Comments
 (0)
Please sign in to comment.