mirror of https://github.com/grpc/grpc-node.git
				
				
				
			test: run internal tests sequentially
This commit is contained in:
		
							parent
							
								
									b192adf2a1
								
							
						
					
					
						commit
						5c657cf3bd
					
				|  | @ -22,7 +22,6 @@ const execa = require('execa'); | ||||||
| const path = require('path'); | const path = require('path'); | ||||||
| const del = require('del'); | const del = require('del'); | ||||||
| const linkSync = require('../util').linkSync; | const linkSync = require('../util').linkSync; | ||||||
| const merge = require('merge2'); |  | ||||||
| 
 | 
 | ||||||
| // gulp-help monkeypatches tasks to have an additional description parameter
 | // gulp-help monkeypatches tasks to have an additional description parameter
 | ||||||
| const gulp = help(_gulp); | const gulp = help(_gulp); | ||||||
|  | @ -52,17 +51,30 @@ gulp.task('internal.test.link.add', 'Link local copies of dependencies', () => { | ||||||
| gulp.task('internal.test.test', 'Run API-level tests', () => { | gulp.task('internal.test.test', 'Run API-level tests', () => { | ||||||
|   // run mocha tests matching a glob with a pre-required fixture,
 |   // run mocha tests matching a glob with a pre-required fixture,
 | ||||||
|   // returning the associated gulp stream
 |   // returning the associated gulp stream
 | ||||||
|   const runTestsWithFixture = (glob, fixture) => gulp |   const runTestsWithFixture = (glob, fixture) => new Promise((resolve, reject) => { | ||||||
|     .src(glob) |     const server = fixture.split('_')[0]; | ||||||
|     .pipe(mocha({ |     const client = fixture.split('_')[1]; | ||||||
|       reporter: 'mocha-jenkins-reporter', |     console.log(`Running ${glob} with ${server} server + ${client} client`); | ||||||
|       require: `${testDir}/fixtures/${fixture}.js` |     gulp.src(glob) | ||||||
|     })); |       .pipe(mocha({ | ||||||
|   const interopTest = `${testDir}/interop/interop_test.js`; |         reporter: 'mocha-jenkins-reporter', | ||||||
|   const tasks = [].concat( |         require: `${testDir}/fixtures/${fixture}.js` | ||||||
|     ['native_native'/*, 'js_js'*/] |       })) | ||||||
|       .map((fixture) => runTestsWithFixture(`${apiTestDir}/*.js`, fixture)), |       .resume() // put the stream in flowing mode
 | ||||||
|     ['native_native', 'native_js'/*, 'js_native', 'js_js'*/] |       .on('end', resolve) | ||||||
|       .map((fixture) => runTestsWithFixture(interopTest, fixture))) |       .on('error', reject); | ||||||
|   return merge(tasks); |   }); | ||||||
|  |   const apiTestGlob = `${apiTestDir}/*.js`; | ||||||
|  |   const interopTestGlob = `${testDir}/interop/interop_sanity_test.js`; | ||||||
|  |   const runTestsArgPairs = [ | ||||||
|  |     [apiTestGlob, 'native_native'], | ||||||
|  |     [apiTestGlob, 'js_js'], | ||||||
|  |     [interopTestGlob, 'native_native'], | ||||||
|  |     [interopTestGlob, 'native_js'], | ||||||
|  |     [interopTestGlob, 'js_native'], | ||||||
|  |     [interopTestGlob, 'js_js'] | ||||||
|  |   ]; | ||||||
|  |   return runTestsArgPairs.reduce((previousPromise, argPair) => { | ||||||
|  |     return previousPromise.then(runTestsWithFixture.bind(null, argPair[0], argPair[1])); | ||||||
|  |   }, Promise.resolve()); | ||||||
| }); | }); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue