mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
* [kbn-plugin-helpers] allow opt-ing out of dependency installation * [plugin-helpers] rename buildIgnoreDependencies to skipInstallDependencies * [plugin-helpers] use noop3 for test * [plugin-helpers] fix test description * [plugin-helpers] fix assertion
This commit is contained in:
parent
f1d19328b5
commit
e8f7e8d6f1
5 changed files with 34 additions and 1 deletions
|
@ -73,5 +73,6 @@ Setting | Description
|
|||
------- | -----------
|
||||
`skipArchive` | Don't create the zip file, leave the build path alone
|
||||
`buildDestination` | Target path for the build output, absolute or relative to the plugin root
|
||||
`skipInstallDependencies` | Don't install dependencies defined in package.json into build output
|
||||
`buildVersion` | Version for the build output
|
||||
`kibanaVersion` | Kibana version for the build output (added to package.json)
|
||||
|
|
|
@ -20,6 +20,7 @@ module.exports = function (root) {
|
|||
kibanaRoot: resolve(root, '../kibana'),
|
||||
serverTestPatterns: ['server/**/__tests__/**/*.js'],
|
||||
buildSourcePatterns: buildSourcePatterns,
|
||||
skipInstallDependencies: false,
|
||||
id: pkg.name,
|
||||
pkg: pkg,
|
||||
version: pkg.version,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"version": "6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
"noop3": "999.999.999"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
|
|
|
@ -53,6 +53,10 @@ module.exports = function createBuild(plugin, buildTarget, buildVersion, kibanaV
|
|||
});
|
||||
})
|
||||
.then(function () {
|
||||
if (plugin.skipInstallDependencies) {
|
||||
return;
|
||||
}
|
||||
|
||||
// install packages in build
|
||||
const options = {
|
||||
cwd: buildRoot,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
const { resolve } = require('path');
|
||||
const { readdirSync } = require('fs');
|
||||
const del = require('del');
|
||||
const createBuild = require('./create_build');
|
||||
|
||||
|
@ -37,4 +38,30 @@ describe('creating the build', () => {
|
|||
expect(pkg.build.git).not.toBeUndefined();
|
||||
expect(pkg.build.date).not.toBeUndefined();
|
||||
});
|
||||
|
||||
describe('skipInstallDependencies = false', () => {
|
||||
it('installs node_modules as a part of build', async () => {
|
||||
expect(PLUGIN.skipInstallDependencies).toBe(false);
|
||||
|
||||
await createBuild(PLUGIN, buildTarget, buildVersion, kibanaVersion, buildFiles);
|
||||
|
||||
expect(readdirSync(resolve(PLUGIN_BUILD_TARGET))).toContain('node_modules');
|
||||
expect(readdirSync(resolve(PLUGIN_BUILD_TARGET, 'node_modules'))).toContain('noop3');
|
||||
});
|
||||
});
|
||||
|
||||
describe('skipInstallDependencies = true', () => {
|
||||
// set skipInstallDependencies to true for these tests
|
||||
beforeEach(() => PLUGIN.skipInstallDependencies = true);
|
||||
// set it back to false after
|
||||
afterEach(() => PLUGIN.skipInstallDependencies = false);
|
||||
|
||||
it('does not install node_modules as a part of build', async () => {
|
||||
expect(PLUGIN.skipInstallDependencies).toBe(true);
|
||||
|
||||
await createBuild(PLUGIN, buildTarget, buildVersion, kibanaVersion, buildFiles);
|
||||
|
||||
expect(readdirSync(resolve(PLUGIN_BUILD_TARGET))).not.toContain('node_modules');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue