@@ -102,7 +102,12 @@ module RWC {
102
102
getSourceFile : ( fileName , languageVersion ) => {
103
103
var fileContents : string ;
104
104
try {
105
- fileContents = sys . readFile ( fileName ) ;
105
+ if ( libPath === fileName ) {
106
+ fileContents = Harness . IO . readFile ( Harness . libFolder + "lib.d.ts" ) ;
107
+ }
108
+ else {
109
+ fileContents = sys . readFile ( fileName ) ;
110
+ }
106
111
}
107
112
catch ( e ) {
108
113
// Leave fileContents undefined;
@@ -134,9 +139,14 @@ module RWC {
134
139
135
140
// Load the files
136
141
inputList . forEach ( ( item : string ) => {
137
- var resolvedPath = Harness . Path . switchToForwardSlashes ( sys . resolvePath ( item ) ) ;
142
+ var resolvedPath = libPath === item ? item : Harness . Path . switchToForwardSlashes ( sys . resolvePath ( item ) ) ;
138
143
try {
139
- var content = sys . readFile ( resolvedPath ) ;
144
+ if ( libPath === item ) {
145
+ var content = Harness . IO . readFile ( Harness . libFolder + "lib.d.ts" ) ;
146
+ }
147
+ else {
148
+ var content = sys . readFile ( resolvedPath ) ;
149
+ }
140
150
}
141
151
catch ( e ) {
142
152
// Leave content undefined.
@@ -148,13 +158,16 @@ module RWC {
148
158
149
159
// Emit the results
150
160
harnessCompiler . emitAll ( emitterIOHost ) ;
151
- harnessCompiler . emitAllDeclarations ( ) ;
152
-
153
161
var compilationErrors = harnessCompiler . reportCompilationErrors ( ) ;
154
162
155
163
// Create an error baseline
156
164
compilationErrors . forEach ( err => {
157
- errors += err . filename + ' line ' + err . line + ': ' + err . message + '\r\n' ;
165
+ if ( err . filename ) {
166
+ errors += err . filename + ' (' + err . line + "," + err . character + "): " + err . message + '\r\n' ;
167
+ }
168
+ else {
169
+ errors += err . message + '\r\n' ;
170
+ }
158
171
} ) ;
159
172
} ) ;
160
173
} ) ;
@@ -165,13 +178,13 @@ module RWC {
165
178
166
179
it ( 'has the expected emitted code' , ( ) => {
167
180
Harness . Baseline . runBaseline ( 'has the expected emitted code' , baseName + '.output.js' , ( ) => {
168
- return collateOutputs ( emitterIOHost , fn => fn . substr ( fn . length - '.js' . length ) === '.js' , s => SyntacticCleaner . clean ( s ) ) ;
181
+ return collateOutputs ( emitterIOHost , fn => Harness . Compiler . isJS ( fn ) , s => SyntacticCleaner . clean ( s ) ) ;
169
182
} , false , baselineOpts ) ;
170
183
} ) ;
171
184
172
185
it ( 'has the expected declaration file content' , ( ) => {
173
186
Harness . Baseline . runBaseline ( 'has the expected declaration file content' , baseName + '.d.ts' , ( ) => {
174
- var result = collateOutputs ( emitterIOHost , fn => fn . substr ( fn . length - '.d.ts' . length ) === '.d.ts' ) ;
187
+ var result = collateOutputs ( emitterIOHost , fn => Harness . Compiler . isDTS ( fn ) ) ;
175
188
return result . length > 0 ? result : null ;
176
189
} , false , baselineOpts ) ;
177
190
} ) ;
0 commit comments