@@ -8,28 +8,31 @@ const childProcess = require('child_process');
8
8
const { describe, it } = require ( 'mocha' ) ;
9
9
10
10
function exec ( command , options = { } ) {
11
- return childProcess . execSync ( command , {
12
- stdio : 'inherit ' ,
11
+ const result = childProcess . execSync ( command , {
12
+ encoding : 'utf-8 ' ,
13
13
...options ,
14
14
} ) ;
15
+ return result != null ? result . trimEnd ( ) : result ;
15
16
}
16
17
17
18
describe ( 'Integration Tests' , ( ) => {
18
- const tmpDir = path . join ( os . tmpdir ( ) , 'graphql-js -integrationTmp' ) ;
19
+ const tmpDir = path . join ( os . tmpdir ( ) , 'express-graphql -integrationTmp' ) ;
19
20
fs . rmdirSync ( tmpDir , { recursive : true } ) ;
20
21
fs . mkdirSync ( tmpDir ) ;
21
22
22
23
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
+ ) ;
26
29
27
30
function testOnNodeProject ( projectName ) {
28
31
exec ( `cp -R ${ path . join ( __dirname , projectName ) } ${ tmpDir } ` ) ;
29
32
30
33
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' } ) ;
33
36
}
34
37
35
38
it ( 'Should compile with all supported TS versions' , ( ) => {
0 commit comments