Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: allow LicenseChecker to be created with no args #25

Merged
merged 1 commit into from
Jan 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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