Skip to content

Commit

Permalink
Move running projects tests into Grunt task (#16946)
Browse files Browse the repository at this point in the history
  • Loading branch information
kimjoar authored Mar 9, 2018
1 parent 0c32d9f commit e5d33e9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions tasks/jenkins.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module.exports = function (grunt) {
'test:server',
'test:jest',
'test:jest_integration',
'test:projects',
'test:browser-ci',
'test:api',
'verifyTranslations',
Expand Down
28 changes: 28 additions & 0 deletions tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module.exports = function (grunt) {
'test:ui',
'test:jest',
'test:jest_integration',
'test:projects',
'test:browser',
'test:api'
]);
Expand Down Expand Up @@ -106,4 +107,31 @@ module.exports = function (grunt) {
});

grunt.registerTask('quick-test', ['test:quick']); // historical alias

grunt.registerTask('test:projects', function () {
const done = this.async();
runProjectsTests().then(done, done);
});

function runProjectsTests() {
const serverCmd = {
cmd: 'yarn',
args: ['kbn', 'run', 'test', '--skip-kibana', '--skip-kibana-extra'],
opts: { stdio: 'inherit' }
};

return new Promise((resolve, reject) => {
grunt.util.spawn(serverCmd, (error, result, code) => {
if (error || code !== 0) {
const error = new Error(`projects tests exited with code ${code}`);
grunt.fail.fatal(error);
reject(error);
return;
}

grunt.log.writeln(result);
resolve();
});
});
}
};
2 changes: 0 additions & 2 deletions test/scripts/jenkins_unit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@
set -e
source "$(dirname $0)/../../src/dev/ci_setup/setup.sh"

yarn kbn run test --skip-kibana --skip-kibana-extra

xvfb-run "$(yarn bin)/grunt" jenkins:unit;

0 comments on commit e5d33e9

Please sign in to comment.