Skip to content

Commit de559fb

Browse files
committed
Fixed the regexp for removing full paths
1 parent 1b43bd8 commit de559fb

37 files changed

Lines changed: 53 additions & 59 deletions

src/harness/runnerbase.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,12 @@ abstract class RunnerBase {
3131

3232
/** Replaces instances of full paths with fileNames only */
3333
static removeFullPaths(path: string) {
34-
let fixedPath = path;
35-
36-
// full paths either start with a drive letter or / for *nix, shouldn't have \ in the path at this point
37-
const fullPath = /(\w+:|\/)?([\w+\-\.]|\/)*\.tsx?/g;
38-
const fullPathList = fixedPath.match(fullPath);
39-
if (fullPathList) {
40-
fullPathList.forEach((match: string) => fixedPath = fixedPath.replace(match, Harness.Path.getFileName(match)));
41-
}
34+
// If its a full path (starts with "C:" or "/") replace with just the filename
35+
let fixedPath = /^(\w:|\/)/.test(path) ? Harness.Path.getFileName(path) : path;
4236

4337
// when running in the browser the 'full path' is the host name, shows up in error baselines
4438
const localHost = /http:\/localhost:\d+/g;
4539
fixedPath = fixedPath.replace(localHost, "");
4640
return fixedPath;
4741
}
48-
}
42+
}

tests/baselines/reference/declarationEmit_invalidReference2.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ tests/cases/compiler/declarationEmit_invalidReference2.ts(1,1): error TS6053: Fi
44
==== tests/cases/compiler/declarationEmit_invalidReference2.ts (1 errors) ====
55
/// <reference path="invalid.ts" />
66
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7-
!!! error TS6053: File 'invalid.ts' not found.
7+
!!! error TS6053: File 'tests/cases/compiler/invalid.ts' not found.
88
var x = 0;

tests/baselines/reference/declarationFileOverwriteError.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error TS5055: Cannot write file 'tests/cases/compiler/a.d.ts' because it would overwrite input file.
22

33

4-
!!! error TS5055: Cannot write file 'a.d.ts' because it would overwrite input file.
4+
!!! error TS5055: Cannot write file 'tests/cases/compiler/a.d.ts' because it would overwrite input file.
55
==== tests/cases/compiler/a.d.ts (0 errors) ====
66

77
declare class c {

tests/baselines/reference/declarationFileOverwriteErrorWithOut.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error TS5055: Cannot write file 'tests/cases/compiler/out.d.ts' because it would overwrite input file.
22

33

4-
!!! error TS5055: Cannot write file 'out.d.ts' because it would overwrite input file.
4+
!!! error TS5055: Cannot write file 'tests/cases/compiler/out.d.ts' because it would overwrite input file.
55
==== tests/cases/compiler/out.d.ts (0 errors) ====
66

77
declare class c {

tests/baselines/reference/exportStarFromEmptyModule.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ tests/cases/compiler/exportStarFromEmptyModule_module4.ts(4,5): error TS2339: Pr
1414
==== tests/cases/compiler/exportStarFromEmptyModule_module3.ts (1 errors) ====
1515
export * from "./exportStarFromEmptyModule_module2";
1616
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17-
!!! error TS2306: File 'exportStarFromEmptyModule_module2.ts' is not a module.
17+
!!! error TS2306: File 'tests/cases/compiler/exportStarFromEmptyModule_module2.ts' is not a module.
1818
export * from "./exportStarFromEmptyModule_module1";
1919

2020
export class A {

tests/baselines/reference/importNonExternalModule.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tests/cases/conformance/externalModules/foo_1.ts(1,22): error TS2306: File 'test
44
==== tests/cases/conformance/externalModules/foo_1.ts (1 errors) ====
55
import foo = require("./foo_0");
66
~~~~~~~~~
7-
!!! error TS2306: File 'foo_0.ts' is not a module.
7+
!!! error TS2306: File 'tests/cases/conformance/externalModules/foo_0.ts' is not a module.
88
// Import should fail. foo_0 not an external module
99
if(foo.answer === 42){
1010

tests/baselines/reference/invalidTripleSlashReference.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ tests/cases/compiler/invalidTripleSlashReference.ts(2,1): error TS6053: File 'te
55
==== tests/cases/compiler/invalidTripleSlashReference.ts (2 errors) ====
66
/// <reference path='filedoesnotexist.ts'/>
77
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8-
!!! error TS6053: File 'filedoesnotexist.ts' not found.
8+
!!! error TS6053: File 'tests/cases/compiler/filedoesnotexist.ts' not found.
99
/// <reference path='otherdoesnotexist.d.ts'/>
1010
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11-
!!! error TS6053: File 'otherdoesnotexist.d.ts' not found.
11+
!!! error TS6053: File 'tests/cases/compiler/otherdoesnotexist.d.ts' not found.
1212

1313
// this test doesn't actually give the errors you want due to the way the compiler reports errors
1414
var x = 1;

tests/baselines/reference/jsFileCompilationWithDeclarationEmitPathSameAsInput.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error TS5055: Cannot write file 'tests/cases/compiler/a.d.ts' because it would overwrite input file.
22

33

4-
!!! error TS5055: Cannot write file 'a.d.ts' because it would overwrite input file.
4+
!!! error TS5055: Cannot write file 'tests/cases/compiler/a.d.ts' because it would overwrite input file.
55
==== tests/cases/compiler/a.ts (0 errors) ====
66
class c {
77
}

tests/baselines/reference/jsFileCompilationWithOutDeclarationFileNameSameAsInputJsFile.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error TS5055: Cannot write file 'tests/cases/compiler/b.d.ts' because it would overwrite input file.
22

33

4-
!!! error TS5055: Cannot write file 'b.d.ts' because it would overwrite input file.
4+
!!! error TS5055: Cannot write file 'tests/cases/compiler/b.d.ts' because it would overwrite input file.
55
==== tests/cases/compiler/a.ts (0 errors) ====
66
class c {
77
}

tests/baselines/reference/library-reference-5.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
==== /node_modules/bar/index.d.ts (1 errors) ====
1919
/// <reference types="alpha" />
2020
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21-
!!! message TS4090: Conflicting library definitions for 'alpha' found at 'index.d.ts' and 'index.d.ts'. Copy the correct file to the 'typings' folder to resolve this conflict.
21+
!!! message TS4090: Conflicting library definitions for 'alpha' found at '/node_modules/bar/node_modules/alpha/index.d.ts' and '/node_modules/foo/node_modules/alpha/index.d.ts'. Copy the correct file to the 'typings' folder to resolve this conflict.
2222
declare var bar: any;
2323

2424
==== /node_modules/bar/node_modules/alpha/index.d.ts (0 errors) ====

0 commit comments

Comments
 (0)