Skip to content

Commit 6015f07

Browse files
hanslBrocco
authored andcommitted
test: fix typings for utils/fs.ts
1 parent 826c634 commit 6015f07

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tests/e2e/utils/fs.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ export function symlinkFile(from: string, to: string, type?: string) {
8080
}
8181

8282
export function createDir(path: string) {
83-
_recursiveMkDir(path);
83+
return _recursiveMkDir(path);
8484
}
8585

8686

87-
function _recursiveMkDir(path: string) {
87+
function _recursiveMkDir(path: string): Promise<void> {
8888
if (fs.existsSync(path)) {
8989
return Promise.resolve();
9090
} else {
@@ -97,11 +97,11 @@ export function copyFile(from: string, to: string) {
9797
return _recursiveMkDir(dirname(to))
9898
.then(() => new Promise((resolve, reject) => {
9999
const rd = fs.createReadStream(from);
100-
rd.on('error', (err) => reject(err));
100+
rd.on('error', (err: Error) => reject(err));
101101

102102
const wr = fs.createWriteStream(to);
103-
wr.on('error', (err) => reject(err));
104-
wr.on('close', (ex) => resolve());
103+
wr.on('error', (err: Error) => reject(err));
104+
wr.on('close', () => resolve());
105105

106106
rd.pipe(wr);
107107
}));
@@ -113,8 +113,7 @@ export function writeMultipleFiles(fs: { [path: string]: string }) {
113113
}
114114

115115

116-
export function replaceInFile(filePath: string, match: string, replacement: string);
117-
export function replaceInFile(filePath: string, match: RegExp, replacement: string) {
116+
export function replaceInFile(filePath: string, match: RegExp | string, replacement: string) {
118117
return readFile(filePath)
119118
.then((content: string) => writeFile(filePath, content.replace(match, replacement)));
120119
}

0 commit comments

Comments
 (0)