@@ -38,20 +38,23 @@ const debugArgv = [`--runInBand`, `--env`, `jest-environment-node-debug`];
3838const jest = require . resolve ( path . join ( `..` , `node_modules` , `.bin` , `jest` ) ) ;
3939
4040const testTask = ( ( cache , execArgv , testOptions ) => memoizeTask ( cache , function test ( target , format , debug = false ) {
41- const opts = Object . assign ( { } , testOptions ) ;
41+ const opts = { ... testOptions } ;
4242 const args = ! debug ? [ ...execArgv ] : [ ...debugArgv , ...execArgv ] ;
43- opts . env = Object . assign ( { } , opts . env , {
43+ if ( ! argv . integration ) {
44+ args . push ( 'test/vector-tests.ts' ) ;
45+ }
46+ opts . env = { ...opts . env ,
4447 TEST_TARGET : target ,
4548 TEST_MODULE : format ,
4649 TEST_TS_SOURCE : ! ! argv . coverage ,
4750 TEST_SOURCES : JSON . stringify ( Array . isArray ( argv . sources ) ? argv . sources : [ argv . sources ] ) ,
4851 TEST_FORMATS : JSON . stringify ( Array . isArray ( argv . formats ) ? argv . formats : [ argv . formats ] ) ,
49- } ) ;
52+ } ;
5053 return ! debug ?
5154 child_process . spawn ( jest , args , opts ) :
5255 child_process . exec ( `node --inspect-brk ${ jest } ${ args . join ( ` ` ) } ` , opts ) ;
5356} ) ) ( { } , jestArgv , {
54- env : Object . assign ( { } , process . env ) ,
57+ env : { ... process . env } ,
5558 stdio : [ `ignore` , `inherit` , `inherit` ] ,
5659} ) ;
5760
@@ -60,9 +63,16 @@ module.exports.testTask = testTask;
6063module . exports . cleanTestData = cleanTestData ;
6164module . exports . createTestData = createTestData ;
6265
63- const ARROW_HOME = path . resolve ( '../' ) ;
64- const integrationDir = path . resolve ( ARROW_HOME , 'integration' ) ;
65- const testFilesDir = path . resolve ( ARROW_HOME , 'js/test/data' ) ;
66+ // Pull C++ and Java paths from environment vars first, otherwise sane defaults
67+ const ARROW_HOME = process . env . ARROW_HOME || path . resolve ( '../' ) ;
68+ const ARROW_JAVA_DIR = process . env . ARROW_JAVA_DIR || path . join ( ARROW_HOME , 'java' ) ;
69+ const CPP_EXE_PATH = process . env . ARROW_CPP_EXE_PATH || path . join ( ARROW_HOME , 'cpp/build/debug' ) ;
70+ const ARROW_INTEGRATION_DIR = process . env . ARROW_INTEGRATION_DIR || path . join ( ARROW_HOME , 'integration' ) ;
71+ const CPP_JSON_TO_ARROW = path . join ( CPP_EXE_PATH , 'json-integration-test' ) ;
72+ const CPP_STREAM_TO_FILE = path . join ( CPP_EXE_PATH , 'stream-to-file' ) ;
73+ const CPP_FILE_TO_STREAM = path . join ( CPP_EXE_PATH , 'file-to-stream' ) ;
74+
75+ const testFilesDir = path . join ( ARROW_HOME , 'js/test/data' ) ;
6676const cppFilesDir = path . join ( testFilesDir , 'cpp' ) ;
6777const javaFilesDir = path . join ( testFilesDir , 'java' ) ;
6878const jsonFilesDir = path . join ( testFilesDir , 'json' ) ;
@@ -73,34 +83,21 @@ async function cleanTestData() {
7383
7484async function createTestJSON ( ) {
7585 await mkdirp ( jsonFilesDir ) ;
76- await exec ( `shx cp ${ integrationDir } /data/*.json ${ jsonFilesDir } ` ) ;
77- await exec ( `python ${ integrationDir } /integration_test.py --write_generated_json ${ jsonFilesDir } ` ) ;
86+ await exec ( `shx cp ${ ARROW_INTEGRATION_DIR } /data/*.json ${ jsonFilesDir } ` ) ;
87+ await exec ( `python ${ ARROW_INTEGRATION_DIR } /integration_test.py --write_generated_json ${ jsonFilesDir } ` ) ;
7888}
7989
8090async function createTestData ( ) {
8191
82- // Only re-create test data if the test data folder doesn't exist
83- // This should be the case on first checkout, and on the CI server
84- try {
85- const testFilesExist = await stat ( testFilesDir ) ;
86- if ( testFilesExist && testFilesExist . isDirectory ( ) ) {
87- return ;
88- }
89- } catch ( e ) {
90- // continue
92+ let JAVA_TOOLS_JAR = process . env . ARROW_JAVA_INTEGRATION_JAR ;
93+ if ( ! JAVA_TOOLS_JAR ) {
94+ const pom_version = await
95+ readFile ( path . join ( ARROW_JAVA_DIR , 'pom.xml' ) )
96+ . then ( ( pom ) => parseXML ( pom . toString ( ) ) )
97+ . then ( ( pomXML ) => pomXML . project . version [ 0 ] ) ;
98+ JAVA_TOOLS_JAR = path . join ( ARROW_JAVA_DIR , `/tools/target/arrow-tools-${ pom_version } -jar-with-dependencies.jar` ) ;
9199 }
92100
93- // Pull C++ and Java paths from environment vars first, otherwise sane defaults
94- const CPP_EXE_PATH = process . env . ARROW_CPP_EXE_PATH || path . resolve ( ARROW_HOME , 'cpp/build/debug' ) ;
95- const CPP_JSON_TO_ARROW = path . join ( CPP_EXE_PATH , 'json-integration-test' ) ;
96- const CPP_STREAM_TO_FILE = path . join ( CPP_EXE_PATH , 'stream-to-file' ) ;
97- const CPP_FILE_TO_STREAM = path . join ( CPP_EXE_PATH , 'file-to-stream' ) ;
98-
99- const pomString = await readFile ( path . join ( ARROW_HOME , 'java' , 'pom.xml' ) ) ;
100- const pomObject = await parseXML ( pomString . toString ( ) ) ;
101- const _arrow_version = pomObject . project . version [ 0 ] ;
102- const JAVA_TOOLS_JAR = process . env . ARROW_JAVA_INTEGRATION_JAR || path . resolve ( ARROW_HOME , `java/tools/target/arrow-tools-${ _arrow_version } -jar-with-dependencies.jar` ) ;
103-
104101 await cleanTestData ( ) . then ( createTestJSON ) ;
105102 await mkdirp ( path . join ( cppFilesDir , 'file' ) ) ;
106103 await mkdirp ( path . join ( javaFilesDir , 'file' ) ) ;
@@ -119,11 +116,11 @@ async function createTestData() {
119116 try {
120117 await generateCPPFile ( path . resolve ( jsonPath ) , arrowCppFilePath ) ;
121118 await generateCPPStream ( arrowCppFilePath , arrowCppStreamPath ) ;
122- } catch ( e ) { errors . push ( e . message ) ; }
119+ } catch ( e ) { errors . push ( ` ${ e . stdout } \n ${ e . message } ` ) ; }
123120 try {
124121 await generateJavaFile ( path . resolve ( jsonPath ) , arrowJavaFilePath ) ;
125122 await generateJavaStream ( arrowJavaFilePath , arrowJavaStreamPath ) ;
126- } catch ( e ) { errors . push ( e . message ) ; }
123+ } catch ( e ) { errors . push ( ` ${ e . stdout } \n ${ e . message } ` ) ; }
127124 }
128125 if ( errors . length ) {
129126 console . error ( errors . join ( `\n` ) ) ;
0 commit comments