Skip to content

Commit 42f6a99

Browse files
committed
Merge pull request #169 from DickvdBrink/browser-test-patch
Fix browser tests not working when not cloned in TypeScript directory
2 parents c3624c9 + 4635215 commit 42f6a99

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/webTestServer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ function dir(path: string, spec?: string, options?: any) {
5454
function filesInFolder(folder: string): string[] {
5555
var folder = switchToForwardSlashes(folder);
5656
var paths: string[] = [];
57+
// Everything after the current directory is relative
58+
var baseDirectoryLength = process.cwd().length + 1;
5759

5860
try {
5961
var files = fs.readdirSync(folder);
@@ -62,7 +64,7 @@ function dir(path: string, spec?: string, options?: any) {
6264
if (options.recursive && stat.isDirectory()) {
6365
paths = paths.concat(filesInFolder(folder + "/" + files[i]));
6466
} else if (stat.isFile() && (!spec || files[i].match(spec))) {
65-
var relativePath = folder.substring(folder.indexOf('/TypeScript/') + 12);
67+
var relativePath = folder.substring(baseDirectoryLength);
6668
paths.push(relativePath + "/" + files[i]);
6769
}
6870
}

0 commit comments

Comments
 (0)