mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
add basic test for the build action
Original commit: elastic/kibana-plugin-helpers@52230f6c3b
This commit is contained in:
parent
a52da8e3d6
commit
82ff13ee87
5 changed files with 52 additions and 2 deletions
|
@ -13,6 +13,8 @@
|
|||
"author": "Spencer Alger <email@spalger.com>",
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"test": "npm run lint && npm run jest",
|
||||
"jest": "jest",
|
||||
"lint": "eslint bin/ help/ tasks/"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -28,9 +30,11 @@
|
|||
"doc": "docs"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "1.10.3",
|
||||
"babel-eslint": "4.1.8",
|
||||
"eslint-plugin-mocha": "1.1.0"
|
||||
"del": "^2.2.2",
|
||||
"eslint": "1.10.3",
|
||||
"eslint-plugin-mocha": "1.1.0",
|
||||
"jest": "^17.0.3"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
module.exports = kibana => new kibana.Plugin({
|
||||
uiExports: {
|
||||
hacks: [
|
||||
'plugins/test_plugin/hack.js'
|
||||
]
|
||||
}
|
||||
});
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "test_plugin",
|
||||
"version": "0.0.1",
|
||||
"kibana": {
|
||||
"version": "6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
console.log('this is my hack');
|
25
packages/kbn-plugin-helpers/tasks/build/build_action.spec.js
Normal file
25
packages/kbn-plugin-helpers/tasks/build/build_action.spec.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
const resolve = require('path').resolve;
|
||||
const fs = require('fs');
|
||||
|
||||
const del = require('del');
|
||||
|
||||
const buildAction = require('./build_action');
|
||||
|
||||
const PLUGIN_FIXTURE = resolve(__dirname, '__fixtures__/test_plugin');
|
||||
const PLUGIN_BUILD_DIR = resolve(PLUGIN_FIXTURE, 'build');
|
||||
const PLUGIN = require('../../lib/id_plugin')(PLUGIN_FIXTURE);
|
||||
|
||||
describe('build_action', () => {
|
||||
beforeEach(() => del(PLUGIN_BUILD_DIR));
|
||||
afterEach(() => del(PLUGIN_BUILD_DIR));
|
||||
|
||||
it('creates a zip in the build directory', (done) => {
|
||||
buildAction(PLUGIN, () => {
|
||||
if (!fs.existsSync(resolve(PLUGIN_BUILD_DIR, PLUGIN.id + '-' + PLUGIN.version + '.zip'))) {
|
||||
done(new Error('expected the plugin to build a zip file'));
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue