-
Notifications
You must be signed in to change notification settings - Fork 8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tasks/lib/packages] do not include kibana in "installed packages"
- Loading branch information
Showing
6 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('I am fixture 1'); |
1 change: 1 addition & 0 deletions
1
tasks/lib/packages/__tests__/fixtures/fixture1/node_modules/dep1/index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
tasks/lib/packages/__tests__/fixtures/fixture1/node_modules/dep1/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "fixture1", | ||
"version": "0.0.1", | ||
"license": "MIT", | ||
"dependencies": { | ||
"dep1": "0.0.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { resolve } from 'path'; | ||
|
||
import { uniq } from 'lodash'; | ||
import expect from 'expect.js'; | ||
|
||
import { getInstalledPackages } from '../installed_packages'; | ||
|
||
const KIBANA_ROOT = resolve(__dirname, '../../../../'); | ||
const FIXTURE1_ROOT = resolve(__dirname, 'fixtures/fixture1'); | ||
|
||
describe('tasks/lib/packages', () => { | ||
describe('getInstalledPackages()', function () { | ||
|
||
let kibanaPackages; | ||
let fixture1Packages; | ||
before(async function () { | ||
this.timeout(30 * 1000); | ||
[kibanaPackages, fixture1Packages] = await Promise.all([ | ||
getInstalledPackages({ | ||
directory: KIBANA_ROOT | ||
}), | ||
getInstalledPackages({ | ||
directory: FIXTURE1_ROOT | ||
}), | ||
]); | ||
}); | ||
|
||
it('requires a directory', async () => { | ||
try { | ||
await getInstalledPackages({}); | ||
throw new Error('expected getInstalledPackages() to reject'); | ||
} catch (err) { | ||
expect(err.message).to.contain('directory'); | ||
} | ||
}); | ||
|
||
it('reads all installed packages of a module', () => { | ||
expect(fixture1Packages).to.eql([ | ||
{ | ||
name: 'dep1', | ||
version: '0.0.2', | ||
licenses: [ 'Apache-2.0' ], | ||
directory: resolve(FIXTURE1_ROOT, 'node_modules/dep1'), | ||
relative: 'node_modules/dep1', | ||
} | ||
]); | ||
}); | ||
|
||
it('returns a single entry for every package/version combo', () => { | ||
const tags = kibanaPackages.map(pkg => `${pkg.name}@${pkg.version}`); | ||
expect(tags).to.eql(uniq(tags)); | ||
}); | ||
|
||
it('does not include root package in the list', async () => { | ||
expect(kibanaPackages.find(pkg => pkg.name === 'kibana')).to.be(undefined); | ||
expect(fixture1Packages.find(pkg => pkg.name === 'fixture1')).to.be(undefined); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters