@@ -6,7 +6,7 @@ import {computeShortSha} from '../common/utils';
6
6
import { SHA } from './constants' ;
7
7
import { helper } from './helper' ;
8
8
9
- function checkFile ( filePath : string , remove : boolean ) {
9
+ function checkFile ( filePath : string , remove : boolean ) : boolean {
10
10
const exists = existsSync ( filePath ) ;
11
11
if ( exists && remove ) {
12
12
// if we expected the file to exist then we remove it to prevent leftover file errors
@@ -15,7 +15,7 @@ function checkFile(filePath: string, remove: boolean) {
15
15
return exists ;
16
16
}
17
17
18
- function getArtifactPath ( prNum : number , sha : string = SHA ) {
18
+ function getArtifactPath ( prNum : number , sha : string = SHA ) : string {
19
19
return `${ AIO_DOWNLOADS_DIR } /${ prNum } -${ computeShortSha ( sha ) } -aio-snapshot.tgz` ;
20
20
}
21
21
@@ -35,8 +35,8 @@ function checkFiles(prNum: number, isPublic: boolean, sha: string, isLegacy: boo
35
35
return { existingFiles, missingFiles } ;
36
36
}
37
37
38
- class ToExistAsAFile {
39
- public compare ( actual : string , remove = true ) {
38
+ class ToExistAsAFile implements jasmine . CustomMatcher {
39
+ public compare ( actual : string , remove = true ) : jasmine . CustomMatcherResult {
40
40
const pass = checkFile ( actual , remove ) ;
41
41
return {
42
42
message : `Expected file at "${ actual } " ${ pass ? 'not' : '' } to exist` ,
@@ -45,8 +45,8 @@ class ToExistAsAFile {
45
45
}
46
46
}
47
47
48
- class ToExistAsAnArtifact {
49
- public compare ( actual : { prNum : number , sha ?: string } , remove = true ) {
48
+ class ToExistAsAnArtifact implements jasmine . CustomMatcher {
49
+ public compare ( actual : { prNum : number , sha ?: string } , remove = true ) : jasmine . CustomMatcherResult {
50
50
const { prNum, sha = SHA } = actual ;
51
51
const filePath = getArtifactPath ( prNum , sha ) ;
52
52
const pass = checkFile ( filePath , remove ) ;
@@ -57,8 +57,9 @@ class ToExistAsAnArtifact {
57
57
}
58
58
}
59
59
60
- class ToExistAsABuild {
61
- public compare ( actual : { prNum : number , isPublic ?: boolean , sha ?: string , isLegacy ?: boolean } , remove = true ) {
60
+ class ToExistAsABuild implements jasmine . CustomMatcher {
61
+ public compare ( actual : { prNum : number , isPublic ?: boolean , sha ?: string , isLegacy ?: boolean } , remove = true ) :
62
+ jasmine . CustomMatcherResult {
62
63
const { prNum, isPublic = true , sha = SHA , isLegacy = false } = actual ;
63
64
const { missingFiles} = checkFiles ( prNum , isPublic , sha , isLegacy , remove ) ;
64
65
return {
@@ -67,7 +68,8 @@ class ToExistAsABuild {
67
68
pass : missingFiles . length === 0 ,
68
69
} ;
69
70
}
70
- public negativeCompare ( actual : { prNum : number , isPublic ?: boolean , sha ?: string , isLegacy ?: boolean } ) {
71
+ public negativeCompare ( actual : { prNum : number , isPublic ?: boolean , sha ?: string , isLegacy ?: boolean } ) :
72
+ jasmine . CustomMatcherResult {
71
73
const { prNum, isPublic = true , sha = SHA , isLegacy = false } = actual ;
72
74
const { existingFiles } = checkFiles ( prNum , isPublic , sha , isLegacy , false ) ;
73
75
return {
0 commit comments