Skip to content

Commit 40b3638

Browse files
committed
run integration tests with local data for coverage stats
1 parent fe31ee0 commit 40b3638

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

js/gulp/argv.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
const fs = require('fs');
19+
const glob = require('glob');
20+
const path = require('path');
21+
1822
const argv = require(`command-line-args`)([
1923
{ name: `all`, type: Boolean },
2024
{ name: 'update', alias: 'u', type: Boolean },
@@ -36,4 +40,25 @@ argv.module && !modules.length && modules.push(argv.module);
3640
(argv.all || !targets.length) && targets.push(`all`);
3741
(argv.all || !modules.length) && modules.push(`all`);
3842

43+
if (argv.coverage && (!argv.json_files || !argv.json_files.length)) {
44+
45+
let [jsonPaths, arrowPaths] = glob
46+
.sync(path.resolve(__dirname, `../test/data/json/`, `*.json`))
47+
.reduce((paths, jsonPath) => {
48+
const { name } = path.parse(jsonPath);
49+
const [jsonPaths, arrowPaths] = paths;
50+
['cpp', 'java'].forEach((source) => ['file', 'stream'].forEach((format) => {
51+
const arrowPath = path.resolve(__dirname, `../test/data/${source}/${format}/${name}.arrow`);
52+
if (fs.existsSync(arrowPath)) {
53+
jsonPaths.push(jsonPath);
54+
arrowPaths.push(arrowPath);
55+
}
56+
}));
57+
return paths;
58+
}, [[], []]);
59+
60+
argv.json_files = jsonPaths;
61+
argv.arrow_files = arrowPaths;
62+
}
63+
3964
module.exports = { argv, targets, modules };

js/gulp/test-task.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ const testOptions = {
4444
const testTask = ((cache, execArgv, testOptions) => memoizeTask(cache, function test(target, format, debug = false) {
4545
const opts = { ...testOptions };
4646
const args = !debug ? [...execArgv] : [...debugArgv, ...execArgv];
47-
args.push(`test/${argv.integration ? `integration/*` : `unit/*`}`);
47+
if (!argv.coverage) {
48+
args.push(`test/${argv.integration ? `integration/*` : `unit/*`}`);
49+
}
4850
opts.env = { ...opts.env,
4951
TEST_TARGET: target,
5052
TEST_MODULE: format,

0 commit comments

Comments
 (0)