From 379893ee8a0b9ea9aadffbd037d3df58041c0249 Mon Sep 17 00:00:00 2001 From: Qing Tomlinson Date: Fri, 8 Nov 2024 15:26:30 -0700 Subject: [PATCH 1/9] Implement getAllLatest in azblobHarvestStore --- lib/utils.js | 1 + providers/stores/abstractAzblobStore.js | 2 +- providers/stores/azblobHarvestStore.js | 99 ++++-- test/lib/util.js | 2 + test/providers/store/azblobHarvest.js | 433 ++++++++++++++++++------ 5 files changed, 405 insertions(+), 132 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 8b2709368..d992dadfe 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -88,6 +88,7 @@ function getLatestVersion(versions) { const normalizedCurrent = _normalizeVersion(current) if (!normalizedCurrent || semver.prerelease(normalizedCurrent) !== null) return max const normalizedMax = _normalizeVersion(max) + if (!normalizedMax) return normalizedCurrent return semver.gt(normalizedCurrent, normalizedMax) ? current : max }, versions[0]) } diff --git a/providers/stores/abstractAzblobStore.js b/providers/stores/abstractAzblobStore.js index f6bc1536d..b208e6e03 100644 --- a/providers/stores/abstractAzblobStore.js +++ b/providers/stores/abstractAzblobStore.js @@ -11,7 +11,7 @@ class AbstractAzBlobStore { constructor(options) { this.options = options this.containerName = options.containerName - this.logger = logger() + this.logger = this.options.logger || logger() } async initialize() { diff --git a/providers/stores/azblobHarvestStore.js b/providers/stores/azblobHarvestStore.js index 6b6c75147..72bd0ff0f 100644 --- a/providers/stores/azblobHarvestStore.js +++ b/providers/stores/azblobHarvestStore.js @@ -5,6 +5,7 @@ const AbstractAzBlobStore = require('./abstractAzblobStore') const AbstractFileStore = require('./abstractFileStore') const ResultCoordinates = require('../../lib/resultCoordinates') const { sortedUniq } = require('lodash') +const { getLatestVersion } = require('../../lib/utils') const resultOrError = (resolve, reject) => (error, result) => (error ? reject(error) : resolve(result)) const responseOrError = (resolve, reject) => (error, result, response) => (error ? reject(error) : resolve(response)) @@ -47,33 +48,38 @@ class AzHarvestBlobStore extends AbstractAzBlobStore { * @returns An object with a property for each tool and tool version */ getAll(coordinates) { - const name = this._toStoragePathFromCoordinates(coordinates) // Note that here we are assuming the number of blobs will be small-ish (<10) and // a) all fit in memory reasonably, and // b) fit in one list call (i.e., <5000) - const list = new Promise((resolve, reject) => + return this._getAllFiles(coordinates).then(files => this._getContent(files)) + } + + _getAllFiles(coordinates) { + const name = this._toStoragePathFromCoordinates(coordinates) + return new Promise((resolve, reject) => this.blobService.listBlobsSegmentedWithPrefix(this.containerName, name, null, resultOrError(resolve, reject)) + ).then(files => + files.entries.filter(file => { + return ( + file.name.length === name.length || // either an exact match, or + (file.name.length > name.length && // a longer string + (file.name[name.length] === '/' || // where the next character starts extra tool indications + file.name.substr(name.length) === '.json')) + ) + }) + ) + } + + _getContent(files) { + const contents = Promise.all( + files.map(file => { + return new Promise((resolve, reject) => + this.blobService.getBlobToText(this.containerName, file.name, resultOrError(resolve, reject)) + ).then(result => { + return { name: file.name, content: JSON.parse(result) } + }) + }) ) - const contents = list.then(files => { - return Promise.all( - files.entries - .filter(file => { - return ( - file.name.length === name.length || // either an exact match, or - (file.name.length > name.length && // a longer string - (file.name[name.length] === '/' || // where the next character starts extra tool indications - file.name.substr(name.length) === '.json')) // or is the end, identifying a json file extension - ) - }) - .map(file => { - return new Promise((resolve, reject) => - this.blobService.getBlobToText(this.containerName, file.name, resultOrError(resolve, reject)) - ).then(result => { - return { name: file.name, content: JSON.parse(result) } - }) - }) - ) - }) return contents.then(entries => { return entries.reduce((result, entry) => { const { tool, toolVersion } = this._toResultCoordinatesFromStoragePath(entry.name) @@ -85,6 +91,55 @@ class AzHarvestBlobStore extends AbstractAzBlobStore { }, {}) }) } + + /** + * Get the latest version of each tool output for the given coordinates. The coordinates must be all the way down + * to a revision. + * @param {EntityCoordinates} coordinates - The component revision to report on + * @returns {Promise} A promise that resolves to an object with a property for each tool and tool version + * + */ + getAllLatest(coordinates) { + const allFiles = this._getAllFiles(coordinates) + let latestFiles = this._getLatestFiles(allFiles) + + return latestFiles.then(files => this._getContent(files)) + } + + _getLatestFiles(allFiles) { + return ( + allFiles + .then(files => { + const names = files.map(file => file.name) + const latest = new Set(this._getLatestToolVersions(names)) + return files.filter(file => latest.has(file.name)) + }) + .catch(error => { + this.logger.error('Error getting latest files', error) + return [] + }) + //fall back to getAll by returning validFiles + .then(latest => (latest.length === 0 ? allFiles : latest)) + ) + } + + _getLatestToolVersions(paths) { + const entries = paths + .map(path => { + const { tool, toolVersion } = this._toResultCoordinatesFromStoragePath(path) + return { tool, toolVersion, path } + }) + .reduce((latest, { tool, toolVersion, path }) => { + if (!tool || !toolVersion) return latest + latest[tool] = latest[tool] || {} + //if the version is greater than the current version, replace it + if (!latest[tool].toolVersion || getLatestVersion([toolVersion, latest[tool].toolVersion]) === toolVersion) { + latest[tool] = { toolVersion, path } + } + return latest + }, {}) + return Object.values(entries).map(entry => entry.path) + } } module.exports = options => new AzHarvestBlobStore(options) diff --git a/test/lib/util.js b/test/lib/util.js index 12f62b58e..ba5123f27 100644 --- a/test/lib/util.js +++ b/test/lib/util.js @@ -19,6 +19,8 @@ describe('Utils latest version', () => { '4.0.0': ['4.0.0', '4.0.1-rc.2'], '5.0.0': ['5.0.0', '5.0.1-beta'], '6.0.0': ['6.0.0', 'undefined'], + '7.0.0': [undefined, '7.0.0'], + '8.0.0': ['2.9.0b1', '8.0.0'], notarray: 'notarray', null: [], junk: ['junk', 'junk1', 'junk2'] diff --git a/test/providers/store/azblobHarvest.js b/test/providers/store/azblobHarvest.js index 61eb7b21e..ec614ad1f 100644 --- a/test/providers/store/azblobHarvest.js +++ b/test/providers/store/azblobHarvest.js @@ -3,132 +3,347 @@ const Store = require('../../../providers/stores/azblobHarvestStore') const sinon = require('sinon') -const { expect } = require('chai') +const deepEqualInAnyOrder = require('deep-equal-in-any-order') +const chai = require('chai') +chai.use(deepEqualInAnyOrder) +const expect = chai.expect +const AbstractFileStore = require('../../../providers/stores/abstractFileStore') describe('azblob Harvest store', () => { - it('should list results', async () => { - const data = [ - { - name: 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json', - metadata: { urn: 'urn:npm:npmjs:-:co:revision:4.6.0:tool:clearlydefined:1' } - }, - { - name: 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.2.1.json', - metadata: { urn: 'urn:npm:npmjs:-:co:revision:4.6.0:tool:scancode:2.2.1' } - } - ] - const store = createAzBlobStore(data, true) - - const result = await store.list({ - type: 'npm', - provider: 'npmjs', - namespace: null, - name: 'co', - revision: '4.6.0' + describe('list', () => { + it('should list results', async () => { + const data = [ + { + name: 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json', + metadata: { urn: 'urn:npm:npmjs:-:co:revision:4.6.0:tool:clearlydefined:1' } + }, + { + name: 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.2.1.json', + metadata: { urn: 'urn:npm:npmjs:-:co:revision:4.6.0:tool:scancode:2.2.1' } + } + ] + const store = createAzBlobStore(data, true) + + const result = await store.list({ + type: 'npm', + provider: 'npmjs', + namespace: null, + name: 'co', + revision: '4.6.0' + }) + const expected = ['npm/npmjs/-/co/4.6.0/clearlydefined/1', 'npm/npmjs/-/co/4.6.0/scancode/2.2.1'] + expect(result).to.equalInAnyOrder(expected) + }) + + it('should list results preserving case from blob metadata', async () => { + const data = [ + { + name: 'npm/npmjs/-/jsonstream/revision/1.3.4/tool/clearlydefined/1.json', + metadata: { urn: 'urn:npm:npmjs:-:JSONStream:revision:1.3.4:tool:clearlydefined:1' } + }, + { + name: 'npm/npmjs/-/jsonstream/revision/1.3.4/tool/scancode/2.2.1.json', + metadata: { urn: 'urn:npm:npmjs:-:JSONStream:revision:1.3.4:tool:scancode:2.2.1' } + } + ] + const store = createAzBlobStore(data, true) + + const result = await store.list({ + type: 'npm', + provider: 'npmjs', + namespace: null, + name: 'JSONStream', + revision: '1.3.4' + }) + const expected = ['npm/npmjs/-/JSONStream/1.3.4/clearlydefined/1', 'npm/npmjs/-/JSONStream/1.3.4/scancode/2.2.1'] + expect(result).to.be.deep.equalInAnyOrder(expected) + + const resultCased = await store.list({ + type: 'npm', + provider: 'npmjs', + namespace: null, + name: 'jsonstream', + revision: '1.3.4' + }) + expect(resultCased).to.equalInAnyOrder(expected) + }) + + it('list results with partial coordinates', async () => { + const data = [ + { + name: 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json', + metadata: { urn: 'urn:npm:npmjs:-:co:revision:4.6.0:tool:clearlydefined:1' } + }, + { + name: 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.2.1.json', + metadata: { urn: 'urn:npm:npmjs:-:co:revision:4.6.0:tool:scancode:2.2.1' } + }, + { + name: 'npm/npmjs/-/co/revision/3.6.0/tool/clearlydefined/1.json', + metadata: { urn: 'urn:npm:npmjs:-:co:revision:3.6.0:tool:clearlydefined:1' } + }, + { + name: 'npm/npmjs/-/co/revision/3.6.0/tool/scancode/1.2.1.json', + metadata: { urn: 'urn:npm:npmjs:-:co:revision:3.6.0:tool:scancode:1.2.1' } + } + ] + const store = createAzBlobStore(data, true) + + const result = await store.list({ + type: 'npm', + provider: 'npmjs', + namespace: null, + name: 'co' + }) + const expected = [ + 'npm/npmjs/-/co/3.6.0/clearlydefined/1', + 'npm/npmjs/-/co/3.6.0/scancode/1.2.1', + 'npm/npmjs/-/co/4.6.0/clearlydefined/1', + 'npm/npmjs/-/co/4.6.0/scancode/2.2.1' + ] + expect(result).to.equalInAnyOrder(expected) }) - const expected = ['npm/npmjs/-/co/4.6.0/clearlydefined/1', 'npm/npmjs/-/co/4.6.0/scancode/2.2.1'] - expect(result).to.equalInAnyOrder(expected) }) - it('should list results preserving case from blob metadata', async () => { - const data = [ - { - name: 'npm/npmjs/-/jsonstream/revision/1.3.4/tool/clearlydefined/1.json', - metadata: { urn: 'urn:npm:npmjs:-:JSONStream:revision:1.3.4:tool:clearlydefined:1' } - }, - { - name: 'npm/npmjs/-/jsonstream/revision/1.3.4/tool/scancode/2.2.1.json', - metadata: { urn: 'urn:npm:npmjs:-:JSONStream:revision:1.3.4:tool:scancode:2.2.1' } - } - ] - const store = createAzBlobStore(data, true) - - const result = await store.list({ - type: 'npm', - provider: 'npmjs', - namespace: null, - name: 'JSONStream', - revision: '1.3.4' + describe('getAll', () => { + it('handles tool output', async () => { + const azblobStore = createAzBlobStore( + createEntries([ + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/clearlydefined/1.5.0.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.18.1.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.14.0.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/reuse/3.2.1.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/reuse/3.2.2.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/32.3.0.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/30.3.0.json' + ]) + ) + + const result = await azblobStore.getAll({ + type: 'maven', + provider: 'mavencentral', + namespace: 'org.apache.httpcomponents', + name: 'httpcore', + revision: '4.4.16' + }) + + const tools = Object.getOwnPropertyNames(result) + expect(tools.length).to.eq(4) + const clearlydefinedVersions = Object.getOwnPropertyNames(result.clearlydefined) + expect(clearlydefinedVersions[0]).to.eq('1.5.0') + expect(clearlydefinedVersions.length).to.eq(1) + const scancodeVersions = Object.getOwnPropertyNames(result.scancode) + expect(scancodeVersions).to.equalInAnyOrder(['32.3.0', '30.3.0']) + const licenseeVersions = Object.getOwnPropertyNames(result.licensee) + expect(licenseeVersions).to.equalInAnyOrder(['9.18.1', '9.14.0']) + const reuseVersions = Object.getOwnPropertyNames(result.reuse) + expect(reuseVersions).to.equalInAnyOrder(['3.2.1', '3.2.2']) }) - const expected = ['npm/npmjs/-/JSONStream/1.3.4/clearlydefined/1', 'npm/npmjs/-/JSONStream/1.3.4/scancode/2.2.1'] - expect(result).to.be.deep.equalInAnyOrder(expected) - - const resultCased = await store.list({ - type: 'npm', - provider: 'npmjs', - namespace: null, - name: 'jsonstream', - revision: '1.3.4' + + it('handles unversioned tool output', async () => { + const azblobStore = createAzBlobStore([ + { name: 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json' }, + { name: 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.2.1.json' }, + { name: 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.1.json' }, + { name: 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.2.json' }, + { name: 'npm/npmjs/-/co/revision/4.6.0/tool/scancode.json' } // this is the problem file see https://github.com/clearlydefined/service/issues/184 + ]) + + const result = await azblobStore.getAll({ + type: 'npm', + provider: 'npmjs', + namespace: null, + name: 'co', + revision: '4.6.0' + }) + + const tools = Object.getOwnPropertyNames(result) + expect(tools.length).to.eq(2) + const clearlydefinedVersions = Object.getOwnPropertyNames(result.clearlydefined) + expect(clearlydefinedVersions[0]).to.eq('1') + expect(clearlydefinedVersions.length).to.eq(1) + const scancodeVersions = Object.getOwnPropertyNames(result.scancode) + expect(scancodeVersions[0]).to.eq('2.2.1') + expect(scancodeVersions[1]).to.eq('2.9.1') + expect(scancodeVersions[2]).to.eq('2.9.2') + expect(scancodeVersions.length).to.eq(3) }) - expect(resultCased).to.equalInAnyOrder(expected) }) - it('list results with partial coordinates', async () => { - const data = [ - { - name: 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json', - metadata: { urn: 'urn:npm:npmjs:-:co:revision:4.6.0:tool:clearlydefined:1' } - }, - { - name: 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.2.1.json', - metadata: { urn: 'urn:npm:npmjs:-:co:revision:4.6.0:tool:scancode:2.2.1' } - }, - { - name: 'npm/npmjs/-/co/revision/3.6.0/tool/clearlydefined/1.json', - metadata: { urn: 'urn:npm:npmjs:-:co:revision:3.6.0:tool:clearlydefined:1' } - }, - { - name: 'npm/npmjs/-/co/revision/3.6.0/tool/scancode/1.2.1.json', - metadata: { urn: 'urn:npm:npmjs:-:co:revision:3.6.0:tool:scancode:1.2.1' } - } - ] - const store = createAzBlobStore(data, true) - - const result = await store.list({ - type: 'npm', - provider: 'npmjs', - namespace: null, - name: 'co' + describe('_getLatestToolVersions', () => { + let store + beforeEach(() => { + store = Store({}) + }) + it('should get latest tool versions', () => { + let latest = store._getLatestToolVersions([ + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/clearlydefined/1.5.0.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.18.1.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.14.0.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/reuse/3.2.1.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/reuse/3.2.2.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/32.3.0.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/30.3.0.json' + ]) + expect(latest).to.equalInAnyOrder([ + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/clearlydefined/1.5.0.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.18.1.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/reuse/3.2.2.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/32.3.0.json' + ]) + }) + it('should get latest tool versions and ignore un-versioned data', () => { + let latest = store._getLatestToolVersions([ + 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.2.1.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.1.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.2.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode.json' + ]) + expect(latest).to.equalInAnyOrder([ + 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.2.json' + ]) + }) + it('should get latest tool versions and ignore invalid semver', () => { + let latest = store._getLatestToolVersions([ + 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.10.0.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.2.1.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.2.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/3.2.2.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/30.3.0.json' + ]) + expect(latest).to.equalInAnyOrder([ + 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/30.3.0.json' + ]) + }) + + it('should ignore invalid semver, invalid sermver first', () => { + let latest = store._getLatestToolVersions([ + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json' + ]) + expect(latest).to.equalInAnyOrder(['npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json']) + }) + + it('should ignore invalid semver, invalid sermver last', () => { + let latest = store._getLatestToolVersions([ + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json' + ]) + expect(latest).to.equalInAnyOrder(['npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json']) + }) + + it('should return at least the first tool version', () => { + let latest = store._getLatestToolVersions([ + 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json' + ]) + expect(latest).to.equalInAnyOrder([ + 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json' + ]) }) - const expected = [ - 'npm/npmjs/-/co/3.6.0/clearlydefined/1', - 'npm/npmjs/-/co/3.6.0/scancode/1.2.1', - 'npm/npmjs/-/co/4.6.0/clearlydefined/1', - 'npm/npmjs/-/co/4.6.0/scancode/2.2.1' - ] - expect(result).to.equalInAnyOrder(expected) }) - it('handles unversioned tool output', async () => { - const azblobStore = createAzBlobStore([ - { name: 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json' }, - { name: 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.2.1.json' }, - { name: 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.1.json' }, - { name: 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.2.json' }, - { name: 'npm/npmjs/-/co/revision/4.6.0/tool/scancode.json' } // this is the problem file see https://github.com/clearlydefined/service/issues/184 - ]) - - const result = await azblobStore.getAll({ - type: 'npm', - provider: 'npmjs', - namespace: null, - name: 'co', - revision: '4.6.0' + describe('getAllLatest', () => { + it('retrieves latest entries', async () => { + const azblobStore = createAzBlobStore( + createEntries([ + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/clearlydefined/1.5.0.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.18.1.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.14.0.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/reuse/3.2.1.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/reuse/3.2.2.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/32.3.0.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/30.3.0.json' + ]) + ) + + const result = await azblobStore.getAllLatest({ + type: 'maven', + provider: 'mavencentral', + namespace: 'org.apache.httpcomponents', + name: 'httpcore', + revision: '4.4.16' + }) + + const tools = Object.getOwnPropertyNames(result) + expect(tools.length).to.eq(4) + const clearlydefinedVersions = Object.getOwnPropertyNames(result.clearlydefined) + expect(clearlydefinedVersions).to.deep.eq(['1.5.0']) + const scancodeVersions = Object.getOwnPropertyNames(result.scancode) + expect(scancodeVersions).to.deep.eq(['32.3.0']) + const licenseeVersions = Object.getOwnPropertyNames(result.licensee) + expect(licenseeVersions).to.deep.eq(['9.18.1']) + const reuseVersions = Object.getOwnPropertyNames(result.reuse) + expect(reuseVersions).to.deep.eq(['3.2.2']) + }) + + it('retrieves latest entries ignoring unversioned result', async () => { + const azblobStore = createAzBlobStore( + createEntries([ + 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.2.1.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.1.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.2.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.0b1.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode.json' + ]) + ) + + const result = await azblobStore.getAllLatest({ + type: 'npm', + provider: 'npmjs', + namespace: null, + name: 'co', + revision: '4.6.0' + }) + const tools = Object.getOwnPropertyNames(result) + expect(tools.length).to.eq(2) + const clearlydefinedVersions = Object.getOwnPropertyNames(result.clearlydefined) + expect(clearlydefinedVersions).to.deep.eq(['1']) + const scancodeVersions = Object.getOwnPropertyNames(result.scancode) + expect(scancodeVersions).to.deep.eq(['2.9.2']) }) - const tools = Object.getOwnPropertyNames(result) - expect(tools.length).to.eq(2) - const clearlydefinedVersions = Object.getOwnPropertyNames(result.clearlydefined) - expect(clearlydefinedVersions[0]).to.eq('1') - expect(clearlydefinedVersions.length).to.eq(1) - const scancodeVersions = Object.getOwnPropertyNames(result.scancode) - expect(scancodeVersions[0]).to.eq('2.2.1') - expect(scancodeVersions[1]).to.eq('2.9.1') - expect(scancodeVersions[2]).to.eq('2.9.2') - expect(scancodeVersions.length).to.eq(3) + it('should fall back to getAll when there is no latest', async () => { + const azblobStore = createAzBlobStore( + createEntries([ + 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.2.1.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.1.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.0b1.json' + ]) + ) + azblobStore.logger = { error: sinon.stub() } + azblobStore._getLatestToolVersions = sinon.stub().throws(new Error('test error')) + const result = await azblobStore.getAllLatest({ + type: 'npm', + provider: 'npmjs', + namespace: null, + name: 'co', + revision: '4.6.0' + }) + const tools = Object.getOwnPropertyNames(result) + expect(tools.length).to.eq(2) + const clearlydefinedVersions = Object.getOwnPropertyNames(result.clearlydefined) + expect(clearlydefinedVersions).to.deep.eq(['1']) + const scancodeVersions = Object.getOwnPropertyNames(result.scancode) + expect(scancodeVersions).to.deep.eq(['2.2.1', '2.9.1', '2.9.0b1']) + expect(azblobStore.logger.error.calledOnce).to.be.true + }) }) }) +function createEntries(names) { + return names.map(name => ({ name })) +} + function createAzBlobStore(entries, withMetadata) { const blobServiceStub = { listBlobsSegmentedWithPrefix: sinon.stub().callsArgWith(withMetadata ? 4 : 3, null, { entries }), From 755a75436b9f7d74ae1fa7a9ae692758bfa61672 Mon Sep 17 00:00:00 2001 From: Qing Tomlinson Date: Sat, 9 Nov 2024 11:24:14 -0700 Subject: [PATCH 2/9] Refactor to support getAllLastest in fileHarvestStore --- business/definitionService.js | 2 +- providers/stores/abstractFileStore.js | 24 +- providers/stores/azblobHarvestStore.js | 56 +-- providers/stores/fileHarvestStore.js | 48 ++- test/providers/store/abstractFileStore.js | 422 +++++++++++++--------- test/providers/store/azblobHarvest.js | 72 +--- test/providers/store/fileHarvest.js | 138 ++++--- 7 files changed, 438 insertions(+), 324 deletions(-) diff --git a/business/definitionService.js b/business/definitionService.js index f988b8497..5a80def55 100644 --- a/business/definitionService.js +++ b/business/definitionService.js @@ -286,7 +286,7 @@ class DefinitionService { */ async compute(coordinates, curationSpec) { this.logger.debug('4:compute:blob:start', { ts: new Date().toISOString(), coordinates: coordinates.toString() }) - const raw = await this.harvestStore.getAll(coordinates) + const raw = await this.harvestStore.getAllLatest(coordinates) this.logger.debug('4:compute:blob:end', { ts: new Date().toISOString(), coordinates: coordinates.toString() }) coordinates = this._getCasedCoordinates(raw, coordinates) this.logger.debug('5:compute:summarize:start', { diff --git a/providers/stores/abstractFileStore.js b/providers/stores/abstractFileStore.js index d616e3c25..8d272d8ff 100644 --- a/providers/stores/abstractFileStore.js +++ b/providers/stores/abstractFileStore.js @@ -7,10 +7,13 @@ const recursive = require('recursive-readdir') const { promisify } = require('util') const ResultCoordinates = require('../../lib/resultCoordinates') const schema = require('../../schemas/definition-1.0') +const { getLatestVersion } = require('../../lib/utils') +const logger = require('../logging/logger') class AbstractFileStore { constructor(options) { - this.options = options + this.options = options || {} + this.logger = this.options.logger || logger() } async initialize() {} @@ -146,6 +149,25 @@ class AbstractFileStore { .join('/') .toLowerCase() } + + static getLatestToolPaths(paths, toResultCoordinates = path => this.toResultCoordinatesFromStoragePath(path)) { + const entries = paths + .map(path => { + const { tool, toolVersion } = toResultCoordinates(path) + return { tool, toolVersion, path } + }) + .reduce((latest, { tool, toolVersion, path }) => { + if (!tool || !toolVersion) return latest + latest[tool] = latest[tool] || {} + //if the version is greater than the current version, replace it + if (!latest[tool].toolVersion || getLatestVersion([toolVersion, latest[tool].toolVersion]) === toolVersion) { + latest[tool] = { toolVersion, path } + } + return latest + }, {}) + const latestPaths = Object.values(entries).map(entry => entry.path) + return new Set(latestPaths) + } } module.exports = AbstractFileStore diff --git a/providers/stores/azblobHarvestStore.js b/providers/stores/azblobHarvestStore.js index 72bd0ff0f..089d1ac9d 100644 --- a/providers/stores/azblobHarvestStore.js +++ b/providers/stores/azblobHarvestStore.js @@ -5,7 +5,6 @@ const AbstractAzBlobStore = require('./abstractAzblobStore') const AbstractFileStore = require('./abstractFileStore') const ResultCoordinates = require('../../lib/resultCoordinates') const { sortedUniq } = require('lodash') -const { getLatestVersion } = require('../../lib/utils') const resultOrError = (resolve, reject) => (error, result) => (error ? reject(error) : resolve(result)) const responseOrError = (resolve, reject) => (error, result, response) => (error ? reject(error) : resolve(response)) @@ -47,11 +46,12 @@ class AzHarvestBlobStore extends AbstractAzBlobStore { * @param {EntityCoordinates} coordinates - The component revision to report on * @returns An object with a property for each tool and tool version */ - getAll(coordinates) { + async getAll(coordinates) { // Note that here we are assuming the number of blobs will be small-ish (<10) and // a) all fit in memory reasonably, and // b) fit in one list call (i.e., <5000) - return this._getAllFiles(coordinates).then(files => this._getContent(files)) + const files = await this._getAllFiles(coordinates) + return await this._getContent(files) } _getAllFiles(coordinates) { @@ -99,46 +99,26 @@ class AzHarvestBlobStore extends AbstractAzBlobStore { * @returns {Promise} A promise that resolves to an object with a property for each tool and tool version * */ - getAllLatest(coordinates) { - const allFiles = this._getAllFiles(coordinates) - let latestFiles = this._getLatestFiles(allFiles) - - return latestFiles.then(files => this._getContent(files)) + async getAllLatest(coordinates) { + const allFiles = await this._getAllFiles(coordinates) + const latestFiles = this._getLatestFiles(allFiles) + return await this._getContent(latestFiles) } _getLatestFiles(allFiles) { - return ( - allFiles - .then(files => { - const names = files.map(file => file.name) - const latest = new Set(this._getLatestToolVersions(names)) - return files.filter(file => latest.has(file.name)) - }) - .catch(error => { - this.logger.error('Error getting latest files', error) - return [] - }) - //fall back to getAll by returning validFiles - .then(latest => (latest.length === 0 ? allFiles : latest)) - ) + let latestFiles = [] + const names = allFiles.map(file => file.name) + try { + const latest = this._getLatestToolPaths(names) + latestFiles = allFiles.filter(file => latest.has(file.name)) + } catch (error) { + this.logger.error('Error getting latest files', error) + } + return latestFiles.length === 0 ? allFiles : latestFiles } - _getLatestToolVersions(paths) { - const entries = paths - .map(path => { - const { tool, toolVersion } = this._toResultCoordinatesFromStoragePath(path) - return { tool, toolVersion, path } - }) - .reduce((latest, { tool, toolVersion, path }) => { - if (!tool || !toolVersion) return latest - latest[tool] = latest[tool] || {} - //if the version is greater than the current version, replace it - if (!latest[tool].toolVersion || getLatestVersion([toolVersion, latest[tool].toolVersion]) === toolVersion) { - latest[tool] = { toolVersion, path } - } - return latest - }, {}) - return Object.values(entries).map(entry => entry.path) + _getLatestToolPaths(paths) { + return AbstractFileStore.getLatestToolPaths(paths, path => this._toResultCoordinatesFromStoragePath(path)) } } diff --git a/providers/stores/fileHarvestStore.js b/providers/stores/fileHarvestStore.js index f4917302e..6a5fdb10c 100644 --- a/providers/stores/fileHarvestStore.js +++ b/providers/stores/fileHarvestStore.js @@ -47,17 +47,24 @@ class FileHarvestStore extends AbstractFileStore { */ async getAll(coordinates) { // TODO validate/enforce that the coordinates are down to the component revision - const root = this._toStoragePathFromCoordinates(coordinates) // Note that here we are assuming the number of blobs will be small-ish (<10) and // a) all fit in memory reasonably, and // b) fit in one list call (i.e., <5000) - let files = null + const files = await this._getAllFiles(coordinates) + return await this._getContent(files) + } + + async _getAllFiles(coordinates) { + const root = this._toStoragePathFromCoordinates(coordinates) try { - files = await recursive(root, ['.DS_Store']) + return await recursive(root, ['.DS_Store']) } catch (error) { if (error.code === 'ENOENT') return {} throw error } + } + + async _getContent(files) { const contents = await Promise.all( files.map(file => { return new Promise((resolve, reject) => @@ -74,6 +81,41 @@ class FileHarvestStore extends AbstractFileStore { return result }, {}) } + + /** + * Get the latest version of each tool output for the given coordinates. The coordinates must be all the way down + * to a revision. + * @param {EntityCoordinates} coordinates - The component revision to report on + * @returns {Promise} A promise that resolves to an object with a property for each tool and tool version + * + */ + async getAllLatest(coordinates) { + const allFiles = await this._getAllFiles(coordinates) + const latestFiles = this._getLatestFiles(allFiles) + return await this._getContent(latestFiles) + } + + _getLatestFiles(allFiles) { + let latestFiles = [] + try { + const latest = this._getLatestToolVersions(allFiles) + latestFiles = allFiles.filter(file => latest.has(file)) + } catch (error) { + this.logger.error('Error getting latest files', error) + } + if (latestFiles.length === 0) { + this.logger.debug('No latest files found, returning all files') + return allFiles + } + if (latestFiles.length !== allFiles.length) { + this.logger.debug(`Using latest: \n${latestFiles}`) + } + return latestFiles + } + + _getLatestToolVersions(paths) { + return AbstractFileStore.getLatestToolPaths(paths, path => this._toResultCoordinatesFromStoragePath(path)) + } } module.exports = options => new FileHarvestStore(options) diff --git a/test/providers/store/abstractFileStore.js b/test/providers/store/abstractFileStore.js index 3a6987572..e45451c21 100644 --- a/test/providers/store/abstractFileStore.js +++ b/test/providers/store/abstractFileStore.js @@ -4,193 +4,275 @@ const proxyquire = require('proxyquire') const sinon = require('sinon') const sandbox = sinon.createSandbox() -const { expect } = require('chai') +const deepEqualInAnyOrder = require('deep-equal-in-any-order') +const chai = require('chai') +chai.use(deepEqualInAnyOrder) +const expect = chai.expect const EntityCoordinates = require('../../../lib/entityCoordinates') +const AbstractFileStore = require('../../../providers/stores/abstractFileStore') -describe('AbstractFileStore lists entries ', () => { - let FileStore - const data = { - '/foo/npm/npmjs/-/test/revision/1.0/tool/testtool/2.0.json': {}, - '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool0/1.0.json': {}, - '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool1/2.0.json': {}, - '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool2/3.0.json': {} - } +describe('AbstractFileStore', () => { + describe('AbstractFileStore lists entries ', () => { + let FileStore + const data = { + '/foo/npm/npmjs/-/test/revision/1.0/tool/testtool/2.0.json': {}, + '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool0/1.0.json': {}, + '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool1/2.0.json': {}, + '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool2/3.0.json': {} + } - beforeEach(function () { - const recursiveStub = async path => { - path = path.replace(/\\/g, '/') - if (path.includes('error')) throw new Error('test error') - const result = Object.keys(data).filter(p => p.startsWith(path)) - if (result.length === 0) { - const error = new Error('test') - error.code = 'ENOENT' - throw error + beforeEach(function () { + const recursiveStub = async path => { + path = path.replace(/\\/g, '/') + if (path.includes('error')) throw new Error('test error') + const result = Object.keys(data).filter(p => p.startsWith(path)) + if (result.length === 0) { + const error = new Error('test') + error.code = 'ENOENT' + throw error + } + return result.filter(p => p !== path) } - return result.filter(p => p !== path) - } - const fsStub = { - readFile: (path, cb) => { - cb(null, JSON.stringify({ path })) + const fsStub = { + readFile: (path, cb) => { + cb(null, JSON.stringify({ path })) + } } - } - FileStore = proxyquire('../../../providers/stores/abstractFileStore', { - 'recursive-readdir': recursiveStub, - fs: fsStub + FileStore = proxyquire('../../../providers/stores/abstractFileStore', { + 'recursive-readdir': recursiveStub, + fs: fsStub + }) }) - }) - afterEach(function () { - sandbox.restore() - }) + afterEach(function () { + sandbox.restore() + }) - it('throws original error when not ENOENT', async () => { - const fileStore = new FileStore({ location: '/foo' }) - try { - await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'error', '0.0'), data => data) - throw new Error('should have thrown error') - } catch (error) { - expect(error.message).to.eq('test error') - } - }) + it('throws original error when not ENOENT', async () => { + const fileStore = new FileStore({ location: '/foo' }) + try { + await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'error', '0.0'), data => data) + throw new Error('should have thrown error') + } catch (error) { + expect(error.message).to.eq('test error') + } + }) - it('works for unknown path coordinates ', async () => { - const fileStore = new FileStore({ location: '/foo' }) - const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'bogus', '0.0'), data => data) - expect(result.length).to.eq(0) - }) + it('works for unknown path coordinates ', async () => { + const fileStore = new FileStore({ location: '/foo' }) + const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'bogus', '0.0'), data => data) + expect(result.length).to.eq(0) + }) - it('lists no files', async () => { - const fileStore = new FileStore({ location: '/foo' }) - const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '0.0'), data => data) - expect(result.length).to.eq(0) - }) + it('lists no files', async () => { + const fileStore = new FileStore({ location: '/foo' }) + const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '0.0'), data => data) + expect(result.length).to.eq(0) + }) - it('lists single files', async () => { - const fileStore = new FileStore({ location: '/foo' }) - const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '1.0'), data => data) - expect(result.length).to.eq(1) - expect(result[0].path).to.eq('/foo/npm/npmjs/-/test/revision/1.0/tool/testtool/2.0.json') + it('lists single files', async () => { + const fileStore = new FileStore({ location: '/foo' }) + const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '1.0'), data => data) + expect(result.length).to.eq(1) + expect(result[0].path).to.eq('/foo/npm/npmjs/-/test/revision/1.0/tool/testtool/2.0.json') + }) + + it('lists multiple files', async () => { + const fileStore = new FileStore({ location: '/foo' }) + const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '2.0'), data => data) + const expected = [ + '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool0/1.0.json', + '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool1/2.0.json', + '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool2/3.0.json' + ] + expect(result.map(entry => entry.path)).to.equalInAnyOrder(expected) + }) }) - it('lists multiple files', async () => { - const fileStore = new FileStore({ location: '/foo' }) - const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '2.0'), data => data) - const expected = [ - '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool0/1.0.json', - '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool1/2.0.json', - '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool2/3.0.json' + describe('coordinates to path mapping', () => { + const windows = 'c:\\foo\\bar' + const linux = '/foo/bar' + const data = [ + { + location: linux, + path: 'npm/npmjs/namespace/name/revision/1.0', + coordinates: { + type: 'npm', + provider: 'npmjs', + namespace: 'namespace', + name: 'name', + revision: '1.0', + tool: undefined, + toolVersion: undefined + } + }, + { + location: linux, + path: 'npm/npmjs/namespace/name/revision/1.0/tool/testtool/2.0', + coordinates: { + type: 'npm', + provider: 'npmjs', + namespace: 'namespace', + name: 'name', + revision: '1.0', + tool: 'testtool', + toolVersion: '2.0' + } + }, + { + location: linux, + path: 'npm/npmjs/namespace/name', + coordinates: { + type: 'npm', + provider: 'npmjs', + namespace: 'namespace', + name: 'name', + revision: undefined, + tool: undefined, + toolVersion: undefined + } + }, + { + location: linux, + path: 'npm/npmjs/-/name/revision/1.0', + coordinates: { + type: 'npm', + provider: 'npmjs', + namespace: null, + name: 'name', + revision: '1.0', + tool: undefined, + toolVersion: undefined + } + }, + { + location: windows, + path: 'npm\\npmjs\\namespace\\name\\revision\\1.0', + coordinates: { + type: 'npm', + provider: 'npmjs', + namespace: 'namespace', + name: 'name', + revision: '1.0', + tool: undefined, + toolVersion: undefined + } + }, + { + location: windows, + path: 'npm\\npmjs\\namespace\\name', + coordinates: { + type: 'npm', + provider: 'npmjs', + namespace: 'namespace', + name: 'name', + revision: undefined, + tool: undefined, + toolVersion: undefined + } + }, + { + location: windows, + path: 'npm\\npmjs\\-\\name\\revision\\1.0', + coordinates: { + type: 'npm', + provider: 'npmjs', + namespace: null, + name: 'name', + revision: '1.0', + tool: undefined, + toolVersion: undefined + } + } ] - expect(result.map(entry => entry.path)).to.equalInAnyOrder(expected) + + const AbstractFileStore = require('../../../providers/stores/abstractFileStore') + data.forEach(input => { + it('works well for ' + input.path, () => { + const fileStore = new AbstractFileStore({ location: input.location }) + const separator = input.location.includes('/') ? '/' : '\\' + const result = fileStore._toStoragePathFromCoordinates(input.coordinates) + // account for platform differences in path separator. + const normalizedResult = result.replace(/\\/g, '/') + const normalizedInput = (input.location + separator + input.path).replace(/\\/g, '/') + expect(normalizedResult).to.deep.equal(normalizedInput) + }) + }) }) -}) -describe('coordinates to path mapping', () => { - const windows = 'c:\\foo\\bar' - const linux = '/foo/bar' - const data = [ - { - location: linux, - path: 'npm/npmjs/namespace/name/revision/1.0', - coordinates: { - type: 'npm', - provider: 'npmjs', - namespace: 'namespace', - name: 'name', - revision: '1.0', - tool: undefined, - toolVersion: undefined - } - }, - { - location: linux, - path: 'npm/npmjs/namespace/name/revision/1.0/tool/testtool/2.0', - coordinates: { - type: 'npm', - provider: 'npmjs', - namespace: 'namespace', - name: 'name', - revision: '1.0', - tool: 'testtool', - toolVersion: '2.0' - } - }, - { - location: linux, - path: 'npm/npmjs/namespace/name', - coordinates: { - type: 'npm', - provider: 'npmjs', - namespace: 'namespace', - name: 'name', - revision: undefined, - tool: undefined, - toolVersion: undefined - } - }, - { - location: linux, - path: 'npm/npmjs/-/name/revision/1.0', - coordinates: { - type: 'npm', - provider: 'npmjs', - namespace: null, - name: 'name', - revision: '1.0', - tool: undefined, - toolVersion: undefined - } - }, - { - location: windows, - path: 'npm\\npmjs\\namespace\\name\\revision\\1.0', - coordinates: { - type: 'npm', - provider: 'npmjs', - namespace: 'namespace', - name: 'name', - revision: '1.0', - tool: undefined, - toolVersion: undefined - } - }, - { - location: windows, - path: 'npm\\npmjs\\namespace\\name', - coordinates: { - type: 'npm', - provider: 'npmjs', - namespace: 'namespace', - name: 'name', - revision: undefined, - tool: undefined, - toolVersion: undefined - } - }, - { - location: windows, - path: 'npm\\npmjs\\-\\name\\revision\\1.0', - coordinates: { - type: 'npm', - provider: 'npmjs', - namespace: null, - name: 'name', - revision: '1.0', - tool: undefined, - toolVersion: undefined - } - } - ] + describe('getLatestToolVersions', () => { + it('should get latest tool versions', () => { + let latest = AbstractFileStore.getLatestToolPaths([ + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/clearlydefined/1.5.0.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.18.1.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.14.0.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/reuse/3.2.1.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/reuse/3.2.2.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/32.3.0.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/30.3.0.json' + ]) + expect(Array.from(latest)).to.equalInAnyOrder([ + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/clearlydefined/1.5.0.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.18.1.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/reuse/3.2.2.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/32.3.0.json' + ]) + }) + it('should get latest tool versions and ignore un-versioned data', () => { + let latest = AbstractFileStore.getLatestToolPaths([ + 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.2.1.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.1.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.2.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode.json' + ]) + expect(Array.from(latest)).to.equalInAnyOrder([ + 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.2.json' + ]) + }) + it('should get latest tool versions and ignore invalid semver', () => { + let latest = AbstractFileStore.getLatestToolPaths([ + 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.10.0.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.2.1.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.2.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/3.2.2.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/30.3.0.json' + ]) + expect(Array.from(latest)).to.equalInAnyOrder([ + 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/30.3.0.json' + ]) + }) + + it('should ignore invalid semver, invalid sermver first', () => { + let latest = AbstractFileStore.getLatestToolPaths([ + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json' + ]) + expect(Array.from(latest)).to.equalInAnyOrder(['npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json']) + }) + + it('should ignore invalid semver, invalid sermver last', () => { + let latest = AbstractFileStore.getLatestToolPaths([ + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json' + ]) + expect(Array.from(latest)).to.equalInAnyOrder(['npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json']) + }) - const AbstractFileStore = require('../../../providers/stores/abstractFileStore') - data.forEach(input => { - it('works well for ' + input.path, () => { - const fileStore = new AbstractFileStore({ location: input.location }) - const separator = input.location.includes('/') ? '/' : '\\' - const result = fileStore._toStoragePathFromCoordinates(input.coordinates) - // account for platform differences in path separator. - const normalizedResult = result.replace(/\\/g, '/') - const normalizedInput = (input.location + separator + input.path).replace(/\\/g, '/') - expect(normalizedResult).to.deep.equal(normalizedInput) + it('should return at least the first tool version', () => { + let latest = AbstractFileStore.getLatestToolPaths([ + 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json' + ]) + expect(Array.from(latest)).to.equalInAnyOrder([ + 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json' + ]) }) }) }) diff --git a/test/providers/store/azblobHarvest.js b/test/providers/store/azblobHarvest.js index ec614ad1f..f01c4633a 100644 --- a/test/providers/store/azblobHarvest.js +++ b/test/providers/store/azblobHarvest.js @@ -170,13 +170,10 @@ describe('azblob Harvest store', () => { }) }) - describe('_getLatestToolVersions', () => { - let store - beforeEach(() => { - store = Store({}) - }) + describe('getAllLatest', () => { it('should get latest tool versions', () => { - let latest = store._getLatestToolVersions([ + const store = Store({}) + let latest = store._getLatestToolPaths([ 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/clearlydefined/1.5.0.json', 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.18.1.json', 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.14.0.json', @@ -185,72 +182,13 @@ describe('azblob Harvest store', () => { 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/32.3.0.json', 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/30.3.0.json' ]) - expect(latest).to.equalInAnyOrder([ + expect(Array.from(latest)).to.equalInAnyOrder([ 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/clearlydefined/1.5.0.json', 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.18.1.json', 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/reuse/3.2.2.json', 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/32.3.0.json' ]) }) - it('should get latest tool versions and ignore un-versioned data', () => { - let latest = store._getLatestToolVersions([ - 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json', - 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.2.1.json', - 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.1.json', - 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.2.json', - 'npm/npmjs/-/co/revision/4.6.0/tool/scancode.json' - ]) - expect(latest).to.equalInAnyOrder([ - 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json', - 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.2.json' - ]) - }) - it('should get latest tool versions and ignore invalid semver', () => { - let latest = store._getLatestToolVersions([ - 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.10.0.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.2.1.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.2.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/3.2.2.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/30.3.0.json' - ]) - expect(latest).to.equalInAnyOrder([ - 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/30.3.0.json' - ]) - }) - - it('should ignore invalid semver, invalid sermver first', () => { - let latest = store._getLatestToolVersions([ - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json' - ]) - expect(latest).to.equalInAnyOrder(['npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json']) - }) - - it('should ignore invalid semver, invalid sermver last', () => { - let latest = store._getLatestToolVersions([ - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json' - ]) - expect(latest).to.equalInAnyOrder(['npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json']) - }) - - it('should return at least the first tool version', () => { - let latest = store._getLatestToolVersions([ - 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json' - ]) - expect(latest).to.equalInAnyOrder([ - 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json' - ]) - }) - }) - - describe('getAllLatest', () => { it('retrieves latest entries', async () => { const azblobStore = createAzBlobStore( createEntries([ @@ -321,7 +259,7 @@ describe('azblob Harvest store', () => { ]) ) azblobStore.logger = { error: sinon.stub() } - azblobStore._getLatestToolVersions = sinon.stub().throws(new Error('test error')) + azblobStore._getLatestToolPaths = sinon.stub().throws(new Error('test error')) const result = await azblobStore.getAllLatest({ type: 'npm', provider: 'npmjs', diff --git a/test/providers/store/fileHarvest.js b/test/providers/store/fileHarvest.js index 40533718c..a9b0f1731 100644 --- a/test/providers/store/fileHarvest.js +++ b/test/providers/store/fileHarvest.js @@ -2,10 +2,15 @@ // SPDX-License-Identifier: MIT const sinon = require('sinon') -const { expect } = require('chai') +const deepEqualInAnyOrder = require('deep-equal-in-any-order') +const chai = require('chai') +chai.use(deepEqualInAnyOrder) +const expect = chai.expect const EntityCoordinates = require('../../../lib/entityCoordinates') const AbstractFileStore = require('../../../providers/stores/abstractFileStore') const FileStore = require('../../../providers/stores/fileHarvestStore') +const { file } = require('tmp') +const { RegexPathMatcher } = require('mockttp/dist/rules/matchers') const data = { 'npm/npmjs/-/test/0.0': {}, @@ -22,57 +27,102 @@ const data = { contents: { _metadata: { links: { self: { href: 'urn:npm:npmjs:-:test:revision:2.0:tool:testtool2:3.0' } } } } } } - -describe('FileHarvestStore list tool results', () => { - before(() => { - sinon.stub(AbstractFileStore.prototype, 'list').callsFake(async (coordinates, visitor) => { - const path = coordinates.toString() - if (path.includes('error')) throw new Error('test error') - return Object.keys(data) - .map(key => (key.startsWith(path) ? visitor(data[key].contents) : null)) - .filter(e => e) +describe('FileHarvestStore', () => { + describe(' list tool results', () => { + before(() => { + sinon.stub(AbstractFileStore.prototype, 'list').callsFake(async (coordinates, visitor) => { + const path = coordinates.toString() + if (path.includes('error')) throw new Error('test error') + return Object.keys(data) + .map(key => (key.startsWith(path) ? visitor(data[key].contents) : null)) + .filter(e => e) + }) }) - }) - after(() => AbstractFileStore.prototype.list.restore()) + after(() => AbstractFileStore.prototype.list.restore()) - it('throws original error when not ENOENT', async () => { - const fileStore = FileStore() - try { - await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'error', '0.0')) - throw new Error('should have thrown error') - } catch (error) { - expect(error.message).to.eq('test error') - } - }) + it('throws original error when not ENOENT', async () => { + const fileStore = FileStore() + try { + await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'error', '0.0')) + throw new Error('should have thrown error') + } catch (error) { + expect(error.message).to.eq('test error') + } + }) - it('works for unknown path coordinates ', async () => { - const fileStore = FileStore() - const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'bogus', '0.0')) - expect(result.length).to.eq(0) - }) + it('works for unknown path coordinates ', async () => { + const fileStore = FileStore() + const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'bogus', '0.0')) + expect(result.length).to.eq(0) + }) - it('lists no results', async () => { - const fileStore = FileStore() - const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '0.0'), 'result') - expect(result.length).to.eq(0) - }) + it('lists no results', async () => { + const fileStore = FileStore() + const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '0.0'), 'result') + expect(result.length).to.eq(0) + }) - it('lists a single result', async () => { - const fileStore = FileStore() - const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '1.0'), 'result') - const expected = ['npm/npmjs/-/test/1.0/testtool/2.0'] - expect(result).to.equalInAnyOrder(expected) + it('lists a single result', async () => { + const fileStore = FileStore() + const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '1.0'), 'result') + const expected = ['npm/npmjs/-/test/1.0/testtool/2.0'] + expect(result).to.equalInAnyOrder(expected) + }) + + it('lists multiple results', async () => { + const fileStore = FileStore() + const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '2.0'), 'result') + const expected = [ + 'npm/npmjs/-/test/2.0/testtool0/1.0', + 'npm/npmjs/-/test/2.0/testtool1/2.0', + 'npm/npmjs/-/test/2.0/testtool2/3.0' + ] + expect(result).to.equalInAnyOrder(expected) + }) }) - it('lists multiple results', async () => { - const fileStore = FileStore() - const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '2.0'), 'result') - const expected = [ - 'npm/npmjs/-/test/2.0/testtool0/1.0', - 'npm/npmjs/-/test/2.0/testtool1/2.0', - 'npm/npmjs/-/test/2.0/testtool2/3.0' + describe('_getLatestFiles', () => { + const allFiles = [ + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/clearlydefined/1.3.1.json', + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/clearlydefined/1.4.1.json', + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/licensee/9.18.1.json', + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/reuse/3.2.1.json', + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/reuse/3.2.2.json', + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/scancode/30.3.0.json', + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/scancode/32.3.0.json' ] - expect(result).to.equalInAnyOrder(expected) + let fileStore + + beforeEach(() => { + const options = { + location: '/tmp/harvested_data', + logger: { + error: () => {}, + debug: () => {} + } + } + fileStore = FileStore(options) + }) + + it('should get latest files', () => { + const result = fileStore._getLatestFiles(allFiles) + expect(result.length).to.eq(4) + expect(Array.from(result)).to.equalInAnyOrder([ + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/clearlydefined/1.4.1.json', + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/licensee/9.18.1.json', + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/reuse/3.2.2.json', + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/scancode/32.3.0.json' + ]) + }) + + it('should handle error', () => { + fileStore._getLatestToolVersions = sinon.stub().throws(new Error('test error')) + fileStore.logger.error = sinon.stub() + const result = fileStore._getLatestFiles(allFiles) + expect(fileStore.logger.error.calledOnce).to.be.true + expect(result.length).to.eq(allFiles.length) + expect(Array.from(result)).to.equalInAnyOrder(allFiles) + }) }) }) From bdfc3ae1a605eb5a9179228abb69a2b63e850677 Mon Sep 17 00:00:00 2001 From: Qing Tomlinson Date: Sat, 9 Nov 2024 14:29:40 -0700 Subject: [PATCH 3/9] Fix unit tests --- test/business/definitionServiceTest.js | 2 +- test/providers/store/azblobHarvest.js | 1 - test/providers/store/fileHarvest.js | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/test/business/definitionServiceTest.js b/test/business/definitionServiceTest.js index 24326dea9..4f76cb8a5 100644 --- a/test/business/definitionServiceTest.js +++ b/test/business/definitionServiceTest.js @@ -342,7 +342,7 @@ function setup(definition, coordinateSpec, curation) { return } } - const harvestStore = { getAll: () => Promise.resolve(null) } + const harvestStore = { getAllLatest: () => Promise.resolve(null) } const harvestService = { harvest: () => sinon.stub() } const summary = { summarizeAll: () => Promise.resolve(null) } const aggregator = { process: () => Promise.resolve(definition) } diff --git a/test/providers/store/azblobHarvest.js b/test/providers/store/azblobHarvest.js index f01c4633a..dcbaa7e4b 100644 --- a/test/providers/store/azblobHarvest.js +++ b/test/providers/store/azblobHarvest.js @@ -7,7 +7,6 @@ const deepEqualInAnyOrder = require('deep-equal-in-any-order') const chai = require('chai') chai.use(deepEqualInAnyOrder) const expect = chai.expect -const AbstractFileStore = require('../../../providers/stores/abstractFileStore') describe('azblob Harvest store', () => { describe('list', () => { diff --git a/test/providers/store/fileHarvest.js b/test/providers/store/fileHarvest.js index a9b0f1731..a71c73b9c 100644 --- a/test/providers/store/fileHarvest.js +++ b/test/providers/store/fileHarvest.js @@ -9,8 +9,6 @@ const expect = chai.expect const EntityCoordinates = require('../../../lib/entityCoordinates') const AbstractFileStore = require('../../../providers/stores/abstractFileStore') const FileStore = require('../../../providers/stores/fileHarvestStore') -const { file } = require('tmp') -const { RegexPathMatcher } = require('mockttp/dist/rules/matchers') const data = { 'npm/npmjs/-/test/0.0': {}, From 658f2eaedd4450ebb8985b60bd081d3a0312af10 Mon Sep 17 00:00:00 2001 From: Qing Tomlinson Date: Wed, 13 Nov 2024 16:09:29 -0800 Subject: [PATCH 4/9] Fix error handling in fileHavestStore --- providers/stores/fileHarvestStore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/providers/stores/fileHarvestStore.js b/providers/stores/fileHarvestStore.js index 6a5fdb10c..e5e7b827d 100644 --- a/providers/stores/fileHarvestStore.js +++ b/providers/stores/fileHarvestStore.js @@ -59,7 +59,7 @@ class FileHarvestStore extends AbstractFileStore { try { return await recursive(root, ['.DS_Store']) } catch (error) { - if (error.code === 'ENOENT') return {} + if (error.code === 'ENOENT') return [] throw error } } From 3dd83ac14eea3ac7cd55fa4d3783f98cd3148e68 Mon Sep 17 00:00:00 2001 From: Qing Tomlinson Date: Fri, 15 Nov 2024 17:31:28 -0800 Subject: [PATCH 5/9] Add more tests --- test/business/definitionServiceTest.js | 65 +++++++++++++++++++ .../3.1.0/tool/clearlydefined/1.1.2.json | 1 + .../3.1.0/tool/clearlydefined/1.3.4.json | 1 + .../revision/3.1.0/tool/clearlydefined/1.json | 1 + .../revision/3.1.0/tool/fossology/3.3.0.json | 1 + .../revision/3.1.0/tool/fossology/3.6.0.json | 1 + .../revision/3.1.0/tool/licensee/9.12.1.json | 1 + .../revision/3.1.0/tool/licensee/9.14.0.json | 1 + .../revision/3.1.0/tool/reuse/1.3.0.json | 1 + .../revision/3.1.0/tool/reuse/3.2.1.json | 1 + .../revision/3.1.0/tool/scancode/2.2.1.json | 1 + .../3.1.0/tool/scancode/2.9.0+b1.json | 1 + .../revision/3.1.0/tool/scancode/30.3.0.json | 1 + test/providers/store/abstractFileStore.js | 14 ++-- test/providers/store/fileHarvest.js | 54 ++++++++++++--- 15 files changed, 129 insertions(+), 16 deletions(-) create mode 100644 test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.1.2.json create mode 100644 test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.3.4.json create mode 100644 test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.json create mode 100644 test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/fossology/3.3.0.json create mode 100644 test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/fossology/3.6.0.json create mode 100644 test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/licensee/9.12.1.json create mode 100644 test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/licensee/9.14.0.json create mode 100644 test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/reuse/1.3.0.json create mode 100644 test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/reuse/3.2.1.json create mode 100644 test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.2.1.json create mode 100644 test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0+b1.json create mode 100644 test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/scancode/30.3.0.json diff --git a/test/business/definitionServiceTest.js b/test/business/definitionServiceTest.js index 4f76cb8a5..7d4b4a64a 100644 --- a/test/business/definitionServiceTest.js +++ b/test/business/definitionServiceTest.js @@ -12,6 +12,9 @@ const deepEqualInAnyOrder = require('deep-equal-in-any-order') const chai = require('chai') chai.use(deepEqualInAnyOrder) const expect = chai.expect +const FileHarvestStore = require('../../providers/stores/fileHarvestStore') +const SummaryService = require('../../business/summarizer') +const AggregatorService = require('../../business/aggregator') describe('Definition Service', () => { it('invalidates single coordinate', async () => { @@ -310,6 +313,68 @@ describe('Definition Service Facet management', () => { }) }) +describe('Integration test', () => { + let fileHarvestStore + beforeEach(() => { + fileHarvestStore = createFileHarvestStore(fileHarvestStore) + }) + + it('computes the same definition with latest harvest data', async () => { + const coordinates = EntityCoordinates.fromString('npm/npmjs/-/debug/3.1.0') + const allHarvestData = await fileHarvestStore.getAll(coordinates) + delete allHarvestData['scancode']['2.9.0+b1'] //remove invalid scancode version + let service = setupDefinitionService(allHarvestData) + const baseline_def = await service.compute(coordinates) + + const latestHarvestData = await fileHarvestStore.getAllLatest(coordinates) + service = setupDefinitionService(latestHarvestData) + const comparison_def = await service.compute(coordinates) + + //updated timestamp is not deterministic + expect(comparison_def._meta.updated).to.not.equal(baseline_def._meta.updated) + comparison_def._meta.updated = baseline_def._meta.updated + expect(comparison_def).to.deep.equal(baseline_def) + }) +}) + +function createFileHarvestStore(fileHarvestStore) { + const options = { + location: 'test/fixtures/store', + logger: { + error: () => {}, + debug: () => {} + } + } + return FileHarvestStore(options) +} + +function setupDefinitionService(rawHarvestData) { + const harvestStore = { getAllLatest: () => Promise.resolve(rawHarvestData) } + const summary = SummaryService({}) + + const tools = [['clearlydefined', 'reuse', 'licensee', 'scancode', 'fossology', 'cdsource']] + const aggregator = AggregatorService({ precedence: tools }) + aggregator.logger = { info: sinon.stub() } + const curator = { + get: () => Promise.resolve(), + apply: (_coordinates, _curationSpec, definition) => Promise.resolve(definition), + autoCurate: () => {} + } + return setupWithDelegates(curator, harvestStore, summary, aggregator) +} + +function setupWithDelegates(curator, harvestStore, summary, aggregator) { + const store = { delete: sinon.stub(), get: sinon.stub(), store: sinon.stub() } + const search = { delete: sinon.stub(), store: sinon.stub() } + const cache = { delete: sinon.stub(), get: sinon.stub(), set: sinon.stub() } + + const harvestService = { harvest: () => sinon.stub() } + const service = DefinitionService(harvestStore, harvestService, summary, aggregator, curator, store, search, cache) + service.logger = { info: sinon.stub(), debug: () => {} } + service._harvest = sinon.stub() + return service +} + function validate(definition) { // Tack on a dummy coordinates to keep the schema happy. Tool summarizations do not have to include coordinates definition.coordinates = { type: 'npm', provider: 'npmjs', namespace: null, name: 'foo', revision: '1.0' } diff --git a/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.1.2.json b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.1.2.json new file mode 100644 index 000000000..b513a4e9e --- /dev/null +++ b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.1.2.json @@ -0,0 +1 @@ +{"_metadata":{"type":"npm","url":"cd:/npm/npmjs/-/debug/3.1.0","fetchedAt":"2018-09-25T08:50:22.497Z","links":{"self":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:clearlydefined:1.1.2","type":"resource"},"siblings":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:clearlydefined","type":"collection"},"scancode":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:scancode","type":"collection"},"fossology":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:fossology","type":"collection"},"source":{"href":"urn:git:github:visionmedia:debug:revision:f073e056f33efdd5b311381eb6bca2bc850745bf","type":"resource"}},"version":"1.1.2","processedAt":"2018-09-25T08:50:23.285Z"},"package.json":{"name":"debug","version":"3.1.0","repository":{"type":"git","url":"git://github.com/visionmedia/debug.git"},"description":"small debugging utility","keywords":["debug","log","debugger"],"author":"TJ Holowaychuk ","contributors":["Nathan Rajlich (http://n8.io)","Andrew Rhyne "],"license":"MIT","dependencies":{"ms":"2.0.0"},"devDependencies":{"browserify":"14.4.0","chai":"^3.5.0","concurrently":"^3.1.0","coveralls":"^2.11.15","eslint":"^3.12.1","istanbul":"^0.4.5","karma":"^1.3.0","karma-chai":"^0.1.0","karma-mocha":"^1.3.0","karma-phantomjs-launcher":"^1.0.2","karma-sinon":"^1.0.5","mocha":"^3.2.0","mocha-lcov-reporter":"^1.2.0","rimraf":"^2.5.4","sinon":"^1.17.6","sinon-chai":"^2.8.0"},"main":"./src/index.js","browser":"./src/browser.js"},"registryData":{"_id":"debug","_rev":"892-a4892a9c88eb5cf467bf945f0d8eb937","name":"debug","description":"small debugging utility","dist-tags":{"latest":"4.0.1"},"readme":"# debug\n[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers)\n[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)\n\n\n\nA tiny JavaScript debugging utility modelled after Node.js core's debugging\ntechnique. Works in Node.js and web browsers.\n\n## Installation\n\n```bash\n$ npm install debug\n```\n\n## Usage\n\n`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.\n\nExample [_app.js_](./examples/node/app.js):\n\n```js\nvar debug = require('debug')('http')\n , http = require('http')\n , name = 'My App';\n\n// fake app\n\ndebug('booting %o', name);\n\nhttp.createServer(function(req, res){\n debug(req.method + ' ' + req.url);\n res.end('hello\\n');\n}).listen(3000, function(){\n debug('listening');\n});\n\n// fake worker of some kind\n\nrequire('./worker');\n```\n\nExample [_worker.js_](./examples/node/worker.js):\n\n```js\nvar a = require('debug')('worker:a')\n , b = require('debug')('worker:b');\n\nfunction work() {\n a('doing lots of uninteresting work');\n setTimeout(work, Math.random() * 1000);\n}\n\nwork();\n\nfunction workb() {\n b('doing some work');\n setTimeout(workb, Math.random() * 2000);\n}\n\nworkb();\n```\n\nThe `DEBUG` environment variable is then used to enable these based on space or\ncomma-delimited names.\n\nHere are some examples:\n\n\"screen\n\"screen\n\"screen\n\n#### Windows command prompt notes\n\n##### CMD\n\nOn Windows the environment variable is set using the `set` command.\n\n```cmd\nset DEBUG=*,-not_this\n```\n\nExample:\n\n```cmd\nset DEBUG=* & node app.js\n```\n\n##### PowerShell (VS Code default)\n\nPowerShell uses different syntax to set environment variables.\n\n```cmd\n$env:DEBUG = \"*,-not_this\"\n```\n\nExample:\n\n```cmd\n$env:DEBUG='app';node app.js\n```\n\nThen, run the program to be debugged as usual.\n\nnpm script example:\n```js\n \"windowsDebug\": \"@powershell -Command $env:DEBUG='*';node app.js\",\n```\n\n## Namespace Colors\n\nEvery debug instance has a color generated for it based on its namespace name.\nThis helps when visually parsing the debug output to identify which debug instance\na debug line belongs to.\n\n#### Node.js\n\nIn Node.js, colors are enabled when stderr is a TTY. You also _should_ install\nthe [`supports-color`](https://npmjs.org/supports-color) module alongside debug,\notherwise debug will only use a small handful of basic colors.\n\n\n\n#### Web Browser\n\nColors are also enabled on \"Web Inspectors\" that understand the `%c` formatting\noption. These are WebKit web inspectors, Firefox ([since version\n31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))\nand the Firebug plugin for Firefox (any version).\n\n\n\n\n## Millisecond diff\n\nWhen actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the \"+NNNms\" will show you how much time was spent between calls.\n\n\n\nWhen stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below:\n\n\n\n\n## Conventions\n\nIf you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use \":\" to separate features. For example \"bodyParser\" from Connect would then be \"connect:bodyParser\". If you append a \"*\" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output.\n\n## Wildcards\n\nThe `*` character may be used as a wildcard. Suppose for example your library has\ndebuggers named \"connect:bodyParser\", \"connect:compress\", \"connect:session\",\ninstead of listing all three with\n`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do\n`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.\n\nYou can also exclude specific debuggers by prefixing them with a \"-\" character.\nFor example, `DEBUG=*,-connect:*` would include all debuggers except those\nstarting with \"connect:\".\n\n## Environment Variables\n\nWhen running through Node.js, you can set a few environment variables that will\nchange the behavior of the debug logging:\n\n| Name | Purpose |\n|-----------|-------------------------------------------------|\n| `DEBUG` | Enables/disables specific debugging namespaces. |\n| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). |\n| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |\n| `DEBUG_DEPTH` | Object inspection depth. |\n| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |\n\n\n__Note:__ The environment variables beginning with `DEBUG_` end up being\nconverted into an Options object that gets used with `%o`/`%O` formatters.\nSee the Node.js documentation for\n[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)\nfor the complete list.\n\n## Formatters\n\nDebug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting.\nBelow are the officially supported formatters:\n\n| Formatter | Representation |\n|-----------|----------------|\n| `%O` | Pretty-print an Object on multiple lines. |\n| `%o` | Pretty-print an Object all on a single line. |\n| `%s` | String. |\n| `%d` | Number (both integer and float). |\n| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |\n| `%%` | Single percent sign ('%'). This does not consume an argument. |\n\n\n### Custom formatters\n\nYou can add custom formatters by extending the `debug.formatters` object.\nFor example, if you wanted to add support for rendering a Buffer as hex with\n`%h`, you could do something like:\n\n```js\nconst createDebug = require('debug')\ncreateDebug.formatters.h = (v) => {\n return v.toString('hex')\n}\n\n// …elsewhere\nconst debug = createDebug('foo')\ndebug('this is hex: %h', new Buffer('hello world'))\n// foo this is hex: 68656c6c6f20776f726c6421 +0ms\n```\n\n\n## Browser Support\n\nYou can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),\nor just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),\nif you don't want to build it yourself.\n\nDebug's enable state is currently persisted by `localStorage`.\nConsider the situation shown below where you have `worker:a` and `worker:b`,\nand wish to debug both. You can enable this using `localStorage.debug`:\n\n```js\nlocalStorage.debug = 'worker:*'\n```\n\nAnd then refresh the page.\n\n```js\na = debug('worker:a');\nb = debug('worker:b');\n\nsetInterval(function(){\n a('doing some work');\n}, 1000);\n\nsetInterval(function(){\n b('doing some work');\n}, 1200);\n```\n\n\n## Output streams\n\n By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:\n\nExample [_stdout.js_](./examples/node/stdout.js):\n\n```js\nvar debug = require('debug');\nvar error = debug('app:error');\n\n// by default stderr is used\nerror('goes to stderr!');\n\nvar log = debug('app:log');\n// set this namespace to log via console.log\nlog.log = console.log.bind(console); // don't forget to bind to console!\nlog('goes to stdout');\nerror('still goes to stderr!');\n\n// set all output to go via console.info\n// overrides all per-namespace log settings\ndebug.log = console.info.bind(console);\nerror('now goes to stdout via console.info');\nlog('still goes to stdout, but via console.info now');\n```\n\n## Extend\nYou can simply extend debugger \n```js\nconst log = require('debug')('auth');\n\n//creates new debug instance with extended namespace\nconst logSign = log.extend('sign');\nconst logLogin = log.extend('login');\n\nlog('hello'); // auth hello\nlogSign('hello'); //auth:sign hello\nlogLogin('hello'); //auth:login hello\n```\n\n## Set dynamically\n\nYou can also enable debug dynamically by calling the `enable()` method :\n\n```js\nlet debug = require('debug');\n\nconsole.log(1, debug.enabled('test'));\n\ndebug.enable('test');\nconsole.log(2, debug.enabled('test'));\n\ndebug.disable();\nconsole.log(3, debug.enabled('test'));\n\n```\n\nprint : \n```\n1 false\n2 true\n3 false\n```\n\nUsage : \n`enable(namespaces)` \n`namespaces` can include modes separated by a colon and wildcards.\n \nNote that calling `enable()` completely overrides previously set DEBUG variable : \n\n```\n$ DEBUG=foo node -e 'var dbg = require(\"debug\"); dbg.enable(\"bar\"); console.log(dbg.enabled(\"foo\"))'\n=> false\n```\n\n## Checking whether a debug target is enabled\n\nAfter you've created a debug instance, you can determine whether or not it is\nenabled by checking the `enabled` property:\n\n```javascript\nconst debug = require('debug')('http');\n\nif (debug.enabled) {\n // do stuff...\n}\n```\n\nYou can also manually toggle this property to force the debug instance to be\nenabled or disabled.\n\n\n## Authors\n\n - TJ Holowaychuk\n - Nathan Rajlich\n - Andrew Rhyne\n\n## Backers\n\nSupport us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Sponsors\n\nBecome a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","maintainers":[{"email":"kolban1@kolban.com","name":"kolban"},{"email":"i.am.qix@gmail.com","name":"qix"},{"email":"i.am.qix@gmail.com","name":"qix-"},{"email":"rhyneandrew@gmail.com","name":"thebigredgeek"},{"email":"tj@vision-media.ca","name":"tjholowaychuk"},{"email":"nathan@tootallnate.net","name":"tootallnate"}],"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"users":{"tellnes":true,"fgribreau":true,"m42am":true,"drudge":true,"megadrive":true,"maxmaximov":true,"oroce":true,"meggesje":true,"nak2k":true,"pid":true,"danielchatfield":true,"buritica":true,"tigefa":true,"einfallstoll":true,"darosh":true,"jfedyczak":true,"appnus":true,"piascikj":true,"evkline":true,"funroll":true,"yi":true,"stonestyle":true,"gabeio":true,"raulb":true,"morishitter":true,"jorgemsrs":true,"fanchangyong":true,"satans17":true,"philippwiddra":true,"mpinteractiv":true,"edalorzo":true,"roboterhund87":true,"tootallnate":true,"joelbair":true,"travelingtechguy":true,"nromano":true,"jokarlist":true,"maschs":true,"juliomarcos":true,"anton-rudeshko":true,"kxbrand":true,"mgesmundo":true,"victorzimmer":true,"fill":true,"dennisgnl":true,"iisii":true,"etiv":true,"gonzalofj":true,"stringparser":true,"passcod":true,"jianping":true,"binnng":true,"ethancai":true,"knownasilya":true,"woverton":true,"lsjroberts":true,"af":true,"faas":true,"ivangaravito":true,"carlton":true,"popomore":true,"52u":true,"ubenzer":true,"kaiquewdev":true,"sierisimo":true,"chzhewl":true,"marcin.operacz":true,"cilindrox":true,"laiff":true,"mikermcneil":true,"assaf":true,"sametsisartenep":true,"santihbc":true,"isalutin":true,"sprjrx":true,"pwaleczek":true,"haeck":true,"ads901119":true,"thimoteus":true,"illbullet":true,"phoward8020":true,"j3kz":true,"paulomcnally":true,"kulakowka":true,"garek":true,"kachar":true,"sessionbean":true,"samhou1988":true,"minghe":true,"seanjh":true,"tophsic":true,"digitalsadhu":true,"barenko":true,"fank":true,"geilt":true,"flockonus":true,"sahilsk":true,"detj":true,"goodseller":true,"simplyianm":true,"nickeljew":true,"dongxu":true,"rbartoli":true,"itonyyo":true,"drhoffmann":true,"jdpagley":true,"kankungyip":true,"vishnuvathsan":true,"legacy":true,"gvn":true,"alexkval":true,"pobrien":true,"tbeseda":true,"nika.interisti":true,"mondalaci":true,"arnold-almeida":true,"budnix":true,"kai_":true,"leonardodavinci":true,"saitodisse":true,"wangnan0610":true,"sasquatch":true,"jasoncheng":true,"sbrajesh":true,"holyzfy":true,"godion":true,"iamwiz":true,"rahman":true,"brandondoran":true,"wenbing":true,"nwinant":true,"etsit":true,"rgbz":true,"darkowlzz":true,"subso":true,"rbecheras":true,"shriek":true,"glebec":true,"craneleeon":true,"gaganblr":true,"nadimix":true,"luuhoangnam":true,"ergunozyurt":true,"nanook":true,"pigram":true,"koslun":true,"cestrensem":true,"developit":true,"demian85":true,"henryorrin":true,"james.talmage":true,"hyzhak":true,"curioussavage":true,"kingtrocki":true,"parkerproject":true,"perrywu":true,"8legged":true,"unstunted":true,"nasser-torabzade":true,"naij":true,"joelwallis":true,"dbck":true,"nayrangnu":true,"battlemidget":true,"jacopkane":true,"honzajde":true,"nice_body":true,"aolu11":true,"princetoad":true,"boyw165":true,"donkino":true,"koulmomo":true,"ksangita":true,"karlbateman":true,"arifulhb":true,"arnoldstoba":true,"andrewconnell":true,"pdedkov":true,"dbendavid":true,"nketchum":true,"xgheaven":true,"vwal":true,"isaacvitor":true,"krabello":true,"aitorllj93":true,"kungkk":true,"yhui02":true,"nohjoono":true,"acollins-ts":true,"wkaifang":true,"iolo":true,"stylemistake":true,"shiva127":true,"necr0":true,"mattqs":true,"temsa":true,"kobleistvan":true,"crazyjingling":true,"takethefire":true,"mkany":true,"nalindak":true,"buzuli":true,"wfalkwallace":true,"fatelei":true,"cshao":true,"preco21":true,"almccann":true,"yokubee":true,"ziliwesley":true,"piyushmakhija":true,"maxidr":true,"stany":true,"kleintobe":true,"po":true,"luislobo":true,"fibo":true,"wynfrith":true,"leahcimic":true,"thebearingedge":true,"kletchatii":true,"jesusgoku":true,"thiagoh":true,"mhfrantz":true,"weisk":true,"ahsanshafiq":true,"sabrina.luo":true,"iroc":true,"piixiiees":true,"bian17888":true,"jonniespratley":true,"algonzo":true,"abdihaikal":true,"cdll":true,"alexbaumgertner":true,"rlgomes":true,"vutran":true,"program247365":true,"nightire":true,"jessaustin":true,"kizzlebot":true,"zacbarton":true,"davidbraun":true,"daviddias":true,"abhisekp":true,"lwgojustgo":true,"dexteryy":true,"dkannan":true,"muukii0803":true,"vishwasc":true,"tribou":true,"wuwenbin":true,"carlosvillademor":true,"antjw":true,"ninozhang":true,"kontrax":true,"qddegtya":true,"onbjerg":true,"janoskk":true,"xieranmaya":true,"eirikbirkeland":true,"markoni":true,"voischev":true,"cmechlin":true,"hex20dec":true,"nerdybeast":true,"viz":true,"joannerpena":true,"figroc":true,"zhanghaili":true,"orkisz":true,"sdt":true,"lgh06":true,"nukisman":true,"nelix":true,"benzaita":true,"pauljmartinez":true,"martinkock":true,"nhz.io":true,"chris-me":true,"lijinghust":true,"steel1990":true,"jakedetels":true,"ovuncozturk":true,"shan":true,"troels.trvo.dk":true,"codecounselor":true,"kruemelo":true,"dingdean":true,"meshaneian":true,"echaouchna":true,"buru1020":true,"arttse":true,"slicethendice":true,"jasonwang1888":true,"diegorbaquero":true,"monjer":true,"mkoc":true,"benpptung":true,"tht13":true,"eduardocereto":true,"andr":true,"furzeface":true,"whitelynx":true,"jits":true,"clarenceho":true,"alimd":true,"tin-lek":true,"ksyrytczyk":true,"kilkelly":true,"heyimeugene":true,"ackhub":true,"cslater":true,"leomperes":true,"sylvain261":true,"true0r":true,"binq":true,"tylerbrock":true,"schwartzman":true,"liushoukai":true,"evandrix":true,"errhunter":true,"chinmay2893":true,"elussich":true,"zhoutk":true,"dkblay":true,"qmmr":true,"yutwatan":true,"ajduke":true,"akinjide":true,"rdmclin2":true,"scytalezero":true,"bapinney":true,"slowmove":true,"djviolin":true,"hain":true,"operandom":true,"shanewholloway":true,"lousando":true,"brpaz":true,"alin.alexa":true,"klombomb":true,"sunkeyhub":true,"itsakt":true,"nogirev":true,"qbylucky":true,"patoi":true,"i.vispyanskiy":true,"jonathas":true,"stuwest":true,"holly":true,"drewigg":true,"luhalvesbr":true,"nagra":true,"h0ward":true,"rkopylkov":true,"xdream86":true,"markthethomas":true,"jonyweb":true,"tonyljl526":true,"akarem":true,"wendellm":true,"ungurys":true,"ivan.marquez":true,"ymk":true,"adamlu":true,"dracochou":true,"luisgamero":true,"conzi":true,"manikantag":true,"dralc":true,"slurm":true,"szymex73":true,"pwn":true,"rocket0191":true,"cisc":true,"polarpython":true,"clemo":true,"coryrobinson42":true,"radumilici":true,"yesseecity":true,"masonwan":true,"shakakira":true,"lunelson":true,"domjtalbot":true,"tangchr":true,"galenandrew":true,"soenkekluth":true,"codebyren":true,"nathanbuchar":true,"npsm":true,"quafoo":true,"goody":true,"gilson004":true,"dushanminic":true,"andygreenegrass":true,"dr_blue":true,"knoja4":true,"yangtze":true,"ahvonenj":true,"mojaray2k":true,"fwoelffel":true,"fabien0102":true,"fgmnts":true,"coolhanddev":true,"garenyondem":true,"mr-smiley":true,"tomasmax":true,"alexey-mish":true,"qqcome110":true,"jmanuelrosa":true,"gher":true,"paroczi":true,"rylan_yan":true,"wangfeia":true,"bobxuyang":true,"irnnr":true,"rich-97":true,"lukaserat":true,"arefm":true,"ahmetertem":true,"tangweikun":true,"usingthesystem":true,"chrisco":true,"code-curious":true,"danielye":true,"nohomey":true,"miroklarin":true,"vasz":true,"joaquin.briceno":true,"l8niteowl":true,"aquiandres":true,"hal9zillion":true,"jkrusinski":true,"slowfish":true,"shangsinian":true,"adeelp":true,"spences10":true,"dduran1967":true,"suddi":true,"rakeshmakam":true,"rmjames":true,"miloc":true,"twierbach":true,"jordan-carney":true,"piecioshka":true,"laomu":true,"leonzhao":true,"rogeruiz":true,"isa424":true,"mhaidarh":true,"bradnauta":true,"huarse":true,"aggrotek":true,"koobitor":true,"shrimpseaweed":true,"beenorgone":true,"ssljivic":true,"gomoto":true,"xueboren":true,"qingleili":true,"xiaochao":true,"pumpersonda":true,"junos":true,"shuoshubao":true,"yatsu":true,"eshaanmathur":true,"icodeforcookies":true,"mwurzberger":true,"hugovila":true,"dmitr":true,"ritsu":true,"asaupup":true,"miadzadfallah":true,"keenwon":true,"chinawolf_wyp":true,"kodekracker":true,"gpuente":true,"oboochin":true,"larrychen":true,"udnisap":true,"konstantin.kai":true,"xyyjk":true,"gavinning":true,"jimmyboh":true,"pmbenjamin":true,"maxwelldu":true,"ramy":true,"usex":true,"trewaters":true,"noah_":true,"cheapsteak":true,"evanshortiss":true,"jon_shen":true,"lusai":true,"sibawite":true,"brentonhouse":true,"pddivine":true,"subinvarghesein":true,"shyamguth":true,"junjiansyu":true,"daniel-zahariev":true,"seasons521":true,"hema":true,"abdul":true,"deubaka":true,"sprying":true,"liunian":true,"kuzmicheff":true,"edwardxyt":true,"dreamh":true,"ljmf00":true,"stone-jin":true,"csuermann":true,"tomasgvivo":true,"xtx1130":true,"krzych93":true,"greganswer":true,"hndev":true,"xfloops":true,"cetincem":true,"ctlnrd":true,"grabantot":true,"thangakumar":true,"xinwangwang":true,"azz":true,"nguyenmanhdat2903":true,"yikuo":true,"arbauman":true,"majkel":true,"d-band":true,"largepuma":true,"karuppiah":true,"isayme":true,"doxy":true,"ronin161":true,"npm-packages":true,"button0501":true,"sajera":true,"tonerbarato":true,"atomgao":true,"npmmurali":true,"vision_tecnologica":true,"gresite_piscinas":true,"helderam":true,"maycon_ribeiro":true,"granhermandadblanca":true,"suryasaripalli":true,"thor_bux":true,"itcorp":true,"tomgao365":true,"colageno":true,"cedx":true,"sternelee":true,"mdang8":true,"darrentorpey":true,"creativeadea":true,"k-kuwahara":true,"robinblomberg":true,"lulubozichang":true,"serge-nikitin":true,"heartnett":true,"joni3k":true,"jrejaud":true,"vapeadores":true,"raycharles":true,"nuwaio":true,"lijsh":true,"rochejul":true,"meeh":true,"spanishtights":true,"mrzmmr":true,"xu_q90":true,"itesic":true,"ferx":true,"laudeon":true,"sumit270":true,"womjoy":true,"highgravity":true,"pandabao":true,"morogasper":true,"bhedge":true,"behumble":true,"dbendy":true,"jshcrowthe":true,"nikovitto":true,"sbskl":true,"bblackwo":true,"guyharwood":true,"jeremy_yang":true,"dh19911021":true,"tcrowe":true,"xsilen":true,"stormcrows":true,"roylewis123":true,"ccastelli":true,"shahabkhalvati":true,"brainpoint":true,"alexc1212":true,"sdove1":true,"neaker15668":true,"vparaskevas":true,"danielheene":true,"2lach":true,"donotor":true,"jota":true,"mig38m":true,"johnstru16":true,"tpkn":true,"edjroz":true,"kremr":true,"donecharlton":true,"leakon":true,"azulejosmetrosubway":true,"instazapas":true,"yakumat":true,"codeinpixel":true,"allen_lyu":true,"dresende":true,"cyma-soluciones":true,"endsun":true,"zalithka":true,"bursalia-gestion":true,"71emj1":true,"kostya.fokin":true,"eyson":true,"dyakovk":true,"scott.m.sarsfield":true,"skarlso":true,"luiscauro":true,"pldin601":true,"laoshaw":true,"helcat":true,"iceriver2":true,"nickgogan":true,"xrush":true,"ricardweii":true,"daskepon":true,"heineiuo":true,"thevikingcoder":true,"aronblake":true,"cr8tiv":true,"avivharuzi":true,"tedyhy":true,"debashish":true,"mdedirudianto":true,"imaginegenesis":true,"y-a-v-a":true,"natterstefan":true,"vidhuz":true,"cphayim":true,"srksumanth":true,"semir2":true,"aereobarato":true,"divyanshbatham":true,"iamninad":true,"millercl":true,"1cr18ni9":true,"kamikadze4game":true,"julon":true,"gestoria-madrid":true,"kamirdjanian":true,"diogocapela":true,"haroun":true,"clwm01":true,"n1kk":true,"zhangaz1":true,"eswat2":true,"hyanghai":true,"thefox":true,"shashankpallerla":true,"rafamel":true,"huiyifyj":true,"thekuzia":true,"edmondnow":true,"mohokh67":true,"yowainwright":true,"rossdavis":true,"naokikimura":true,"ruchirgodura":true,"dec_f":true,"mjurincic":true,"jwv":true,"huyz":true,"karzanosman984":true,"losymear":true,"robsoer":true,"tooyond":true,"erickeno":true,"glek":true,"michaelermer":true,"josudoey":true,"xiaobing":true,"philosec":true,"jream":true},"repository":{"type":"git","url":"git://github.com/visionmedia/debug.git"},"homepage":"https://github.com/visionmedia/debug#readme","keywords":["debug","log","debugger"],"bugs":{"url":"https://github.com/visionmedia/debug/issues"},"readmeFilename":"README.md","contributors":[{"name":"Nathan Rajlich","email":"nathan@tootallnate.net","url":"http://n8.io"},{"name":"Andrew Rhyne","email":"rhyneandrew@gmail.com"}],"license":"MIT","manifest":{"name":"debug","version":"3.1.0","repository":{"type":"git","url":"git://github.com/visionmedia/debug.git"},"description":"small debugging utility","keywords":["debug","log","debugger"],"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"contributors":[{"name":"Nathan Rajlich","email":"nathan@tootallnate.net","url":"http://n8.io"},{"name":"Andrew Rhyne","email":"rhyneandrew@gmail.com"}],"license":"MIT","dependencies":{"ms":"2.0.0"},"devDependencies":{"browserify":"14.4.0","chai":"^3.5.0","concurrently":"^3.1.0","coveralls":"^2.11.15","eslint":"^3.12.1","istanbul":"^0.4.5","karma":"^1.3.0","karma-chai":"^0.1.0","karma-mocha":"^1.3.0","karma-phantomjs-launcher":"^1.0.2","karma-sinon":"^1.0.5","mocha":"^3.2.0","mocha-lcov-reporter":"^1.2.0","rimraf":"^2.5.4","sinon":"^1.17.6","sinon-chai":"^2.8.0"},"main":"./src/index.js","browser":"./src/browser.js","gitHead":"f073e056f33efdd5b311381eb6bca2bc850745bf","bugs":{"url":"https://github.com/visionmedia/debug/issues"},"homepage":"https://github.com/visionmedia/debug#readme","_id":"debug@3.1.0","_npmVersion":"5.3.0","_nodeVersion":"8.4.0","_npmUser":{"name":"tootallnate","email":"nathan@tootallnate.net"},"dist":{"integrity":"sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==","shasum":"5bb5a0672628b64149566ba16819e61518c67261","tarball":"https://registry.npmjs.org/debug/-/debug-3.1.0.tgz"},"maintainers":[{"email":"rhyneandrew@gmail.com","name":"thebigredgeek"},{"email":"kolban1@kolban.com","name":"kolban"},{"email":"nathan@tootallnate.net","name":"tootallnate"},{"email":"tj@vision-media.ca","name":"tjholowaychuk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/debug-3.1.0.tgz_1506453230282_0.13498495938256383"},"directories":{}},"releaseDate":"2017-09-26T19:13:51.492Z"},"sourceInfo":{"type":"git","provider":"github","namespace":"visionmedia","name":"debug","revision":"f073e056f33efdd5b311381eb6bca2bc850745bf","url":null,"path":null},"interestingFiles":[{"path":"LICENSE","token":"98c970de440dcfc77471610aec2377c9d9b0db2b3be6d1add524a586e1d7f422"}]} \ No newline at end of file diff --git a/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.3.4.json b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.3.4.json new file mode 100644 index 000000000..aa882af13 --- /dev/null +++ b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.3.4.json @@ -0,0 +1 @@ +{"_metadata":{"type":"npm","url":"cd:/npm/npmjs/-/debug/3.1.0","fetchedAt":"2019-03-14T03:23:10.187Z","links":{"self":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:clearlydefined:1.3.4","type":"resource"},"siblings":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:clearlydefined","type":"collection"},"licensee":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:licensee","type":"collection"},"fossology":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:fossology","type":"collection"},"scancode":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:scancode","type":"collection"},"source":{"href":"urn:git:github:visionmedia:debug:revision:f073e056f33efdd5b311381eb6bca2bc850745bf","type":"resource"}},"schemaVersion":"1.3.4","toolVersion":"1.1.4","processedAt":"2019-03-14T03:23:10.314Z"},"attachments":[{"path":"package/LICENSE","token":"98c970de440dcfc77471610aec2377c9d9b0db2b3be6d1add524a586e1d7f422"},{"path":"package/package.json","token":"607790755743bf6fffb337f7661460fda64b9de81b0f3e4c27954ea41b46abd3"}],"summaryInfo":{"k":64,"count":15,"hashes":{"sha1":"5bb5a0672628b64149566ba16819e61518c67261","sha256":"dac8e5de92ce0e149d5708c893ef9d401fe80729ce9a0d66b4f40678708fd5ec"}},"files":[{"path":"package/.coveralls.yml","hashes":{"sha1":"90709e4fb4ce17729974b3a140ccbf330519835c","sha256":"64e6b64f19837a76c30865579aabdde1a825729ae0204ba73ba6de77296ce18e"}},{"path":"package/.eslintrc","hashes":{"sha1":"9249b5c46b21d7e51bd0d9ad96c27d7a7a1d720b","sha256":"66c124aad9fb6effb2cd86912a97aeb5d9a03cfcb60b18da1bc0e0f6a100bcd2"}},{"path":"package/.npmignore","hashes":{"sha1":"90fef7cc1058bd0f85b0959c4fcd49230a29593e","sha256":"f4580152a6f48954b44cb2a0a002fa500467663db5a6dc8e796b52533dc04ec1"}},{"path":"package/.travis.yml","hashes":{"sha1":"ad20938f07f056cbbdb35383aebc88feb5ecc361","sha256":"f0698f642c1a37c840f4eda339b197bb7e563f5ffeabc65312608fa4d31cfbf6"}},{"path":"package/CHANGELOG.md","hashes":{"sha1":"9e7ab0e94f1d90c8073a4f75c79e01e2d86bef4c","sha256":"7a4879d2b37c50ed15d18a51c07905f993588873d7730b1584db386f81588d34"}},{"path":"package/LICENSE","hashes":{"sha1":"d16a2786962571280a11cae01d5e59aeb1351c9a","sha256":"98c970de440dcfc77471610aec2377c9d9b0db2b3be6d1add524a586e1d7f422"}},{"path":"package/Makefile","hashes":{"sha1":"27ba9abecf06bf547905c50f5979caff65574b4c","sha256":"6710a17e1572ed23600b5746cb6bae63bb0fa27b46c4e5a1604e45956edbccea"}},{"path":"package/README.md","hashes":{"sha1":"65d9d60fa0cd4cb997ec0b4d7aff8390aef24401","sha256":"5d6ccbbfbc3baeed80ca7253ae6641e9f28b4746e5eef5e4095f6635e2e3af57"}},{"path":"package/karma.conf.js","hashes":{"sha1":"93fef7cf3ed6f04d2cfc3cd0b8d5d972d35cfd29","sha256":"2430869adb61a5e24a3612110a9b49a948e6db43ab7e947c003a9c19c478e609"}},{"path":"package/node.js","hashes":{"sha1":"aa7655ee80c9a485313675f9379c2f18d33ea061","sha256":"996b381f353555cb172ebb2802bb2a7323442ff67b7b530cc26834058d7f31a2"}},{"path":"package/package.json","hashes":{"sha1":"ea58ffe857db300084291a1b7bd73c08e4fd69ca","sha256":"607790755743bf6fffb337f7661460fda64b9de81b0f3e4c27954ea41b46abd3"}},{"path":"package/src/browser.js","hashes":{"sha1":"836c2d882a28ef05767ab67e4499b443922d7adf","sha256":"ff0797d27d04ba7f69485abb04357ec274d6e0e896896e6cf640d29a9d399bb0"}},{"path":"package/src/debug.js","hashes":{"sha1":"58e3676c3989d3f6c03fa8f50485c1249a0b148a","sha256":"c2df5319cf8768d1bb64f99f74e7dc14188a9455b20509b9a8c4bd126a2b5e4e"}},{"path":"package/src/index.js","hashes":{"sha1":"be4a5e319ff5c28b88a1ab4d272b59bd420e22e3","sha256":"27a340bb23865b2eee705d7fdc000538ad2664564bfd2148f30cc5921ceb722e"}},{"path":"package/src/node.js","hashes":{"sha1":"6a0da57e0adbfe592cc3df2c2e708083f7dcad28","sha256":"23a1f983515544cdb386e1c17605ec4717399ac95c1be9d8f1cb5b2c116a1494"}}],"package.json":{"name":"debug","version":"3.1.0","repository":{"type":"git","url":"git://github.com/visionmedia/debug.git"},"description":"small debugging utility","keywords":["debug","log","debugger"],"author":"TJ Holowaychuk ","contributors":["Nathan Rajlich (http://n8.io)","Andrew Rhyne "],"license":"MIT","dependencies":{"ms":"2.0.0"},"devDependencies":{"browserify":"14.4.0","chai":"^3.5.0","concurrently":"^3.1.0","coveralls":"^2.11.15","eslint":"^3.12.1","istanbul":"^0.4.5","karma":"^1.3.0","karma-chai":"^0.1.0","karma-mocha":"^1.3.0","karma-phantomjs-launcher":"^1.0.2","karma-sinon":"^1.0.5","mocha":"^3.2.0","mocha-lcov-reporter":"^1.2.0","rimraf":"^2.5.4","sinon":"^1.17.6","sinon-chai":"^2.8.0"},"main":"./src/index.js","browser":"./src/browser.js"},"registryData":{"_id":"debug","_rev":"901-d5a7726a6c12fb5b68b86f9674681f93","name":"debug","description":"small debugging utility","dist-tags":{"latest":"4.1.1"},"readme":"# debug\n[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers)\n[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)\n\n\n\nA tiny JavaScript debugging utility modelled after Node.js core's debugging\ntechnique. Works in Node.js and web browsers.\n\n## Installation\n\n```bash\n$ npm install debug\n```\n\n## Usage\n\n`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.\n\nExample [_app.js_](./examples/node/app.js):\n\n```js\nvar debug = require('debug')('http')\n , http = require('http')\n , name = 'My App';\n\n// fake app\n\ndebug('booting %o', name);\n\nhttp.createServer(function(req, res){\n debug(req.method + ' ' + req.url);\n res.end('hello\\n');\n}).listen(3000, function(){\n debug('listening');\n});\n\n// fake worker of some kind\n\nrequire('./worker');\n```\n\nExample [_worker.js_](./examples/node/worker.js):\n\n```js\nvar a = require('debug')('worker:a')\n , b = require('debug')('worker:b');\n\nfunction work() {\n a('doing lots of uninteresting work');\n setTimeout(work, Math.random() * 1000);\n}\n\nwork();\n\nfunction workb() {\n b('doing some work');\n setTimeout(workb, Math.random() * 2000);\n}\n\nworkb();\n```\n\nThe `DEBUG` environment variable is then used to enable these based on space or\ncomma-delimited names.\n\nHere are some examples:\n\n\"screen\n\"screen\n\"screen\n\n#### Windows command prompt notes\n\n##### CMD\n\nOn Windows the environment variable is set using the `set` command.\n\n```cmd\nset DEBUG=*,-not_this\n```\n\nExample:\n\n```cmd\nset DEBUG=* & node app.js\n```\n\n##### PowerShell (VS Code default)\n\nPowerShell uses different syntax to set environment variables.\n\n```cmd\n$env:DEBUG = \"*,-not_this\"\n```\n\nExample:\n\n```cmd\n$env:DEBUG='app';node app.js\n```\n\nThen, run the program to be debugged as usual.\n\nnpm script example:\n```js\n \"windowsDebug\": \"@powershell -Command $env:DEBUG='*';node app.js\",\n```\n\n## Namespace Colors\n\nEvery debug instance has a color generated for it based on its namespace name.\nThis helps when visually parsing the debug output to identify which debug instance\na debug line belongs to.\n\n#### Node.js\n\nIn Node.js, colors are enabled when stderr is a TTY. You also _should_ install\nthe [`supports-color`](https://npmjs.org/supports-color) module alongside debug,\notherwise debug will only use a small handful of basic colors.\n\n\n\n#### Web Browser\n\nColors are also enabled on \"Web Inspectors\" that understand the `%c` formatting\noption. These are WebKit web inspectors, Firefox ([since version\n31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))\nand the Firebug plugin for Firefox (any version).\n\n\n\n\n## Millisecond diff\n\nWhen actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the \"+NNNms\" will show you how much time was spent between calls.\n\n\n\nWhen stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below:\n\n\n\n\n## Conventions\n\nIf you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use \":\" to separate features. For example \"bodyParser\" from Connect would then be \"connect:bodyParser\". If you append a \"*\" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output.\n\n## Wildcards\n\nThe `*` character may be used as a wildcard. Suppose for example your library has\ndebuggers named \"connect:bodyParser\", \"connect:compress\", \"connect:session\",\ninstead of listing all three with\n`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do\n`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.\n\nYou can also exclude specific debuggers by prefixing them with a \"-\" character.\nFor example, `DEBUG=*,-connect:*` would include all debuggers except those\nstarting with \"connect:\".\n\n## Environment Variables\n\nWhen running through Node.js, you can set a few environment variables that will\nchange the behavior of the debug logging:\n\n| Name | Purpose |\n|-----------|-------------------------------------------------|\n| `DEBUG` | Enables/disables specific debugging namespaces. |\n| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). |\n| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |\n| `DEBUG_DEPTH` | Object inspection depth. |\n| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |\n\n\n__Note:__ The environment variables beginning with `DEBUG_` end up being\nconverted into an Options object that gets used with `%o`/`%O` formatters.\nSee the Node.js documentation for\n[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)\nfor the complete list.\n\n## Formatters\n\nDebug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting.\nBelow are the officially supported formatters:\n\n| Formatter | Representation |\n|-----------|----------------|\n| `%O` | Pretty-print an Object on multiple lines. |\n| `%o` | Pretty-print an Object all on a single line. |\n| `%s` | String. |\n| `%d` | Number (both integer and float). |\n| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |\n| `%%` | Single percent sign ('%'). This does not consume an argument. |\n\n\n### Custom formatters\n\nYou can add custom formatters by extending the `debug.formatters` object.\nFor example, if you wanted to add support for rendering a Buffer as hex with\n`%h`, you could do something like:\n\n```js\nconst createDebug = require('debug')\ncreateDebug.formatters.h = (v) => {\n return v.toString('hex')\n}\n\n// …elsewhere\nconst debug = createDebug('foo')\ndebug('this is hex: %h', new Buffer('hello world'))\n// foo this is hex: 68656c6c6f20776f726c6421 +0ms\n```\n\n\n## Browser Support\n\nYou can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),\nor just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),\nif you don't want to build it yourself.\n\nDebug's enable state is currently persisted by `localStorage`.\nConsider the situation shown below where you have `worker:a` and `worker:b`,\nand wish to debug both. You can enable this using `localStorage.debug`:\n\n```js\nlocalStorage.debug = 'worker:*'\n```\n\nAnd then refresh the page.\n\n```js\na = debug('worker:a');\nb = debug('worker:b');\n\nsetInterval(function(){\n a('doing some work');\n}, 1000);\n\nsetInterval(function(){\n b('doing some work');\n}, 1200);\n```\n\n\n## Output streams\n\n By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:\n\nExample [_stdout.js_](./examples/node/stdout.js):\n\n```js\nvar debug = require('debug');\nvar error = debug('app:error');\n\n// by default stderr is used\nerror('goes to stderr!');\n\nvar log = debug('app:log');\n// set this namespace to log via console.log\nlog.log = console.log.bind(console); // don't forget to bind to console!\nlog('goes to stdout');\nerror('still goes to stderr!');\n\n// set all output to go via console.info\n// overrides all per-namespace log settings\ndebug.log = console.info.bind(console);\nerror('now goes to stdout via console.info');\nlog('still goes to stdout, but via console.info now');\n```\n\n## Extend\nYou can simply extend debugger \n```js\nconst log = require('debug')('auth');\n\n//creates new debug instance with extended namespace\nconst logSign = log.extend('sign');\nconst logLogin = log.extend('login');\n\nlog('hello'); // auth hello\nlogSign('hello'); //auth:sign hello\nlogLogin('hello'); //auth:login hello\n```\n\n## Set dynamically\n\nYou can also enable debug dynamically by calling the `enable()` method :\n\n```js\nlet debug = require('debug');\n\nconsole.log(1, debug.enabled('test'));\n\ndebug.enable('test');\nconsole.log(2, debug.enabled('test'));\n\ndebug.disable();\nconsole.log(3, debug.enabled('test'));\n\n```\n\nprint : \n```\n1 false\n2 true\n3 false\n```\n\nUsage : \n`enable(namespaces)` \n`namespaces` can include modes separated by a colon and wildcards.\n \nNote that calling `enable()` completely overrides previously set DEBUG variable : \n\n```\n$ DEBUG=foo node -e 'var dbg = require(\"debug\"); dbg.enable(\"bar\"); console.log(dbg.enabled(\"foo\"))'\n=> false\n```\n\n`disable()`\n\nWill disable all namespaces. The functions returns the namespaces currently\nenabled (and skipped). This can be useful if you want to disable debugging\ntemporarily without knowing what was enabled to begin with.\n\nFor example:\n\n```js\nlet debug = require('debug');\ndebug.enable('foo:*,-foo:bar');\nlet namespaces = debug.disable();\ndebug.enable(namespaces);\n```\n\nNote: There is no guarantee that the string will be identical to the initial\nenable string, but semantically they will be identical.\n\n## Checking whether a debug target is enabled\n\nAfter you've created a debug instance, you can determine whether or not it is\nenabled by checking the `enabled` property:\n\n```javascript\nconst debug = require('debug')('http');\n\nif (debug.enabled) {\n // do stuff...\n}\n```\n\nYou can also manually toggle this property to force the debug instance to be\nenabled or disabled.\n\n\n## Authors\n\n - TJ Holowaychuk\n - Nathan Rajlich\n - Andrew Rhyne\n\n## Backers\n\nSupport us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Sponsors\n\nBecome a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","maintainers":[{"email":"i.am.qix@gmail.com","name":"qix"},{"email":"rhyneandrew@gmail.com","name":"thebigredgeek"},{"email":"tj@vision-media.ca","name":"tjholowaychuk"},{"email":"nathan@tootallnate.net","name":"tootallnate"}],"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"users":{"tellnes":true,"fgribreau":true,"m42am":true,"drudge":true,"megadrive":true,"maxmaximov":true,"oroce":true,"meggesje":true,"nak2k":true,"pid":true,"danielchatfield":true,"buritica":true,"tigefa":true,"einfallstoll":true,"darosh":true,"jfedyczak":true,"appnus":true,"piascikj":true,"evkline":true,"funroll":true,"yi":true,"stonestyle":true,"gabeio":true,"raulb":true,"morishitter":true,"jorgemsrs":true,"fanchangyong":true,"satans17":true,"philippwiddra":true,"mpinteractiv":true,"edalorzo":true,"roboterhund87":true,"tootallnate":true,"joelbair":true,"travelingtechguy":true,"nromano":true,"jokarlist":true,"maschs":true,"juliomarcos":true,"anton-rudeshko":true,"kxbrand":true,"mgesmundo":true,"victorzimmer":true,"fill":true,"dennisgnl":true,"iisii":true,"etiv":true,"gonzalofj":true,"stringparser":true,"passcod":true,"jianping":true,"binnng":true,"ethancai":true,"knownasilya":true,"woverton":true,"lsjroberts":true,"af":true,"faas":true,"ivangaravito":true,"carlton":true,"popomore":true,"52u":true,"ubenzer":true,"kaiquewdev":true,"sierisimo":true,"chzhewl":true,"marcin.operacz":true,"cilindrox":true,"laiff":true,"mikermcneil":true,"assaf":true,"sametsisartenep":true,"santihbc":true,"isalutin":true,"sprjrx":true,"pwaleczek":true,"haeck":true,"ads901119":true,"thimoteus":true,"illbullet":true,"phoward8020":true,"j3kz":true,"paulomcnally":true,"kulakowka":true,"garek":true,"kachar":true,"sessionbean":true,"samhou1988":true,"minghe":true,"seanjh":true,"tophsic":true,"digitalsadhu":true,"barenko":true,"fank":true,"geilt":true,"flockonus":true,"sahilsk":true,"detj":true,"goodseller":true,"simplyianm":true,"nickeljew":true,"dongxu":true,"rbartoli":true,"itonyyo":true,"drhoffmann":true,"jdpagley":true,"kankungyip":true,"vishnuvathsan":true,"legacy":true,"gvn":true,"alexkval":true,"pobrien":true,"tbeseda":true,"nika.interisti":true,"mondalaci":true,"arnold-almeida":true,"budnix":true,"kai_":true,"leonardodavinci":true,"saitodisse":true,"wangnan0610":true,"sasquatch":true,"jasoncheng":true,"sbrajesh":true,"holyzfy":true,"godion":true,"iamwiz":true,"rahman":true,"brandondoran":true,"wenbing":true,"nwinant":true,"etsit":true,"rgbz":true,"darkowlzz":true,"subso":true,"rbecheras":true,"shriek":true,"glebec":true,"craneleeon":true,"gaganblr":true,"nadimix":true,"luuhoangnam":true,"ergunozyurt":true,"nanook":true,"pigram":true,"koslun":true,"cestrensem":true,"developit":true,"demian85":true,"henryorrin":true,"james.talmage":true,"hyzhak":true,"curioussavage":true,"kingtrocki":true,"parkerproject":true,"perrywu":true,"8legged":true,"unstunted":true,"nasser-torabzade":true,"naij":true,"joelwallis":true,"dbck":true,"nayrangnu":true,"battlemidget":true,"jacopkane":true,"honzajde":true,"nice_body":true,"aolu11":true,"princetoad":true,"boyw165":true,"donkino":true,"koulmomo":true,"ksangita":true,"karlbateman":true,"arifulhb":true,"arnoldstoba":true,"andrewconnell":true,"pdedkov":true,"dbendavid":true,"nketchum":true,"xgheaven":true,"vwal":true,"isaacvitor":true,"krabello":true,"aitorllj93":true,"kungkk":true,"yhui02":true,"nohjoono":true,"acollins-ts":true,"wkaifang":true,"iolo":true,"stylemistake":true,"shiva127":true,"necr0":true,"mattqs":true,"temsa":true,"kobleistvan":true,"crazyjingling":true,"takethefire":true,"mkany":true,"nalindak":true,"buzuli":true,"wfalkwallace":true,"fatelei":true,"cshao":true,"preco21":true,"almccann":true,"yokubee":true,"ziliwesley":true,"piyushmakhija":true,"maxidr":true,"stany":true,"kleintobe":true,"po":true,"luislobo":true,"fibo":true,"wynfrith":true,"leahcimic":true,"thebearingedge":true,"kletchatii":true,"jesusgoku":true,"thiagoh":true,"mhfrantz":true,"weisk":true,"ahsanshafiq":true,"sabrina.luo":true,"iroc":true,"piixiiees":true,"bian17888":true,"jonniespratley":true,"algonzo":true,"abdihaikal":true,"cdll":true,"alexbaumgertner":true,"rlgomes":true,"vutran":true,"program247365":true,"nightire":true,"jessaustin":true,"kizzlebot":true,"zacbarton":true,"davidbraun":true,"daviddias":true,"abhisekp":true,"lwgojustgo":true,"dexteryy":true,"dkannan":true,"muukii0803":true,"vishwasc":true,"tribou":true,"wuwenbin":true,"carlosvillademor":true,"antjw":true,"ninozhang":true,"kontrax":true,"qddegtya":true,"onbjerg":true,"janoskk":true,"xieranmaya":true,"eirikbirkeland":true,"markoni":true,"voischev":true,"cmechlin":true,"hex20dec":true,"nerdybeast":true,"viz":true,"joannerpena":true,"figroc":true,"zhanghaili":true,"orkisz":true,"sdt":true,"lgh06":true,"nukisman":true,"nelix":true,"benzaita":true,"pauljmartinez":true,"martinkock":true,"nhz.io":true,"chris-me":true,"lijinghust":true,"steel1990":true,"jakedetels":true,"ovuncozturk":true,"shan":true,"troels.trvo.dk":true,"codecounselor":true,"kruemelo":true,"dingdean":true,"meshaneian":true,"echaouchna":true,"buru1020":true,"arttse":true,"slicethendice":true,"jasonwang1888":true,"diegorbaquero":true,"monjer":true,"mkoc":true,"benpptung":true,"tht13":true,"eduardocereto":true,"andr":true,"furzeface":true,"whitelynx":true,"jits":true,"clarenceho":true,"alimd":true,"tin-lek":true,"ksyrytczyk":true,"kilkelly":true,"heyimeugene":true,"ackhub":true,"cslater":true,"leomperes":true,"sylvain261":true,"true0r":true,"binq":true,"tylerbrock":true,"schwartzman":true,"liushoukai":true,"evandrix":true,"errhunter":true,"chinmay2893":true,"elussich":true,"zhoutk":true,"dkblay":true,"qmmr":true,"yutwatan":true,"ajduke":true,"akinjide":true,"rdmclin2":true,"scytalezero":true,"bapinney":true,"slowmove":true,"djviolin":true,"hain":true,"operandom":true,"shanewholloway":true,"lousando":true,"brpaz":true,"alin.alexa":true,"klombomb":true,"sunkeyhub":true,"itsakt":true,"nogirev":true,"qbylucky":true,"patoi":true,"i.vispyanskiy":true,"jonathas":true,"stuwest":true,"holly":true,"drewigg":true,"luhalvesbr":true,"nagra":true,"h0ward":true,"rkopylkov":true,"xdream86":true,"markthethomas":true,"jonyweb":true,"tonyljl526":true,"akarem":true,"wendellm":true,"ungurys":true,"ivan.marquez":true,"ymk":true,"adamlu":true,"dracochou":true,"luisgamero":true,"conzi":true,"manikantag":true,"dralc":true,"slurm":true,"szymex73":true,"pwn":true,"rocket0191":true,"cisc":true,"polarpython":true,"clemo":true,"coryrobinson42":true,"radumilici":true,"yesseecity":true,"masonwan":true,"shakakira":true,"lunelson":true,"domjtalbot":true,"tangchr":true,"galenandrew":true,"soenkekluth":true,"codebyren":true,"nathanbuchar":true,"npsm":true,"quafoo":true,"goody":true,"gilson004":true,"dushanminic":true,"andygreenegrass":true,"dr_blue":true,"knoja4":true,"yangtze":true,"ahvonenj":true,"mojaray2k":true,"fwoelffel":true,"fabien0102":true,"fgmnts":true,"coolhanddev":true,"garenyondem":true,"mr-smiley":true,"tomasmax":true,"alexey-mish":true,"qqcome110":true,"jmanuelrosa":true,"gher":true,"paroczi":true,"rylan_yan":true,"wangfeia":true,"bobxuyang":true,"irnnr":true,"rich-97":true,"lukaserat":true,"arefm":true,"ahmetertem":true,"tangweikun":true,"usingthesystem":true,"chrisco":true,"code-curious":true,"danielye":true,"nohomey":true,"miroklarin":true,"vasz":true,"joaquin.briceno":true,"l8niteowl":true,"aquiandres":true,"hal9zillion":true,"jkrusinski":true,"slowfish":true,"shangsinian":true,"adeelp":true,"spences10":true,"dduran1967":true,"suddi":true,"rakeshmakam":true,"rmjames":true,"miloc":true,"twierbach":true,"jordan-carney":true,"piecioshka":true,"laomu":true,"leonzhao":true,"rogeruiz":true,"isa424":true,"mhaidarh":true,"bradnauta":true,"huarse":true,"aggrotek":true,"koobitor":true,"shrimpseaweed":true,"beenorgone":true,"ssljivic":true,"gomoto":true,"xueboren":true,"qingleili":true,"xiaochao":true,"pumpersonda":true,"junos":true,"shuoshubao":true,"yatsu":true,"eshaanmathur":true,"icodeforcookies":true,"mwurzberger":true,"hugovila":true,"dmitr":true,"ritsu":true,"asaupup":true,"miadzadfallah":true,"keenwon":true,"chinawolf_wyp":true,"kodekracker":true,"gpuente":true,"oboochin":true,"larrychen":true,"udnisap":true,"konstantin.kai":true,"xyyjk":true,"gavinning":true,"jimmyboh":true,"pmbenjamin":true,"maxwelldu":true,"ramy":true,"usex":true,"trewaters":true,"noah_":true,"cheapsteak":true,"evanshortiss":true,"jon_shen":true,"lusai":true,"sibawite":true,"brentonhouse":true,"pddivine":true,"subinvarghesein":true,"shyamguth":true,"junjiansyu":true,"daniel-zahariev":true,"seasons521":true,"hema":true,"abdul":true,"deubaka":true,"sprying":true,"liunian":true,"kuzmicheff":true,"edwardxyt":true,"dreamh":true,"ljmf00":true,"stone-jin":true,"csuermann":true,"tomasgvivo":true,"xtx1130":true,"krzych93":true,"greganswer":true,"hndev":true,"xfloops":true,"cetincem":true,"ctlnrd":true,"grabantot":true,"thangakumar":true,"xinwangwang":true,"azz":true,"nguyenmanhdat2903":true,"yikuo":true,"arbauman":true,"majkel":true,"d-band":true,"largepuma":true,"karuppiah":true,"isayme":true,"doxy":true,"ronin161":true,"npm-packages":true,"button0501":true,"sajera":true,"tonerbarato":true,"atomgao":true,"npmmurali":true,"vision_tecnologica":true,"gresite_piscinas":true,"helderam":true,"maycon_ribeiro":true,"granhermandadblanca":true,"suryasaripalli":true,"thor_bux":true,"itcorp":true,"tomgao365":true,"colageno":true,"cedx":true,"sternelee":true,"mdang8":true,"darrentorpey":true,"creativeadea":true,"k-kuwahara":true,"robinblomberg":true,"lulubozichang":true,"serge-nikitin":true,"heartnett":true,"joni3k":true,"jrejaud":true,"vapeadores":true,"raycharles":true,"nuwaio":true,"lijsh":true,"rochejul":true,"meeh":true,"spanishtights":true,"mrzmmr":true,"xu_q90":true,"itesic":true,"ferx":true,"laudeon":true,"sumit270":true,"womjoy":true,"highgravity":true,"pandabao":true,"morogasper":true,"bhedge":true,"behumble":true,"dbendy":true,"jshcrowthe":true,"nikovitto":true,"sbskl":true,"bblackwo":true,"guyharwood":true,"jeremy_yang":true,"dh19911021":true,"tcrowe":true,"xsilen":true,"stormcrows":true,"roylewis123":true,"ccastelli":true,"shahabkhalvati":true,"brainpoint":true,"alexc1212":true,"sdove1":true,"neaker15668":true,"vparaskevas":true,"danielheene":true,"2lach":true,"donotor":true,"jota":true,"mig38m":true,"johnstru16":true,"tpkn":true,"edjroz":true,"kremr":true,"donecharlton":true,"leakon":true,"azulejosmetrosubway":true,"instazapas":true,"yakumat":true,"codeinpixel":true,"allen_lyu":true,"dresende":true,"cyma-soluciones":true,"endsun":true,"zalithka":true,"bursalia-gestion":true,"71emj1":true,"kostya.fokin":true,"eyson":true,"dyakovk":true,"scott.m.sarsfield":true,"skarlso":true,"luiscauro":true,"pldin601":true,"laoshaw":true,"helcat":true,"iceriver2":true,"nickgogan":true,"xrush":true,"ricardweii":true,"daskepon":true,"heineiuo":true,"thevikingcoder":true,"aronblake":true,"cr8tiv":true,"avivharuzi":true,"tedyhy":true,"debashish":true,"mdedirudianto":true,"imaginegenesis":true,"y-a-v-a":true,"natterstefan":true,"vidhuz":true,"cphayim":true,"srksumanth":true,"semir2":true,"aereobarato":true,"divyanshbatham":true,"iamninad":true,"millercl":true,"1cr18ni9":true,"kamikadze4game":true,"julon":true,"gestoria-madrid":true,"kamirdjanian":true,"diogocapela":true,"haroun":true,"clwm01":true,"n1kk":true,"zhangaz1":true,"eswat2":true,"hyanghai":true,"thefox":true,"shashankpallerla":true,"rafamel":true,"huiyifyj":true,"thekuzia":true,"edmondnow":true,"mohokh67":true,"yowainwright":true,"rossdavis":true,"naokikimura":true,"ruchirgodura":true,"dec_f":true,"mjurincic":true,"jwv":true,"huyz":true,"karzanosman984":true,"losymear":true,"robsoer":true,"tooyond":true,"erickeno":true,"glek":true,"michaelermer":true,"josudoey":true,"xiaobing":true,"philosec":true,"jream":true,"kazem1":true,"ahillier":true},"repository":{"type":"git","url":"git://github.com/visionmedia/debug.git"},"homepage":"https://github.com/visionmedia/debug#readme","keywords":["debug","log","debugger"],"bugs":{"url":"https://github.com/visionmedia/debug/issues"},"readmeFilename":"README.md","contributors":[{"name":"Nathan Rajlich","email":"nathan@tootallnate.net","url":"http://n8.io"},{"name":"Andrew Rhyne","email":"rhyneandrew@gmail.com"}],"license":"MIT","manifest":{"name":"debug","version":"3.1.0","repository":{"type":"git","url":"git://github.com/visionmedia/debug.git"},"description":"small debugging utility","keywords":["debug","log","debugger"],"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"contributors":[{"name":"Nathan Rajlich","email":"nathan@tootallnate.net","url":"http://n8.io"},{"name":"Andrew Rhyne","email":"rhyneandrew@gmail.com"}],"license":"MIT","dependencies":{"ms":"2.0.0"},"devDependencies":{"browserify":"14.4.0","chai":"^3.5.0","concurrently":"^3.1.0","coveralls":"^2.11.15","eslint":"^3.12.1","istanbul":"^0.4.5","karma":"^1.3.0","karma-chai":"^0.1.0","karma-mocha":"^1.3.0","karma-phantomjs-launcher":"^1.0.2","karma-sinon":"^1.0.5","mocha":"^3.2.0","mocha-lcov-reporter":"^1.2.0","rimraf":"^2.5.4","sinon":"^1.17.6","sinon-chai":"^2.8.0"},"main":"./src/index.js","browser":"./src/browser.js","gitHead":"f073e056f33efdd5b311381eb6bca2bc850745bf","bugs":{"url":"https://github.com/visionmedia/debug/issues"},"homepage":"https://github.com/visionmedia/debug#readme","_id":"debug@3.1.0","_npmVersion":"5.3.0","_nodeVersion":"8.4.0","_npmUser":{"name":"tootallnate","email":"nathan@tootallnate.net"},"dist":{"integrity":"sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==","shasum":"5bb5a0672628b64149566ba16819e61518c67261","tarball":"https://registry.npmjs.org/debug/-/debug-3.1.0.tgz"},"maintainers":[{"email":"rhyneandrew@gmail.com","name":"thebigredgeek"},{"email":"kolban1@kolban.com","name":"kolban"},{"email":"nathan@tootallnate.net","name":"tootallnate"},{"email":"tj@vision-media.ca","name":"tjholowaychuk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/debug-3.1.0.tgz_1506453230282_0.13498495938256383"},"directories":{}},"releaseDate":"2017-09-26T19:13:51.492Z"},"sourceInfo":{"type":"git","provider":"github","namespace":"visionmedia","name":"debug","revision":"f073e056f33efdd5b311381eb6bca2bc850745bf","url":null,"path":null}} \ No newline at end of file diff --git a/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.json b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.json new file mode 100644 index 000000000..73899dde0 --- /dev/null +++ b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.json @@ -0,0 +1 @@ +{"_metadata":{"type":"npm","url":"cd:/npm/npmjs/-/debug/3.1.0","fetchedAt":"2018-03-12T21:12:23.801Z","links":{"self":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:clearlydefined:1","type":"resource"},"siblings":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:clearlydefined","type":"collection"},"scancode":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:scancode","type":"collection"},"source":{"href":"urn:git:github:visionmedia:debug:revision:f073e056f33efdd5b311381eb6bca2bc850745bf","type":"resource"}},"version":1,"processedAt":"2018-03-12T21:12:23.889Z"},"package.json":{"name":"debug","version":"3.1.0","repository":{"type":"git","url":"git://github.com/visionmedia/debug.git"},"description":"small debugging utility","keywords":["debug","log","debugger"],"author":"TJ Holowaychuk ","contributors":["Nathan Rajlich (http://n8.io)","Andrew Rhyne "],"license":"MIT","dependencies":{"ms":"2.0.0"},"devDependencies":{"browserify":"14.4.0","chai":"^3.5.0","concurrently":"^3.1.0","coveralls":"^2.11.15","eslint":"^3.12.1","istanbul":"^0.4.5","karma":"^1.3.0","karma-chai":"^0.1.0","karma-mocha":"^1.3.0","karma-phantomjs-launcher":"^1.0.2","karma-sinon":"^1.0.5","mocha":"^3.2.0","mocha-lcov-reporter":"^1.2.0","rimraf":"^2.5.4","sinon":"^1.17.6","sinon-chai":"^2.8.0"},"main":"./src/index.js","browser":"./src/browser.js"},"registryData":{"_id":"debug","_rev":"866-0574daac80ea2d410ff731354d35dd5d","name":"debug","description":"small debugging utility","dist-tags":{"latest":"3.1.0"},"readme":"# debug\n[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers)\n[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)\n\n\n\nA tiny JavaScript debugging utility modelled after Node.js core's debugging\ntechnique. Works in Node.js and web browsers.\n\n## Installation\n\n```bash\n$ npm install debug\n```\n\n## Usage\n\n`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.\n\nExample [_app.js_](./examples/node/app.js):\n\n```js\nvar debug = require('debug')('http')\n , http = require('http')\n , name = 'My App';\n\n// fake app\n\ndebug('booting %o', name);\n\nhttp.createServer(function(req, res){\n debug(req.method + ' ' + req.url);\n res.end('hello\\n');\n}).listen(3000, function(){\n debug('listening');\n});\n\n// fake worker of some kind\n\nrequire('./worker');\n```\n\nExample [_worker.js_](./examples/node/worker.js):\n\n```js\nvar a = require('debug')('worker:a')\n , b = require('debug')('worker:b');\n\nfunction work() {\n a('doing lots of uninteresting work');\n setTimeout(work, Math.random() * 1000);\n}\n\nwork();\n\nfunction workb() {\n b('doing some work');\n setTimeout(workb, Math.random() * 2000);\n}\n\nworkb();\n```\n\nThe `DEBUG` environment variable is then used to enable these based on space or\ncomma-delimited names.\n\nHere are some examples:\n\n\"screen\n\"screen\n\"screen\n\n#### Windows note\n\nOn Windows the environment variable is set using the `set` command.\n\n```cmd\nset DEBUG=*,-not_this\n```\n\nNote that PowerShell uses different syntax to set environment variables.\n\n```cmd\n$env:DEBUG = \"*,-not_this\"\n```\n\nThen, run the program to be debugged as usual.\n\n\n## Namespace Colors\n\nEvery debug instance has a color generated for it based on its namespace name.\nThis helps when visually parsing the debug output to identify which debug instance\na debug line belongs to.\n\n#### Node.js\n\nIn Node.js, colors are enabled when stderr is a TTY. You also _should_ install\nthe [`supports-color`](https://npmjs.org/supports-color) module alongside debug,\notherwise debug will only use a small handful of basic colors.\n\n\n\n#### Web Browser\n\nColors are also enabled on \"Web Inspectors\" that understand the `%c` formatting\noption. These are WebKit web inspectors, Firefox ([since version\n31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))\nand the Firebug plugin for Firefox (any version).\n\n\n\n\n## Millisecond diff\n\nWhen actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the \"+NNNms\" will show you how much time was spent between calls.\n\n\n\nWhen stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below:\n\n\n\n\n## Conventions\n\nIf you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use \":\" to separate features. For example \"bodyParser\" from Connect would then be \"connect:bodyParser\". If you append a \"*\" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output.\n\n## Wildcards\n\nThe `*` character may be used as a wildcard. Suppose for example your library has\ndebuggers named \"connect:bodyParser\", \"connect:compress\", \"connect:session\",\ninstead of listing all three with\n`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do\n`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.\n\nYou can also exclude specific debuggers by prefixing them with a \"-\" character.\nFor example, `DEBUG=*,-connect:*` would include all debuggers except those\nstarting with \"connect:\".\n\n## Environment Variables\n\nWhen running through Node.js, you can set a few environment variables that will\nchange the behavior of the debug logging:\n\n| Name | Purpose |\n|-----------|-------------------------------------------------|\n| `DEBUG` | Enables/disables specific debugging namespaces. |\n| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). |\n| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |\n| `DEBUG_DEPTH` | Object inspection depth. |\n| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |\n\n\n__Note:__ The environment variables beginning with `DEBUG_` end up being\nconverted into an Options object that gets used with `%o`/`%O` formatters.\nSee the Node.js documentation for\n[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)\nfor the complete list.\n\n## Formatters\n\nDebug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting.\nBelow are the officially supported formatters:\n\n| Formatter | Representation |\n|-----------|----------------|\n| `%O` | Pretty-print an Object on multiple lines. |\n| `%o` | Pretty-print an Object all on a single line. |\n| `%s` | String. |\n| `%d` | Number (both integer and float). |\n| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |\n| `%%` | Single percent sign ('%'). This does not consume an argument. |\n\n\n### Custom formatters\n\nYou can add custom formatters by extending the `debug.formatters` object.\nFor example, if you wanted to add support for rendering a Buffer as hex with\n`%h`, you could do something like:\n\n```js\nconst createDebug = require('debug')\ncreateDebug.formatters.h = (v) => {\n return v.toString('hex')\n}\n\n// …elsewhere\nconst debug = createDebug('foo')\ndebug('this is hex: %h', new Buffer('hello world'))\n// foo this is hex: 68656c6c6f20776f726c6421 +0ms\n```\n\n\n## Browser Support\n\nYou can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),\nor just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),\nif you don't want to build it yourself.\n\nDebug's enable state is currently persisted by `localStorage`.\nConsider the situation shown below where you have `worker:a` and `worker:b`,\nand wish to debug both. You can enable this using `localStorage.debug`:\n\n```js\nlocalStorage.debug = 'worker:*'\n```\n\nAnd then refresh the page.\n\n```js\na = debug('worker:a');\nb = debug('worker:b');\n\nsetInterval(function(){\n a('doing some work');\n}, 1000);\n\nsetInterval(function(){\n b('doing some work');\n}, 1200);\n```\n\n\n## Output streams\n\n By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:\n\nExample [_stdout.js_](./examples/node/stdout.js):\n\n```js\nvar debug = require('debug');\nvar error = debug('app:error');\n\n// by default stderr is used\nerror('goes to stderr!');\n\nvar log = debug('app:log');\n// set this namespace to log via console.log\nlog.log = console.log.bind(console); // don't forget to bind to console!\nlog('goes to stdout');\nerror('still goes to stderr!');\n\n// set all output to go via console.info\n// overrides all per-namespace log settings\ndebug.log = console.info.bind(console);\nerror('now goes to stdout via console.info');\nlog('still goes to stdout, but via console.info now');\n```\n\n## Checking whether a debug target is enabled\n\nAfter you've created a debug instance, you can determine whether or not it is\nenabled by checking the `enabled` property:\n\n```javascript\nconst debug = require('debug')('http');\n\nif (debug.enabled) {\n // do stuff...\n}\n```\n\nYou can also manually toggle this property to force the debug instance to be\nenabled or disabled.\n\n\n## Authors\n\n - TJ Holowaychuk\n - Nathan Rajlich\n - Andrew Rhyne\n\n## Backers\n\nSupport us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Sponsors\n\nBecome a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","maintainers":[{"email":"rhyneandrew@gmail.com","name":"thebigredgeek"},{"email":"kolban1@kolban.com","name":"kolban"},{"email":"nathan@tootallnate.net","name":"tootallnate"},{"email":"tj@vision-media.ca","name":"tjholowaychuk"}],"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"users":{"tellnes":true,"fgribreau":true,"m42am":true,"drudge":true,"megadrive":true,"maxmaximov":true,"oroce":true,"meggesje":true,"nak2k":true,"pid":true,"danielchatfield":true,"buritica":true,"tigefa":true,"einfallstoll":true,"darosh":true,"jfedyczak":true,"appnus":true,"piascikj":true,"evkline":true,"funroll":true,"yi":true,"stonestyle":true,"gabeio":true,"raulb":true,"morishitter":true,"jorgemsrs":true,"fanchangyong":true,"satans17":true,"philippwiddra":true,"mpinteractiv":true,"edalorzo":true,"roboterhund87":true,"tootallnate":true,"joelbair":true,"travelingtechguy":true,"nromano":true,"jokarlist":true,"maschs":true,"juliomarcos":true,"anton-rudeshko":true,"kxbrand":true,"mgesmundo":true,"victorzimmer":true,"fill":true,"dennisgnl":true,"iisii":true,"etiv":true,"gonzalofj":true,"stringparser":true,"passcod":true,"jianping":true,"binnng":true,"ethancai":true,"knownasilya":true,"woverton":true,"lsjroberts":true,"af":true,"faas":true,"ivangaravito":true,"carlton":true,"popomore":true,"52u":true,"ubenzer":true,"kaiquewdev":true,"sierisimo":true,"chzhewl":true,"marcin.operacz":true,"cilindrox":true,"laiff":true,"mikermcneil":true,"assaf":true,"sametsisartenep":true,"santihbc":true,"isalutin":true,"sprjrx":true,"pwaleczek":true,"haeck":true,"ads901119":true,"thimoteus":true,"illbullet":true,"phoward8020":true,"j3kz":true,"paulomcnally":true,"kulakowka":true,"garek":true,"kachar":true,"sessionbean":true,"samhou1988":true,"minghe":true,"seanjh":true,"tophsic":true,"digitalsadhu":true,"barenko":true,"fank":true,"geilt":true,"flockonus":true,"sahilsk":true,"detj":true,"goodseller":true,"simplyianm":true,"nickeljew":true,"dongxu":true,"rbartoli":true,"itonyyo":true,"drhoffmann":true,"jdpagley":true,"kankungyip":true,"vishnuvathsan":true,"legacy":true,"gvn":true,"alexkval":true,"pobrien":true,"tbeseda":true,"nika.interisti":true,"mondalaci":true,"arnold-almeida":true,"budnix":true,"kai_":true,"leonardodavinci":true,"saitodisse":true,"wangnan0610":true,"sasquatch":true,"jasoncheng":true,"sbrajesh":true,"holyzfy":true,"godion":true,"iamwiz":true,"rahman":true,"brandondoran":true,"wenbing":true,"nwinant":true,"etsit":true,"rgbz":true,"darkowlzz":true,"subso":true,"rbecheras":true,"shriek":true,"glebec":true,"craneleeon":true,"gaganblr":true,"nadimix":true,"luuhoangnam":true,"ergunozyurt":true,"nanook":true,"pigram":true,"koslun":true,"cestrensem":true,"developit":true,"demian85":true,"henryorrin":true,"james.talmage":true,"hyzhak":true,"curioussavage":true,"kingtrocki":true,"parkerproject":true,"perrywu":true,"8legged":true,"unstunted":true,"nasser-torabzade":true,"naij":true,"joelwallis":true,"dbck":true,"nayrangnu":true,"battlemidget":true,"jacopkane":true,"honzajde":true,"nice_body":true,"aolu11":true,"princetoad":true,"boyw165":true,"donkino":true,"koulmomo":true,"ksangita":true,"karlbateman":true,"arifulhb":true,"arnoldstoba":true,"andrewconnell":true,"pdedkov":true,"dbendavid":true,"nketchum":true,"xgheaven":true,"vwal":true,"isaacvitor":true,"krabello":true,"aitorllj93":true,"kungkk":true,"yhui02":true,"nohjoono":true,"acollins-ts":true,"wkaifang":true,"iolo":true,"stylemistake":true,"shiva127":true,"necr0":true,"mattqs":true,"temsa":true,"kobleistvan":true,"crazyjingling":true,"takethefire":true,"mkany":true,"nalindak":true,"buzuli":true,"wfalkwallace":true,"fatelei":true,"cshao":true,"preco21":true,"almccann":true,"yokubee":true,"ziliwesley":true,"piyushmakhija":true,"maxidr":true,"stany":true,"kleintobe":true,"po":true,"luislobo":true,"fibo":true,"wynfrith":true,"leahcimic":true,"thebearingedge":true,"kletchatii":true,"jesusgoku":true,"thiagoh":true,"mhfrantz":true,"weisk":true,"ahsanshafiq":true,"sabrina.luo":true,"iroc":true,"piixiiees":true,"bian17888":true,"jonniespratley":true,"algonzo":true,"abdihaikal":true,"cdll":true,"alexbaumgertner":true,"rlgomes":true,"vutran":true,"program247365":true,"nightire":true,"jessaustin":true,"kizzlebot":true,"zacbarton":true,"davidbraun":true,"daviddias":true,"abhisekp":true,"lwgojustgo":true,"dexteryy":true,"dkannan":true,"muukii0803":true,"vishwasc":true,"tribou":true,"wuwenbin":true,"carlosvillademor":true,"antjw":true,"ninozhang":true,"kontrax":true,"qddegtya":true,"onbjerg":true,"janoskk":true,"xieranmaya":true,"eirikbirkeland":true,"markoni":true,"voischev":true,"cmechlin":true,"hex20dec":true,"nerdybeast":true,"viz":true,"joannerpena":true,"figroc":true,"zhanghaili":true,"orkisz":true,"sdt":true,"lgh06":true,"nukisman":true,"nelix":true,"benzaita":true,"pauljmartinez":true,"martinkock":true,"nhz.io":true,"chris-me":true,"lijinghust":true,"steel1990":true,"jakedetels":true,"ovuncozturk":true,"shan":true,"troels.trvo.dk":true,"codecounselor":true,"kruemelo":true,"dingdean":true,"meshaneian":true,"echaouchna":true,"buru1020":true,"arttse":true,"slicethendice":true,"jasonwang1888":true,"diegorbaquero":true,"monjer":true,"mkoc":true,"benpptung":true,"tht13":true,"eduardocereto":true,"andr":true,"furzeface":true,"whitelynx":true,"jits":true,"clarenceho":true,"alimd":true,"tin-lek":true,"ksyrytczyk":true,"kilkelly":true,"heyimeugene":true,"ackhub":true,"cslater":true,"leomperes":true,"sylvain261":true,"true0r":true,"binq":true,"tylerbrock":true,"schwartzman":true,"liushoukai":true,"evandrix":true,"errhunter":true,"chinmay2893":true,"elussich":true,"zhoutk":true,"dkblay":true,"qmmr":true,"yutwatan":true,"ajduke":true,"akinjide":true,"rdmclin2":true,"scytalezero":true,"bapinney":true,"slowmove":true,"djviolin":true,"hain":true,"operandom":true,"shanewholloway":true,"lousando":true,"brpaz":true,"alin.alexa":true,"klombomb":true,"sunkeyhub":true,"itsakt":true,"nogirev":true,"qbylucky":true,"patoi":true,"i.vispyanskiy":true,"jonathas":true,"stuwest":true,"holly":true,"drewigg":true,"luhalvesbr":true,"nagra":true,"h0ward":true,"rkopylkov":true,"xdream86":true,"markthethomas":true,"jonyweb":true,"tonyljl526":true,"akarem":true,"wendellm":true,"ungurys":true,"ivan.marquez":true,"ymk":true,"adamlu":true,"dracochou":true,"luisgamero":true,"conzi":true,"manikantag":true,"dralc":true,"slurm":true,"szymex73":true,"pwn":true,"rocket0191":true,"cisc":true,"polarpython":true,"clemo":true,"coryrobinson42":true,"radumilici":true,"yesseecity":true,"masonwan":true,"shakakira":true,"lunelson":true,"domjtalbot":true,"tangchr":true,"galenandrew":true,"soenkekluth":true,"codebyren":true,"nathanbuchar":true,"npsm":true,"quafoo":true,"goody":true,"gilson004":true,"dushanminic":true,"andygreenegrass":true,"dr_blue":true,"knoja4":true,"yangtze":true,"erickeno":true,"ahvonenj":true,"mojaray2k":true,"fwoelffel":true,"fabien0102":true,"fgmnts":true,"coolhanddev":true,"garenyondem":true,"mr-smiley":true,"tomasmax":true,"alexey-mish":true,"qqcome110":true,"jmanuelrosa":true,"gher":true,"paroczi":true,"rylan_yan":true,"wangfeia":true,"bobxuyang":true,"irnnr":true,"rich-97":true,"lukaserat":true,"arefm":true,"ahmetertem":true,"tangweikun":true,"usingthesystem":true,"chrisco":true,"code-curious":true,"danielye":true,"nohomey":true,"miroklarin":true,"vasz":true,"joaquin.briceno":true,"l8niteowl":true,"aquiandres":true,"hal9zillion":true,"jkrusinski":true,"slowfish":true,"shangsinian":true,"adeelp":true,"spences10":true,"dduran1967":true,"suddi":true,"rakeshmakam":true,"rmjames":true,"miloc":true,"twierbach":true,"jordan-carney":true,"piecioshka":true,"laomu":true,"leonzhao":true,"rogeruiz":true,"isa424":true,"mhaidarh":true,"bradnauta":true,"huarse":true,"aggrotek":true,"koobitor":true,"shrimpseaweed":true,"beenorgone":true,"ssljivic":true,"gomoto":true,"xueboren":true,"qingleili":true,"xiaochao":true,"pumpersonda":true,"junos":true,"shuoshubao":true,"yatsu":true,"eshaanmathur":true,"icodeforcookies":true,"mwurzberger":true,"hugovila":true,"dmitr":true,"ritsu":true,"asaupup":true,"miadzadfallah":true,"keenwon":true,"chinawolf_wyp":true,"kodekracker":true,"gpuente":true,"oboochin":true,"larrychen":true,"udnisap":true,"konstantin.kai":true,"xyyjk":true,"modood":true,"gavinning":true,"jimmyboh":true,"pmbenjamin":true,"maxwelldu":true,"ramy":true,"usex":true,"trewaters":true,"noah_":true,"cheapsteak":true,"evanshortiss":true,"jon_shen":true,"lusai":true,"sibawite":true,"brentonhouse":true,"pddivine":true,"subinvarghesein":true,"shyamguth":true,"junjiansyu":true,"daniel-zahariev":true,"seasons521":true,"hema":true,"abdul":true,"deubaka":true,"sprying":true,"liunian":true,"kuzmicheff":true,"edwardxyt":true,"dreamh":true,"ljmf00":true,"stone-jin":true,"csuermann":true,"tomasgvivo":true,"xtx1130":true,"krzych93":true,"greganswer":true,"hndev":true,"xfloops":true,"cetincem":true,"ctlnrd":true,"grabantot":true,"thangakumar":true,"xinwangwang":true,"azz":true,"nguyenmanhdat2903":true,"yikuo":true,"arbauman":true,"majkel":true,"d-band":true,"largepuma":true,"karuppiah":true,"isayme":true,"doxy":true,"ronin161":true,"npm-packages":true,"button0501":true,"sajera":true,"tonerbarato":true,"atomgao":true,"npmmurali":true,"vision_tecnologica":true,"gresite_piscinas":true,"helderam":true,"maycon_ribeiro":true,"granhermandadblanca":true,"suryasaripalli":true,"thor_bux":true,"itcorp":true,"tomgao365":true,"colageno":true,"cedx":true,"sternelee":true,"mdang8":true,"darrentorpey":true,"creativeadea":true,"k-kuwahara":true,"robinblomberg":true,"lulubozichang":true,"serge-nikitin":true,"heartnett":true,"joni3k":true,"jrejaud":true,"vapeadores":true,"raycharles":true,"nuwaio":true,"lijsh":true,"rochejul":true,"meeh":true,"spanishtights":true,"mrzmmr":true,"xu_q90":true,"itesic":true,"ferx":true,"laudeon":true,"sumit270":true,"womjoy":true,"highgravity":true,"pandabao":true,"morogasper":true,"bhedge":true,"behumble":true,"dbendy":true,"jshcrowthe":true,"nikovitto":true,"sbskl":true,"bblackwo":true,"guyharwood":true,"jeremy_yang":true,"dh19911021":true,"tcrowe":true,"xsilen":true,"stormcrows":true,"roylewis123":true,"ccastelli":true,"shahabkhalvati":true,"brainpoint":true,"alexc1212":true,"sdove1":true,"neaker15668":true,"vparaskevas":true,"danielheene":true,"2lach":true,"donotor":true,"jota":true,"mig38m":true,"johnstru16":true,"tpkn":true,"edjroz":true,"kremr":true,"donecharlton":true,"leakon":true,"azulejosmetrosubway":true,"instazapas":true,"yakumat":true,"codeinpixel":true,"allen_lyu":true,"dresende":true,"cyma-soluciones":true,"endsun":true,"zalithka":true,"bursalia-gestion":true,"71emj1":true,"kostya.fokin":true,"eyson":true,"dyakovk":true,"scott.m.sarsfield":true,"skarlso":true,"luiscauro":true,"pldin601":true,"laoshaw":true,"helcat":true,"iceriver2":true,"nickgogan":true,"xrush":true,"ricardweii":true,"daskepon":true,"heineiuo":true,"thevikingcoder":true,"aronblake":true,"cr8tiv":true,"avivharuzi":true,"tedyhy":true,"debashish":true,"mdedirudianto":true,"imaginegenesis":true,"y-a-v-a":true,"natterstefan":true,"vidhuz":true,"cphayim":true,"srksumanth":true,"semir2":true,"aereobarato":true,"divyanshbatham":true,"iamninad":true,"millercl":true,"1cr18ni9":true,"kamikadze4game":true,"julon":true,"gestoria-madrid":true,"kamirdjanian":true,"diogocapela":true,"haroun":true,"clwm01":true,"n1kk":true,"zhangaz1":true,"eswat2":true,"hyanghai":true,"thefox":true,"shashankpallerla":true,"rafamel":true,"huiyifyj":true,"thekuzia":true,"edmondnow":true,"mohokh67":true,"yowainwright":true,"rossdavis":true,"naokikimura":true,"ruchirgodura":true,"dec_f":true,"mjurincic":true,"jwv":true,"huyz":true,"karzanosman984":true},"repository":{"type":"git","url":"git://github.com/visionmedia/debug.git"},"homepage":"https://github.com/visionmedia/debug#readme","keywords":["debug","log","debugger"],"bugs":{"url":"https://github.com/visionmedia/debug/issues"},"readmeFilename":"README.md","contributors":[{"name":"Nathan Rajlich","email":"nathan@tootallnate.net","url":"http://n8.io"},{"name":"Andrew Rhyne","email":"rhyneandrew@gmail.com"}],"license":"MIT","_attachments":{},"manifest":{"name":"debug","version":"3.1.0","repository":{"type":"git","url":"git://github.com/visionmedia/debug.git"},"description":"small debugging utility","keywords":["debug","log","debugger"],"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"contributors":[{"name":"Nathan Rajlich","email":"nathan@tootallnate.net","url":"http://n8.io"},{"name":"Andrew Rhyne","email":"rhyneandrew@gmail.com"}],"license":"MIT","dependencies":{"ms":"2.0.0"},"devDependencies":{"browserify":"14.4.0","chai":"^3.5.0","concurrently":"^3.1.0","coveralls":"^2.11.15","eslint":"^3.12.1","istanbul":"^0.4.5","karma":"^1.3.0","karma-chai":"^0.1.0","karma-mocha":"^1.3.0","karma-phantomjs-launcher":"^1.0.2","karma-sinon":"^1.0.5","mocha":"^3.2.0","mocha-lcov-reporter":"^1.2.0","rimraf":"^2.5.4","sinon":"^1.17.6","sinon-chai":"^2.8.0"},"main":"./src/index.js","browser":"./src/browser.js","gitHead":"f073e056f33efdd5b311381eb6bca2bc850745bf","bugs":{"url":"https://github.com/visionmedia/debug/issues"},"homepage":"https://github.com/visionmedia/debug#readme","_id":"debug@3.1.0","_npmVersion":"5.3.0","_nodeVersion":"8.4.0","_npmUser":{"name":"tootallnate","email":"nathan@tootallnate.net"},"dist":{"integrity":"sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==","shasum":"5bb5a0672628b64149566ba16819e61518c67261","tarball":"https://registry.npmjs.org/debug/-/debug-3.1.0.tgz"},"maintainers":[{"email":"rhyneandrew@gmail.com","name":"thebigredgeek"},{"email":"kolban1@kolban.com","name":"kolban"},{"email":"nathan@tootallnate.net","name":"tootallnate"},{"email":"tj@vision-media.ca","name":"tjholowaychuk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/debug-3.1.0.tgz_1506453230282_0.13498495938256383"},"directories":{}},"releaseDate":"2017-09-26T19:13:51.492Z"},"sourceInfo":{"type":"git","provider":"github","url":"https://github.com/visionmedia/debug","revision":"f073e056f33efdd5b311381eb6bca2bc850745bf","path":null}} \ No newline at end of file diff --git a/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/fossology/3.3.0.json b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/fossology/3.3.0.json new file mode 100644 index 000000000..917b8c138 --- /dev/null +++ b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/fossology/3.3.0.json @@ -0,0 +1 @@ +{"_metadata":{"type":"fossology","url":"cd:/npm/npmjs/-/debug/3.1.0/tool/scancode","fetchedAt":"2018-09-26T08:09:09.693Z","links":{"self":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:fossology:3.3.0","type":"resource"},"siblings":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:scancode","type":"collection"}},"version":"3.3.0","processedAt":"2018-09-26T08:09:10.447Z"},"nomos":{"version":"3.3.0","parameters":"-ld /tmp/cd-cONOHO","output":{"contentType":"text/plain","content":"File package/karma.conf.js contains license(s) No_license_found\nFile package/Makefile contains license(s) No_license_found\nFile package/src/debug.js contains license(s) No_license_found\nFile package/src/browser.js contains license(s) No_license_found\nFile package/README.md contains license(s) MIT\nFile package/.coveralls.yml contains license(s) No_license_found\nFile package/LICENSE contains license(s) MIT\nFile package/.eslintrc contains license(s) No_license_found\nFile package/node.js contains license(s) No_license_found\nFile package/src/node.js contains license(s) No_license_found\nFile package/src/index.js contains license(s) No_license_found\nFile package/.travis.yml contains license(s) No_license_found\nFile package/.npmignore contains license(s) No_license_found\nFile package/CHANGELOG.md contains license(s) No_license_found\nFile package/package.json contains license(s) MIT\n"}}} \ No newline at end of file diff --git a/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/fossology/3.6.0.json b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/fossology/3.6.0.json new file mode 100644 index 000000000..86bffe766 --- /dev/null +++ b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/fossology/3.6.0.json @@ -0,0 +1 @@ +{"_metadata":{"type":"fossology","url":"cd:/npm/npmjs/-/debug/3.1.0/tool/licensee","fetchedAt":"2019-02-28T05:55:04.973Z","links":{"self":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:fossology:3.6.0","type":"resource"},"siblings":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:licensee","type":"collection"}},"schemaVersion":"3.6.0","toolVersion":"3.4.0","processedAt":"2019-02-28T05:55:07.251Z"},"nomos":{"version":"3.4.0","parameters":"","output":{"contentType":"text/plain","content":"File package/.npmignore contains license(s) No_license_found\nFile package/karma.conf.js contains license(s) No_license_found\nFile package/.eslintrc contains license(s) No_license_found\nFile package/src/index.js contains license(s) No_license_found\nFile package/src/debug.js contains license(s) No_license_found\nFile package/node.js contains license(s) No_license_found\nFile package/.coveralls.yml contains license(s) No_license_found\nFile package/LICENSE contains license(s) MIT\nFile package/README.md contains license(s) MIT\nFile package/.travis.yml contains license(s) No_license_found\nFile package/Makefile contains license(s) No_license_found\nFile package/src/browser.js contains license(s) No_license_found\nFile package/src/node.js contains license(s) No_license_found\nFile package/CHANGELOG.md contains license(s) No_license_found\nFile package/package.json contains license(s) MIT\n"}},"copyright":{"version":"0.0.0","parameters":["-J"],"output":{"contentType":"application/json","content":[{"path":"package/.coveralls.yml","output":{"results":null}},{"path":"package/.eslintrc","output":{"results":null}},{"path":"package/.npmignore","output":{"results":null}},{"path":"package/.travis.yml","output":{"results":null}},{"path":"package/CHANGELOG.md","output":{"results":[{"content":"contributors","end":7321,"start":7309,"type":"author"},{"content":"contributors","end":10026,"start":10014,"type":"author"},{"content":"authors","end":10087,"start":10080,"type":"author"}]}},{"path":"package/LICENSE","output":{"results":[{"content":"Copyright (c) 2014 TJ Holowaychuk ","end":73,"start":19,"type":"statement"},{"content":"tj@vision-media.ca","end":72,"start":54,"type":"email"},{"content":"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY","end":947,"start":867,"type":"author"}]}},{"path":"package/Makefile","output":{"results":[{"content":"http://stackoverflow.com/a/5982798/376773","end":72,"start":31,"type":"url"}]}},{"path":"package/README.md","output":{"results":[{"content":"Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>","end":18802,"start":18737,"type":"statement"},{"content":"https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug)","end":125,"start":25,"type":"url"},{"content":"https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master)","end":285,"start":147,"type":"url"},{"content":"https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/)","end":400,"start":297,"type":"url"},{"content":"https://opencollective.com/debug/backers/badge.svg)](#backers)","end":482,"start":420,"type":"url"},{"content":"https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)","end":566,"start":502,"type":"url"},{"content":"https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png\">","end":689,"start":590,"type":"url"},{"content":"https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png\">","end":2193,"start":2094,"type":"url"},{"content":"https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png\">","end":2359,"start":2260,"type":"url"},{"content":"https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png\">","end":2525,"start":2426,"type":"url"},{"content":"https://npmjs.org/supports-color)","end":3169,"start":3136,"type":"url"},{"content":"https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png\">","end":3379,"start":3280,"type":"url"},{"content":"https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))","end":3685,"start":3548,"type":"url"},{"content":"https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png\">","end":3858,"start":3759,"type":"url"},{"content":"https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png\">","end":4285,"start":4186,"type":"url"},{"content":"https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png\">","end":4537,"start":4438,"type":"url"},{"content":"https://nodejs.org/api/util.html#util_util_inspect_object_options)","end":6547,"start":6481,"type":"url"},{"content":"https://wikipedia.org/wiki/Printf_format_string)","end":6661,"start":6613,"type":"url"},{"content":"https://github.com/substack/node-browserify)","end":7760,"start":7716,"type":"url"},{"content":"https://wzrd.in/)","end":7821,"start":7804,"type":"url"},{"content":"https://wzrd.in/standalone/debug@latest)","end":7870,"start":7830,"type":"url"},{"content":"https://opencollective.com/debug#backer)]","end":9699,"start":9658,"type":"url"},{"content":"https://opencollective.com/debug/backer/0/website\"","end":9760,"start":9710,"type":"url"},{"content":"https://opencollective.com/debug/backer/0/avatar.svg\">","end":9841,"start":9787,"type":"url"},{"content":"https://opencollective.com/debug/backer/1/website\"","end":9905,"start":9855,"type":"url"},{"content":"https://opencollective.com/debug/backer/1/avatar.svg\">","end":9986,"start":9932,"type":"url"},{"content":"https://opencollective.com/debug/backer/2/website\"","end":10050,"start":10000,"type":"url"},{"content":"https://opencollective.com/debug/backer/2/avatar.svg\">","end":10131,"start":10077,"type":"url"},{"content":"https://opencollective.com/debug/backer/3/website\"","end":10195,"start":10145,"type":"url"},{"content":"https://opencollective.com/debug/backer/3/avatar.svg\">","end":10276,"start":10222,"type":"url"},{"content":"https://opencollective.com/debug/backer/4/website\"","end":10340,"start":10290,"type":"url"},{"content":"https://opencollective.com/debug/backer/4/avatar.svg\">","end":10421,"start":10367,"type":"url"},{"content":"https://opencollective.com/debug/backer/5/website\"","end":10485,"start":10435,"type":"url"},{"content":"https://opencollective.com/debug/backer/5/avatar.svg\">","end":10566,"start":10512,"type":"url"},{"content":"https://opencollective.com/debug/backer/6/website\"","end":10630,"start":10580,"type":"url"},{"content":"https://opencollective.com/debug/backer/6/avatar.svg\">","end":10711,"start":10657,"type":"url"},{"content":"https://opencollective.com/debug/backer/7/website\"","end":10775,"start":10725,"type":"url"},{"content":"https://opencollective.com/debug/backer/7/avatar.svg\">","end":10856,"start":10802,"type":"url"},{"content":"https://opencollective.com/debug/backer/8/website\"","end":10920,"start":10870,"type":"url"},{"content":"https://opencollective.com/debug/backer/8/avatar.svg\">","end":11001,"start":10947,"type":"url"},{"content":"https://opencollective.com/debug/backer/9/website\"","end":11065,"start":11015,"type":"url"},{"content":"https://opencollective.com/debug/backer/9/avatar.svg\">","end":11146,"start":11092,"type":"url"},{"content":"https://opencollective.com/debug/backer/10/website\"","end":11211,"start":11160,"type":"url"},{"content":"https://opencollective.com/debug/backer/10/avatar.svg\">","end":11293,"start":11238,"type":"url"},{"content":"https://opencollective.com/debug/backer/11/website\"","end":11358,"start":11307,"type":"url"},{"content":"https://opencollective.com/debug/backer/11/avatar.svg\">","end":11440,"start":11385,"type":"url"},{"content":"https://opencollective.com/debug/backer/12/website\"","end":11505,"start":11454,"type":"url"},{"content":"https://opencollective.com/debug/backer/12/avatar.svg\">","end":11587,"start":11532,"type":"url"},{"content":"https://opencollective.com/debug/backer/13/website\"","end":11652,"start":11601,"type":"url"},{"content":"https://opencollective.com/debug/backer/13/avatar.svg\">","end":11734,"start":11679,"type":"url"},{"content":"https://opencollective.com/debug/backer/14/website\"","end":11799,"start":11748,"type":"url"},{"content":"https://opencollective.com/debug/backer/14/avatar.svg\">","end":11881,"start":11826,"type":"url"},{"content":"https://opencollective.com/debug/backer/15/website\"","end":11946,"start":11895,"type":"url"},{"content":"https://opencollective.com/debug/backer/15/avatar.svg\">","end":12028,"start":11973,"type":"url"},{"content":"https://opencollective.com/debug/backer/16/website\"","end":12093,"start":12042,"type":"url"},{"content":"https://opencollective.com/debug/backer/16/avatar.svg\">","end":12175,"start":12120,"type":"url"},{"content":"https://opencollective.com/debug/backer/17/website\"","end":12240,"start":12189,"type":"url"},{"content":"https://opencollective.com/debug/backer/17/avatar.svg\">","end":12322,"start":12267,"type":"url"},{"content":"https://opencollective.com/debug/backer/18/website\"","end":12387,"start":12336,"type":"url"},{"content":"https://opencollective.com/debug/backer/18/avatar.svg\">","end":12469,"start":12414,"type":"url"},{"content":"https://opencollective.com/debug/backer/19/website\"","end":12534,"start":12483,"type":"url"},{"content":"https://opencollective.com/debug/backer/19/avatar.svg\">","end":12616,"start":12561,"type":"url"},{"content":"https://opencollective.com/debug/backer/20/website\"","end":12681,"start":12630,"type":"url"},{"content":"https://opencollective.com/debug/backer/20/avatar.svg\">","end":12763,"start":12708,"type":"url"},{"content":"https://opencollective.com/debug/backer/21/website\"","end":12828,"start":12777,"type":"url"},{"content":"https://opencollective.com/debug/backer/21/avatar.svg\">","end":12910,"start":12855,"type":"url"},{"content":"https://opencollective.com/debug/backer/22/website\"","end":12975,"start":12924,"type":"url"},{"content":"https://opencollective.com/debug/backer/22/avatar.svg\">","end":13057,"start":13002,"type":"url"},{"content":"https://opencollective.com/debug/backer/23/website\"","end":13122,"start":13071,"type":"url"},{"content":"https://opencollective.com/debug/backer/23/avatar.svg\">","end":13204,"start":13149,"type":"url"},{"content":"https://opencollective.com/debug/backer/24/website\"","end":13269,"start":13218,"type":"url"},{"content":"https://opencollective.com/debug/backer/24/avatar.svg\">","end":13351,"start":13296,"type":"url"},{"content":"https://opencollective.com/debug/backer/25/website\"","end":13416,"start":13365,"type":"url"},{"content":"https://opencollective.com/debug/backer/25/avatar.svg\">","end":13498,"start":13443,"type":"url"},{"content":"https://opencollective.com/debug/backer/26/website\"","end":13563,"start":13512,"type":"url"},{"content":"https://opencollective.com/debug/backer/26/avatar.svg\">","end":13645,"start":13590,"type":"url"},{"content":"https://opencollective.com/debug/backer/27/website\"","end":13710,"start":13659,"type":"url"},{"content":"https://opencollective.com/debug/backer/27/avatar.svg\">","end":13792,"start":13737,"type":"url"},{"content":"https://opencollective.com/debug/backer/28/website\"","end":13857,"start":13806,"type":"url"},{"content":"https://opencollective.com/debug/backer/28/avatar.svg\">","end":13939,"start":13884,"type":"url"},{"content":"https://opencollective.com/debug/backer/29/website\"","end":14004,"start":13953,"type":"url"},{"content":"https://opencollective.com/debug/backer/29/avatar.svg\">","end":14086,"start":14031,"type":"url"},{"content":"https://opencollective.com/debug#sponsor)]","end":14253,"start":14211,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/0/website\"","end":14315,"start":14264,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/0/avatar.svg\">","end":14397,"start":14342,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/1/website\"","end":14462,"start":14411,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/1/avatar.svg\">","end":14544,"start":14489,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/2/website\"","end":14609,"start":14558,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/2/avatar.svg\">","end":14691,"start":14636,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/3/website\"","end":14756,"start":14705,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/3/avatar.svg\">","end":14838,"start":14783,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/4/website\"","end":14903,"start":14852,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/4/avatar.svg\">","end":14985,"start":14930,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/5/website\"","end":15050,"start":14999,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/5/avatar.svg\">","end":15132,"start":15077,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/6/website\"","end":15197,"start":15146,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/6/avatar.svg\">","end":15279,"start":15224,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/7/website\"","end":15344,"start":15293,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/7/avatar.svg\">","end":15426,"start":15371,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/8/website\"","end":15491,"start":15440,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/8/avatar.svg\">","end":15573,"start":15518,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/9/website\"","end":15638,"start":15587,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/9/avatar.svg\">","end":15720,"start":15665,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/10/website\"","end":15786,"start":15734,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/10/avatar.svg\">","end":15869,"start":15813,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/11/website\"","end":15935,"start":15883,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/11/avatar.svg\">","end":16018,"start":15962,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/12/website\"","end":16084,"start":16032,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/12/avatar.svg\">","end":16167,"start":16111,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/13/website\"","end":16233,"start":16181,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/13/avatar.svg\">","end":16316,"start":16260,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/14/website\"","end":16382,"start":16330,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/14/avatar.svg\">","end":16465,"start":16409,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/15/website\"","end":16531,"start":16479,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/15/avatar.svg\">","end":16614,"start":16558,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/16/website\"","end":16680,"start":16628,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/16/avatar.svg\">","end":16763,"start":16707,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/17/website\"","end":16829,"start":16777,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/17/avatar.svg\">","end":16912,"start":16856,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/18/website\"","end":16978,"start":16926,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/18/avatar.svg\">","end":17061,"start":17005,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/19/website\"","end":17127,"start":17075,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/19/avatar.svg\">","end":17210,"start":17154,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/20/website\"","end":17276,"start":17224,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/20/avatar.svg\">","end":17359,"start":17303,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/21/website\"","end":17425,"start":17373,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/21/avatar.svg\">","end":17508,"start":17452,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/22/website\"","end":17574,"start":17522,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/22/avatar.svg\">","end":17657,"start":17601,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/23/website\"","end":17723,"start":17671,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/23/avatar.svg\">","end":17806,"start":17750,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/24/website\"","end":17872,"start":17820,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/24/avatar.svg\">","end":17955,"start":17899,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/25/website\"","end":18021,"start":17969,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/25/avatar.svg\">","end":18104,"start":18048,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/26/website\"","end":18170,"start":18118,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/26/avatar.svg\">","end":18253,"start":18197,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/27/website\"","end":18319,"start":18267,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/27/avatar.svg\">","end":18402,"start":18346,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/28/website\"","end":18468,"start":18416,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/28/avatar.svg\">","end":18551,"start":18495,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/29/website\"","end":18617,"start":18565,"type":"url"},{"content":"https://opencollective.com/debug/sponsor/29/avatar.svg\">","end":18700,"start":18644,"type":"url"},{"content":"tj@vision-media.ca","end":18798,"start":18780,"type":"email"},{"content":"Authors","end":9500,"start":9493,"type":"author"},{"content":"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY","end":19636,"start":19590,"type":"author"}]}},{"path":"package/karma.conf.js","output":{"results":[{"content":"https://npmjs.org/browse/keyword/karma-adapter","end":332,"start":286,"type":"url"},{"content":"https://npmjs.org/browse/keyword/karma-preprocessor","end":728,"start":677,"type":"url"},{"content":"https://npmjs.org/browse/keyword/karma-reporter","end":912,"start":865,"type":"url"},{"content":"https://npmjs.org/browse/keyword/karma-launcher","end":1467,"start":1420,"type":"url"}]}},{"path":"package/node.js","output":{"results":null}},{"path":"package/package.json","output":{"results":[{"content":"http://n8.io)\"","end":372,"start":358,"type":"url"},{"content":"tj@vision-media.ca","end":288,"start":270,"type":"email"},{"content":"nathan@tootallnate.net","end":355,"start":333,"type":"email"},{"content":"rhyneandrew@gmail.com","end":414,"start":393,"type":"email"},{"content":"contributors","end":307,"start":295,"type":"author"}]}},{"path":"package/src/browser.js","output":{"results":[{"content":"http://stackoverflow.com/a/16459606/376773","end":2186,"start":2144,"type":"url"},{"content":"https://github.com/facebook/react-native/pull/1632","end":2281,"start":2231,"type":"url"},{"content":"http://stackoverflow.com/a/398120/376773","end":2500,"start":2460,"type":"url"},{"content":"https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages","end":2748,"start":2673,"type":"url"}]}},{"path":"package/src/debug.js","output":{"results":null}},{"path":"package/src/index.js","output":{"results":null}},{"path":"package/src/node.js","output":{"results":null}}]}},"monk":{"version":"0.0.0","parameters":["-k","monk_knowledgebase"],"output":{"contentType":"text/plain","content":"found diff match between \"package/LICENSE\" and \"MIT\" (rf_pk=311); rank 96; diffs: {t[75+134] M0 s[0+134], t[210+12] MR s[135+12], t[223+442] M0 s[148+448], t[666+8] MR s[597+8], t[675+430] M0 s[606+432]}\nWARNING: cannot re-encode 'package/README.md', going binary from now on\nfound diff match between \"package/README.md\" and \"MIT\" (rf_pk=311); rank 96; diffs: {t[18804+133] M0 s[0+134], t[18938+12] MR s[135+12], t[18951+439] M0 s[148+448], t[19391+8] MR s[597+8], t[19400+426] M0 s[606+432]}\n"}}} \ No newline at end of file diff --git a/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/licensee/9.12.1.json b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/licensee/9.12.1.json new file mode 100644 index 000000000..7c340f1d7 --- /dev/null +++ b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/licensee/9.12.1.json @@ -0,0 +1 @@ +{"_metadata":{"type":"licensee","url":"cd:/npm/npmjs/-/debug/3.1.0","fetchedAt":"2019-02-28T05:55:04.518Z","links":{"self":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:licensee:9.12.1","type":"resource"},"siblings":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:licensee","type":"collection"}},"schemaVersion":"9.12.1","toolVersion":"9.10.1","processedAt":"2019-02-28T05:55:05.995Z"},"licensee":{"version":"9.10.1","parameters":["--json","--no-readme"],"output":{"contentType":"application/json","content":{"licenses":[{"key":"mit","spdx_id":"MIT","meta":{"title":"MIT License","source":"https://spdx.org/licenses/MIT.html","description":"A short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.","how":"Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file. Replace [year] with the current year and [fullname] with the name (or names) of the copyright holders.","using":[{"Babel":"https://github.com/babel/babel/blob/master/LICENSE"},{".NET Core":"https://github.com/dotnet/corefx/blob/master/LICENSE.TXT"},{"Rails":"https://github.com/rails/rails/blob/master/MIT-LICENSE"}],"featured":true,"hidden":false,"nickname":null,"note":null},"url":"http://choosealicense.com/licenses/mit/","rules":{"permissions":[{"tag":"commercial-use","label":"Commercial use","description":"This software and derivatives may be used for commercial purposes."},{"tag":"modifications","label":"Modification","description":"This software may be modified."},{"tag":"distribution","label":"Distribution","description":"This software may be distributed."},{"tag":"private-use","label":"Private use","description":"This software may be used and modified in private."}],"conditions":[{"tag":"include-copyright","label":"License and copyright notice","description":"A copy of the license and copyright notice must be included with the software."}],"limitations":[{"tag":"liability","label":"Liability","description":"This license includes a limitation of liability."},{"tag":"warranty","label":"Warranty","description":"The license explicitly states that it does NOT provide any warranty."}]},"fields":[{"name":"year","description":"The current year"},{"name":"fullname","description":"The full name or username of the repository owner"}],"other":false,"gpl":false,"lgpl":false,"cc":false}],"matched_files":[{"filename":"package/LICENSE","content":"(The MIT License)\n\nCopyright (c) 2014 TJ Holowaychuk \n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software \nand associated documentation files (the 'Software'), to deal in the Software without restriction, \nincluding without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, \nand/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial \nportions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT \nLIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. \nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, \nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE \nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","content_hash":"46cdc03462b9af57968df67b450cc4372ac41f53","content_normalized":"permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files the \"software\" , to deal in the software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the software, and to permit persons to whom the software is furnished to do so, subject to the following conditions: the above copyright notice and this permission notice shall be included in all copies or substantial portions of the software. the software is provided \"as is\", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. in no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.","matcher":{"name":"exact","confidence":100},"matched_license":"MIT"},{"filename":"package/package.json","content":"{\n \"name\": \"debug\",\n \"version\": \"3.1.0\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git://github.com/visionmedia/debug.git\"\n },\n \"description\": \"small debugging utility\",\n \"keywords\": [\n \"debug\",\n \"log\",\n \"debugger\"\n ],\n \"author\": \"TJ Holowaychuk \",\n \"contributors\": [\n \"Nathan Rajlich (http://n8.io)\",\n \"Andrew Rhyne \"\n ],\n \"license\": \"MIT\",\n \"dependencies\": {\n \"ms\": \"2.0.0\"\n },\n \"devDependencies\": {\n \"browserify\": \"14.4.0\",\n \"chai\": \"^3.5.0\",\n \"concurrently\": \"^3.1.0\",\n \"coveralls\": \"^2.11.15\",\n \"eslint\": \"^3.12.1\",\n \"istanbul\": \"^0.4.5\",\n \"karma\": \"^1.3.0\",\n \"karma-chai\": \"^0.1.0\",\n \"karma-mocha\": \"^1.3.0\",\n \"karma-phantomjs-launcher\": \"^1.0.2\",\n \"karma-sinon\": \"^1.0.5\",\n \"mocha\": \"^3.2.0\",\n \"mocha-lcov-reporter\": \"^1.2.0\",\n \"rimraf\": \"^2.5.4\",\n \"sinon\": \"^1.17.6\",\n \"sinon-chai\": \"^2.8.0\"\n },\n \"main\": \"./src/index.js\",\n \"browser\": \"./src/browser.js\"\n}\n","content_hash":null,"content_normalized":null,"matcher":{"name":"npmbower","confidence":90},"matched_license":"MIT"}]}}},"attachments":[{"path":"package/LICENSE","token":"98c970de440dcfc77471610aec2377c9d9b0db2b3be6d1add524a586e1d7f422"},{"path":"package/package.json","token":"607790755743bf6fffb337f7661460fda64b9de81b0f3e4c27954ea41b46abd3"}]} \ No newline at end of file diff --git a/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/licensee/9.14.0.json b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/licensee/9.14.0.json new file mode 100644 index 000000000..5a6748889 --- /dev/null +++ b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/licensee/9.14.0.json @@ -0,0 +1 @@ +{"_metadata":{"type":"licensee","url":"cd:/npm/npmjs/-/debug/3.1.0","fetchedAt":"2022-06-17T13:15:51.573Z","links":{"self":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:licensee:9.14.0","type":"resource"},"siblings":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:licensee","type":"collection"}},"schemaVersion":"9.14.0","toolVersion":"9.12.0","processedAt":"2022-06-17T13:15:52.286Z"},"licensee":{"version":"9.12.0","parameters":["--json","--no-readme"],"output":{"contentType":"application/json","content":{"licenses":[{"key":"mit","spdx_id":"MIT","meta":{"title":"MIT License","source":"https://spdx.org/licenses/MIT.html","description":"A short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.","how":"Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file. Replace [year] with the current year and [fullname] with the name (or names) of the copyright holders.","using":[{"Babel":"https://github.com/babel/babel/blob/master/LICENSE"},{".NET Core":"https://github.com/dotnet/corefx/blob/master/LICENSE.TXT"},{"Rails":"https://github.com/rails/rails/blob/master/MIT-LICENSE"}],"featured":true,"hidden":false,"nickname":null,"note":null},"url":"http://choosealicense.com/licenses/mit/","rules":{"permissions":[{"tag":"commercial-use","label":"Commercial use","description":"This software and derivatives may be used for commercial purposes."},{"tag":"modifications","label":"Modification","description":"This software may be modified."},{"tag":"distribution","label":"Distribution","description":"This software may be distributed."},{"tag":"private-use","label":"Private use","description":"This software may be used and modified in private."}],"conditions":[{"tag":"include-copyright","label":"License and copyright notice","description":"A copy of the license and copyright notice must be included with the software."}],"limitations":[{"tag":"liability","label":"Liability","description":"This license includes a limitation of liability."},{"tag":"warranty","label":"Warranty","description":"The license explicitly states that it does NOT provide any warranty."}]},"fields":[{"name":"year","description":"The current year"},{"name":"fullname","description":"The full name or username of the repository owner"}],"other":false,"gpl":false,"lgpl":false,"cc":false}],"matched_files":[{"filename":"package/LICENSE","content":"(The MIT License)\n\nCopyright (c) 2014 TJ Holowaychuk \n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software \nand associated documentation files (the 'Software'), to deal in the Software without restriction, \nincluding without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, \nand/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial \nportions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT \nLIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. \nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, \nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE \nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","content_hash":"d64f3bb4282a97b37454b5bb96a8a264a3363dc3","content_normalized":"permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"software\"), to deal in the software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the software, and to permit persons to whom the software is furnished to do so, subject to the following conditions: the above copyright notice and this permission notice shall be included in all copies or substantial portions of the software. the software is provided \"as is\", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. in no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.","matcher":{"name":"exact","confidence":100},"matched_license":"MIT","attribution":"Copyright (c) 2014 TJ Holowaychuk "},{"filename":"package/package.json","content":"{\n \"name\": \"debug\",\n \"version\": \"3.1.0\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git://github.com/visionmedia/debug.git\"\n },\n \"description\": \"small debugging utility\",\n \"keywords\": [\n \"debug\",\n \"log\",\n \"debugger\"\n ],\n \"author\": \"TJ Holowaychuk \",\n \"contributors\": [\n \"Nathan Rajlich (http://n8.io)\",\n \"Andrew Rhyne \"\n ],\n \"license\": \"MIT\",\n \"dependencies\": {\n \"ms\": \"2.0.0\"\n },\n \"devDependencies\": {\n \"browserify\": \"14.4.0\",\n \"chai\": \"^3.5.0\",\n \"concurrently\": \"^3.1.0\",\n \"coveralls\": \"^2.11.15\",\n \"eslint\": \"^3.12.1\",\n \"istanbul\": \"^0.4.5\",\n \"karma\": \"^1.3.0\",\n \"karma-chai\": \"^0.1.0\",\n \"karma-mocha\": \"^1.3.0\",\n \"karma-phantomjs-launcher\": \"^1.0.2\",\n \"karma-sinon\": \"^1.0.5\",\n \"mocha\": \"^3.2.0\",\n \"mocha-lcov-reporter\": \"^1.2.0\",\n \"rimraf\": \"^2.5.4\",\n \"sinon\": \"^1.17.6\",\n \"sinon-chai\": \"^2.8.0\"\n },\n \"main\": \"./src/index.js\",\n \"browser\": \"./src/browser.js\"\n}\n","content_hash":null,"content_normalized":null,"matcher":{"name":"npmbower","confidence":90},"matched_license":"MIT","attribution":null}]}}},"attachments":[{"path":"package/LICENSE","token":"98c970de440dcfc77471610aec2377c9d9b0db2b3be6d1add524a586e1d7f422"},{"path":"package/package.json","token":"607790755743bf6fffb337f7661460fda64b9de81b0f3e4c27954ea41b46abd3"}]} \ No newline at end of file diff --git a/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/reuse/1.3.0.json b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/reuse/1.3.0.json new file mode 100644 index 000000000..d81266e15 --- /dev/null +++ b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/reuse/1.3.0.json @@ -0,0 +1 @@ +{"_metadata":{"type":"reuse","url":"cd:/npm/npmjs/-/debug/3.1.0","fetchedAt":"2023-12-08T18:53:48.970Z","links":{"self":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:reuse:1.3.0","type":"resource"},"siblings":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:reuse","type":"collection"}},"schemaVersion":"1.3.0","toolVersion":"1.1.0","processedAt":"2023-12-08T18:53:49.746Z"},"reuse":{"metadata":{"SPDXVersion":"SPDX-2.1","DataLicense":"CC0-1.0","SPDXID":"SPDXRef-DOCUMENT","DocumentName":"cd-7YHCUJ","DocumentNamespace":"http://spdx.org/spdxdocs/spdx-v2.1-07136bd5-3e61-43a2-9002-d5ca25bc1e70","CreatorPerson":"Anonymous ()","CreatorOrganization":"Anonymous ()","CreatorTool":"reuse-1.1.0","Created":"2023-12-08T18:53:49Z","CreatorComment":"This document was created automatically using available reuse information consistent with REUSE."},"files":[{"FileName":"package/.coveralls.yml","SPDXID":"SPDXRef-3540a328924806b88b61eb507a52cbae","FileChecksumSHA1":"90709e4fb4ce17729974b3a140ccbf330519835c","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/.eslintrc","SPDXID":"SPDXRef-6ee2e6c46f0607a482334c5bc0b1601d","FileChecksumSHA1":"9249b5c46b21d7e51bd0d9ad96c27d7a7a1d720b","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/.npmignore","SPDXID":"SPDXRef-54692a1b28bcb353b2664338656d82e5","FileChecksumSHA1":"90fef7cc1058bd0f85b0959c4fcd49230a29593e","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/.travis.yml","SPDXID":"SPDXRef-8af56ba0e457f4d1a0e5a4cc6fe2fe7b","FileChecksumSHA1":"ad20938f07f056cbbdb35383aebc88feb5ecc361","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/CHANGELOG.md","SPDXID":"SPDXRef-3cf347c054e0486b3812a194aea1e3fc","FileChecksumSHA1":"9e7ab0e94f1d90c8073a4f75c79e01e2d86bef4c","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/Makefile","SPDXID":"SPDXRef-054a0140dbcf15693e792a5a49796e52","FileChecksumSHA1":"27ba9abecf06bf547905c50f5979caff65574b4c","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/README.md","SPDXID":"SPDXRef-3c6927502a425242768e0af7156ed443","FileChecksumSHA1":"65d9d60fa0cd4cb997ec0b4d7aff8390aef24401","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/karma.conf.js","SPDXID":"SPDXRef-4395fa5baf702960daeaf72321f3c29e","FileChecksumSHA1":"93fef7cf3ed6f04d2cfc3cd0b8d5d972d35cfd29","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/node.js","SPDXID":"SPDXRef-9d7b9314098bbf08d3c31339460e0000","FileChecksumSHA1":"aa7655ee80c9a485313675f9379c2f18d33ea061","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/package.json","SPDXID":"SPDXRef-ba3feb95c89f16f01b65812313ed68ad","FileChecksumSHA1":"ea58ffe857db300084291a1b7bd73c08e4fd69ca","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/src/browser.js","SPDXID":"SPDXRef-cae2121fb42437eb15b6c901492447d3","FileChecksumSHA1":"836c2d882a28ef05767ab67e4499b443922d7adf","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/src/debug.js","SPDXID":"SPDXRef-4a5b4e31ad8f9d0c60fed749d48815d9","FileChecksumSHA1":"58e3676c3989d3f6c03fa8f50485c1249a0b148a","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/src/index.js","SPDXID":"SPDXRef-89fd5deec6031ab878b67bcf3f502c28","FileChecksumSHA1":"be4a5e319ff5c28b88a1ab4d272b59bd420e22e3","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/src/node.js","SPDXID":"SPDXRef-910c95bb23fac00e55f9be588c1bcb1e","FileChecksumSHA1":"6a0da57e0adbfe592cc3df2c2e708083f7dcad28","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"}],"licenses":[]}} \ No newline at end of file diff --git a/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/reuse/3.2.1.json b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/reuse/3.2.1.json new file mode 100644 index 000000000..88ec15c98 --- /dev/null +++ b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/reuse/3.2.1.json @@ -0,0 +1 @@ +{"_metadata":{"type":"reuse","url":"cd:/npm/npmjs/-/debug/3.1.0","fetchedAt":"2024-05-06T07:08:51.004Z","links":{"self":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:reuse:3.2.1","type":"resource"},"siblings":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:reuse","type":"collection"}},"schemaVersion":"3.2.1","toolVersion":"3.0.1","processedAt":"2024-05-06T07:08:51.611Z"},"reuse":{"metadata":{"SPDXVersion":"SPDX-2.1","DataLicense":"CC0-1.0","SPDXID":"SPDXRef-DOCUMENT","DocumentName":"cd-lkvoAB","DocumentNamespace":"http://spdx.org/spdxdocs/spdx-v2.1-5db1382f-fe0d-4747-98b8-c85647398842","CreatorPerson":"Anonymous ()","CreatorOrganization":"Anonymous ()","CreatorTool":"reuse-3.0.1","Created":"2024-05-06T07:08:51+00:00Z","CreatorComment":"This document was created automatically using available reuse information consistent with REUSE."},"files":[{"FileName":"package/.coveralls.yml","SPDXID":"SPDXRef-21c9df81624da066ef0a784b26db124a","FileChecksumSHA1":"90709e4fb4ce17729974b3a140ccbf330519835c","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/.eslintrc","SPDXID":"SPDXRef-ccfaa7b8f8092ae437bffa52b12bad82","FileChecksumSHA1":"9249b5c46b21d7e51bd0d9ad96c27d7a7a1d720b","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/.npmignore","SPDXID":"SPDXRef-f110439efd9dfbd1adbedb6d183a969a","FileChecksumSHA1":"90fef7cc1058bd0f85b0959c4fcd49230a29593e","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/.travis.yml","SPDXID":"SPDXRef-69296f3828d59a037388af0dc2695106","FileChecksumSHA1":"ad20938f07f056cbbdb35383aebc88feb5ecc361","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/CHANGELOG.md","SPDXID":"SPDXRef-0330c6e6de519c9f320dd01391b61bc1","FileChecksumSHA1":"9e7ab0e94f1d90c8073a4f75c79e01e2d86bef4c","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/Makefile","SPDXID":"SPDXRef-c13d1b897c60a02677f3b9a20e19d2d8","FileChecksumSHA1":"27ba9abecf06bf547905c50f5979caff65574b4c","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/README.md","SPDXID":"SPDXRef-bb9b6515721ecb663c3795aabaa4f201","FileChecksumSHA1":"65d9d60fa0cd4cb997ec0b4d7aff8390aef24401","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/karma.conf.js","SPDXID":"SPDXRef-84924756adbb63091f775f2ff95e41e1","FileChecksumSHA1":"93fef7cf3ed6f04d2cfc3cd0b8d5d972d35cfd29","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/node.js","SPDXID":"SPDXRef-8509ca697e8348e7da91a2d66cd3f599","FileChecksumSHA1":"aa7655ee80c9a485313675f9379c2f18d33ea061","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/package.json","SPDXID":"SPDXRef-61f76546d5adc7bce1bfbe477ed77b5e","FileChecksumSHA1":"ea58ffe857db300084291a1b7bd73c08e4fd69ca","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/src/browser.js","SPDXID":"SPDXRef-aa196035fb46f704bdf236bfa4530667","FileChecksumSHA1":"836c2d882a28ef05767ab67e4499b443922d7adf","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/src/debug.js","SPDXID":"SPDXRef-7a5c3b5cd184a8c679b0959ff4b4605d","FileChecksumSHA1":"58e3676c3989d3f6c03fa8f50485c1249a0b148a","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/src/index.js","SPDXID":"SPDXRef-04df78bb76635ff2cfb6f81037a06e88","FileChecksumSHA1":"be4a5e319ff5c28b88a1ab4d272b59bd420e22e3","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"},{"FileName":"package/src/node.js","SPDXID":"SPDXRef-8a414e30cbec03e50b8b8ee1ed77f344","FileChecksumSHA1":"6a0da57e0adbfe592cc3df2c2e708083f7dcad28","LicenseConcluded":"NOASSERTION","FileCopyrightText":"NONE"}],"licenses":[]}} \ No newline at end of file diff --git a/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.2.1.json b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.2.1.json new file mode 100644 index 000000000..8aa4f64d6 --- /dev/null +++ b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.2.1.json @@ -0,0 +1 @@ +{"_metadata":{"type":"scancode","url":"cd:/npm/npmjs/-/debug/3.1.0","fetchedAt":"2018-02-27T21:46:39.236Z","links":{"self":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:scancode:2.2.1","type":"resource"},"siblings":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:scancode","type":"collection"}},"version":"2.2.1","contentType":"application/json","releaseDate":"2017-09-26T19:13:51.492Z","processedAt":"2018-02-27T21:47:21.394Z"},"content":{"scancode_notice":"Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.","scancode_version":"2.2.1","scancode_options":{"--copyright":true,"--license":true,"--package":true,"--info":true,"--license-score":0,"--strip-root":true,"--format":"json-pp","--diag":true,"--only-findings":true},"files_count":3,"files":[{"path":"package/LICENSE","type":"file","name":"LICENSE","base_name":"LICENSE","extension":"","date":"2017-06-15","size":1107,"sha1":"d16a2786962571280a11cae01d5e59aeb1351c9a","md5":"ddd815a475e7338b0be7a14d8ee35a99","files_count":null,"mime_type":"text/plain","file_type":"ASCII text","programming_language":null,"is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":false,"is_script":false,"scan_errors":[],"licenses":[{"key":"mit","score":15,"short_name":"MIT License","category":"Permissive","owner":"MIT","homepage_url":"http://opensource.org/licenses/mit-license.php","text_url":"http://opensource.org/licenses/mit-license.php","reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:mit","spdx_license_key":"MIT","spdx_url":"https://spdx.org/licenses/MIT","start_line":1,"end_line":1,"matched_rule":{"identifier":"mit_27.RULE","license_choice":false,"licenses":["mit"],"matcher":"2-aho","rule_length":3,"matched_length":3,"match_coverage":100,"rule_relevance":15}},{"key":"mit","score":100,"short_name":"MIT License","category":"Permissive","owner":"MIT","homepage_url":"http://opensource.org/licenses/mit-license.php","text_url":"http://opensource.org/licenses/mit-license.php","reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:mit","spdx_license_key":"MIT","spdx_url":"https://spdx.org/licenses/MIT","start_line":5,"end_line":18,"matched_rule":{"identifier":"mit.LICENSE","license_choice":false,"licenses":["mit"],"matcher":"2-aho","rule_length":163,"matched_length":163,"match_coverage":100,"rule_relevance":100}}],"copyrights":[{"statements":["Copyright (c) 2014 TJ Holowaychuk "],"holders":["TJ Holowaychuk"],"authors":[],"start_line":3,"end_line":3}],"packages":[]},{"path":"package/package.json","type":"file","name":"package.json","base_name":"package","extension":".json","date":"2017-09-26","size":1021,"sha1":"ea58ffe857db300084291a1b7bd73c08e4fd69ca","md5":"cd0b3a0d33bee20af1c9452cccf99e17","files_count":null,"mime_type":"text/plain","file_type":"ASCII text","programming_language":"JSON","is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":true,"is_script":false,"scan_errors":[],"licenses":[{"key":"mit","score":10,"short_name":"MIT License","category":"Permissive","owner":"MIT","homepage_url":"http://opensource.org/licenses/mit-license.php","text_url":"http://opensource.org/licenses/mit-license.php","reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:mit","spdx_license_key":"MIT","spdx_url":"https://spdx.org/licenses/MIT","start_line":19,"end_line":19,"matched_rule":{"identifier":"mit_34.RULE","license_choice":false,"licenses":["mit"],"matcher":"2-aho","rule_length":2,"matched_length":2,"match_coverage":100,"rule_relevance":10}}],"copyrights":[{"statements":[],"holders":[],"authors":["Nathan Rajlich "],"start_line":14,"end_line":16}],"packages":[{"type":"npm","name":"debug","version":"3.1.0","primary_language":"JavaScript","packaging":null,"summary":"small debugging utility","description":null,"payload_type":null,"size":null,"release_date":null,"authors":[{"type":"person","name":"TJ Holowaychuk","email":"tj@vision-media.ca","url":null}],"maintainers":[],"contributors":[{"type":"person","name":"Nathan Rajlich","email":"nathan@tootallnate.net","url":"http://n8.io"},{"type":"person","name":"Andrew Rhyne","email":"rhyneandrew@gmail.com","url":null}],"owners":[],"packagers":[],"distributors":[],"vendors":[],"keywords":["debug","log","debugger"],"keywords_doc_url":null,"metafile_locations":["package"],"metafile_urls":[],"homepage_url":null,"notes":null,"download_urls":["https://registry.npmjs.org/debug/-/debug-3.1.0.tgz"],"download_sha1":null,"download_sha256":null,"download_md5":null,"bug_tracking_url":null,"support_contacts":[],"code_view_url":null,"vcs_tool":"git","vcs_repository":"git://github.com/visionmedia/debug.git","vcs_revision":null,"copyright_top_level":null,"copyrights":[],"asserted_licenses":[{"license":"MIT","url":null,"text":null,"notice":null}],"legal_file_locations":[],"license_expression":null,"license_texts":[],"notice_texts":[],"dependencies":{"development":[{"name":"browserify","version":null,"version_constraint":"14.4.0"},{"name":"chai","version":null,"version_constraint":"^3.5.0"},{"name":"concurrently","version":null,"version_constraint":"^3.1.0"},{"name":"coveralls","version":null,"version_constraint":"^2.11.15"},{"name":"eslint","version":null,"version_constraint":"^3.12.1"},{"name":"istanbul","version":null,"version_constraint":"^0.4.5"},{"name":"karma","version":null,"version_constraint":"^1.3.0"},{"name":"karma-chai","version":null,"version_constraint":"^0.1.0"},{"name":"karma-mocha","version":null,"version_constraint":"^1.3.0"},{"name":"karma-phantomjs-launcher","version":null,"version_constraint":"^1.0.2"},{"name":"karma-sinon","version":null,"version_constraint":"^1.0.5"},{"name":"mocha","version":null,"version_constraint":"^3.2.0"},{"name":"mocha-lcov-reporter","version":null,"version_constraint":"^1.2.0"},{"name":"rimraf","version":null,"version_constraint":"^2.5.4"},{"name":"sinon","version":null,"version_constraint":"^1.17.6"},{"name":"sinon-chai","version":null,"version_constraint":"^2.8.0"}],"runtime":[{"name":"ms","version":null,"version_constraint":"2.0.0"}]},"related_packages":[]}]},{"path":"package/README.md","type":"file","name":"README.md","base_name":"README","extension":".md","date":"2017-09-26","size":19827,"sha1":"65d9d60fa0cd4cb997ec0b4d7aff8390aef24401","md5":"f701af8298d3b577ce395f9f9c55e269","files_count":null,"mime_type":"text/plain","file_type":"UTF-8 Unicode text, with very long lines","programming_language":null,"is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":false,"is_script":false,"scan_errors":[],"licenses":[{"key":"mit","score":15,"short_name":"MIT License","category":"Permissive","owner":"MIT","homepage_url":"http://opensource.org/licenses/mit-license.php","text_url":"http://opensource.org/licenses/mit-license.php","reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:mit","spdx_license_key":"MIT","spdx_url":"https://spdx.org/licenses/MIT","start_line":347,"end_line":347,"matched_rule":{"identifier":"mit_27.RULE","license_choice":false,"licenses":["mit"],"matcher":"2-aho","rule_length":3,"matched_length":3,"match_coverage":100,"rule_relevance":15}},{"key":"mit","score":100,"short_name":"MIT License","category":"Permissive","owner":"MIT","homepage_url":"http://opensource.org/licenses/mit-license.php","text_url":"http://opensource.org/licenses/mit-license.php","reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:mit","spdx_license_key":"MIT","spdx_url":"https://spdx.org/licenses/MIT","start_line":351,"end_line":368,"matched_rule":{"identifier":"mit.LICENSE","license_choice":false,"licenses":["mit"],"matcher":"2-aho","rule_length":163,"matched_length":163,"match_coverage":100,"rule_relevance":100}}],"copyrights":[{"statements":["Copyright (c) 2014-2017 TJ Holowaychuk < tj@vision-media.ca>"],"holders":["TJ Holowaychuk < tj@vision-media.ca>"],"authors":[],"start_line":349,"end_line":349}],"packages":[]}]}} \ No newline at end of file diff --git a/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0+b1.json b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0+b1.json new file mode 100644 index 000000000..87d11ef53 --- /dev/null +++ b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0+b1.json @@ -0,0 +1 @@ +{"_metadata":{"type":"scancode","url":"cd:/npm/npmjs/-/debug/3.1.0","fetchedAt":"2018-03-12T20:31:32.704Z","links":{"self":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:scancode:2.9.0+b1","type":"resource"},"siblings":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:scancode","type":"collection"}},"version":"2.9.0+b1","contentType":"application/json","releaseDate":"2017-09-26T19:13:51.492Z","processedAt":"2018-03-12T20:31:55.941Z"},"content":{"scancode_notice":"Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.","scancode_version":"2.9.0b1","scancode_options":{"input":"/tmp/cd-aiM4UK","--copyright":true,"--info":true,"--json-pp":"/tmp/cd-CBLveW","--license":true,"--license-diag":true,"--only-findings":true,"--package":true,"--processes":"2","--quiet":true,"--strip-root":true,"--timeout":"1000.0"},"files_count":3,"files":[{"path":"package/LICENSE","type":"file","name":"LICENSE","base_name":"LICENSE","extension":"","size":1107,"date":"2017-06-15","sha1":"d16a2786962571280a11cae01d5e59aeb1351c9a","md5":"ddd815a475e7338b0be7a14d8ee35a99","mime_type":"text/plain","file_type":"ASCII text","programming_language":null,"is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":false,"is_script":false,"licenses":[{"key":"mit","score":15,"short_name":"MIT License","category":"Permissive","owner":"MIT","homepage_url":"http://opensource.org/licenses/mit-license.php","text_url":"http://opensource.org/licenses/mit-license.php","reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:mit","spdx_license_key":"MIT","spdx_url":"https://spdx.org/licenses/MIT","start_line":1,"end_line":1,"matched_rule":{"identifier":"mit_27.RULE","license_choice":false,"licenses":["mit"],"matcher":"2-aho","rule_length":3,"matched_length":3,"match_coverage":100,"rule_relevance":15}},{"key":"mit","score":100,"short_name":"MIT License","category":"Permissive","owner":"MIT","homepage_url":"http://opensource.org/licenses/mit-license.php","text_url":"http://opensource.org/licenses/mit-license.php","reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:mit","spdx_license_key":"MIT","spdx_url":"https://spdx.org/licenses/MIT","start_line":5,"end_line":18,"matched_rule":{"identifier":"mit.LICENSE","license_choice":false,"licenses":["mit"],"matcher":"2-aho","rule_length":163,"matched_length":163,"match_coverage":100,"rule_relevance":100}}],"copyrights":[{"statements":["Copyright (c) 2014 TJ Holowaychuk "],"holders":["TJ Holowaychuk"],"authors":[],"start_line":3,"end_line":3}],"packages":[],"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]},{"path":"package/package.json","type":"file","name":"package.json","base_name":"package","extension":".json","size":1021,"date":"2017-09-26","sha1":"ea58ffe857db300084291a1b7bd73c08e4fd69ca","md5":"cd0b3a0d33bee20af1c9452cccf99e17","mime_type":"text/plain","file_type":"ASCII text","programming_language":"JSON","is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":true,"is_script":false,"licenses":[{"key":"mit","score":10,"short_name":"MIT License","category":"Permissive","owner":"MIT","homepage_url":"http://opensource.org/licenses/mit-license.php","text_url":"http://opensource.org/licenses/mit-license.php","reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:mit","spdx_license_key":"MIT","spdx_url":"https://spdx.org/licenses/MIT","start_line":19,"end_line":19,"matched_rule":{"identifier":"mit_34.RULE","license_choice":false,"licenses":["mit"],"matcher":"2-aho","rule_length":2,"matched_length":2,"match_coverage":100,"rule_relevance":10}}],"copyrights":[],"packages":[{"type":"npm","name":"debug","version":"3.1.0","primary_language":"JavaScript","packaging":null,"summary":"small debugging utility","description":null,"payload_type":null,"size":null,"release_date":null,"authors":[{"type":"person","name":"TJ Holowaychuk","email":"tj@vision-media.ca","url":null}],"maintainers":[],"contributors":[{"type":"person","name":"Nathan Rajlich","email":"nathan@tootallnate.net","url":"http://n8.io"},{"type":"person","name":"Andrew Rhyne","email":"rhyneandrew@gmail.com","url":null}],"owners":[],"packagers":[],"distributors":[],"vendors":[],"keywords":["debug","log","debugger"],"keywords_doc_url":null,"metafile_locations":["package"],"metafile_urls":[],"homepage_url":null,"notes":null,"download_urls":["https://registry.npmjs.org/debug/-/debug-3.1.0.tgz"],"download_sha1":null,"download_sha256":null,"download_md5":null,"bug_tracking_url":null,"support_contacts":[],"code_view_url":null,"vcs_tool":"git","vcs_repository":"git://github.com/visionmedia/debug.git","vcs_revision":null,"copyright_top_level":null,"copyrights":[],"asserted_licenses":[{"license":"MIT","url":null,"text":null,"notice":null}],"legal_file_locations":[],"license_expression":null,"license_texts":[],"notice_texts":[],"dependencies":{"development":[{"name":"browserify","version":null,"version_constraint":"14.4.0"},{"name":"chai","version":null,"version_constraint":"^3.5.0"},{"name":"concurrently","version":null,"version_constraint":"^3.1.0"},{"name":"coveralls","version":null,"version_constraint":"^2.11.15"},{"name":"eslint","version":null,"version_constraint":"^3.12.1"},{"name":"istanbul","version":null,"version_constraint":"^0.4.5"},{"name":"karma","version":null,"version_constraint":"^1.3.0"},{"name":"karma-chai","version":null,"version_constraint":"^0.1.0"},{"name":"karma-mocha","version":null,"version_constraint":"^1.3.0"},{"name":"karma-phantomjs-launcher","version":null,"version_constraint":"^1.0.2"},{"name":"karma-sinon","version":null,"version_constraint":"^1.0.5"},{"name":"mocha","version":null,"version_constraint":"^3.2.0"},{"name":"mocha-lcov-reporter","version":null,"version_constraint":"^1.2.0"},{"name":"rimraf","version":null,"version_constraint":"^2.5.4"},{"name":"sinon","version":null,"version_constraint":"^1.17.6"},{"name":"sinon-chai","version":null,"version_constraint":"^2.8.0"}],"runtime":[{"name":"ms","version":null,"version_constraint":"2.0.0"}]},"related_packages":[]}],"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]},{"path":"package/README.md","type":"file","name":"README.md","base_name":"README","extension":".md","size":19827,"date":"2017-09-26","sha1":"65d9d60fa0cd4cb997ec0b4d7aff8390aef24401","md5":"f701af8298d3b577ce395f9f9c55e269","mime_type":"text/plain","file_type":"UTF-8 Unicode text, with very long lines","programming_language":null,"is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":false,"is_script":false,"licenses":[{"key":"mit","score":15,"short_name":"MIT License","category":"Permissive","owner":"MIT","homepage_url":"http://opensource.org/licenses/mit-license.php","text_url":"http://opensource.org/licenses/mit-license.php","reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:mit","spdx_license_key":"MIT","spdx_url":"https://spdx.org/licenses/MIT","start_line":347,"end_line":347,"matched_rule":{"identifier":"mit_27.RULE","license_choice":false,"licenses":["mit"],"matcher":"2-aho","rule_length":3,"matched_length":3,"match_coverage":100,"rule_relevance":15}},{"key":"mit","score":100,"short_name":"MIT License","category":"Permissive","owner":"MIT","homepage_url":"http://opensource.org/licenses/mit-license.php","text_url":"http://opensource.org/licenses/mit-license.php","reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:mit","spdx_license_key":"MIT","spdx_url":"https://spdx.org/licenses/MIT","start_line":351,"end_line":368,"matched_rule":{"identifier":"mit.LICENSE","license_choice":false,"licenses":["mit"],"matcher":"2-aho","rule_length":163,"matched_length":163,"match_coverage":100,"rule_relevance":100}}],"copyrights":[{"statements":["Copyright (c) 2014-2017 TJ Holowaychuk < tj@vision-media.ca>"],"holders":["TJ Holowaychuk <"],"authors":[],"start_line":349,"end_line":349}],"packages":[],"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]}]}} \ No newline at end of file diff --git a/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/scancode/30.3.0.json b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/scancode/30.3.0.json new file mode 100644 index 000000000..6ae4046c0 --- /dev/null +++ b/test/fixtures/store/npm/npmjs/-/debug/revision/3.1.0/tool/scancode/30.3.0.json @@ -0,0 +1 @@ +{"_metadata":{"type":"scancode","url":"cd:/npm/npmjs/-/debug/3.1.0","fetchedAt":"2022-06-17T13:15:51.545Z","links":{"self":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:scancode:30.3.0","type":"resource"},"siblings":{"href":"urn:npm:npmjs:-:debug:revision:3.1.0:tool:scancode","type":"collection"}},"schemaVersion":"30.3.0","toolVersion":"30.1.0","contentType":"application/json","releaseDate":"2017-09-26T19:13:51.492Z","processedAt":"2022-06-17T13:16:00.481Z"},"content":{"headers":[{"tool_name":"scancode-toolkit","tool_version":"30.1.0","options":{"input":["/tmp/cd-HxmrU7"],"--classify":true,"--copyright":true,"--email":true,"--generated":true,"--info":true,"--is-license-text":true,"--json-pp":"/tmp/cd-YlBY9v","--license":true,"--license-clarity-score":true,"--license-text":true,"--license-text-diagnostics":true,"--package":true,"--processes":"2","--strip-root":true,"--summary":true,"--summary-key-files":true,"--timeout":"1000.0","--url":true},"notice":"Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.","start_timestamp":"2022-06-17T131553.297464","end_timestamp":"2022-06-17T131559.615699","output_format_version":"1.0.0","duration":6.318253040313721,"message":null,"errors":[],"warnings":[],"extra_data":{"spdx_license_list_version":"3.14","OUTDATED":"WARNING: Outdated ScanCode Toolkit version! You are using an outdated version of ScanCode Toolkit: 30.1.0 released on: 2021-09-24. A new version is available with important improvements including bug and security fixes, updated license, copyright and package detection, and improved scanning accuracy. Please download and install the latest version of ScanCode. Visit https://github.com/nexB/scancode-toolkit/releases for details.","files_count":15}}],"summary":{"license_expressions":[{"value":"mit","count":5}],"copyrights":[{"value":null,"count":13},{"value":"Copyright (c) TJ Holowaychuk ","count":2}],"holders":[{"value":null,"count":13},{"value":"TJ Holowaychuk","count":2}],"authors":[{"value":null,"count":14},{"value":"TJ Holowaychuk ","count":1}],"programming_language":[{"value":"JavaScript","count":6}],"packages":[{"type":"npm","namespace":null,"name":"debug","version":"3.1.0","qualifiers":{},"subpath":null,"primary_language":"JavaScript","description":"small debugging utility","release_date":null,"parties":[{"type":"person","role":"author","name":"TJ Holowaychuk","email":"tj@vision-media.ca","url":null},{"type":"person","role":"contributor","name":"Nathan Rajlich","email":"nathan@tootallnate.net","url":"http://n8.io"},{"type":"person","role":"contributor","name":"Andrew Rhyne","email":"rhyneandrew@gmail.com","url":null}],"keywords":["debug","log","debugger"],"homepage_url":null,"download_url":"https://registry.npmjs.org/debug/-/debug-3.1.0.tgz","size":null,"sha1":null,"md5":null,"sha256":null,"sha512":null,"bug_tracking_url":null,"code_view_url":null,"vcs_url":"git://github.com/visionmedia/debug.git","copyright":null,"license_expression":"mit","declared_license":["MIT"],"notice_text":null,"root_path":"package","dependencies":[{"purl":"pkg:npm/ms","requirement":"2.0.0","scope":"dependencies","is_runtime":true,"is_optional":false,"is_resolved":false},{"purl":"pkg:npm/browserify","requirement":"14.4.0","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/chai","requirement":"^3.5.0","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/concurrently","requirement":"^3.1.0","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/coveralls","requirement":"^2.11.15","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/eslint","requirement":"^3.12.1","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/istanbul","requirement":"^0.4.5","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/karma","requirement":"^1.3.0","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/karma-chai","requirement":"^0.1.0","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/karma-mocha","requirement":"^1.3.0","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/karma-phantomjs-launcher","requirement":"^1.0.2","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/karma-sinon","requirement":"^1.0.5","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/mocha","requirement":"^3.2.0","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/mocha-lcov-reporter","requirement":"^1.2.0","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/rimraf","requirement":"^2.5.4","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/sinon","requirement":"^1.17.6","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/sinon-chai","requirement":"^2.8.0","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false}],"contains_source_code":null,"source_packages":[],"extra_data":{},"purl":"pkg:npm/debug@3.1.0","repository_homepage_url":"https://www.npmjs.com/package/debug","repository_download_url":"https://registry.npmjs.org/debug/-/debug-3.1.0.tgz","api_data_url":"https://registry.npmjs.org/debug/3.1.0","files":[{"path":"package/package.json","type":"file"}]}]},"license_clarity_score":{"score":45,"declared":true,"discovered":0,"consistency":false,"spdx":false,"license_texts":true},"summary_of_key_files":{"license_expressions":[{"value":"mit","count":5}],"copyrights":[{"value":"Copyright (c) TJ Holowaychuk ","count":2}],"holders":[{"value":"TJ Holowaychuk","count":2}],"authors":[{"value":"TJ Holowaychuk ","count":1}],"programming_language":[]},"files":[{"path":"package","type":"directory","name":"package","base_name":"package","extension":"","size":0,"date":null,"sha1":null,"md5":null,"sha256":null,"mime_type":null,"file_type":null,"programming_language":null,"is_binary":false,"is_text":false,"is_archive":false,"is_media":false,"is_source":false,"is_script":false,"licenses":[],"license_expressions":[],"percentage_of_license_text":0,"copyrights":[],"holders":[],"authors":[],"packages":[],"emails":[],"urls":[],"is_legal":false,"is_manifest":false,"is_readme":false,"is_top_level":true,"is_key_file":false,"is_generated":false,"is_license_text":false,"files_count":15,"dirs_count":1,"size_count":53635,"scan_errors":[]},{"path":"package/.coveralls.yml","type":"file","name":".coveralls.yml","base_name":".coveralls","extension":".yml","size":46,"date":"2017-06-15","sha1":"90709e4fb4ce17729974b3a140ccbf330519835c","md5":"55352d85883681df5f0fa66d3f32a872","sha256":"64e6b64f19837a76c30865579aabdde1a825729ae0204ba73ba6de77296ce18e","mime_type":"text/plain","file_type":"ASCII text","programming_language":null,"is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":false,"is_script":false,"licenses":[],"license_expressions":[],"percentage_of_license_text":0,"copyrights":[],"holders":[],"authors":[],"packages":[],"emails":[],"urls":[],"is_legal":false,"is_manifest":false,"is_readme":false,"is_top_level":true,"is_key_file":false,"is_generated":false,"is_license_text":false,"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]},{"path":"package/.eslintrc","type":"file","name":".eslintrc","base_name":".eslintrc","extension":"","size":219,"date":"2017-09-22","sha1":"9249b5c46b21d7e51bd0d9ad96c27d7a7a1d720b","md5":"5f1cddc345689f0bdca588b0a90e64f0","sha256":"66c124aad9fb6effb2cd86912a97aeb5d9a03cfcb60b18da1bc0e0f6a100bcd2","mime_type":"application/json","file_type":"JSON data","programming_language":null,"is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":false,"is_script":false,"licenses":[],"license_expressions":[],"percentage_of_license_text":0,"copyrights":[],"holders":[],"authors":[],"packages":[],"emails":[],"urls":[],"is_legal":false,"is_manifest":false,"is_readme":false,"is_top_level":true,"is_key_file":false,"is_generated":false,"is_license_text":false,"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]},{"path":"package/.npmignore","type":"file","name":".npmignore","base_name":".npmignore","extension":"","size":72,"date":"2017-06-15","sha1":"90fef7cc1058bd0f85b0959c4fcd49230a29593e","md5":"b0205b7904bef0ad0b403fbcf4f57434","sha256":"f4580152a6f48954b44cb2a0a002fa500467663db5a6dc8e796b52533dc04ec1","mime_type":"text/plain","file_type":"ASCII text","programming_language":null,"is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":false,"is_script":false,"licenses":[],"license_expressions":[],"percentage_of_license_text":0,"copyrights":[],"holders":[],"authors":[],"packages":[],"emails":[],"urls":[],"is_legal":false,"is_manifest":false,"is_readme":false,"is_top_level":true,"is_key_file":false,"is_generated":false,"is_license_text":false,"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]},{"path":"package/.travis.yml","type":"file","name":".travis.yml","base_name":".travis","extension":".yml","size":185,"date":"2017-09-22","sha1":"ad20938f07f056cbbdb35383aebc88feb5ecc361","md5":"220daf85814cf108e17a793146504261","sha256":"f0698f642c1a37c840f4eda339b197bb7e563f5ffeabc65312608fa4d31cfbf6","mime_type":"text/plain","file_type":"ASCII text","programming_language":null,"is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":false,"is_script":false,"licenses":[],"license_expressions":[],"percentage_of_license_text":0,"copyrights":[],"holders":[],"authors":[],"packages":[],"emails":[],"urls":[],"is_legal":false,"is_manifest":false,"is_readme":false,"is_top_level":true,"is_key_file":false,"is_generated":false,"is_license_text":false,"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]},{"path":"package/CHANGELOG.md","type":"file","name":"CHANGELOG.md","base_name":"CHANGELOG","extension":".md","size":12950,"date":"2017-09-26","sha1":"9e7ab0e94f1d90c8073a4f75c79e01e2d86bef4c","md5":"28887cf82104b986b49ebd40f75f634d","sha256":"7a4879d2b37c50ed15d18a51c07905f993588873d7730b1584db386f81588d34","mime_type":"text/plain","file_type":"ASCII text","programming_language":null,"is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":false,"is_script":false,"licenses":[],"license_expressions":[],"percentage_of_license_text":0,"copyrights":[],"holders":[],"authors":[],"packages":[],"emails":[],"urls":[],"is_legal":false,"is_manifest":false,"is_readme":false,"is_top_level":true,"is_key_file":false,"is_generated":false,"is_license_text":false,"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]},{"path":"package/karma.conf.js","type":"file","name":"karma.conf.js","base_name":"karma.conf","extension":".js","size":1736,"date":"2017-06-15","sha1":"93fef7cf3ed6f04d2cfc3cd0b8d5d972d35cfd29","md5":"06f3babbdc43c6c4dd1493b6c1af32e2","sha256":"2430869adb61a5e24a3612110a9b49a948e6db43ab7e947c003a9c19c478e609","mime_type":"text/plain","file_type":"ASCII text","programming_language":"JavaScript","is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":true,"is_script":false,"licenses":[],"license_expressions":[],"percentage_of_license_text":0,"copyrights":[],"holders":[],"authors":[],"packages":[],"emails":[],"urls":[{"url":"https://npmjs.org/browse/keyword/karma-adapter","start_line":12,"end_line":12},{"url":"https://npmjs.org/browse/keyword/karma-preprocessor","start_line":30,"end_line":30},{"url":"https://npmjs.org/browse/keyword/karma-reporter","start_line":36,"end_line":36},{"url":"https://npmjs.org/browse/keyword/karma-launcher","start_line":58,"end_line":58}],"is_legal":false,"is_manifest":false,"is_readme":false,"is_top_level":true,"is_key_file":false,"is_generated":true,"is_license_text":false,"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]},{"path":"package/LICENSE","type":"file","name":"LICENSE","base_name":"LICENSE","extension":"","size":1107,"date":"2017-06-15","sha1":"d16a2786962571280a11cae01d5e59aeb1351c9a","md5":"ddd815a475e7338b0be7a14d8ee35a99","sha256":"98c970de440dcfc77471610aec2377c9d9b0db2b3be6d1add524a586e1d7f422","mime_type":"text/plain","file_type":"ASCII text","programming_language":null,"is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":false,"is_script":false,"licenses":[{"key":"mit","score":100,"name":"MIT License","short_name":"MIT License","category":"Permissive","is_exception":false,"is_unknown":false,"owner":"MIT","homepage_url":"http://opensource.org/licenses/mit-license.php","text_url":"http://opensource.org/licenses/mit-license.php","reference_url":"https://scancode-licensedb.aboutcode.org/mit","scancode_text_url":"https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE","scancode_data_url":"https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.yml","spdx_license_key":"MIT","spdx_url":"https://spdx.org/licenses/MIT","start_line":1,"end_line":1,"matched_rule":{"identifier":"mit_27.RULE","license_expression":"mit","licenses":["mit"],"referenced_filenames":[],"is_license_text":false,"is_license_notice":false,"is_license_reference":true,"is_license_tag":false,"is_license_intro":false,"has_unknown":false,"matcher":"2-aho","rule_length":3,"matched_length":3,"match_coverage":100,"rule_relevance":100},"matched_text":"The MIT License)"},{"key":"mit","score":100,"name":"MIT License","short_name":"MIT License","category":"Permissive","is_exception":false,"is_unknown":false,"owner":"MIT","homepage_url":"http://opensource.org/licenses/mit-license.php","text_url":"http://opensource.org/licenses/mit-license.php","reference_url":"https://scancode-licensedb.aboutcode.org/mit","scancode_text_url":"https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE","scancode_data_url":"https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.yml","spdx_license_key":"MIT","spdx_url":"https://spdx.org/licenses/MIT","start_line":5,"end_line":18,"matched_rule":{"identifier":"mit.LICENSE","license_expression":"mit","licenses":["mit"],"referenced_filenames":[],"is_license_text":true,"is_license_notice":false,"is_license_reference":false,"is_license_tag":false,"is_license_intro":false,"has_unknown":false,"matcher":"2-aho","rule_length":161,"matched_length":161,"match_coverage":100,"rule_relevance":100},"matched_text":"Permission is hereby granted, free of charge, to any person obtaining a copy of this software \nand associated documentation files (the 'Software'), to deal in the Software without restriction, \nincluding without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, \nand/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial \nportions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT \nLIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. \nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, \nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE \nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."}],"license_expressions":["mit","mit"],"percentage_of_license_text":94.8,"copyrights":[{"value":"Copyright (c) 2014 TJ Holowaychuk ","start_line":3,"end_line":3}],"holders":[{"value":"TJ Holowaychuk","start_line":3,"end_line":3}],"authors":[],"packages":[],"emails":[{"email":"tj@vision-media.ca","start_line":3,"end_line":3}],"urls":[],"is_legal":true,"is_manifest":false,"is_readme":false,"is_top_level":true,"is_key_file":true,"is_generated":false,"is_license_text":true,"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]},{"path":"package/Makefile","type":"file","name":"Makefile","base_name":"Makefile","extension":"","size":1234,"date":"2017-09-22","sha1":"27ba9abecf06bf547905c50f5979caff65574b4c","md5":"cd737b01cb5a860f5bbc15f2e6a3c183","sha256":"6710a17e1572ed23600b5746cb6bae63bb0fa27b46c4e5a1604e45956edbccea","mime_type":"text/plain","file_type":"ASCII text","programming_language":null,"is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":false,"is_script":false,"licenses":[],"license_expressions":[],"percentage_of_license_text":0,"copyrights":[],"holders":[],"authors":[],"packages":[],"emails":[],"urls":[{"url":"http://stackoverflow.com/a/5982798/376773","start_line":1,"end_line":1}],"is_legal":false,"is_manifest":false,"is_readme":false,"is_top_level":true,"is_key_file":false,"is_generated":false,"is_license_text":false,"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]},{"path":"package/node.js","type":"file","name":"node.js","base_name":"node","extension":".js","size":40,"date":"2017-06-15","sha1":"aa7655ee80c9a485313675f9379c2f18d33ea061","md5":"79f3814f32362c1c6f9dbb8a1e3b01bf","sha256":"996b381f353555cb172ebb2802bb2a7323442ff67b7b530cc26834058d7f31a2","mime_type":"text/plain","file_type":"ASCII text","programming_language":"JavaScript","is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":true,"is_script":false,"licenses":[],"license_expressions":[],"percentage_of_license_text":0,"copyrights":[],"holders":[],"authors":[],"packages":[],"emails":[],"urls":[],"is_legal":false,"is_manifest":false,"is_readme":false,"is_top_level":true,"is_key_file":false,"is_generated":false,"is_license_text":false,"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]},{"path":"package/package.json","type":"file","name":"package.json","base_name":"package","extension":".json","size":1021,"date":"2017-09-26","sha1":"ea58ffe857db300084291a1b7bd73c08e4fd69ca","md5":"cd0b3a0d33bee20af1c9452cccf99e17","sha256":"607790755743bf6fffb337f7661460fda64b9de81b0f3e4c27954ea41b46abd3","mime_type":"application/json","file_type":"JSON data","programming_language":null,"is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":false,"is_script":false,"licenses":[{"key":"mit","score":100,"name":"MIT License","short_name":"MIT License","category":"Permissive","is_exception":false,"is_unknown":false,"owner":"MIT","homepage_url":"http://opensource.org/licenses/mit-license.php","text_url":"http://opensource.org/licenses/mit-license.php","reference_url":"https://scancode-licensedb.aboutcode.org/mit","scancode_text_url":"https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE","scancode_data_url":"https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.yml","spdx_license_key":"MIT","spdx_url":"https://spdx.org/licenses/MIT","start_line":19,"end_line":19,"matched_rule":{"identifier":"mit_30.RULE","license_expression":"mit","licenses":["mit"],"referenced_filenames":[],"is_license_text":false,"is_license_notice":false,"is_license_reference":false,"is_license_tag":true,"is_license_intro":false,"has_unknown":false,"matcher":"2-aho","rule_length":2,"matched_length":2,"match_coverage":100,"rule_relevance":100},"matched_text":"license\": \"MIT\","}],"license_expressions":["mit"],"percentage_of_license_text":1.53,"copyrights":[],"holders":[],"authors":[{"value":"TJ Holowaychuk ","start_line":14,"end_line":14}],"packages":[{"type":"npm","namespace":null,"name":"debug","version":"3.1.0","qualifiers":{},"subpath":null,"primary_language":"JavaScript","description":"small debugging utility","release_date":null,"parties":[{"type":"person","role":"author","name":"TJ Holowaychuk","email":"tj@vision-media.ca","url":null},{"type":"person","role":"contributor","name":"Nathan Rajlich","email":"nathan@tootallnate.net","url":"http://n8.io"},{"type":"person","role":"contributor","name":"Andrew Rhyne","email":"rhyneandrew@gmail.com","url":null}],"keywords":["debug","log","debugger"],"homepage_url":null,"download_url":"https://registry.npmjs.org/debug/-/debug-3.1.0.tgz","size":null,"sha1":null,"md5":null,"sha256":null,"sha512":null,"bug_tracking_url":null,"code_view_url":null,"vcs_url":"git://github.com/visionmedia/debug.git","copyright":null,"license_expression":"mit","declared_license":["MIT"],"notice_text":null,"root_path":"package","dependencies":[{"purl":"pkg:npm/ms","requirement":"2.0.0","scope":"dependencies","is_runtime":true,"is_optional":false,"is_resolved":false},{"purl":"pkg:npm/browserify","requirement":"14.4.0","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/chai","requirement":"^3.5.0","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/concurrently","requirement":"^3.1.0","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/coveralls","requirement":"^2.11.15","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/eslint","requirement":"^3.12.1","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/istanbul","requirement":"^0.4.5","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/karma","requirement":"^1.3.0","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/karma-chai","requirement":"^0.1.0","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/karma-mocha","requirement":"^1.3.0","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/karma-phantomjs-launcher","requirement":"^1.0.2","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/karma-sinon","requirement":"^1.0.5","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/mocha","requirement":"^3.2.0","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/mocha-lcov-reporter","requirement":"^1.2.0","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/rimraf","requirement":"^2.5.4","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/sinon","requirement":"^1.17.6","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false},{"purl":"pkg:npm/sinon-chai","requirement":"^2.8.0","scope":"devDependencies","is_runtime":false,"is_optional":true,"is_resolved":false}],"contains_source_code":null,"source_packages":[],"extra_data":{},"purl":"pkg:npm/debug@3.1.0","repository_homepage_url":"https://www.npmjs.com/package/debug","repository_download_url":"https://registry.npmjs.org/debug/-/debug-3.1.0.tgz","api_data_url":"https://registry.npmjs.org/debug/3.1.0","files":[{"path":"package/package.json","type":"file"}]}],"emails":[{"email":"tj@vision-media.ca","start_line":14,"end_line":14},{"email":"nathan@tootallnate.net","start_line":16,"end_line":16},{"email":"rhyneandrew@gmail.com","start_line":17,"end_line":17}],"urls":[{"url":"git://github.com/visionmedia/debug.git","start_line":6,"end_line":6},{"url":"http://n8.io/","start_line":16,"end_line":16}],"is_legal":false,"is_manifest":true,"is_readme":false,"is_top_level":true,"is_key_file":true,"is_generated":false,"is_license_text":false,"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]},{"path":"package/README.md","type":"file","name":"README.md","base_name":"README","extension":".md","size":19827,"date":"2017-09-26","sha1":"65d9d60fa0cd4cb997ec0b4d7aff8390aef24401","md5":"f701af8298d3b577ce395f9f9c55e269","sha256":"5d6ccbbfbc3baeed80ca7253ae6641e9f28b4746e5eef5e4095f6635e2e3af57","mime_type":"text/plain","file_type":"UTF-8 Unicode text, with very long lines","programming_language":null,"is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":false,"is_script":false,"licenses":[{"key":"mit","score":100,"name":"MIT License","short_name":"MIT License","category":"Permissive","is_exception":false,"is_unknown":false,"owner":"MIT","homepage_url":"http://opensource.org/licenses/mit-license.php","text_url":"http://opensource.org/licenses/mit-license.php","reference_url":"https://scancode-licensedb.aboutcode.org/mit","scancode_text_url":"https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE","scancode_data_url":"https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.yml","spdx_license_key":"MIT","spdx_url":"https://spdx.org/licenses/MIT","start_line":345,"end_line":347,"matched_rule":{"identifier":"mit_649.RULE","license_expression":"mit","licenses":["mit"],"referenced_filenames":[],"is_license_text":false,"is_license_notice":true,"is_license_reference":false,"is_license_tag":false,"is_license_intro":false,"has_unknown":false,"matcher":"2-aho","rule_length":4,"matched_length":4,"match_coverage":100,"rule_relevance":100},"matched_text":"License\n\n(The MIT License)"},{"key":"mit","score":100,"name":"MIT License","short_name":"MIT License","category":"Permissive","is_exception":false,"is_unknown":false,"owner":"MIT","homepage_url":"http://opensource.org/licenses/mit-license.php","text_url":"http://opensource.org/licenses/mit-license.php","reference_url":"https://scancode-licensedb.aboutcode.org/mit","scancode_text_url":"https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE","scancode_data_url":"https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.yml","spdx_license_key":"MIT","spdx_url":"https://spdx.org/licenses/MIT","start_line":351,"end_line":368,"matched_rule":{"identifier":"mit.LICENSE","license_expression":"mit","licenses":["mit"],"referenced_filenames":[],"is_license_text":true,"is_license_notice":false,"is_license_reference":false,"is_license_tag":false,"is_license_intro":false,"has_unknown":false,"matcher":"2-aho","rule_length":161,"matched_length":161,"match_coverage":100,"rule_relevance":100},"matched_text":"Permission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."}],"license_expressions":["mit","mit"],"percentage_of_license_text":6.42,"copyrights":[{"value":"Copyright (c) 2014-2017 TJ Holowaychuk ","start_line":349,"end_line":349}],"holders":[{"value":"TJ Holowaychuk","start_line":349,"end_line":349}],"authors":[],"packages":[],"emails":[{"email":"tj@vision-media.ca","start_line":349,"end_line":349}],"urls":[{"url":"https://travis-ci.org/visionmedia/debug.svg?branch=master","start_line":2,"end_line":2},{"url":"https://travis-ci.org/visionmedia/debug","start_line":2,"end_line":2},{"url":"https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master","start_line":2,"end_line":2},{"url":"https://coveralls.io/github/visionmedia/debug?branch=master","start_line":2,"end_line":2},{"url":"https://visionmedia-community-slackin.now.sh/badge.svg","start_line":2,"end_line":2},{"url":"https://visionmedia-community-slackin.now.sh/","start_line":2,"end_line":2},{"url":"https://opencollective.com/debug/backers/badge.svg","start_line":2,"end_line":2},{"url":"https://opencollective.com/debug/sponsors/badge.svg","start_line":3,"end_line":3},{"url":"https://npmjs.org/supports-color","start_line":99,"end_line":99},{"url":"https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31","start_line":108,"end_line":108},{"url":"https://nodejs.org/api/util.html#util_util_inspect_object_options","start_line":158,"end_line":158},{"url":"https://wikipedia.org/wiki/Printf_format_string","start_line":163,"end_line":163},{"url":"https://github.com/substack/node-browserify","start_line":197,"end_line":197},{"url":"https://wzrd.in/","start_line":198,"end_line":198},{"url":"https://wzrd.in/standalone/debug@latest","start_line":198,"end_line":198},{"url":"https://opencollective.com/debug#backer","start_line":276,"end_line":276},{"url":"https://opencollective.com/debug/backer/0/website","start_line":278,"end_line":278},{"url":"https://opencollective.com/debug/backer/0/avatar.svg","start_line":278,"end_line":278},{"url":"https://opencollective.com/debug/backer/1/website","start_line":279,"end_line":279},{"url":"https://opencollective.com/debug/backer/1/avatar.svg","start_line":279,"end_line":279},{"url":"https://opencollective.com/debug/backer/2/website","start_line":280,"end_line":280},{"url":"https://opencollective.com/debug/backer/2/avatar.svg","start_line":280,"end_line":280},{"url":"https://opencollective.com/debug/backer/3/website","start_line":281,"end_line":281},{"url":"https://opencollective.com/debug/backer/3/avatar.svg","start_line":281,"end_line":281},{"url":"https://opencollective.com/debug/backer/4/website","start_line":282,"end_line":282},{"url":"https://opencollective.com/debug/backer/4/avatar.svg","start_line":282,"end_line":282},{"url":"https://opencollective.com/debug/backer/5/website","start_line":283,"end_line":283},{"url":"https://opencollective.com/debug/backer/5/avatar.svg","start_line":283,"end_line":283},{"url":"https://opencollective.com/debug/backer/6/website","start_line":284,"end_line":284},{"url":"https://opencollective.com/debug/backer/6/avatar.svg","start_line":284,"end_line":284},{"url":"https://opencollective.com/debug/backer/7/website","start_line":285,"end_line":285},{"url":"https://opencollective.com/debug/backer/7/avatar.svg","start_line":285,"end_line":285},{"url":"https://opencollective.com/debug/backer/8/website","start_line":286,"end_line":286},{"url":"https://opencollective.com/debug/backer/8/avatar.svg","start_line":286,"end_line":286},{"url":"https://opencollective.com/debug/backer/9/website","start_line":287,"end_line":287},{"url":"https://opencollective.com/debug/backer/9/avatar.svg","start_line":287,"end_line":287},{"url":"https://opencollective.com/debug/backer/10/website","start_line":288,"end_line":288},{"url":"https://opencollective.com/debug/backer/10/avatar.svg","start_line":288,"end_line":288},{"url":"https://opencollective.com/debug/backer/11/website","start_line":289,"end_line":289},{"url":"https://opencollective.com/debug/backer/11/avatar.svg","start_line":289,"end_line":289},{"url":"https://opencollective.com/debug/backer/12/website","start_line":290,"end_line":290},{"url":"https://opencollective.com/debug/backer/12/avatar.svg","start_line":290,"end_line":290},{"url":"https://opencollective.com/debug/backer/13/website","start_line":291,"end_line":291},{"url":"https://opencollective.com/debug/backer/13/avatar.svg","start_line":291,"end_line":291},{"url":"https://opencollective.com/debug/backer/14/website","start_line":292,"end_line":292},{"url":"https://opencollective.com/debug/backer/14/avatar.svg","start_line":292,"end_line":292},{"url":"https://opencollective.com/debug/backer/15/website","start_line":293,"end_line":293},{"url":"https://opencollective.com/debug/backer/15/avatar.svg","start_line":293,"end_line":293},{"url":"https://opencollective.com/debug/backer/16/website","start_line":294,"end_line":294},{"url":"https://opencollective.com/debug/backer/16/avatar.svg","start_line":294,"end_line":294}],"is_legal":false,"is_manifest":false,"is_readme":true,"is_top_level":true,"is_key_file":true,"is_generated":false,"is_license_text":false,"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]},{"path":"package/src","type":"directory","name":"src","base_name":"src","extension":"","size":0,"date":null,"sha1":null,"md5":null,"sha256":null,"mime_type":null,"file_type":null,"programming_language":null,"is_binary":false,"is_text":false,"is_archive":false,"is_media":false,"is_source":false,"is_script":false,"licenses":[],"license_expressions":[],"percentage_of_license_text":0,"copyrights":[],"holders":[],"authors":[],"packages":[],"emails":[],"urls":[],"is_legal":false,"is_manifest":false,"is_readme":false,"is_top_level":true,"is_key_file":false,"is_generated":false,"is_license_text":false,"files_count":4,"dirs_count":0,"size_count":15198,"scan_errors":[]},{"path":"package/src/browser.js","type":"file","name":"browser.js","base_name":"browser","extension":".js","size":5707,"date":"2017-09-26","sha1":"836c2d882a28ef05767ab67e4499b443922d7adf","md5":"23d5a69338855f953a919ce32b53a2d2","sha256":"ff0797d27d04ba7f69485abb04357ec274d6e0e896896e6cf640d29a9d399bb0","mime_type":"text/plain","file_type":"ASCII text","programming_language":"JavaScript","is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":true,"is_script":false,"licenses":[],"license_expressions":[],"percentage_of_license_text":0,"copyrights":[],"holders":[],"authors":[],"packages":[],"emails":[],"urls":[{"url":"http://stackoverflow.com/a/16459606/376773","start_line":57,"end_line":57},{"url":"https://github.com/facebook/react-native/pull/1632","start_line":58,"end_line":58},{"url":"http://stackoverflow.com/a/398120/376773","start_line":60,"end_line":60},{"url":"https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages","start_line":63,"end_line":63}],"is_legal":false,"is_manifest":false,"is_readme":false,"is_top_level":false,"is_key_file":false,"is_generated":false,"is_license_text":false,"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]},{"path":"package/src/debug.js","type":"file","name":"debug.js","base_name":"debug","extension":".js","size":4889,"date":"2017-09-26","sha1":"58e3676c3989d3f6c03fa8f50485c1249a0b148a","md5":"140d46ef8644efa440cd8b602d56b1e0","sha256":"c2df5319cf8768d1bb64f99f74e7dc14188a9455b20509b9a8c4bd126a2b5e4e","mime_type":"text/plain","file_type":"ASCII text","programming_language":"JavaScript","is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":true,"is_script":false,"licenses":[],"license_expressions":[],"percentage_of_license_text":0,"copyrights":[],"holders":[],"authors":[],"packages":[],"emails":[],"urls":[],"is_legal":false,"is_manifest":false,"is_readme":false,"is_top_level":false,"is_key_file":false,"is_generated":false,"is_license_text":false,"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]},{"path":"package/src/index.js","type":"file","name":"index.js","base_name":"index","extension":".js","size":263,"date":"2017-09-22","sha1":"be4a5e319ff5c28b88a1ab4d272b59bd420e22e3","md5":"afd4620d6095583cdae71b234c60c13a","sha256":"27a340bb23865b2eee705d7fdc000538ad2664564bfd2148f30cc5921ceb722e","mime_type":"text/plain","file_type":"ASCII text","programming_language":"JavaScript","is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":true,"is_script":false,"licenses":[],"license_expressions":[],"percentage_of_license_text":0,"copyrights":[],"holders":[],"authors":[],"packages":[],"emails":[],"urls":[],"is_legal":false,"is_manifest":false,"is_readme":false,"is_top_level":false,"is_key_file":false,"is_generated":false,"is_license_text":false,"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]},{"path":"package/src/node.js","type":"file","name":"node.js","base_name":"node","extension":".js","size":4339,"date":"2017-09-26","sha1":"6a0da57e0adbfe592cc3df2c2e708083f7dcad28","md5":"2754f6e90cbac39ee063f9b010b135f3","sha256":"23a1f983515544cdb386e1c17605ec4717399ac95c1be9d8f1cb5b2c116a1494","mime_type":"text/plain","file_type":"ASCII text","programming_language":"JavaScript","is_binary":false,"is_text":true,"is_archive":false,"is_media":false,"is_source":true,"is_script":false,"licenses":[],"license_expressions":[],"percentage_of_license_text":0,"copyrights":[],"holders":[],"authors":[],"packages":[],"emails":[],"urls":[],"is_legal":false,"is_manifest":false,"is_readme":false,"is_top_level":false,"is_key_file":false,"is_generated":false,"is_license_text":false,"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]}]}} \ No newline at end of file diff --git a/test/providers/store/abstractFileStore.js b/test/providers/store/abstractFileStore.js index e45451c21..dbadf2b68 100644 --- a/test/providers/store/abstractFileStore.js +++ b/test/providers/store/abstractFileStore.js @@ -11,7 +11,6 @@ const expect = chai.expect const EntityCoordinates = require('../../../lib/entityCoordinates') const AbstractFileStore = require('../../../providers/stores/abstractFileStore') -describe('AbstractFileStore', () => { describe('AbstractFileStore lists entries ', () => { let FileStore const data = { @@ -202,7 +201,7 @@ describe('AbstractFileStore', () => { describe('getLatestToolVersions', () => { it('should get latest tool versions', () => { - let latest = AbstractFileStore.getLatestToolPaths([ + const latest = AbstractFileStore.getLatestToolPaths([ 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/clearlydefined/1.5.0.json', 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.18.1.json', 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.14.0.json', @@ -219,7 +218,7 @@ describe('AbstractFileStore', () => { ]) }) it('should get latest tool versions and ignore un-versioned data', () => { - let latest = AbstractFileStore.getLatestToolPaths([ + const latest = AbstractFileStore.getLatestToolPaths([ 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json', 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.2.1.json', 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.1.json', @@ -232,7 +231,7 @@ describe('AbstractFileStore', () => { ]) }) it('should get latest tool versions and ignore invalid semver', () => { - let latest = AbstractFileStore.getLatestToolPaths([ + const latest = AbstractFileStore.getLatestToolPaths([ 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.10.0.json', 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.2.1.json', @@ -249,7 +248,7 @@ describe('AbstractFileStore', () => { }) it('should ignore invalid semver, invalid sermver first', () => { - let latest = AbstractFileStore.getLatestToolPaths([ + const latest = AbstractFileStore.getLatestToolPaths([ 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json', 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json' ]) @@ -257,7 +256,7 @@ describe('AbstractFileStore', () => { }) it('should ignore invalid semver, invalid sermver last', () => { - let latest = AbstractFileStore.getLatestToolPaths([ + const latest = AbstractFileStore.getLatestToolPaths([ 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json', 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json' ]) @@ -265,7 +264,7 @@ describe('AbstractFileStore', () => { }) it('should return at least the first tool version', () => { - let latest = AbstractFileStore.getLatestToolPaths([ + const latest = AbstractFileStore.getLatestToolPaths([ 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json' ]) @@ -275,4 +274,3 @@ describe('AbstractFileStore', () => { ]) }) }) -}) diff --git a/test/providers/store/fileHarvest.js b/test/providers/store/fileHarvest.js index a71c73b9c..fe9e0bd4f 100644 --- a/test/providers/store/fileHarvest.js +++ b/test/providers/store/fileHarvest.js @@ -93,14 +93,7 @@ describe('FileHarvestStore', () => { let fileStore beforeEach(() => { - const options = { - location: '/tmp/harvested_data', - logger: { - error: () => {}, - debug: () => {} - } - } - fileStore = FileStore(options) + fileStore = createFileHarvestStore() }) it('should get latest files', () => { @@ -122,5 +115,50 @@ describe('FileHarvestStore', () => { expect(result.length).to.eq(allFiles.length) expect(Array.from(result)).to.equalInAnyOrder(allFiles) }) + + it('should return all harvest results', async () => { + const coordinates = EntityCoordinates.fromString('npm/npmjs/-/debug/3.1.0') + const result = await fileStore.getAll(coordinates) + const tools = Object.getOwnPropertyNames(result) + expect(tools.length).to.eq(5) + const clearlydefinedVersions = Object.getOwnPropertyNames(result.clearlydefined) + expect(clearlydefinedVersions).to.equalInAnyOrder(['1', '1.1.2', '1.3.4']) + const scancodeVersions = Object.getOwnPropertyNames(result.scancode) + expect(scancodeVersions).to.equalInAnyOrder(['2.2.1', '2.9.0+b1', '30.3.0']) + const licenseeVersions = Object.getOwnPropertyNames(result.licensee) + expect(licenseeVersions).to.equalInAnyOrder(['9.12.1', '9.14.0']) + const reuseVersions = Object.getOwnPropertyNames(result.reuse) + expect(reuseVersions).to.equalInAnyOrder(['1.3.0', '3.2.1']) + const fossologyVersions = Object.getOwnPropertyNames(result.fossology) + expect(fossologyVersions).to.equalInAnyOrder(['3.3.0', '3.6.0']) + }) + + it('should return all latest harvest results', async () => { + const coordinates = EntityCoordinates.fromString('npm/npmjs/-/debug/3.1.0') + const result = await fileStore.getAllLatest(coordinates) + const tools = Object.getOwnPropertyNames(result) + expect(tools.length).to.eq(5) + const clearlydefinedVersions = Object.getOwnPropertyNames(result.clearlydefined) + expect(clearlydefinedVersions).to.equalInAnyOrder(['1.3.4']) + const scancodeVersions = Object.getOwnPropertyNames(result.scancode) + expect(scancodeVersions).to.equalInAnyOrder(['30.3.0']) + const licenseeVersions = Object.getOwnPropertyNames(result.licensee) + expect(licenseeVersions).to.equalInAnyOrder(['9.14.0']) + const reuseVersions = Object.getOwnPropertyNames(result.reuse) + expect(reuseVersions).to.equalInAnyOrder(['3.2.1']) + const fossologyVersions = Object.getOwnPropertyNames(result.fossology) + expect(fossologyVersions).to.equalInAnyOrder(['3.6.0']) + }) }) }) + +function createFileHarvestStore() { + const options = { + location: 'test/fixtures/store', + logger: { + error: () => {}, + debug: () => {} + } + } + return FileStore(options) +} From 8ce337c7b515a942c1fba89a8d7695d006566b27 Mon Sep 17 00:00:00 2001 From: Qing Tomlinson Date: Fri, 15 Nov 2024 17:42:12 -0800 Subject: [PATCH 6/9] Fix formatting --- test/business/definitionServiceTest.js | 6 +- test/providers/store/abstractFileStore.js | 484 +++++++++++----------- test/providers/store/fileHarvest.js | 215 +++++----- 3 files changed, 352 insertions(+), 353 deletions(-) diff --git a/test/business/definitionServiceTest.js b/test/business/definitionServiceTest.js index 7d4b4a64a..93a5e5d8f 100644 --- a/test/business/definitionServiceTest.js +++ b/test/business/definitionServiceTest.js @@ -316,7 +316,7 @@ describe('Definition Service Facet management', () => { describe('Integration test', () => { let fileHarvestStore beforeEach(() => { - fileHarvestStore = createFileHarvestStore(fileHarvestStore) + fileHarvestStore = createFileHarvestStore() }) it('computes the same definition with latest harvest data', async () => { @@ -332,12 +332,12 @@ describe('Integration test', () => { //updated timestamp is not deterministic expect(comparison_def._meta.updated).to.not.equal(baseline_def._meta.updated) - comparison_def._meta.updated = baseline_def._meta.updated + comparison_def._meta.updated = baseline_def._meta.updated expect(comparison_def).to.deep.equal(baseline_def) }) }) -function createFileHarvestStore(fileHarvestStore) { +function createFileHarvestStore() { const options = { location: 'test/fixtures/store', logger: { diff --git a/test/providers/store/abstractFileStore.js b/test/providers/store/abstractFileStore.js index dbadf2b68..7e76ba1ea 100644 --- a/test/providers/store/abstractFileStore.js +++ b/test/providers/store/abstractFileStore.js @@ -11,266 +11,266 @@ const expect = chai.expect const EntityCoordinates = require('../../../lib/entityCoordinates') const AbstractFileStore = require('../../../providers/stores/abstractFileStore') - describe('AbstractFileStore lists entries ', () => { - let FileStore - const data = { - '/foo/npm/npmjs/-/test/revision/1.0/tool/testtool/2.0.json': {}, - '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool0/1.0.json': {}, - '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool1/2.0.json': {}, - '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool2/3.0.json': {} - } +describe('AbstractFileStore lists entries ', () => { + let FileStore + const data = { + '/foo/npm/npmjs/-/test/revision/1.0/tool/testtool/2.0.json': {}, + '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool0/1.0.json': {}, + '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool1/2.0.json': {}, + '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool2/3.0.json': {} + } - beforeEach(function () { - const recursiveStub = async path => { - path = path.replace(/\\/g, '/') - if (path.includes('error')) throw new Error('test error') - const result = Object.keys(data).filter(p => p.startsWith(path)) - if (result.length === 0) { - const error = new Error('test') - error.code = 'ENOENT' - throw error - } - return result.filter(p => p !== path) + beforeEach(function () { + const recursiveStub = async path => { + path = path.replace(/\\/g, '/') + if (path.includes('error')) throw new Error('test error') + const result = Object.keys(data).filter(p => p.startsWith(path)) + if (result.length === 0) { + const error = new Error('test') + error.code = 'ENOENT' + throw error } - const fsStub = { - readFile: (path, cb) => { - cb(null, JSON.stringify({ path })) - } + return result.filter(p => p !== path) + } + const fsStub = { + readFile: (path, cb) => { + cb(null, JSON.stringify({ path })) } - FileStore = proxyquire('../../../providers/stores/abstractFileStore', { - 'recursive-readdir': recursiveStub, - fs: fsStub - }) + } + FileStore = proxyquire('../../../providers/stores/abstractFileStore', { + 'recursive-readdir': recursiveStub, + fs: fsStub }) + }) - afterEach(function () { - sandbox.restore() - }) + afterEach(function () { + sandbox.restore() + }) - it('throws original error when not ENOENT', async () => { - const fileStore = new FileStore({ location: '/foo' }) - try { - await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'error', '0.0'), data => data) - throw new Error('should have thrown error') - } catch (error) { - expect(error.message).to.eq('test error') - } - }) + it('throws original error when not ENOENT', async () => { + const fileStore = new FileStore({ location: '/foo' }) + try { + await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'error', '0.0'), data => data) + throw new Error('should have thrown error') + } catch (error) { + expect(error.message).to.eq('test error') + } + }) - it('works for unknown path coordinates ', async () => { - const fileStore = new FileStore({ location: '/foo' }) - const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'bogus', '0.0'), data => data) - expect(result.length).to.eq(0) - }) + it('works for unknown path coordinates ', async () => { + const fileStore = new FileStore({ location: '/foo' }) + const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'bogus', '0.0'), data => data) + expect(result.length).to.eq(0) + }) - it('lists no files', async () => { - const fileStore = new FileStore({ location: '/foo' }) - const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '0.0'), data => data) - expect(result.length).to.eq(0) - }) + it('lists no files', async () => { + const fileStore = new FileStore({ location: '/foo' }) + const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '0.0'), data => data) + expect(result.length).to.eq(0) + }) - it('lists single files', async () => { - const fileStore = new FileStore({ location: '/foo' }) - const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '1.0'), data => data) - expect(result.length).to.eq(1) - expect(result[0].path).to.eq('/foo/npm/npmjs/-/test/revision/1.0/tool/testtool/2.0.json') - }) + it('lists single files', async () => { + const fileStore = new FileStore({ location: '/foo' }) + const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '1.0'), data => data) + expect(result.length).to.eq(1) + expect(result[0].path).to.eq('/foo/npm/npmjs/-/test/revision/1.0/tool/testtool/2.0.json') + }) - it('lists multiple files', async () => { - const fileStore = new FileStore({ location: '/foo' }) - const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '2.0'), data => data) - const expected = [ - '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool0/1.0.json', - '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool1/2.0.json', - '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool2/3.0.json' - ] - expect(result.map(entry => entry.path)).to.equalInAnyOrder(expected) - }) + it('lists multiple files', async () => { + const fileStore = new FileStore({ location: '/foo' }) + const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '2.0'), data => data) + const expected = [ + '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool0/1.0.json', + '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool1/2.0.json', + '/foo/npm/npmjs/-/test/revision/2.0/tool/testtool2/3.0.json' + ] + expect(result.map(entry => entry.path)).to.equalInAnyOrder(expected) }) +}) - describe('coordinates to path mapping', () => { - const windows = 'c:\\foo\\bar' - const linux = '/foo/bar' - const data = [ - { - location: linux, - path: 'npm/npmjs/namespace/name/revision/1.0', - coordinates: { - type: 'npm', - provider: 'npmjs', - namespace: 'namespace', - name: 'name', - revision: '1.0', - tool: undefined, - toolVersion: undefined - } - }, - { - location: linux, - path: 'npm/npmjs/namespace/name/revision/1.0/tool/testtool/2.0', - coordinates: { - type: 'npm', - provider: 'npmjs', - namespace: 'namespace', - name: 'name', - revision: '1.0', - tool: 'testtool', - toolVersion: '2.0' - } - }, - { - location: linux, - path: 'npm/npmjs/namespace/name', - coordinates: { - type: 'npm', - provider: 'npmjs', - namespace: 'namespace', - name: 'name', - revision: undefined, - tool: undefined, - toolVersion: undefined - } - }, - { - location: linux, - path: 'npm/npmjs/-/name/revision/1.0', - coordinates: { - type: 'npm', - provider: 'npmjs', - namespace: null, - name: 'name', - revision: '1.0', - tool: undefined, - toolVersion: undefined - } - }, - { - location: windows, - path: 'npm\\npmjs\\namespace\\name\\revision\\1.0', - coordinates: { - type: 'npm', - provider: 'npmjs', - namespace: 'namespace', - name: 'name', - revision: '1.0', - tool: undefined, - toolVersion: undefined - } - }, - { - location: windows, - path: 'npm\\npmjs\\namespace\\name', - coordinates: { - type: 'npm', - provider: 'npmjs', - namespace: 'namespace', - name: 'name', - revision: undefined, - tool: undefined, - toolVersion: undefined - } - }, - { - location: windows, - path: 'npm\\npmjs\\-\\name\\revision\\1.0', - coordinates: { - type: 'npm', - provider: 'npmjs', - namespace: null, - name: 'name', - revision: '1.0', - tool: undefined, - toolVersion: undefined - } +describe('coordinates to path mapping', () => { + const windows = 'c:\\foo\\bar' + const linux = '/foo/bar' + const data = [ + { + location: linux, + path: 'npm/npmjs/namespace/name/revision/1.0', + coordinates: { + type: 'npm', + provider: 'npmjs', + namespace: 'namespace', + name: 'name', + revision: '1.0', + tool: undefined, + toolVersion: undefined } - ] + }, + { + location: linux, + path: 'npm/npmjs/namespace/name/revision/1.0/tool/testtool/2.0', + coordinates: { + type: 'npm', + provider: 'npmjs', + namespace: 'namespace', + name: 'name', + revision: '1.0', + tool: 'testtool', + toolVersion: '2.0' + } + }, + { + location: linux, + path: 'npm/npmjs/namespace/name', + coordinates: { + type: 'npm', + provider: 'npmjs', + namespace: 'namespace', + name: 'name', + revision: undefined, + tool: undefined, + toolVersion: undefined + } + }, + { + location: linux, + path: 'npm/npmjs/-/name/revision/1.0', + coordinates: { + type: 'npm', + provider: 'npmjs', + namespace: null, + name: 'name', + revision: '1.0', + tool: undefined, + toolVersion: undefined + } + }, + { + location: windows, + path: 'npm\\npmjs\\namespace\\name\\revision\\1.0', + coordinates: { + type: 'npm', + provider: 'npmjs', + namespace: 'namespace', + name: 'name', + revision: '1.0', + tool: undefined, + toolVersion: undefined + } + }, + { + location: windows, + path: 'npm\\npmjs\\namespace\\name', + coordinates: { + type: 'npm', + provider: 'npmjs', + namespace: 'namespace', + name: 'name', + revision: undefined, + tool: undefined, + toolVersion: undefined + } + }, + { + location: windows, + path: 'npm\\npmjs\\-\\name\\revision\\1.0', + coordinates: { + type: 'npm', + provider: 'npmjs', + namespace: null, + name: 'name', + revision: '1.0', + tool: undefined, + toolVersion: undefined + } + } + ] - const AbstractFileStore = require('../../../providers/stores/abstractFileStore') - data.forEach(input => { - it('works well for ' + input.path, () => { - const fileStore = new AbstractFileStore({ location: input.location }) - const separator = input.location.includes('/') ? '/' : '\\' - const result = fileStore._toStoragePathFromCoordinates(input.coordinates) - // account for platform differences in path separator. - const normalizedResult = result.replace(/\\/g, '/') - const normalizedInput = (input.location + separator + input.path).replace(/\\/g, '/') - expect(normalizedResult).to.deep.equal(normalizedInput) - }) + const AbstractFileStore = require('../../../providers/stores/abstractFileStore') + data.forEach(input => { + it('works well for ' + input.path, () => { + const fileStore = new AbstractFileStore({ location: input.location }) + const separator = input.location.includes('/') ? '/' : '\\' + const result = fileStore._toStoragePathFromCoordinates(input.coordinates) + // account for platform differences in path separator. + const normalizedResult = result.replace(/\\/g, '/') + const normalizedInput = (input.location + separator + input.path).replace(/\\/g, '/') + expect(normalizedResult).to.deep.equal(normalizedInput) }) }) +}) - describe('getLatestToolVersions', () => { - it('should get latest tool versions', () => { - const latest = AbstractFileStore.getLatestToolPaths([ - 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/clearlydefined/1.5.0.json', - 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.18.1.json', - 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.14.0.json', - 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/reuse/3.2.1.json', - 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/reuse/3.2.2.json', - 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/32.3.0.json', - 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/30.3.0.json' - ]) - expect(Array.from(latest)).to.equalInAnyOrder([ - 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/clearlydefined/1.5.0.json', - 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.18.1.json', - 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/reuse/3.2.2.json', - 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/32.3.0.json' - ]) - }) - it('should get latest tool versions and ignore un-versioned data', () => { - const latest = AbstractFileStore.getLatestToolPaths([ - 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json', - 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.2.1.json', - 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.1.json', - 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.2.json', - 'npm/npmjs/-/co/revision/4.6.0/tool/scancode.json' - ]) - expect(Array.from(latest)).to.equalInAnyOrder([ - 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json', - 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.2.json' - ]) - }) - it('should get latest tool versions and ignore invalid semver', () => { - const latest = AbstractFileStore.getLatestToolPaths([ - 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.10.0.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.2.1.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.2.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/3.2.2.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/30.3.0.json' - ]) - expect(Array.from(latest)).to.equalInAnyOrder([ - 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/30.3.0.json' - ]) - }) +describe('getLatestToolVersions', () => { + it('should get latest tool versions', () => { + const latest = AbstractFileStore.getLatestToolPaths([ + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/clearlydefined/1.5.0.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.18.1.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.14.0.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/reuse/3.2.1.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/reuse/3.2.2.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/32.3.0.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/30.3.0.json' + ]) + expect(Array.from(latest)).to.equalInAnyOrder([ + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/clearlydefined/1.5.0.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/licensee/9.18.1.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/reuse/3.2.2.json', + 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/32.3.0.json' + ]) + }) + it('should get latest tool versions and ignore un-versioned data', () => { + const latest = AbstractFileStore.getLatestToolPaths([ + 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.2.1.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.1.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.2.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode.json' + ]) + expect(Array.from(latest)).to.equalInAnyOrder([ + 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json', + 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.2.json' + ]) + }) + it('should get latest tool versions and ignore invalid semver', () => { + const latest = AbstractFileStore.getLatestToolPaths([ + 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.10.0.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.2.1.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.2.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/3.2.2.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/30.3.0.json' + ]) + expect(Array.from(latest)).to.equalInAnyOrder([ + 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/30.3.0.json' + ]) + }) - it('should ignore invalid semver, invalid sermver first', () => { - const latest = AbstractFileStore.getLatestToolPaths([ - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json' - ]) - expect(Array.from(latest)).to.equalInAnyOrder(['npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json']) - }) + it('should ignore invalid semver, invalid sermver first', () => { + const latest = AbstractFileStore.getLatestToolPaths([ + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json' + ]) + expect(Array.from(latest)).to.equalInAnyOrder(['npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json']) + }) - it('should ignore invalid semver, invalid sermver last', () => { - const latest = AbstractFileStore.getLatestToolPaths([ - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json' - ]) - expect(Array.from(latest)).to.equalInAnyOrder(['npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json']) - }) + it('should ignore invalid semver, invalid sermver last', () => { + const latest = AbstractFileStore.getLatestToolPaths([ + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json' + ]) + expect(Array.from(latest)).to.equalInAnyOrder(['npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.1.json']) + }) - it('should return at least the first tool version', () => { - const latest = AbstractFileStore.getLatestToolPaths([ - 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json' - ]) - expect(Array.from(latest)).to.equalInAnyOrder([ - 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', - 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json' - ]) - }) + it('should return at least the first tool version', () => { + const latest = AbstractFileStore.getLatestToolPaths([ + 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json' + ]) + expect(Array.from(latest)).to.equalInAnyOrder([ + 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', + 'npm/npmjs/-/debug/revision/3.1.0/tool/scancode/2.9.0b1.json' + ]) }) +}) diff --git a/test/providers/store/fileHarvest.js b/test/providers/store/fileHarvest.js index fe9e0bd4f..622ca83a0 100644 --- a/test/providers/store/fileHarvest.js +++ b/test/providers/store/fileHarvest.js @@ -25,130 +25,129 @@ const data = { contents: { _metadata: { links: { self: { href: 'urn:npm:npmjs:-:test:revision:2.0:tool:testtool2:3.0' } } } } } } -describe('FileHarvestStore', () => { - describe(' list tool results', () => { - before(() => { - sinon.stub(AbstractFileStore.prototype, 'list').callsFake(async (coordinates, visitor) => { - const path = coordinates.toString() - if (path.includes('error')) throw new Error('test error') - return Object.keys(data) - .map(key => (key.startsWith(path) ? visitor(data[key].contents) : null)) - .filter(e => e) - }) + +describe('FileHarvestStore list tool results', () => { + before(() => { + sinon.stub(AbstractFileStore.prototype, 'list').callsFake(async (coordinates, visitor) => { + const path = coordinates.toString() + if (path.includes('error')) throw new Error('test error') + return Object.keys(data) + .map(key => (key.startsWith(path) ? visitor(data[key].contents) : null)) + .filter(e => e) }) + }) - after(() => AbstractFileStore.prototype.list.restore()) + after(() => AbstractFileStore.prototype.list.restore()) - it('throws original error when not ENOENT', async () => { - const fileStore = FileStore() - try { - await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'error', '0.0')) - throw new Error('should have thrown error') - } catch (error) { - expect(error.message).to.eq('test error') - } - }) + it('throws original error when not ENOENT', async () => { + const fileStore = FileStore() + try { + await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'error', '0.0')) + throw new Error('should have thrown error') + } catch (error) { + expect(error.message).to.eq('test error') + } + }) - it('works for unknown path coordinates ', async () => { - const fileStore = FileStore() - const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'bogus', '0.0')) - expect(result.length).to.eq(0) - }) + it('works for unknown path coordinates ', async () => { + const fileStore = FileStore() + const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'bogus', '0.0')) + expect(result.length).to.eq(0) + }) - it('lists no results', async () => { - const fileStore = FileStore() - const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '0.0'), 'result') - expect(result.length).to.eq(0) - }) + it('lists no results', async () => { + const fileStore = FileStore() + const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '0.0'), 'result') + expect(result.length).to.eq(0) + }) - it('lists a single result', async () => { - const fileStore = FileStore() - const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '1.0'), 'result') - const expected = ['npm/npmjs/-/test/1.0/testtool/2.0'] - expect(result).to.equalInAnyOrder(expected) - }) + it('lists a single result', async () => { + const fileStore = FileStore() + const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '1.0'), 'result') + const expected = ['npm/npmjs/-/test/1.0/testtool/2.0'] + expect(result).to.equalInAnyOrder(expected) + }) - it('lists multiple results', async () => { - const fileStore = FileStore() - const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '2.0'), 'result') - const expected = [ - 'npm/npmjs/-/test/2.0/testtool0/1.0', - 'npm/npmjs/-/test/2.0/testtool1/2.0', - 'npm/npmjs/-/test/2.0/testtool2/3.0' - ] - expect(result).to.equalInAnyOrder(expected) - }) + it('lists multiple results', async () => { + const fileStore = FileStore() + const result = await fileStore.list(new EntityCoordinates('npm', 'npmjs', null, 'test', '2.0'), 'result') + const expected = [ + 'npm/npmjs/-/test/2.0/testtool0/1.0', + 'npm/npmjs/-/test/2.0/testtool1/2.0', + 'npm/npmjs/-/test/2.0/testtool2/3.0' + ] + expect(result).to.equalInAnyOrder(expected) + }) +}) + +describe('getLatestFiles', () => { + const allFiles = [ + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/clearlydefined/1.3.1.json', + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/clearlydefined/1.4.1.json', + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/licensee/9.18.1.json', + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/reuse/3.2.1.json', + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/reuse/3.2.2.json', + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/scancode/30.3.0.json', + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/scancode/32.3.0.json' + ] + let fileStore + + beforeEach(() => { + fileStore = createFileHarvestStore() }) - describe('_getLatestFiles', () => { - const allFiles = [ - '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/clearlydefined/1.3.1.json', + it('should get latest files', () => { + const result = fileStore._getLatestFiles(allFiles) + expect(result.length).to.eq(4) + expect(Array.from(result)).to.equalInAnyOrder([ '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/clearlydefined/1.4.1.json', '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/licensee/9.18.1.json', - '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/reuse/3.2.1.json', '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/reuse/3.2.2.json', - '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/scancode/30.3.0.json', '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/scancode/32.3.0.json' - ] - let fileStore - - beforeEach(() => { - fileStore = createFileHarvestStore() - }) - - it('should get latest files', () => { - const result = fileStore._getLatestFiles(allFiles) - expect(result.length).to.eq(4) - expect(Array.from(result)).to.equalInAnyOrder([ - '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/clearlydefined/1.4.1.json', - '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/licensee/9.18.1.json', - '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/reuse/3.2.2.json', - '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/scancode/32.3.0.json' - ]) - }) + ]) + }) - it('should handle error', () => { - fileStore._getLatestToolVersions = sinon.stub().throws(new Error('test error')) - fileStore.logger.error = sinon.stub() - const result = fileStore._getLatestFiles(allFiles) - expect(fileStore.logger.error.calledOnce).to.be.true - expect(result.length).to.eq(allFiles.length) - expect(Array.from(result)).to.equalInAnyOrder(allFiles) - }) + it('should handle error', () => { + fileStore._getLatestToolVersions = sinon.stub().throws(new Error('test error')) + fileStore.logger.error = sinon.stub() + const result = fileStore._getLatestFiles(allFiles) + expect(fileStore.logger.error.calledOnce).to.be.true + expect(result.length).to.eq(allFiles.length) + expect(Array.from(result)).to.equalInAnyOrder(allFiles) + }) - it('should return all harvest results', async () => { - const coordinates = EntityCoordinates.fromString('npm/npmjs/-/debug/3.1.0') - const result = await fileStore.getAll(coordinates) - const tools = Object.getOwnPropertyNames(result) - expect(tools.length).to.eq(5) - const clearlydefinedVersions = Object.getOwnPropertyNames(result.clearlydefined) - expect(clearlydefinedVersions).to.equalInAnyOrder(['1', '1.1.2', '1.3.4']) - const scancodeVersions = Object.getOwnPropertyNames(result.scancode) - expect(scancodeVersions).to.equalInAnyOrder(['2.2.1', '2.9.0+b1', '30.3.0']) - const licenseeVersions = Object.getOwnPropertyNames(result.licensee) - expect(licenseeVersions).to.equalInAnyOrder(['9.12.1', '9.14.0']) - const reuseVersions = Object.getOwnPropertyNames(result.reuse) - expect(reuseVersions).to.equalInAnyOrder(['1.3.0', '3.2.1']) - const fossologyVersions = Object.getOwnPropertyNames(result.fossology) - expect(fossologyVersions).to.equalInAnyOrder(['3.3.0', '3.6.0']) - }) + it('should return all harvest results', async () => { + const coordinates = EntityCoordinates.fromString('npm/npmjs/-/debug/3.1.0') + const result = await fileStore.getAll(coordinates) + const tools = Object.getOwnPropertyNames(result) + expect(tools.length).to.eq(5) + const clearlydefinedVersions = Object.getOwnPropertyNames(result.clearlydefined) + expect(clearlydefinedVersions).to.equalInAnyOrder(['1', '1.1.2', '1.3.4']) + const scancodeVersions = Object.getOwnPropertyNames(result.scancode) + expect(scancodeVersions).to.equalInAnyOrder(['2.2.1', '2.9.0+b1', '30.3.0']) + const licenseeVersions = Object.getOwnPropertyNames(result.licensee) + expect(licenseeVersions).to.equalInAnyOrder(['9.12.1', '9.14.0']) + const reuseVersions = Object.getOwnPropertyNames(result.reuse) + expect(reuseVersions).to.equalInAnyOrder(['1.3.0', '3.2.1']) + const fossologyVersions = Object.getOwnPropertyNames(result.fossology) + expect(fossologyVersions).to.equalInAnyOrder(['3.3.0', '3.6.0']) + }) - it('should return all latest harvest results', async () => { - const coordinates = EntityCoordinates.fromString('npm/npmjs/-/debug/3.1.0') - const result = await fileStore.getAllLatest(coordinates) - const tools = Object.getOwnPropertyNames(result) - expect(tools.length).to.eq(5) - const clearlydefinedVersions = Object.getOwnPropertyNames(result.clearlydefined) - expect(clearlydefinedVersions).to.equalInAnyOrder(['1.3.4']) - const scancodeVersions = Object.getOwnPropertyNames(result.scancode) - expect(scancodeVersions).to.equalInAnyOrder(['30.3.0']) - const licenseeVersions = Object.getOwnPropertyNames(result.licensee) - expect(licenseeVersions).to.equalInAnyOrder(['9.14.0']) - const reuseVersions = Object.getOwnPropertyNames(result.reuse) - expect(reuseVersions).to.equalInAnyOrder(['3.2.1']) - const fossologyVersions = Object.getOwnPropertyNames(result.fossology) - expect(fossologyVersions).to.equalInAnyOrder(['3.6.0']) - }) + it('should return all latest harvest results', async () => { + const coordinates = EntityCoordinates.fromString('npm/npmjs/-/debug/3.1.0') + const result = await fileStore.getAllLatest(coordinates) + const tools = Object.getOwnPropertyNames(result) + expect(tools.length).to.eq(5) + const clearlydefinedVersions = Object.getOwnPropertyNames(result.clearlydefined) + expect(clearlydefinedVersions).to.equalInAnyOrder(['1.3.4']) + const scancodeVersions = Object.getOwnPropertyNames(result.scancode) + expect(scancodeVersions).to.equalInAnyOrder(['30.3.0']) + const licenseeVersions = Object.getOwnPropertyNames(result.licensee) + expect(licenseeVersions).to.equalInAnyOrder(['9.14.0']) + const reuseVersions = Object.getOwnPropertyNames(result.reuse) + expect(reuseVersions).to.equalInAnyOrder(['3.2.1']) + const fossologyVersions = Object.getOwnPropertyNames(result.fossology) + expect(fossologyVersions).to.equalInAnyOrder(['3.6.0']) }) }) From a83fe72a597bb214492885857b6325731b991503 Mon Sep 17 00:00:00 2001 From: Qing Tomlinson Date: Mon, 18 Nov 2024 12:30:08 -0800 Subject: [PATCH 7/9] Fix formatting in tests --- test/providers/store/abstractFileStore.js | 2 ++ test/providers/store/azblobHarvest.js | 37 +++++++------------- test/providers/store/fileHarvest.js | 42 +++++++++++------------ 3 files changed, 36 insertions(+), 45 deletions(-) diff --git a/test/providers/store/abstractFileStore.js b/test/providers/store/abstractFileStore.js index 7e76ba1ea..d749c9a7f 100644 --- a/test/providers/store/abstractFileStore.js +++ b/test/providers/store/abstractFileStore.js @@ -217,6 +217,7 @@ describe('getLatestToolVersions', () => { 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/32.3.0.json' ]) }) + it('should get latest tool versions and ignore un-versioned data', () => { const latest = AbstractFileStore.getLatestToolPaths([ 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json', @@ -230,6 +231,7 @@ describe('getLatestToolVersions', () => { 'npm/npmjs/-/co/revision/4.6.0/tool/scancode/2.9.2.json' ]) }) + it('should get latest tool versions and ignore invalid semver', () => { const latest = AbstractFileStore.getLatestToolPaths([ 'npm/npmjs/-/debug/revision/3.1.0/tool/clearlydefined/1.5.0.json', diff --git a/test/providers/store/azblobHarvest.js b/test/providers/store/azblobHarvest.js index dcbaa7e4b..980c18573 100644 --- a/test/providers/store/azblobHarvest.js +++ b/test/providers/store/azblobHarvest.js @@ -188,6 +188,7 @@ describe('azblob Harvest store', () => { 'maven/mavencentral/org.apache.httpcomponents/httpcore/revision/4.4.16/tool/scancode/32.3.0.json' ]) }) + it('retrieves latest entries', async () => { const azblobStore = createAzBlobStore( createEntries([ @@ -209,16 +210,13 @@ describe('azblob Harvest store', () => { revision: '4.4.16' }) - const tools = Object.getOwnPropertyNames(result) - expect(tools.length).to.eq(4) - const clearlydefinedVersions = Object.getOwnPropertyNames(result.clearlydefined) - expect(clearlydefinedVersions).to.deep.eq(['1.5.0']) - const scancodeVersions = Object.getOwnPropertyNames(result.scancode) - expect(scancodeVersions).to.deep.eq(['32.3.0']) - const licenseeVersions = Object.getOwnPropertyNames(result.licensee) - expect(licenseeVersions).to.deep.eq(['9.18.1']) - const reuseVersions = Object.getOwnPropertyNames(result.reuse) - expect(reuseVersions).to.deep.eq(['3.2.2']) + const exptected = { + clearlydefined: { '1.5.0': {} }, + licensee: { '9.18.1': {} }, + reuse: { '3.2.2': {} }, + scancode: { '32.3.0': {} } + } + expect(result).to.deep.equal(exptected) }) it('retrieves latest entries ignoring unversioned result', async () => { @@ -240,15 +238,11 @@ describe('azblob Harvest store', () => { name: 'co', revision: '4.6.0' }) - const tools = Object.getOwnPropertyNames(result) - expect(tools.length).to.eq(2) - const clearlydefinedVersions = Object.getOwnPropertyNames(result.clearlydefined) - expect(clearlydefinedVersions).to.deep.eq(['1']) - const scancodeVersions = Object.getOwnPropertyNames(result.scancode) - expect(scancodeVersions).to.deep.eq(['2.9.2']) + const exptected = { clearlydefined: { 1: {} }, scancode: { '2.9.2': {} } } + expect(result).to.deep.equal(exptected) }) - it('should fall back to getAll when there is no latest', async () => { + it('should fall back to getAll when there is error', async () => { const azblobStore = createAzBlobStore( createEntries([ 'npm/npmjs/-/co/revision/4.6.0/tool/clearlydefined/1.json', @@ -266,13 +260,8 @@ describe('azblob Harvest store', () => { name: 'co', revision: '4.6.0' }) - const tools = Object.getOwnPropertyNames(result) - expect(tools.length).to.eq(2) - const clearlydefinedVersions = Object.getOwnPropertyNames(result.clearlydefined) - expect(clearlydefinedVersions).to.deep.eq(['1']) - const scancodeVersions = Object.getOwnPropertyNames(result.scancode) - expect(scancodeVersions).to.deep.eq(['2.2.1', '2.9.1', '2.9.0b1']) - expect(azblobStore.logger.error.calledOnce).to.be.true + const exptected = { clearlydefined: { 1: {} }, scancode: { '2.2.1': {}, '2.9.1': {}, '2.9.0b1': {} } } + expect(result).to.deep.equal(exptected) }) }) }) diff --git a/test/providers/store/fileHarvest.js b/test/providers/store/fileHarvest.js index 622ca83a0..986b7f091 100644 --- a/test/providers/store/fileHarvest.js +++ b/test/providers/store/fileHarvest.js @@ -80,7 +80,7 @@ describe('FileHarvestStore list tool results', () => { }) }) -describe('getLatestFiles', () => { +describe('getAll and getAllLatest', () => { const allFiles = [ '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/clearlydefined/1.3.1.json', '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/clearlydefined/1.4.1.json', @@ -96,26 +96,6 @@ describe('getLatestFiles', () => { fileStore = createFileHarvestStore() }) - it('should get latest files', () => { - const result = fileStore._getLatestFiles(allFiles) - expect(result.length).to.eq(4) - expect(Array.from(result)).to.equalInAnyOrder([ - '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/clearlydefined/1.4.1.json', - '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/licensee/9.18.1.json', - '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/reuse/3.2.2.json', - '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/scancode/32.3.0.json' - ]) - }) - - it('should handle error', () => { - fileStore._getLatestToolVersions = sinon.stub().throws(new Error('test error')) - fileStore.logger.error = sinon.stub() - const result = fileStore._getLatestFiles(allFiles) - expect(fileStore.logger.error.calledOnce).to.be.true - expect(result.length).to.eq(allFiles.length) - expect(Array.from(result)).to.equalInAnyOrder(allFiles) - }) - it('should return all harvest results', async () => { const coordinates = EntityCoordinates.fromString('npm/npmjs/-/debug/3.1.0') const result = await fileStore.getAll(coordinates) @@ -149,6 +129,26 @@ describe('getLatestFiles', () => { const fossologyVersions = Object.getOwnPropertyNames(result.fossology) expect(fossologyVersions).to.equalInAnyOrder(['3.6.0']) }) + + it('should get latest files', () => { + const result = fileStore._getLatestFiles(allFiles) + expect(result.length).to.eq(4) + expect(Array.from(result)).to.equalInAnyOrder([ + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/clearlydefined/1.4.1.json', + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/licensee/9.18.1.json', + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/reuse/3.2.2.json', + '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/scancode/32.3.0.json' + ]) + }) + + it('should handle error', () => { + fileStore._getLatestToolVersions = sinon.stub().throws(new Error('test error')) + fileStore.logger.error = sinon.stub() + const result = fileStore._getLatestFiles(allFiles) + expect(fileStore.logger.error.calledOnce).to.be.true + expect(result.length).to.eq(allFiles.length) + expect(Array.from(result)).to.equalInAnyOrder(allFiles) + }) }) function createFileHarvestStore() { From c5412593200d194cc97907d5944bd0b75daf4ef4 Mon Sep 17 00:00:00 2001 From: Qing Tomlinson Date: Wed, 20 Nov 2024 10:16:02 -0800 Subject: [PATCH 8/9] Renaming --- providers/stores/azblobHarvestStore.js | 14 +++++++------- providers/stores/fileHarvestStore.js | 14 +++++++------- test/providers/store/fileHarvest.js | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/providers/stores/azblobHarvestStore.js b/providers/stores/azblobHarvestStore.js index 089d1ac9d..ae110e57f 100644 --- a/providers/stores/azblobHarvestStore.js +++ b/providers/stores/azblobHarvestStore.js @@ -50,11 +50,11 @@ class AzHarvestBlobStore extends AbstractAzBlobStore { // Note that here we are assuming the number of blobs will be small-ish (<10) and // a) all fit in memory reasonably, and // b) fit in one list call (i.e., <5000) - const files = await this._getAllFiles(coordinates) - return await this._getContent(files) + const allFilesList = await this._getListOfAllFiles(coordinates) + return await this._getContent(allFilesList) } - _getAllFiles(coordinates) { + _getListOfAllFiles(coordinates) { const name = this._toStoragePathFromCoordinates(coordinates) return new Promise((resolve, reject) => this.blobService.listBlobsSegmentedWithPrefix(this.containerName, name, null, resultOrError(resolve, reject)) @@ -100,12 +100,12 @@ class AzHarvestBlobStore extends AbstractAzBlobStore { * */ async getAllLatest(coordinates) { - const allFiles = await this._getAllFiles(coordinates) - const latestFiles = this._getLatestFiles(allFiles) - return await this._getContent(latestFiles) + const allFilesList = await this._getListOfAllFiles(coordinates) + const latestFilesList = this._getListOfLatestFiles(allFilesList) + return await this._getContent(latestFilesList) } - _getLatestFiles(allFiles) { + _getListOfLatestFiles(allFiles) { let latestFiles = [] const names = allFiles.map(file => file.name) try { diff --git a/providers/stores/fileHarvestStore.js b/providers/stores/fileHarvestStore.js index e5e7b827d..9d3f75980 100644 --- a/providers/stores/fileHarvestStore.js +++ b/providers/stores/fileHarvestStore.js @@ -50,11 +50,11 @@ class FileHarvestStore extends AbstractFileStore { // Note that here we are assuming the number of blobs will be small-ish (<10) and // a) all fit in memory reasonably, and // b) fit in one list call (i.e., <5000) - const files = await this._getAllFiles(coordinates) - return await this._getContent(files) + const allFilesList = await this._getListOfAllFiles(coordinates) + return await this._getContent(allFilesList) } - async _getAllFiles(coordinates) { + async _getListOfAllFiles(coordinates) { const root = this._toStoragePathFromCoordinates(coordinates) try { return await recursive(root, ['.DS_Store']) @@ -90,12 +90,12 @@ class FileHarvestStore extends AbstractFileStore { * */ async getAllLatest(coordinates) { - const allFiles = await this._getAllFiles(coordinates) - const latestFiles = this._getLatestFiles(allFiles) - return await this._getContent(latestFiles) + const allFilesList = await this._getListOfAllFiles(coordinates) + const latestFilesList = this._getListOfLatestFiles(allFilesList) + return await this._getContent(latestFilesList) } - _getLatestFiles(allFiles) { + _getListOfLatestFiles(allFiles) { let latestFiles = [] try { const latest = this._getLatestToolVersions(allFiles) diff --git a/test/providers/store/fileHarvest.js b/test/providers/store/fileHarvest.js index 986b7f091..1fc0b3516 100644 --- a/test/providers/store/fileHarvest.js +++ b/test/providers/store/fileHarvest.js @@ -131,7 +131,7 @@ describe('getAll and getAllLatest', () => { }) it('should get latest files', () => { - const result = fileStore._getLatestFiles(allFiles) + const result = fileStore._getListOfLatestFiles(allFiles) expect(result.length).to.eq(4) expect(Array.from(result)).to.equalInAnyOrder([ '/tmp/harvested_data/pypi/pypi/-/platformdirs/revision/4.2.0/tool/clearlydefined/1.4.1.json', @@ -144,7 +144,7 @@ describe('getAll and getAllLatest', () => { it('should handle error', () => { fileStore._getLatestToolVersions = sinon.stub().throws(new Error('test error')) fileStore.logger.error = sinon.stub() - const result = fileStore._getLatestFiles(allFiles) + const result = fileStore._getListOfLatestFiles(allFiles) expect(fileStore.logger.error.calledOnce).to.be.true expect(result.length).to.eq(allFiles.length) expect(Array.from(result)).to.equalInAnyOrder(allFiles) From 836832518f646e6bc2b36296ad96ccb55579a2e9 Mon Sep 17 00:00:00 2001 From: "E. Lynette Rayle" Date: Fri, 6 Dec 2024 07:31:37 -0500 Subject: [PATCH 9/9] update version to v2.1.0 in prep of release --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0088d9172..51213da0e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "service", - "version": "2.0.1", + "version": "2.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "service", - "version": "2.0.1", + "version": "2.1.0", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index fc52031b5..3db16f7bf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "service", - "version": "2.0.1", + "version": "2.1.0", "description": "Service side of clearlydefined.io.", "scripts": { "test": "npm run mocha && npm run lint",