kibana/tasks/functional_test_runner.js
Spencer 31fed421ff Implement/timestamps in log (#11781)
* [utils/streams] add createMapStream()

* [utils/toolingLog] make tooling log operate in object mode

* [ci/ftr] log the time before each log message
2017-05-15 14:28:14 -07:00

38 lines
983 B
JavaScript

import { resolve } from 'path';
import moment from 'moment';
import { createFunctionalTestRunner } from '../src/functional_test_runner';
import { createToolingLog, createMapStream } from '../src/utils';
export default function (grunt) {
grunt.registerTask('functionalTestRunner', function () {
const log = createToolingLog('debug');
log
.pipe(createMapStream(line => {
return `${moment().format('hh:mm:ss.SSS')} ${line}`;
}))
.pipe(process.stdout);
const functionalTestRunner = createFunctionalTestRunner({
log,
configFile: resolve(__dirname, '../test/functional/config.js'),
});
const callback = this.async();
functionalTestRunner.run()
.then(failureCount => {
if (failureCount) {
grunt.fail.warn(`${failureCount} test failures`);
return;
}
callback();
})
.catch(err => {
grunt.fail.warn(err.stack);
callback(err);
});
});
}