Skip to content

Commit

Permalink
run integration tests with local data for coverage stats
Browse files Browse the repository at this point in the history
  • Loading branch information
trxcllnt committed Jan 24, 2018
1 parent fe31ee0 commit 40b3638
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
25 changes: 25 additions & 0 deletions js/gulp/argv.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
// specific language governing permissions and limitations
// under the License.

const fs = require('fs');
const glob = require('glob');
const path = require('path');

const argv = require(`command-line-args`)([
{ name: `all`, type: Boolean },
{ name: 'update', alias: 'u', type: Boolean },
Expand All @@ -36,4 +40,25 @@ argv.module && !modules.length && modules.push(argv.module);
(argv.all || !targets.length) && targets.push(`all`);
(argv.all || !modules.length) && modules.push(`all`);

if (argv.coverage && (!argv.json_files || !argv.json_files.length)) {

let [jsonPaths, arrowPaths] = glob
.sync(path.resolve(__dirname, `../test/data/json/`, `*.json`))
.reduce((paths, jsonPath) => {
const { name } = path.parse(jsonPath);
const [jsonPaths, arrowPaths] = paths;
['cpp', 'java'].forEach((source) => ['file', 'stream'].forEach((format) => {
const arrowPath = path.resolve(__dirname, `../test/data/${source}/${format}/${name}.arrow`);
if (fs.existsSync(arrowPath)) {
jsonPaths.push(jsonPath);
arrowPaths.push(arrowPath);
}
}));
return paths;
}, [[], []]);

argv.json_files = jsonPaths;
argv.arrow_files = arrowPaths;
}

module.exports = { argv, targets, modules };
4 changes: 3 additions & 1 deletion js/gulp/test-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ const testOptions = {
const testTask = ((cache, execArgv, testOptions) => memoizeTask(cache, function test(target, format, debug = false) {
const opts = { ...testOptions };
const args = !debug ? [...execArgv] : [...debugArgv, ...execArgv];
args.push(`test/${argv.integration ? `integration/*` : `unit/*`}`);
if (!argv.coverage) {
args.push(`test/${argv.integration ? `integration/*` : `unit/*`}`);
}
opts.env = { ...opts.env,
TEST_TARGET: target,
TEST_MODULE: format,
Expand Down

0 comments on commit 40b3638

Please sign in to comment.