@@ -931,5 +931,77 @@ describe('detect-node-support', () => {
931931 } ) ;
932932 } ) ;
933933 } ) ;
934+
935+ describe ( 'with dependencies' , ( ) => {
936+
937+ it ( 'resolves dependency information' , async ( ) => {
938+
939+ listRemoteStub
940+ . returns ( '9cef39d21ad229dea4b10295f55b0d9a83800b23\tHEAD\n' ) ;
941+
942+ Nock ( 'https://registry.npmjs.org' )
943+ . get ( '/is-ci' )
944+ . reply ( 200 , Fs . readFileSync ( Path . join ( __dirname , 'fixtures' , 'deps-test' , 'packuments' , 'is-ci.json' ) ) )
945+ . get ( '/ci-info' )
946+ . reply ( 200 , Fs . readFileSync ( Path . join ( __dirname , 'fixtures' , 'deps-test' , 'packuments' , 'ci-info.json' ) ) )
947+ . get ( '/debug' )
948+ . reply ( 200 , Fs . readFileSync ( Path . join ( __dirname , 'fixtures' , 'deps-test' , 'packuments' , 'debug.json' ) ) )
949+ . get ( '/ms' )
950+ . reply ( 200 , Fs . readFileSync ( Path . join ( __dirname , 'fixtures' , 'deps-test' , 'packuments' , 'ms.json' ) ) )
951+ . persist ( ) ;
952+
953+ Nock ( 'https://raw.githubusercontent.com' )
954+ . get ( '/watson/is-ci/HEAD/package.json' )
955+ . reply ( 200 , JSON . stringify ( { name : 'is-ci' , version : '2.0.0' } ) )
956+ . get ( '/watson/is-ci/HEAD/.travis.yml' )
957+ . reply ( 200 , Fs . readFileSync ( Path . join ( __dirname , 'fixtures' , 'testing-single-version.yml' ) ) )
958+ . get ( '/watson/ci-info/HEAD/package.json' )
959+ . reply ( 200 , JSON . stringify ( { name : 'ci-info' , version : '2.0.0' } ) )
960+ . get ( '/watson/ci-info/HEAD/.travis.yml' )
961+ . reply ( 200 , Fs . readFileSync ( Path . join ( __dirname , 'fixtures' , 'testing-single-version.yml' ) ) ) ;
962+
963+ const path = await internals . prepareFixture ( {
964+ packageJson : JSON . parse ( Fs . readFileSync ( Path . join ( __dirname , 'fixtures' , 'deps-test' , 'package.json' ) ) . toString ( ) )
965+ } ) ;
966+
967+ const result = await NodeSupport . detect ( { path } , { deps : true } ) ;
968+
969+ internals . assertCommit ( result ) ;
970+
971+ expect ( result ) . to . equal ( {
972+ name : '@pkgjs/detect-node-support-deps-test' ,
973+ version : '0.0.0-development' ,
974+ timestamp : 1580673602000 ,
975+ dependencies : {
976+ versions : {
977+ 'ci-info' : [ '1.6.0' ] ,
978+ 'is-ci' : [ '2.0.0' ]
979+ } ,
980+ support : [
981+ {
982+ name : 'ci-info' ,
983+ version : '2.0.0' ,
984+ timestamp : 1580673602000 ,
985+ commit : '9cef39d21ad229dea4b10295f55b0d9a83800b23' ,
986+ travis : {
987+ raw : [ '10' ] ,
988+ resolved : { '10' : '10.19.0' }
989+ }
990+ } ,
991+ {
992+ name : 'is-ci' ,
993+ version : '2.0.0' ,
994+ timestamp : 1580673602000 ,
995+ commit : '9cef39d21ad229dea4b10295f55b0d9a83800b23' ,
996+ travis : {
997+ raw : [ '10' ] ,
998+ resolved : { '10' : '10.19.0' }
999+ }
1000+ }
1001+ ]
1002+ }
1003+ } ) ;
1004+ } ) ;
1005+ } ) ;
9341006 } ) ;
9351007} ) ;
0 commit comments