@@ -67,6 +67,7 @@ describe('Remote queries', function() {
67
67
const fileUri = getFile ( 'data-remote-qlpack/in-pack.ql' ) ;
68
68
69
69
const queryPackRootDir = ( await runRemoteQuery ( cli , credentials , fileUri , true , progress , token ) ) ! ;
70
+ printDirectoryContents ( queryPackRootDir ) ;
70
71
71
72
// to retrieve the list of repositories
72
73
expect ( showQuickPickSpy ) . to . have . been . calledOnce ;
@@ -77,25 +78,32 @@ describe('Remote queries', function() {
77
78
expect ( fs . readdirSync ( queryPackRootDir ) . find ( f => f . startsWith ( 'qlpack-' ) && f . endsWith ( '-generated.tgz' ) ) ) . not . to . be . undefined ;
78
79
79
80
const queryPackDir = path . join ( queryPackRootDir , 'query-pack' ) ;
81
+ printDirectoryContents ( queryPackDir ) ;
82
+
80
83
// in-pack.ql renamed to query.ql
81
84
expect ( fs . existsSync ( path . join ( queryPackDir , 'query.ql' ) ) ) . to . be . true ;
82
85
expect ( fs . existsSync ( path . join ( queryPackDir , 'lib.qll' ) ) ) . to . be . true ;
83
86
expect ( fs . existsSync ( path . join ( queryPackDir , 'qlpack.yml' ) ) ) . to . be . true ;
84
- expect ( fs . existsSync (
85
- // depending on the cli version, we should have one of these files
86
- path . join ( queryPackDir , 'qlpack.lock.yml' ) || path . join ( queryPackDir , 'codeql-pack.lock.yml' )
87
- ) ) . to . be . true ;
87
+
88
+ // depending on the cli version, we should have one of these files
89
+ expect (
90
+ fs . existsSync ( path . join ( queryPackDir , 'qlpack.lock.yml' ) ) ||
91
+ fs . existsSync ( path . join ( queryPackDir , 'codeql-pack.lock.yml' ) )
92
+ ) . to . be . true ;
88
93
expect ( fs . existsSync ( path . join ( queryPackDir , 'not-in-pack.ql' ) ) ) . to . be . false ;
89
94
90
95
// the compiled pack
91
96
const compiledPackDir = path . join ( queryPackDir , '.codeql/pack/github/remote-query-pack/0.0.0/' ) ;
97
+ printDirectoryContents ( compiledPackDir ) ;
98
+
92
99
expect ( fs . existsSync ( path . join ( compiledPackDir , 'query.ql' ) ) ) . to . be . true ;
93
100
expect ( fs . existsSync ( path . join ( compiledPackDir , 'lib.qll' ) ) ) . to . be . true ;
94
101
expect ( fs . existsSync ( path . join ( compiledPackDir , 'qlpack.yml' ) ) ) . to . be . true ;
95
- expect ( fs . existsSync (
96
- // depending on the cli version, we should have one of these files
97
- path . join ( compiledPackDir , 'qlpack.lock.yml' ) || path . join ( queryPackDir , 'codeql-pack.lock.yml' )
98
- ) ) . to . be . true ;
102
+ // depending on the cli version, we should have one of these files
103
+ expect (
104
+ fs . existsSync ( path . join ( compiledPackDir , 'qlpack.lock.yml' ) ) ||
105
+ fs . existsSync ( path . join ( compiledPackDir , 'codeql-pack.lock.yml' ) )
106
+ ) . to . be . true ;
99
107
expect ( fs . existsSync ( path . join ( compiledPackDir , 'not-in-pack.ql' ) ) ) . to . be . false ;
100
108
101
109
// dependencies
@@ -116,27 +124,32 @@ describe('Remote queries', function() {
116
124
// check a few files that we know should exist and others that we know should not
117
125
118
126
// the tarball to deliver to the server
127
+ printDirectoryContents ( queryPackRootDir ) ;
119
128
expect ( fs . readdirSync ( queryPackRootDir ) . find ( f => f . startsWith ( 'qlpack-' ) && f . endsWith ( '-generated.tgz' ) ) ) . not . to . be . undefined ;
120
129
121
130
const queryPackDir = path . join ( queryPackRootDir , 'query-pack' ) ;
131
+ printDirectoryContents ( queryPackDir ) ;
122
132
// in-pack.ql renamed to query.ql
123
133
expect ( fs . existsSync ( path . join ( queryPackDir , 'query.ql' ) ) ) . to . be . true ;
124
134
expect ( fs . existsSync ( path . join ( queryPackDir , 'qlpack.yml' ) ) ) . to . be . true ;
125
- expect ( fs . existsSync (
126
- // depending on the cli version, we should have one of these files
127
- path . join ( queryPackDir , 'qlpack.lock.yml' ) || path . join ( queryPackDir , 'codeql-pack.lock.yml' )
128
- ) ) . to . be . true ;
135
+ // depending on the cli version, we should have one of these files
136
+ expect (
137
+ fs . existsSync ( path . join ( queryPackDir , 'qlpack.lock.yml' ) ) ||
138
+ fs . existsSync ( path . join ( queryPackDir , 'codeql-pack.lock.yml' ) )
139
+ ) . to . be . true ;
129
140
expect ( fs . existsSync ( path . join ( queryPackDir , 'lib.qll' ) ) ) . to . be . false ;
130
141
expect ( fs . existsSync ( path . join ( queryPackDir , 'not-in-pack.ql' ) ) ) . to . be . false ;
131
142
132
143
// the compiled pack
133
144
const compiledPackDir = path . join ( queryPackDir , '.codeql/pack/codeql-remote/query/1.0.0/' ) ;
145
+ printDirectoryContents ( compiledPackDir ) ;
134
146
expect ( fs . existsSync ( path . join ( compiledPackDir , 'query.ql' ) ) ) . to . be . true ;
135
147
expect ( fs . existsSync ( path . join ( compiledPackDir , 'qlpack.yml' ) ) ) . to . be . true ;
136
- expect ( fs . existsSync (
137
- // depending on the cli version, we should have one of these files
138
- path . join ( compiledPackDir , 'qlpack.lock.yml' ) || path . join ( queryPackDir , 'codeql-pack.lock.yml' )
139
- ) ) . to . be . true ;
148
+ // depending on the cli version, we should have one of these files
149
+ expect (
150
+ fs . existsSync ( path . join ( compiledPackDir , 'qlpack.lock.yml' ) ) ||
151
+ fs . existsSync ( path . join ( compiledPackDir , 'codeql-pack.lock.yml' ) )
152
+ ) . to . be . true ;
140
153
expect ( fs . existsSync ( path . join ( compiledPackDir , 'lib.qll' ) ) ) . to . be . false ;
141
154
expect ( fs . existsSync ( path . join ( compiledPackDir , 'not-in-pack.ql' ) ) ) . to . be . false ;
142
155
// should have generated a correct qlpack file
@@ -147,6 +160,7 @@ describe('Remote queries', function() {
147
160
148
161
// dependencies
149
162
const libraryDir = path . join ( compiledPackDir , '.codeql/libraries/codeql' ) ;
163
+ printDirectoryContents ( libraryDir ) ;
150
164
const packNames = fs . readdirSync ( libraryDir ) . sort ( ) ;
151
165
expect ( packNames ) . to . deep . equal ( [ 'javascript-all' , 'javascript-upgrades' ] ) ;
152
166
} ) ;
@@ -169,4 +183,12 @@ describe('Remote queries', function() {
169
183
function getFile ( file : string ) : Uri {
170
184
return Uri . file ( path . join ( baseDir , file ) ) ;
171
185
}
186
+
187
+ function printDirectoryContents ( dir : string ) {
188
+ console . log ( `DIR ${ dir } ` ) ;
189
+ if ( ! fs . existsSync ( dir ) ) {
190
+ console . log ( `DIR ${ dir } does not exist` ) ;
191
+ }
192
+ fs . readdirSync ( dir ) . sort ( ) . forEach ( f => console . log ( ` ${ f } ` ) ) ;
193
+ }
172
194
} ) ;
0 commit comments