* [precommitHook] move to dev script * [eslint] fix lint error * [dev/eslint] do simply boolean checks first * [dev] use shared REPO_ROOT constant * [dev/File] precompute relative/ext of path * [dev/eslint] fix relative import * [dev/eslint] fix typos * [grunt] remove unused run:eslintStaged config * [dev/run] only create log if we are going to use it * [dev/run/isFailError] ensure return value is Boolean * [dev/precommitHook] use less intermediate vars
37 lines
900 B
JavaScript
37 lines
900 B
JavaScript
import { createFunctionalTestRunner } from '../src/functional_test_runner';
|
|
import { createToolingLog } from '../src/dev';
|
|
|
|
export default function (grunt) {
|
|
grunt.registerMultiTask('functional_test_runner', 'run tests with the functional test runner', function () {
|
|
const {
|
|
logLevel,
|
|
configFile,
|
|
configOverrides
|
|
} = this.options();
|
|
|
|
const log = createToolingLog(logLevel);
|
|
log.pipe(process.stdout);
|
|
|
|
const functionalTestRunner = createFunctionalTestRunner({
|
|
log,
|
|
configFile,
|
|
configOverrides
|
|
});
|
|
|
|
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);
|
|
});
|
|
});
|
|
}
|