@@ -17,10 +17,10 @@ const CONFIG = {
1717} ;
1818
1919// We use this for debugging purposes only.
20- let TestFileOverrideList = [ ] ;
20+ let TestFileOverrideList : string [ ] = [ ] ;
2121
2222// Disable some tests that we know to be problematic.
23- const TestFileBlockLists = {
23+ const TestFileBlockLists : Record < string , string [ ] > = {
2424 linux : [ ] ,
2525 darwin : [
2626 // This test has been failing for a long, long time. disable it for now so
@@ -40,26 +40,26 @@ const TestFileBlockLists = {
4040
4141const TestFileBlockList = new Set ( [
4242 ...TestFileBlockLists [ "ALL" ] ,
43- ...TestFileBlockLists [ os . platform ( ) ] ,
43+ ...( TestFileBlockLists [ os . platform ( ) ] || [ ] ) ,
4444] ) ;
4545
4646// Force some tests to run that we have recently fixed but not yet enabled everywhere.
47- const TestFileForceLists = {
47+ const TestFileForceLists : Record < string , string [ ] > = {
4848 linux : [ ] ,
4949 darwin : [ ] ,
5050 ALL : [ ] ,
5151} ;
5252
5353const TestFileForceList = new Set ( [
5454 ...TestFileForceLists [ "ALL" ] ,
55- ...TestFileForceLists [ os . platform ( ) ] ,
55+ ...( TestFileForceLists [ os . platform ( ) ] || [ ] ) ,
5656] ) ;
5757
5858/**
5959 * Re-record all examples that have previously been recorded with
6060 * "recent Chromium".
6161 */
62- function checkReRecord ( testFile , exampleFileInfo : ExampleInfo ) {
62+ function checkReRecord ( testFile : string , exampleFileInfo : ExampleInfo ) {
6363 const wouldNormallyTest =
6464 exampleFileInfo . runtime === "chromium" &&
6565 exampleFileInfo . runtimeReleaseDate . getUTCFullYear ( ) === 2024 &&
@@ -173,7 +173,7 @@ function gatherChromiumExamplesAndTests() {
173173
174174// transforms https://github.com/replayio/chromium.git or
175175// git@github .com:replayio/chromium to replayio/chromium
176- function githubUrlToRepository ( url ) {
176+ function githubUrlToRepository ( url : string | undefined ) {
177177 return url ?. replace ( / .* g i t h u b .c o m [: \/ ] ( .* ) \. g i t / , "$1" ) ;
178178}
179179
@@ -184,8 +184,8 @@ function testHttpConnection(
184184 const startTime = Date . now ( ) ;
185185 return new Promise ( ( resolve , reject ) => {
186186 function attemptConnection ( ) {
187- const request = http . get ( url , async res => {
188- if ( res . statusCode < 500 ) {
187+ const request = http . get ( url , async ( res : http . IncomingMessage ) => {
188+ if ( res . statusCode && res . statusCode < 500 ) {
189189 // As long as we can connect at all, we should be fine.
190190 resolve ( ) ;
191191 return ;
@@ -203,8 +203,8 @@ function testHttpConnection(
203203 setTimeout ( attemptConnection , 1000 ) ; // Retry after 1 second
204204 } ) ;
205205
206- request . on ( "error" , ( err : Error ) => {
207- if ( err [ " code" ] === "ECONNREFUSED" ) {
206+ request . on ( "error" , ( err : Error & { code ?: string } ) => {
207+ if ( err . code === "ECONNREFUSED" ) {
208208 if ( Date . now ( ) - startTime >= timeoutMs ) {
209209 reject ( new Error ( `Failed to connect to the server within ${ timeoutMs / 1000 } seconds` ) ) ;
210210 return ;
@@ -225,7 +225,7 @@ function testHttpConnection(
225225}
226226
227227export default async function run_fe_tests (
228- CHROME_BINARY_PATH ,
228+ CHROME_BINARY_PATH : string | undefined ,
229229 runInCI = true ,
230230 nWorkers = 4 ,
231231 testOverrides ?: string [ ]
0 commit comments