Skip to content

Commit

Permalink
Merge branch 'master' into snyk-upgrade-5de05a6e4a10b4b9928ed5fa82ae1569
Browse files Browse the repository at this point in the history
  • Loading branch information
lili2311 authored Jun 21, 2022
2 parents e2020c3 + a32a8b4 commit b2c536d
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 39 deletions.
9 changes: 0 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
version: 2.1
orbs:
snyk: snyk/[email protected]
puppeteer: threetreeslight/[email protected]
slack: circleci/[email protected]
commands:
Expand Down Expand Up @@ -43,10 +42,6 @@ jobs:
- install_deps
- build_ts
- run: npm test
- snyk/scan:
fail-on-issues: true
monitor-on-build: true
token-variable: SNYK_TOKEN_PROD
- run: npx semantic-release
- slack/status:
fail_only: true
Expand All @@ -63,10 +58,6 @@ jobs:
- install_deps
- build_ts
- run: npm test
- snyk/scan:
fail-on-issues: true
monitor-on-build: false
token-variable: SNYK_TOKEN_PROD
- slack/status:
fail_only: true
only_for_branches: master
Expand Down
4 changes: 1 addition & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint"
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/explicit-function-return-type": [
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
***

[![Known Vulnerabilities](https://snyk.io/test/github/snyk-tech-services/snyk-licenses-texts/badge.svg)](https://snyk.io/test/github/snyk-tech-services/snyk-licenses-texts)
[![Not Maintained](https://img.shields.io/badge/Maintenance%20Level-Not%20Maintained-yellow.svg)](https://gist.github.com/cheerfulstoic/d107229326a01ff0f333a1d3476e068d)

**This repository is not in active development and critical bug fixes only will be considered.**

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.

Expand Down
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
"dependencies": {
"@snyk/configstore": "^3.2.0-rc1",
"cheerio": "1.0.0-rc.3",
"debug": "4.3.3",
"debug": "4.3.4",
"handlebars": "4.7.7",
"lodash": "4.17.21",
"node-fetch": "2.6.7",
"p-map": "4.0.0",
"puppeteer": "5.4.1",
"snyk-api-ts-client": "1.8.1",
"snyk-config": "4.0.0",
"snyk-request-manager": "1.4.3",
"snyk-request-manager": "1.5.0",
"source-map-support": "^0.5.16",
"tslib": "2.4.0",
"yargs": "16.2.0"
Expand All @@ -56,17 +56,16 @@
"@types/jest": "26.0.13",
"@types/lodash": "4.14.161",
"@types/node": "14.6.3",
"@typescript-eslint/eslint-plugin": "^2.18.0",
"@typescript-eslint/parser": "^2.18.0",
"@typescript-eslint/eslint-plugin": "5.29.0",
"@typescript-eslint/parser": "5.29.0",
"cpx": "1.5.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint": "8.18.0",
"jest": "26.4.2",
"prettier": "^1.19.1",
"prettier": "2.7.1",
"ts-jest": "25.5.1",
"ts-node": "8.6.2",
"tsc-watch": "^4.1.0",
"typescript": "^3.7.5"
"typescript": "4.7.4"
},
"pkg": {
"scripts": [
Expand Down
4 changes: 1 addition & 3 deletions test/lib/fixtures/example-license-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
"latestVersionPublishedDate": "2020-02-13T17:43:52.531Z",
"firstPublishedDate": "2012-11-13T15:43:50.942Z",
"isDeprecated": false,
"copyright": [
"Copyright (c) Google"
]
"copyright": ["Copyright (c) Google"]
}
],
"projects": [
Expand Down
27 changes: 17 additions & 10 deletions test/lib/generate-html-report.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ describe('Generate HTML report', () => {
expect(process.env.ORG_ID).not.toBeNull();
});
test('License HTML Report is generated as expected', async () => {
const licenseRes = (loadJson(
const licenseRes = loadJson(
__dirname + '/fixtures/example-license-data.json',
) as unknown) as LicenseReportData;
) as unknown as LicenseReportData;
const orgData = {
name: 'org',
id: 'avd-scv',
Expand All @@ -31,14 +31,21 @@ describe('Generate HTML report', () => {
},
};
const date = new Date('2022-02-22').toLocaleDateString();
const htmlData = await generateHtmlReport(ORG_ID, licenseRes, orgData, undefined, undefined, date);
const htmlData = await generateHtmlReport(
ORG_ID,
licenseRes,
orgData,
undefined,
undefined,
date,
);
expect(htmlData).toMatchSnapshot();
}, 150000);

test('License HTML Report is generated as expected with project based view', async () => {
const licenseRes = (loadJson(
const licenseRes = loadJson(
__dirname + '/fixtures/example-license-data.json',
) as unknown) as LicenseReportData;
) as unknown as LicenseReportData;
const orgData = {
name: 'org',
id: 'avd-scv',
Expand All @@ -62,9 +69,9 @@ describe('Generate HTML report', () => {
}, 150000);

test('License HTML Report is generated as expected with a custom hbs template', async () => {
const licenseRes = (loadJson(
const licenseRes = loadJson(
__dirname + '/fixtures/example-license-data.json',
) as unknown) as LicenseReportData;
) as unknown as LicenseReportData;
const orgData = {
name: 'org',
id: 'avd-scv',
Expand All @@ -87,9 +94,9 @@ describe('Generate HTML report', () => {
expect(htmlData).toMatchSnapshot();
}, 150000);
test('License HTML Report is generated as expected with excludeSnykFields enabled', async () => {
const licenseRes = (loadJson(
const licenseRes = loadJson(
__dirname + '/fixtures/example-license-data.json',
) as unknown) as LicenseReportData;
) as unknown as LicenseReportData;
const orgData = {
name: 'org',
id: 'avd-scv',
Expand All @@ -110,7 +117,7 @@ describe('Generate HTML report', () => {
date,
{
excludeSnykFields: true,
}
},
);
expect(htmlData).toMatchSnapshot();
}, 150000);
Expand Down
8 changes: 4 additions & 4 deletions test/lib/unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe('enrichDependencies', () => {

describe('mergeLicenceAndDepData', () => {
test('mergeLicenceAndDepData returns the same number of licenses & deps as provided', async () => {
const licenseData = ({
const licenseData = {
results: [
{
id: 'ISC',
Expand Down Expand Up @@ -134,7 +134,7 @@ describe('mergeLicenceAndDepData', () => {
],
},
],
} as unknown) as snykApiSdk.OrgTypes.LicensesPostResponseType;
} as unknown as snykApiSdk.OrgTypes.LicensesPostResponseType;

const depApiData = {
'[email protected]': [
Expand Down Expand Up @@ -180,7 +180,7 @@ describe('mergeLicenceAndDepData', () => {
).toEqual(depApiData['[email protected]'][0].copyright);
});
test('mergeLicenceAndDepData for a multi license returns extra licenses after separating multi licenses', async () => {
const licenseData = ({
const licenseData = {
results: [
{
id: 'ISC OR MIT',
Expand Down Expand Up @@ -220,7 +220,7 @@ describe('mergeLicenceAndDepData', () => {
],
},
],
} as unknown) as snykApiSdk.OrgTypes.LicensesPostResponseType;
} as unknown as snykApiSdk.OrgTypes.LicensesPostResponseType;

const depApiData = {
'[email protected]': [
Expand Down
5 changes: 3 additions & 2 deletions test/system/generate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ describe('`snyk-licenses-report generate <...>`', () => {
}, 150000);
it('generated the report successfully with custom template', (done) => {
exec(
`node ${main} generate --orgPublicId=${ORG_ID} --template=${__dirname +
'/fixtures/custom-view.hbs'}`,
`node ${main} generate --orgPublicId=${ORG_ID} --template=${
__dirname + '/fixtures/custom-view.hbs'
}`,
{
env: {
PATH: process.env.PATH,
Expand Down

0 comments on commit b2c536d

Please sign in to comment.