Skip to content

Commit 436baaf

Browse files
author
Yui T
committed
Add default target in compiler option of project runner
1 parent 4e5a3ae commit 436baaf

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/harness/projectsRunner.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ class ProjectRunner extends RunnerBase {
164164
mapRoot: testCase.resolveMapRoot && testCase.mapRoot ? ts.sys.resolvePath(testCase.mapRoot) : testCase.mapRoot,
165165
sourceRoot: testCase.resolveSourceRoot && testCase.sourceRoot ? ts.sys.resolvePath(testCase.sourceRoot) : testCase.sourceRoot,
166166
module: moduleKind,
167-
noResolve: testCase.noResolve
167+
noResolve: testCase.noResolve,
168+
target: ts.ScriptTarget.ES6
168169
};
169170
}
170171

@@ -186,7 +187,7 @@ class ProjectRunner extends RunnerBase {
186187
function createCompilerHost(): ts.CompilerHost {
187188
return {
188189
getSourceFile,
189-
getDefaultLibFilename: options => options.target === ts.ScriptTarget.ES6 ? "lib.es6.d.ts" : "lib.d.ts",
190+
getDefaultLibFilename: options => Harness.Compiler.defaultLibFileName,
190191
writeFile,
191192
getCurrentDirectory,
192193
getCanonicalFileName: Harness.Compiler.getCanonicalFileName,

tests/baselines/reference/project/noDefaultLib/amd/noDefaultLib.errors.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
error TS2318: Cannot find global type 'TemplateStringsArray'.
12
error TS2318: Cannot find global type 'String'.
23
error TS2318: Cannot find global type 'RegExp'.
34
error TS2318: Cannot find global type 'Object'.
@@ -9,6 +10,7 @@ error TS2318: Cannot find global type 'Array'.
910
test.ts(3,8): error TS2304: Cannot find name 'Array'.
1011

1112

13+
!!! error TS2318: Cannot find global type 'TemplateStringsArray'.
1214
!!! error TS2318: Cannot find global type 'String'.
1315
!!! error TS2318: Cannot find global type 'RegExp'.
1416
!!! error TS2318: Cannot find global type 'Object'.

tests/baselines/reference/project/noDefaultLib/node/noDefaultLib.errors.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
error TS2318: Cannot find global type 'TemplateStringsArray'.
12
error TS2318: Cannot find global type 'String'.
23
error TS2318: Cannot find global type 'RegExp'.
34
error TS2318: Cannot find global type 'Object'.
@@ -9,6 +10,7 @@ error TS2318: Cannot find global type 'Array'.
910
test.ts(3,8): error TS2304: Cannot find name 'Array'.
1011

1112

13+
!!! error TS2318: Cannot find global type 'TemplateStringsArray'.
1214
!!! error TS2318: Cannot find global type 'String'.
1315
!!! error TS2318: Cannot find global type 'RegExp'.
1416
!!! error TS2318: Cannot find global type 'Object'.

0 commit comments

Comments
 (0)