Skip to content

Commit

Permalink
Merge pull request #106 from snyk-tech-services/test/increase-test-ti…
Browse files Browse the repository at this point in the history
…meouts

test: increase test timeouts again
  • Loading branch information
lili2311 authored Oct 5, 2022
2 parents 144d2f6 + 6b88cf3 commit e53f69f
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 21 deletions.
32 changes: 20 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
Snyk helps you find, fix and monitor for known vulnerabilities in your dependencies, both on an ad hoc basis and as part of your CI (Build) system.

## Snyk snyk-licenses-texts
Snyk Licenses Report that provides Organization level licenses used, copyrights & dependencies data (including license texts & their urls).
Snyk Licenses Text report that provides Organization level licenses used, copyrights & dependencies data (including license texts & their urls). Optionally the results can be filtered for a specific projects.

The tool is a wrapper around [Snyk APIs](https://snyk.docs.apiary.io/) so users must have API access (including Reporting, Licenses & Dependencies APIs)

# Installation
Download the latest binary from the [releases](https://github.com/snyk-tech-services/snyk-licenses-texts/releases) page
Expand All @@ -19,21 +21,27 @@ Ensure `SNYK_TOKEN` is set and has access to the Organization you want to genera

### Basic CLI commands
- `help` - show help & all available commands and their options
- `json` - generate the raw JSON licenses & dependencies data
- `generate` - generates an HTML report of licenses & dependencies data
- `json` - generate the raw JSON licenses & dependencies data for a Snyk Organization (can filter for a specific Snyk project)
- `generate` - generates an HTML report of licenses & dependencies data for a Snyk Organization (can filter for a specific Snyk project)

### Supported Options
```
Commands:
snyk-licenses-text generate Generate org licenses & dependencies report in HTML format
[aliases: g]
snyk-licenses-text json Generate org licenses & dependencies data in JSON format
[aliases: j]
```
Example usage:
- See help:
`snyk-licenses-report help`
- Get JSON output only:
`snyk-licenses-report json --orgPublicId=<ORG_PUBLIC_ID>`
- Default HTML report (Licenses per Org view):
`snyk-licenses-report generate --orgPublicId=<ORG_PUBLIC_ID>`
- See more information on what is hapenning behind the scenes:
`DEBUG=snyk-license* snyk-licenses-report generate --orgPublicId=<ORG_PUBLIC_ID>`
- See help: `snyk-licenses-text --help`
- See help and available options for a specific command: `snyk-licenses-text --help generate`
- Get JSON output only: `snyk-licenses-text json --orgPublicId=<ORG_PUBLIC_ID>`
- Default HTML report (Licenses per Org view): `snyk-licenses-text generate --orgPublicId=<ORG_PUBLIC_ID>`
- Default HTML report (Licenses per Org view) filtered for a specific project: `snyk-licenses-text generate --orgPublicId=<ORG_PUBLIC_ID> --project=<PROJECT_PUBLIC_ID>`
- See more information on what is happening behind the scenes: `DEBUG=snyk-license* snyk-licenses-text generate --orgPublicId=<ORG_PUBLIC_ID>`
- Custom Handlebars.js template provided:
`snyk-licenses-report generate --orgPublicId=<ORG_PUBLIC_ID> --template="PATH/TO/TEMPLATE/template.hsb"`
`snyk-licenses-text generate --orgPublicId=<ORG_PUBLIC_ID> --template="PATH/TO/TEMPLATE/template.hsb"`
The data in the template is available is in the format:
```
{
Expand Down
2 changes: 1 addition & 1 deletion test/lib/get-dependencies-data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ describe('Get org dependencies', () => {
test('License results are returned from API', async () => {
const licenseRes = await getDependenciesDataForOrg(ORG_ID);
expect(licenseRes.results.length > 0).toBeTruthy();
}, 150000);
}, 200000);
test.todo('Test for when API fails aka bad org id provided');
});
2 changes: 1 addition & 1 deletion test/lib/get-license-data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Get org licenses', () => {
test('License results are returned from API', async () => {
const licenseRes = await getDependenciesDataForOrg(ORG_ID);
expect(licenseRes.results.length > 0).toBeTruthy();
}, 150000);
}, 200000);

test.todo('Test for when API fails aka bad org id provided');
});
8 changes: 4 additions & 4 deletions test/system/generate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('`snyk-licenses-report generate <...>`', () => {
done();
},
);
}, 150000);
}, 200000);

it('generated the report successfully with project-dependencies view', (done) => {
exec(
Expand All @@ -90,7 +90,7 @@ describe('`snyk-licenses-report generate <...>`', () => {
done();
},
);
}, 150000);
}, 200000);

it.skip('generated the report successfully as PDF', (done) => {
exec(
Expand All @@ -107,7 +107,7 @@ describe('`snyk-licenses-report generate <...>`', () => {
done();
},
);
}, 150000);
}, 200000);
it('generated the report successfully with custom template', (done) => {
exec(
`node ${main} generate --orgPublicId=${ORG_ID} --template=${
Expand All @@ -125,7 +125,7 @@ describe('`snyk-licenses-report generate <...>`', () => {
done();
},
);
}, 150000);
}, 200000);
it.todo('API is down');
it.todo('Requested org has no licenses policy');
});
6 changes: 3 additions & 3 deletions test/system/json.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('`snyk-licenses-report json <...>`', () => {
done();
},
);
}, 150000);
}, 200000);
it('Generated JSON data with correct --orgPublicId', async (done) => {
exec(
`node ${main} json --orgPublicId=${ORG_ID}`,
Expand All @@ -36,7 +36,7 @@ describe('`snyk-licenses-report json <...>`', () => {
done();
},
);
}, 150000);
}, 200000);
it('Generated JSON data with correct --orgPublicId --project', async (done) => {
exec(
`node ${main} json --orgPublicId=${ORG_ID} --project=${PROJECT_ID}}`,
Expand All @@ -52,5 +52,5 @@ describe('`snyk-licenses-report json <...>`', () => {
done();
},
);
}, 150000);
}, 200000);
});

0 comments on commit e53f69f

Please sign in to comment.