mirror of
https://github.com/elastic/kibana.git
synced 2025-04-20 16:03:20 -04:00
Backports PR #8981 **Commit 1:** Add checkPlugins task to check for plugins before running tests. * Original sha:9e71c779ba
* Authored by CJ Cenizal <cj@cenizal.com> on 2016-11-05T05:02:13Z **Commit 2:** Remove checkPlugins npm script. Gracefully handle error case. * Original sha:98ec182915
* Authored by CJ Cenizal <cj@cenizal.com> on 2016-11-09T20:51:47Z **Commit 3:** Move checkPlugins task into its own module. * Original sha:bba727461d
* Authored by CJ Cenizal <cj@cenizal.com> on 2016-11-15T23:40:41Z
29 lines
1,009 B
JavaScript
29 lines
1,009 B
JavaScript
import fs from 'fs';
|
|
import path from 'path';
|
|
|
|
export default function checkPlugins(grunt) {
|
|
grunt.registerTask('checkPlugins', 'Checks for plugins which may disrupt tests', function checkPlugins() {
|
|
const done = this.async();
|
|
const pluginsDir = path.resolve('./plugins/');
|
|
|
|
fs.readdir(pluginsDir, (err, files) => {
|
|
if (!files) {
|
|
return done();
|
|
}
|
|
|
|
const plugins = files.filter(file => {
|
|
return fs.statSync(path.join(pluginsDir, file)).isDirectory();
|
|
});
|
|
|
|
if (plugins.length) {
|
|
grunt.log.error('===================================================================================================');
|
|
plugins.forEach(plugin => {
|
|
grunt.log.error(`The ${plugin} plugin may disrupt the test process. Consider removing it and re-running your tests.`);
|
|
});
|
|
grunt.log.error('===================================================================================================');
|
|
}
|
|
|
|
done();
|
|
});
|
|
});
|
|
}
|