@@ -8,28 +8,31 @@ const childProcess = require('child_process');
88const { describe, it } = require ( 'mocha' ) ;
99
1010function exec ( command , options = { } ) {
11- return childProcess . execSync ( command , {
12- stdio : 'inherit ' ,
11+ const result = childProcess . execSync ( command , {
12+ encoding : 'utf-8 ' ,
1313 ...options ,
1414 } ) ;
15+ return result != null ? result . trimEnd ( ) : result ;
1516}
1617
1718describe ( 'Integration Tests' , ( ) => {
18- const tmpDir = path . join ( os . tmpdir ( ) , 'graphql-js -integrationTmp' ) ;
19+ const tmpDir = path . join ( os . tmpdir ( ) , 'express-graphql -integrationTmp' ) ;
1920 fs . rmdirSync ( tmpDir , { recursive : true } ) ;
2021 fs . mkdirSync ( tmpDir ) ;
2122
2223 const distDir = path . resolve ( './npmDist' ) ;
23- exec ( `npm pack ${ distDir } && cp express-graphql-*.tgz express-graphql.tgz` , {
24- cwd : tmpDir ,
25- } ) ;
24+ const archiveName = exec ( `npm --quiet pack ${ distDir } ` , { cwd : tmpDir } ) ;
25+ fs . renameSync (
26+ path . join ( tmpDir , archiveName ) ,
27+ path . join ( tmpDir , 'express-graphql.tgz' ) ,
28+ ) ;
2629
2730 function testOnNodeProject ( projectName ) {
2831 exec ( `cp -R ${ path . join ( __dirname , projectName ) } ${ tmpDir } ` ) ;
2932
3033 const cwd = path . join ( tmpDir , projectName ) ;
31- exec ( 'npm install --quiet' , { cwd } ) ;
32- exec ( 'npm test' , { cwd } ) ;
34+ exec ( 'npm --quiet install ' , { cwd, stdio : 'inherit' } ) ;
35+ exec ( 'npm --quiet test' , { cwd, stdio : 'inherit' } ) ;
3336 }
3437
3538 it ( 'Should compile with all supported TS versions' , ( ) => {
0 commit comments