From 4635215209c74fd9a94aacee42e5181df4f0aeb7 Mon Sep 17 00:00:00 2001 From: Dick van den Brink Date: Tue, 22 Jul 2014 00:13:48 +0200 Subject: [PATCH] Fix browser tests not working when not cloned in TypeScript directory --- tests/webTestServer.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/webTestServer.ts b/tests/webTestServer.ts index b797b83d643..05cf7a10f20 100644 --- a/tests/webTestServer.ts +++ b/tests/webTestServer.ts @@ -54,6 +54,8 @@ function dir(path: string, spec?: string, options?: any) { function filesInFolder(folder: string): string[] { var folder = switchToForwardSlashes(folder); var paths: string[] = []; + // Everything after the current directory is relative + var baseDirectoryLength = process.cwd().length + 1; try { var files = fs.readdirSync(folder); @@ -62,7 +64,7 @@ function dir(path: string, spec?: string, options?: any) { if (options.recursive && stat.isDirectory()) { paths = paths.concat(filesInFolder(folder + "/" + files[i])); } else if (stat.isFile() && (!spec || files[i].match(spec))) { - var relativePath = folder.substring(folder.indexOf('/TypeScript/') + 12); + var relativePath = folder.substring(baseDirectoryLength); paths.push(relativePath + "/" + files[i]); } }