mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 20:25:23 -06:00
Always include 'lib.d.ts' last in tests unless '@noLib' is specified.
This commit is contained in:
parent
8a8d6a3c5b
commit
d2857751b2
@ -10958,6 +10958,8 @@ module ts {
|
||||
function checkSourceFile(node: SourceFile) {
|
||||
let start = new Date().getTime();
|
||||
|
||||
// Check whether the file has declared it is the default lib,
|
||||
// and whether the user has specifically chosen to avoid checking it.
|
||||
let skipCheck = node.hasNoDefaultLib && compilerOptions.noLibCheck;
|
||||
if (!skipCheck) {
|
||||
checkSourceFileWorker(node);
|
||||
|
||||
@ -962,12 +962,19 @@ module Harness {
|
||||
var includeBuiltFiles: { unitName: string; content: string }[] = [];
|
||||
|
||||
var useCaseSensitiveFileNames = ts.sys.useCaseSensitiveFileNames;
|
||||
this.settings.forEach(setOptionForSetting);
|
||||
this.settings.forEach(setCompilerOptionForSetting);
|
||||
|
||||
var fileOutputs: GeneratedFile[] = [];
|
||||
|
||||
var programFiles = inputFiles.concat(includeBuiltFiles).map(file => file.unitName);
|
||||
var program = ts.createProgram(programFiles, options, createCompilerHost(inputFiles.concat(includeBuiltFiles).concat(otherFiles),
|
||||
if (!options.noLib) {
|
||||
// Unless the user doesn't want a default lib at all,
|
||||
// always push the default lib in *last* to normalize the type/symbol baselines.
|
||||
programFiles.push(defaultLibFileName);
|
||||
}
|
||||
|
||||
var program = ts.createProgram(programFiles, options,
|
||||
createCompilerHost(inputFiles.concat(includeBuiltFiles).concat(otherFiles),
|
||||
(fn, contents, writeByteOrderMark) => fileOutputs.push({ fileName: fn, code: contents, writeByteOrderMark: writeByteOrderMark }),
|
||||
options.target, useCaseSensitiveFileNames, currentDirectory, options.newLine));
|
||||
|
||||
@ -986,8 +993,8 @@ module Harness {
|
||||
// reset what newline means in case the last test changed it
|
||||
ts.sys.newLine = newLine;
|
||||
return options;
|
||||
|
||||
function setOptionForSetting(setting: Harness.TestCaseParser.CompilerSetting) {
|
||||
|
||||
function setCompilerOptionForSetting(setting: Harness.TestCaseParser.CompilerSetting) {
|
||||
switch (setting.flag.toLowerCase()) {
|
||||
// "fileName", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noimplicitany", "noresolve"
|
||||
case "module":
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user