Skip to content

Commit

Permalink
chore: allow LicenseChecker to be created with no args (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinwoo authored Jan 11, 2018
1 parent 17f758b commit a47879c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ts/src/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class LicenseChecker extends EventEmitter {
// List of license names that are not SPDX-conforming IDs but are allowed.
private whitelistedLicenses: string[] = [];

constructor({dev = false, verbose = false}: LicenseCheckerOptions) {
constructor({dev = false, verbose = false}: LicenseCheckerOptions = {}) {
super();
this.opts = {dev, verbose};
}
Expand Down
14 changes: 7 additions & 7 deletions ts/test/checker-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test.serial(
async t => {
requestedPackages = [];
const nonGreenPackages: string[] = [];
const checker = new LicenseChecker({});
const checker = new LicenseChecker();
checker.on('non-green-license', arg => {
nonGreenPackages.push(`${arg.packageName}@${arg.version}`);
});
Expand All @@ -91,7 +91,7 @@ test.serial('local directory is checked correctly', async t => {
try {
requestedPackages = [];
const nonGreenPackages: string[] = [];
const checker = new LicenseChecker({});
const checker = new LicenseChecker();
checker.on('non-green-license', arg => {
nonGreenPackages.push(`${arg.packageName}@${arg.version}`);
});
Expand Down Expand Up @@ -121,7 +121,7 @@ test.serial('local directory should have correct licenses too', async t => {
try {
requestedPackages = [];
const nonGreenPackages: string[] = [];
const checker = new LicenseChecker({});
const checker = new LicenseChecker();
checker.on('non-green-license', arg => {
nonGreenPackages.push(`${arg.packageName}@${arg.version}`);
});
Expand Down Expand Up @@ -165,7 +165,7 @@ test.serial('local monorepo directory is checked correctly', async t => {
requestedPackages = [];
const nonGreenPackages: string[] = [];
const packageJsonPaths: string[] = [];
const checker = new LicenseChecker({});
const checker = new LicenseChecker();
checker
.on('non-green-license',
(arg) => {
Expand Down Expand Up @@ -209,7 +209,7 @@ test.serial('package whitelist should be respected (local repo)', async t => {
try {
requestedPackages = [];
const nonGreenPackages: string[] = [];
const checker = new LicenseChecker({});
const checker = new LicenseChecker();
checker.on('non-green-license', arg => {
nonGreenPackages.push(`${arg.packageName}@${arg.version}`);
});
Expand Down Expand Up @@ -245,7 +245,7 @@ test.serial('custom green license list (local repo)', async t => {
try {
requestedPackages = [];
const nonGreenPackages: string[] = [];
const checker = new LicenseChecker({});
const checker = new LicenseChecker();
checker.on('non-green-license', arg => {
nonGreenPackages.push(`${arg.packageName}@${arg.version}`);
});
Expand All @@ -270,7 +270,7 @@ test.serial('errors properly output to console', async t => {
};
requestedPackages = [];
const nonGreenPackages: string[] = [];
const checker = new LicenseChecker({});
const checker = new LicenseChecker();
checker.setDefaultHandlers();
await checker.checkRemotePackage('foo');
console.log = realConsoleLog;
Expand Down

0 comments on commit a47879c

Please sign in to comment.