moved away from submodules
This commit is contained in:
@ -3,14 +3,16 @@ module.exports = function (branch, done) {
|
||||
* Creates a JSON version of the YAML test suite that can be simply bundled for use in the browser.
|
||||
*/
|
||||
var jsYaml = require('js-yaml');
|
||||
var fs = require('relative-fs').relativeTo(__dirname);
|
||||
var fs = require('fs');
|
||||
var async = require('async');
|
||||
var chalk = require('chalk');
|
||||
var _ = require('../../src/lib/utils');
|
||||
var path = require('path');
|
||||
var fromRoot = path.join.bind(path, require('find-root')(__dirname));
|
||||
var _ = require(fromRoot('src/lib/utils'));
|
||||
var tests = {}; // populated in readYamlTests
|
||||
|
||||
var branchSuffix = branch === 'master' ? '' : '_' + _.snakeCase(branch);
|
||||
var esDir = fromRoot('src/elasticsearch' + branchSuffix);
|
||||
|
||||
// generate the yaml tests
|
||||
async.series([
|
||||
@ -19,7 +21,7 @@ module.exports = function (branch, done) {
|
||||
], done);
|
||||
|
||||
function readYamlTests(done) {
|
||||
var testDir = path.join(__dirname, '../../src/elasticsearch/rest-api-spec/test/');
|
||||
var testDir = path.join(esDir, 'rest-api-spec/test/');
|
||||
|
||||
function readDirectories(dir) {
|
||||
fs.readdirSync(dir).forEach(function (filename) {
|
||||
@ -41,7 +43,7 @@ module.exports = function (branch, done) {
|
||||
}
|
||||
|
||||
function writeYamlTests(done) {
|
||||
var testFile = require('path').resolve(__dirname, '../../test/integration/yaml_suite/yaml_tests' + branchSuffix + '.json');
|
||||
var testFile = fromRoot('test/integration/yaml_suite/yaml_tests' + branchSuffix + '.json');
|
||||
fs.writeFileSync(testFile, JSON.stringify(tests, null, ' '), 'utf8');
|
||||
console.log(chalk.white.bold('wrote') + ' YAML tests as JSON to', testFile);
|
||||
done();
|
||||
|
||||
Reference in New Issue
Block a user