From 911511e011d28e2bd41781a639aeb5f0a8dda4bf Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 29 Nov 2016 12:42:17 -0800 Subject: [PATCH] Report option diagnostic in tsconfig.json if possible --- src/compiler/commandLineParser.ts | 11 +- src/compiler/program.ts | 151 ++++++++++++++---- src/compiler/types.ts | 3 +- src/compiler/utilities.ts | 9 ++ src/harness/compilerRunner.ts | 19 ++- src/harness/harness.ts | 15 +- src/harness/projectsRunner.ts | 33 ++-- src/harness/rwcRunner.ts | 9 +- .../unittests/configurationExtension.ts | 20 +-- .../convertCompilerOptionsFromJson.ts | 1 + src/services/services.ts | 14 +- src/services/utilities.ts | 6 +- ...NodeModuleJsDepthDefaultsToZero.errors.txt | 11 ++ ...gBasedModuleResolution1_classic.errors.txt | 18 ++- ...pingBasedModuleResolution1_node.errors.txt | 17 +- ...gBasedModuleResolution2_classic.errors.txt | 20 ++- ...pingBasedModuleResolution2_node.errors.txt | 20 ++- ...tion_withExtension_failedLookup.errors.txt | 10 ++ .../reference/pathsValidation1.errors.txt | 12 +- .../reference/pathsValidation2.errors.txt | 12 +- .../reference/pathsValidation3.errors.txt | 13 +- ...MetadataCommonJSISolatedModules.errors.txt | 14 ++ ...MetadataCommonJSISolatedModules.errors.txt | 14 ++ ...ommonJSISolatedModulesNoResolve.errors.txt | 15 ++ ...ommonJSISolatedModulesNoResolve.errors.txt | 15 ++ .../emitDecoratorMetadataSystemJS.errors.txt | 13 ++ .../emitDecoratorMetadataSystemJS.errors.txt | 13 ++ ...MetadataSystemJSISolatedModules.errors.txt | 15 ++ ...MetadataSystemJSISolatedModules.errors.txt | 15 ++ ...ystemJSISolatedModulesNoResolve.errors.txt | 16 ++ ...ystemJSISolatedModulesNoResolve.errors.txt | 16 ++ ...ationDifferentNamesNotSpecified.errors.txt | 7 +- ...entNamesNotSpecifiedWithAllowJs.errors.txt | 10 +- ...entNamesNotSpecifiedWithAllowJs.errors.txt | 15 +- ...pilationDifferentNamesSpecified.errors.txt | 5 + ...pilationDifferentNamesSpecified.errors.txt | 8 +- ...ferentNamesSpecifiedWithAllowJs.errors.txt | 11 +- ...ferentNamesSpecifiedWithAllowJs.errors.txt | 16 +- ...SameNameDTsSpecifiedWithAllowJs.errors.txt | 8 +- ...SameNameDTsSpecifiedWithAllowJs.errors.txt | 8 +- ...eNameDtsNotSpecifiedWithAllowJs.errors.txt | 7 +- ...eNameDtsNotSpecifiedWithAllowJs.errors.txt | 7 +- ...ameFilesNotSpecifiedWithAllowJs.errors.txt | 5 +- ...ameFilesNotSpecifiedWithAllowJs.errors.txt | 5 +- ...meNameFilesSpecifiedWithAllowJs.errors.txt | 8 +- ...meNameFilesSpecifiedWithAllowJs.errors.txt | 8 +- .../amd/nodeModulesImportHigher.errors.txt | 10 ++ .../node/nodeModulesImportHigher.errors.txt | 10 ++ .../nodeModulesMaxDepthExceeded.errors.txt | 11 ++ .../nodeModulesMaxDepthExceeded.errors.txt | 11 ++ .../nodeModulesMaxDepthIncreased.errors.txt | 8 + .../nodeModulesMaxDepthIncreased.errors.txt | 8 + 52 files changed, 654 insertions(+), 102 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 74308951d54..dc31eb1b9bd 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1026,7 +1026,7 @@ namespace ts { case "project": break; default: - const value = options[name]; + const value = options[name]; const optionDefinition = optionsNameMap.get(name.toLowerCase()); if (optionDefinition) { const customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); @@ -1193,6 +1193,7 @@ namespace ts { options = extend(existingOptions, options); options.configFilePath = configFileName; + options.configFile = sourceFile; const { fileNames, wildcardDirectories } = getFileNames(errors); @@ -1639,17 +1640,15 @@ namespace ts { function createDiagnostic(message: DiagnosticMessage, spec: string): Diagnostic { if (jsonSourceFile && jsonSourceFile.jsonObject) { - for (const property of jsonSourceFile.jsonObject.properties) { - if (property.kind === SyntaxKind.PropertyAssignment && getTextOfPropertyName(property.name) === specKey) { - const specsNode = property.initializer; - for (const element of specsNode.elements) { + for (const property of getPropertyAssignment(jsonSourceFile.jsonObject, specKey)) { + if (isArrayLiteralExpression(property.initializer)) { + for (const element of property.initializer.elements) { if (element.kind === SyntaxKind.StringLiteral && (element).text === spec) { return createDiagnosticForNodeInSourceFile(jsonSourceFile, element, message, spec); } } } } - } return createCompilerDiagnostic(message, spec); } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 650711afc79..994603e0944 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -329,6 +329,7 @@ namespace ts { // Map storing if there is emit blocking diagnostics for given input const hasEmitBlockingDiagnostics = createFileMap(getCanonicalFileName); + let _compilerOptionsObjectLiteralSyntax: ObjectLiteralExpression; let moduleResolutionCache: ModuleResolutionCache; let resolveModuleNamesWorker: (moduleNames: string[], containingFile: string) => ResolvedModuleFull[]; @@ -1108,6 +1109,9 @@ namespace ts { const allDiagnostics: Diagnostic[] = []; addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics()); addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics()); + if (options.configFile) { + addRange(allDiagnostics, programDiagnostics.getDiagnostics(options.configFile.fileName)); + } return sortAndDeduplicateDiagnostics(allDiagnostics); } @@ -1541,33 +1545,33 @@ namespace ts { function verifyCompilerOptions() { if (options.isolatedModules) { if (options.declaration) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); + createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules"); } if (options.noEmitOnError) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); + createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules"); } if (options.out) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); + createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules"); } if (options.outFile) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); + createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules"); } } if (options.inlineSourceMap) { if (options.sourceMap) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); + createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap"); } if (options.mapRoot) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); + createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap"); } } if (options.paths && options.baseUrl === undefined) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_paths_cannot_be_used_without_specifying_baseUrl_option)); + createDiagnosticForOptionName(Diagnostics.Option_paths_cannot_be_used_without_specifying_baseUrl_option, "paths"); } if (options.paths) { @@ -1576,63 +1580,65 @@ namespace ts { continue; } if (!hasZeroOrOneAsteriskCharacter(key)) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key)); + createDiagnosticForOptionPaths(/*onKey*/ true, key, Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key); } if (isArray(options.paths[key])) { - if (options.paths[key].length === 0) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Substitutions_for_pattern_0_shouldn_t_be_an_empty_array, key)); + const len = options.paths[key].length; + if (len === 0) { + createDiagnosticForOptionPaths(/*onKey*/ false, key, Diagnostics.Substitutions_for_pattern_0_shouldn_t_be_an_empty_array, key); } - for (const subst of options.paths[key]) { + for (let i = 0; i < len; i++) { + const subst = options.paths[key][i]; const typeOfSubst = typeof subst; if (typeOfSubst === "string") { if (!hasZeroOrOneAsteriskCharacter(subst)) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character, subst, key)); + createDiagnosticForOptionPathKeyValue(key, i, Diagnostics.Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character, subst, key); } } else { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2, subst, key, typeOfSubst)); + createDiagnosticForOptionPathKeyValue(key, i, Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2, subst, key, typeOfSubst); } } } else { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Substitutions_for_pattern_0_should_be_an_array, key)); + createDiagnosticForOptionPaths(/*onKey*/ false, key, Diagnostics.Substitutions_for_pattern_0_should_be_an_array, key); } } } if (!options.sourceMap && !options.inlineSourceMap) { if (options.inlineSources) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "inlineSources")); + createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "inlineSources"); } if (options.sourceRoot) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "sourceRoot")); + createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "sourceRoot"); } } if (options.out && options.outFile) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); + createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile"); } if (options.mapRoot && !options.sourceMap) { // Error to specify --mapRoot without --sourcemap - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); + createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap"); } if (options.declarationDir) { if (!options.declaration) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration")); + createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration"); } if (options.out || options.outFile) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile")); + createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile"); } } if (options.lib && options.noLib) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib")); + createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib"); } if (options.noImplicitUseStrict && options.alwaysStrict) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict")); + createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict"); } const languageVersion = options.target || ScriptTarget.ES3; @@ -1641,7 +1647,7 @@ namespace ts { const firstNonAmbientExternalModuleSourceFile = forEach(files, f => isExternalModule(f) && !isDeclarationFile(f) ? f : undefined); if (options.isolatedModules) { if (options.module === ModuleKind.None && languageVersion < ScriptTarget.ES2015) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher)); + createDiagnosticForOptionName(Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher, "isolatedModules", "target"); } const firstNonExternalModuleSourceFile = forEach(files, f => !isExternalModule(f) && !isDeclarationFile(f) ? f : undefined); @@ -1659,7 +1665,7 @@ namespace ts { // Cannot specify module gen that isn't amd or system with --out if (outFile) { if (options.module && !(options.module === ModuleKind.AMD || options.module === ModuleKind.System)) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); + createDiagnosticForOptionName(Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile", "module"); } else if (options.module === undefined && firstNonAmbientExternalModuleSourceFile) { const span = getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator); @@ -1678,29 +1684,29 @@ namespace ts { // If we failed to find a good common directory, but outDir is specified and at least one of our files is on a windows drive/URL/other resource, add a failure if (options.outDir && dir === "" && forEach(files, file => getRootLength(file.fileName) > 1)) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + createDiagnosticForOptionName(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir"); } } if (!options.noEmit && options.allowJs && options.declaration) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration")); + createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration"); } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); + createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"); } if (options.jsxFactory) { if (options.reactNamespace) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "reactNamespace", "jsxFactory")); + createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "reactNamespace", "jsxFactory"); } if (!parseIsolatedEntityName(options.jsxFactory, languageVersion)) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFactory)); + createOptionValueDiagnostic("jsxFactory", Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFactory); } } else if (options.reactNamespace && !isIdentifierText(options.reactNamespace, languageVersion)) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace)); + createOptionValueDiagnostic("reactNamespace", Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace); } // If the emit is enabled make sure that every output file is unique and not overwriting any of the input files @@ -1740,6 +1746,91 @@ namespace ts { } } + function createDiagnosticForOptionPathKeyValue(key: string, valueIndex: number, message: DiagnosticMessage, arg0: string | number, arg1: string | number, arg2?: string | number) { + let needCompilerDiagnostic = true; + const pathsSyntax = getOptionPathsSyntax(); + for (const pathProp of pathsSyntax) { + if (isObjectLiteralExpression(pathProp.initializer)) { + for (const keyProps of getPropertyAssignment(pathProp.initializer, key)) { + if (isArrayLiteralExpression(keyProps.initializer) && + keyProps.initializer.elements.length > valueIndex) { + programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, keyProps.initializer.elements[valueIndex], message, arg0, arg1, arg2)); + needCompilerDiagnostic = false; + } + } + } + } + + if (needCompilerDiagnostic) { + programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2)); + } + } + + function createDiagnosticForOptionPaths(onKey: boolean, key: string, message: DiagnosticMessage, arg0: string | number) { + let needCompilerDiagnostic = true; + const pathsSyntax = getOptionPathsSyntax(); + for (const pathProp of pathsSyntax) { + if (isObjectLiteralExpression(pathProp.initializer) && + createOptionDiagnosticInObjectLiteralSyntax( + pathProp.initializer, onKey, key, /*key2*/undefined, + message, arg0)) { + needCompilerDiagnostic = false; + } + } + if (needCompilerDiagnostic) { + programDiagnostics.add(createCompilerDiagnostic(message, arg0)); + } + } + + function getOptionPathsSyntax() { + const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax(); + if (compilerOptionsObjectLiteralSyntax) { + return getPropertyAssignment(compilerOptionsObjectLiteralSyntax, "paths"); + } + return emptyArray; + } + + function createDiagnosticForOptionName(message: DiagnosticMessage, option1: string, option2?: string) { + createDiagnosticForOption(/*onKey*/ true, option1, option2, message, option1, option2); + } + + function createOptionValueDiagnostic(option1: string, message: DiagnosticMessage, arg0: string) { + createDiagnosticForOption(/*onKey*/ false, option1, /*option2*/ undefined, message, arg0); + } + + function createDiagnosticForOption(onKey: boolean, option1: string, option2: string, message: DiagnosticMessage, arg0: string | number, arg1?: string | number) { + const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax(); + const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || + !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1); + + if (needCompilerDiagnostic) { + programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1)); + } + } + + function getCompilerOptionsObjectLiteralSyntax() { + if (_compilerOptionsObjectLiteralSyntax === undefined) { + _compilerOptionsObjectLiteralSyntax = null; // tslint:disable-line:no-null-keyword + if (options.configFile && options.configFile.jsonObject) { + for (const prop of getPropertyAssignment(options.configFile.jsonObject, "compilerOptions")) { + if (isObjectLiteralExpression(prop.initializer)) { + _compilerOptionsObjectLiteralSyntax = prop.initializer; + break; + } + } + } + } + return _compilerOptionsObjectLiteralSyntax; + } + + function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral: ObjectLiteralExpression, onKey: boolean, key1: string, key2: string, message: DiagnosticMessage, arg0: string | number, arg1?: string | number): boolean { + const props = getPropertyAssignment(objectLiteral, key1, key2); + for (const prop of props) { + programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1)); + } + return !!props.length; + } + function blockEmittingOfFile(emitFileName: string, diag: Diagnostic) { hasEmitBlockingDiagnostics.set(toPath(emitFileName, currentDirectory, getCanonicalFileName), true); programDiagnostics.add(diag); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index c7d8eef61b4..44d177d82a3 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3198,6 +3198,7 @@ baseUrl?: string; charset?: string; /* @internal */ configFilePath?: string; + /* @internal */ configFile?: JsonSourceFile; declaration?: boolean; declarationDir?: string; /* @internal */ diagnostics?: boolean; @@ -3266,7 +3267,7 @@ /*@internal*/ version?: boolean; /*@internal*/ watch?: boolean; - [option: string]: CompilerOptionsValue | undefined; + [option: string]: CompilerOptionsValue | JsonSourceFile | undefined; } export interface TypeAcquisition { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index bbb0fd00cb8..85a46fb6a2a 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -948,6 +948,15 @@ namespace ts { return predicate && predicate.kind === TypePredicateKind.This; } + export function getPropertyAssignment(objectLiteral: ObjectLiteralExpression, key: string, key2?: string) { + return filter(objectLiteral.properties, property => { + if (property.kind === SyntaxKind.PropertyAssignment) { + const propName = getTextOfPropertyName(property.name); + return key === propName || (key2 && key2 === propName); + } + }); + } + export function getContainingFunction(node: Node): FunctionLikeDeclaration { while (true) { node = node.parent; diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts index 327932f3667..307b843dc49 100644 --- a/src/harness/compilerRunner.ts +++ b/src/harness/compilerRunner.ts @@ -64,6 +64,7 @@ class CompilerBaselineRunner extends RunnerBase { let result: Harness.Compiler.CompilerResult; let options: ts.CompilerOptions; + let tsConfigFiles: Harness.Compiler.TestFile[]; // equivalent to the files that will be passed on the command line let toBeCompiled: Harness.Compiler.TestFile[]; // equivalent to other files on the file system not directly passed to the compiler (ie things that are referenced by other files) @@ -77,10 +78,12 @@ class CompilerBaselineRunner extends RunnerBase { const units = testCaseContent.testUnitData; harnessSettings = testCaseContent.settings; let tsConfigOptions: ts.CompilerOptions; + tsConfigFiles = []; if (testCaseContent.tsConfig) { assert.equal(testCaseContent.tsConfig.fileNames.length, 0, `list of files in tsconfig is not currently supported`); tsConfigOptions = ts.clone(testCaseContent.tsConfig.options); + tsConfigFiles.push(this.createHarnessTestFile(testCaseContent.tsConfigFileUnitData, rootDir, ts.combinePaths(rootDir, tsConfigOptions.configFilePath))); } else { const baseUrl = harnessSettings["baseUrl"]; @@ -98,21 +101,22 @@ class CompilerBaselineRunner extends RunnerBase { otherFiles = []; if (testCaseContent.settings["noImplicitReferences"] || /require\(/.test(lastUnit.content) || /reference\spath/.test(lastUnit.content)) { - toBeCompiled.push({ unitName: this.makeUnitName(lastUnit.name, rootDir), content: lastUnit.content, fileOptions: lastUnit.fileOptions }); + toBeCompiled.push(this.createHarnessTestFile(lastUnit, rootDir)); units.forEach(unit => { if (unit.name !== lastUnit.name) { - otherFiles.push({ unitName: this.makeUnitName(unit.name, rootDir), content: unit.content, fileOptions: unit.fileOptions }); + otherFiles.push(this.createHarnessTestFile(unit, rootDir)); } }); } else { toBeCompiled = units.map(unit => { - return { unitName: this.makeUnitName(unit.name, rootDir), content: unit.content, fileOptions: unit.fileOptions }; + return this.createHarnessTestFile(unit, rootDir); }); } if (tsConfigOptions && tsConfigOptions.configFilePath !== undefined) { tsConfigOptions.configFilePath = ts.combinePaths(rootDir, tsConfigOptions.configFilePath); + tsConfigOptions.configFile.fileName = tsConfigOptions.configFilePath; } const output = Harness.Compiler.compileFiles( @@ -132,11 +136,12 @@ class CompilerBaselineRunner extends RunnerBase { options = undefined; toBeCompiled = undefined; otherFiles = undefined; + tsConfigFiles = undefined; }); // check errors it("Correct errors for " + fileName, () => { - Harness.Compiler.doErrorBaseline(justName, toBeCompiled.concat(otherFiles), result.errors); + Harness.Compiler.doErrorBaseline(justName, tsConfigFiles.concat(toBeCompiled, otherFiles), result.errors); }); it (`Correct module resolution tracing for ${fileName}`, () => { @@ -165,7 +170,7 @@ class CompilerBaselineRunner extends RunnerBase { it("Correct JS output for " + fileName, () => { if (hasNonDtsFiles && this.emit) { - Harness.Compiler.doJsEmitBaseline(justName, fileName, options, result, toBeCompiled, otherFiles, harnessSettings); + Harness.Compiler.doJsEmitBaseline(justName, fileName, options, result, tsConfigFiles, toBeCompiled, otherFiles, harnessSettings); } }); @@ -183,6 +188,10 @@ class CompilerBaselineRunner extends RunnerBase { }); } + private createHarnessTestFile(lastUnit: Harness.TestCaseParser.TestUnitData, rootDir: string, unitName?: string): Harness.Compiler.TestFile { + return { unitName: unitName || this.makeUnitName(lastUnit.name, rootDir), content: lastUnit.content, fileOptions: lastUnit.fileOptions }; + } + public initializeTests() { describe(this.testSuiteName + " tests", () => { describe("Setup compiler for compiler baselines", () => { diff --git a/src/harness/harness.ts b/src/harness/harness.ts index c3bd46b2ba0..7e45032c1df 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -1614,7 +1614,7 @@ namespace Harness { } } - export function doJsEmitBaseline(baselinePath: string, header: string, options: ts.CompilerOptions, result: CompilerResult, toBeCompiled: Harness.Compiler.TestFile[], otherFiles: Harness.Compiler.TestFile[], harnessSettings: Harness.TestCaseParser.CompilerSettings) { + export function doJsEmitBaseline(baselinePath: string, header: string, options: ts.CompilerOptions, result: CompilerResult, tsConfigFiles: Harness.Compiler.TestFile[], toBeCompiled: Harness.Compiler.TestFile[], otherFiles: Harness.Compiler.TestFile[], harnessSettings: Harness.TestCaseParser.CompilerSettings) { if (!options.noEmit && result.files.length === 0 && result.errors.length === 0) { throw new Error("Expected at least one js file to be emitted or at least one error to be created."); } @@ -1650,7 +1650,7 @@ namespace Harness { if (declFileCompilationResult && declFileCompilationResult.declResult.errors.length) { jsCode += "\r\n\r\n//// [DtsFileErrors]\r\n"; jsCode += "\r\n\r\n"; - jsCode += Harness.Compiler.getErrorBaseline(declFileCompilationResult.declInputFiles.concat(declFileCompilationResult.declOtherFiles), declFileCompilationResult.declResult.errors); + jsCode += Harness.Compiler.getErrorBaseline(tsConfigFiles.concat(declFileCompilationResult.declInputFiles, declFileCompilationResult.declOtherFiles), declFileCompilationResult.declResult.errors); } if (jsCode.length > 0) { @@ -1801,7 +1801,12 @@ namespace Harness { } /** Given a test file containing // @FileName directives, return an array of named units of code to be added to an existing compiler instance */ - export function makeUnitsFromTest(code: string, fileName: string, rootDir?: string): { settings: CompilerSettings; testUnitData: TestUnitData[]; tsConfig: ts.ParsedCommandLine } { + export function makeUnitsFromTest(code: string, fileName: string, rootDir?: string): { + settings: CompilerSettings; + testUnitData: TestUnitData[]; + tsConfig: ts.ParsedCommandLine; + tsConfigFileUnitData: TestUnitData; + } { const settings = extractCompilerSettings(code); // List of all the subfiles we've parsed out @@ -1887,6 +1892,7 @@ namespace Harness { // check if project has tsconfig.json in the list of files let tsConfig: ts.ParsedCommandLine; + let tsConfigFileUnitData: TestUnitData; for (let i = 0; i < testUnitData.length; i++) { const data = testUnitData[i]; if (ts.getBaseFileName(data.name).toLowerCase() === "tsconfig.json") { @@ -1898,6 +1904,7 @@ namespace Harness { } tsConfig = ts.parseJsonSourceFileConfigFileContent(configJson, parseConfigHost, baseDir); tsConfig.options.configFilePath = data.name; + tsConfigFileUnitData = data; // delete entry from the list ts.orderedRemoveItemAt(testUnitData, i); @@ -1905,7 +1912,7 @@ namespace Harness { break; } } - return { settings, testUnitData, tsConfig }; + return { settings, testUnitData, tsConfig, tsConfigFileUnitData }; } } diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index d0ac213db7c..11df554ddfe 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -24,6 +24,7 @@ interface BatchCompileProjectTestCaseEmittedFile extends Harness.Compiler.Genera } interface CompileProjectFilesResult { + configFileSourceFiles: ts.SourceFile[]; moduleKind: ts.ModuleKind; program?: ts.Program; compilerOptions?: ts.CompilerOptions; @@ -125,7 +126,8 @@ class ProjectRunner extends RunnerBase { return Harness.IO.resolvePath(testCase.projectRoot); } - function compileProjectFiles(moduleKind: ts.ModuleKind, getInputFiles: () => string[], + function compileProjectFiles(moduleKind: ts.ModuleKind, configFileSourceFiles: ts.SourceFile[], + getInputFiles: () => string[], getSourceFileTextImpl: (fileName: string) => string, writeFile: (fileName: string, data: string, writeByteOrderMark: boolean) => void, compilerOptions: ts.CompilerOptions): CompileProjectFilesResult { @@ -149,6 +151,7 @@ class ProjectRunner extends RunnerBase { } return { + configFileSourceFiles, moduleKind, program, errors, @@ -197,6 +200,7 @@ class ProjectRunner extends RunnerBase { const outputFiles: BatchCompileProjectTestCaseEmittedFile[] = []; let inputFiles = testCase.inputFiles; let compilerOptions = createCompilerOptions(); + const configFileSourceFiles: ts.SourceFile[] = []; let configFileName: string; if (compilerOptions.project) { @@ -211,6 +215,7 @@ class ProjectRunner extends RunnerBase { let errors: ts.Diagnostic[]; if (configFileName) { const result = ts.readConfigFileToJsonSourceFile(configFileName, getSourceFileText); + configFileSourceFiles.push(result); const configParseHost: ts.ParseConfigHost = { useCaseSensitiveFileNames: Harness.IO.useCaseSensitiveFileNames(), fileExists, @@ -220,6 +225,7 @@ class ProjectRunner extends RunnerBase { const configParseResult = ts.parseJsonSourceFileConfigFileContent(result, configParseHost, ts.getDirectoryPath(configFileName), compilerOptions); if (configParseResult.errors.length > 0) { return { + configFileSourceFiles, moduleKind, errors: result.parseDiagnostics.concat(configParseResult.errors) }; @@ -229,8 +235,9 @@ class ProjectRunner extends RunnerBase { errors = result.parseDiagnostics; } - const projectCompilerResult = compileProjectFiles(moduleKind, () => inputFiles, getSourceFileText, writeFile, compilerOptions); + const projectCompilerResult = compileProjectFiles(moduleKind, configFileSourceFiles, () => inputFiles, getSourceFileText, writeFile, compilerOptions); return { + configFileSourceFiles, moduleKind, program: projectCompilerResult.program, compilerOptions, @@ -397,7 +404,7 @@ class ProjectRunner extends RunnerBase { }); // Dont allow config files since we are compiling existing source options - return compileProjectFiles(compilerResult.moduleKind, getInputFiles, getSourceFileText, writeFile, compilerResult.compilerOptions); + return compileProjectFiles(compilerResult.moduleKind, compilerResult.configFileSourceFiles, getInputFiles, getSourceFileText, writeFile, compilerResult.compilerOptions); function findOutputDtsFile(fileName: string) { return ts.forEach(compilerResult.outputFiles, outputFile => outputFile.emittedFileName === fileName ? outputFile : undefined); @@ -423,16 +430,16 @@ class ProjectRunner extends RunnerBase { } function getErrorsBaseline(compilerResult: CompileProjectFilesResult) { - const inputFiles = compilerResult.program ? ts.map(ts.filter(compilerResult.program.getSourceFiles(), - sourceFile => !Harness.isDefaultLibraryFile(sourceFile.fileName)), - sourceFile => { - return { - unitName: ts.isRootedDiskPath(sourceFile.fileName) ? - RunnerBase.removeFullPaths(sourceFile.fileName) : - sourceFile.fileName, - content: sourceFile.text - }; - }) : []; + const inputFiles = ts.map(compilerResult.configFileSourceFiles.concat( + compilerResult.program ? + ts.filter(compilerResult.program.getSourceFiles(), sourceFile => !Harness.isDefaultLibraryFile(sourceFile.fileName)) : + []), + sourceFile => { + unitName: ts.isRootedDiskPath(sourceFile.fileName) ? + RunnerBase.removeFullPaths(sourceFile.fileName) : + sourceFile.fileName, + content: sourceFile.text + }); return Harness.Compiler.getErrorBaseline(inputFiles, compilerResult.errors); } diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index 567519165c7..6379f829d77 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -30,6 +30,7 @@ namespace RWC { describe("Testing a RWC project: " + jsonPath, () => { let inputFiles: Harness.Compiler.TestFile[] = []; let otherFiles: Harness.Compiler.TestFile[] = []; + let tsconfigFiles: Harness.Compiler.TestFile[] = []; let compilerResult: Harness.Compiler.CompilerResult; let compilerOptions: ts.CompilerOptions; const baselineOpts: Harness.Baseline.BaselineOptions = { @@ -44,6 +45,7 @@ namespace RWC { // Therefore we have to clean out large objects after the test is done. inputFiles = []; otherFiles = []; + tsconfigFiles = []; compilerResult = undefined; compilerOptions = undefined; currentDirectory = undefined; @@ -74,6 +76,7 @@ namespace RWC { const tsconfigFile = ts.forEach(ioLog.filesRead, f => isTsConfigFile(f) ? f : undefined); if (tsconfigFile) { const tsconfigFileContents = getHarnessCompilerInputUnit(tsconfigFile.path); + tsconfigFiles.push({ unitName: tsconfigFile.path, content: tsconfigFileContents.content }); const parsedTsconfigFileContents = ts.parseJsonText(tsconfigFile.path, tsconfigFileContents.content); const configParseHost: ts.ParseConfigHost = { useCaseSensitiveFileNames: Harness.IO.useCaseSensitiveFileNames(), @@ -198,8 +201,8 @@ namespace RWC { return null; } // Do not include the library in the baselines to avoid noise - const baselineFiles = inputFiles.concat(otherFiles).filter(f => !Harness.isDefaultLibraryFile(f.unitName)); - const errors = compilerResult.errors.filter(e => e.file && !Harness.isDefaultLibraryFile(e.file.fileName)); + const baselineFiles = tsconfigFiles.concat(inputFiles, otherFiles).filter(f => !Harness.isDefaultLibraryFile(f.unitName)); + const errors = compilerResult.errors.filter(e => !e.file || !Harness.isDefaultLibraryFile(e.file.fileName)); return Harness.Compiler.getErrorBaseline(baselineFiles, errors); }, baselineOpts); }); @@ -218,7 +221,7 @@ namespace RWC { return Harness.Compiler.minimalDiagnosticsToString(declFileCompilationResult.declResult.errors) + Harness.IO.newLine() + Harness.IO.newLine() + - Harness.Compiler.getErrorBaseline(declFileCompilationResult.declInputFiles.concat(declFileCompilationResult.declOtherFiles), declFileCompilationResult.declResult.errors); + Harness.Compiler.getErrorBaseline(tsconfigFiles.concat(declFileCompilationResult.declInputFiles, declFileCompilationResult.declOtherFiles), declFileCompilationResult.declResult.errors); }, baselineOpts); } }); diff --git a/src/harness/unittests/configurationExtension.ts b/src/harness/unittests/configurationExtension.ts index 8963bf2e505..05a7303a2c5 100644 --- a/src/harness/unittests/configurationExtension.ts +++ b/src/harness/unittests/configurationExtension.ts @@ -119,23 +119,25 @@ namespace ts { function getParseCommandLineJsonSourceFile(entry: string) { const jsonSourceFile = ts.readConfigFileToJsonSourceFile(entry, name => host.readFile(name)); assert(jsonSourceFile.endOfFileToken && !jsonSourceFile.parseDiagnostics.length, flattenDiagnosticMessageText(jsonSourceFile.parseDiagnostics[0] && jsonSourceFile.parseDiagnostics[0].messageText, "\n")); - return ts.parseJsonSourceFileConfigFileContent(jsonSourceFile, host, basePath, {}, entry); + return { + jsonSourceFile, + parsed: ts.parseJsonSourceFileConfigFileContent(jsonSourceFile, host, basePath, {}, entry) + }; } function testSuccess(name: string, entry: string, expected: CompilerOptions, expectedFiles: string[]) { + expected.configFilePath = entry; it(name, () => { const parsed = getParseCommandLine(entry); assert(!parsed.errors.length, flattenDiagnosticMessageText(parsed.errors[0] && parsed.errors[0].messageText, "\n")); - expected.configFilePath = entry; - assert.deepEqual(parsed.options, expected); + assert.deepEqual(parsed.options, ts.extend(expected, { configFile: undefined })); assert.deepEqual(parsed.fileNames, expectedFiles); }); - it(name + "with jsonSourceFile", () => { - const parsed = getParseCommandLineJsonSourceFile(entry); + it(name + " with jsonSourceFile", () => { + const { parsed, jsonSourceFile } = getParseCommandLineJsonSourceFile(entry); assert(!parsed.errors.length, flattenDiagnosticMessageText(parsed.errors[0] && parsed.errors[0].messageText, "\n")); - expected.configFilePath = entry; - assert.deepEqual(parsed.options, expected); + assert.deepEqual(parsed.options, ts.extend(expected, { configFile: jsonSourceFile })); assert.deepEqual(parsed.fileNames, expectedFiles); }); } @@ -146,8 +148,8 @@ namespace ts { verifyDiagnostics(parsed.errors, expectedDiagnostics); }); - it(name + "with jsonSourceFile", () => { - const parsed = getParseCommandLineJsonSourceFile(entry); + it(name + " with jsonSourceFile", () => { + const { parsed } = getParseCommandLineJsonSourceFile(entry); verifyDiagnostics(parsed.errors, expectedDiagnostics); }); } diff --git a/src/harness/unittests/convertCompilerOptionsFromJson.ts b/src/harness/unittests/convertCompilerOptionsFromJson.ts index a00ac5ef56b..450ddface1d 100644 --- a/src/harness/unittests/convertCompilerOptionsFromJson.ts +++ b/src/harness/unittests/convertCompilerOptionsFromJson.ts @@ -34,6 +34,7 @@ namespace ts { const host: ParseConfigHost = new Utils.MockParseConfigHost("/apath/", true, []); const { options: actualCompilerOptions, errors: actualParseErrors } = parseJsonSourceFileConfigFileContent(result, host, "/apath/", /*existingOptions*/ undefined, configFileName); expectedResult.compilerOptions["configFilePath"] = configFileName; + expectedResult.compilerOptions.configFile = result; const parsedCompilerOptions = JSON.stringify(actualCompilerOptions); const expectedCompilerOptions = JSON.stringify(expectedResult.compilerOptions); diff --git a/src/services/services.ts b/src/services/services.ts index cb38b1d500e..3b11b3c39f8 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1216,8 +1216,20 @@ namespace ts { } } + const currentOptions = program.getCompilerOptions(); + const newOptions = hostCache.compilationSettings(); // If the compilation settings do no match, then the program is not up-to-date - return compareDataObjects(program.getCompilerOptions(), hostCache.compilationSettings()); + if (!compareDataObjects(currentOptions, newOptions, "configFile")) { + return false; + } + + // If everything matches but the text of config file is changed, + // error locations can change for program options, so update the program + if (currentOptions.configFile && newOptions.configFile) { + return currentOptions.configFile.text === newOptions.configFile.text; + } + + return true; } } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index c65f308a2ce..bd54fb9c987 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1047,8 +1047,12 @@ namespace ts { return false; } - export function compareDataObjects(dst: any, src: any): boolean { + export function compareDataObjects(dst: any, src: any, ignoreKey?: string): boolean { for (const e in dst) { + if (ignoreKey && ignoreKey === e) { + continue; + } + if (typeof dst[e] === "object") { if (!compareDataObjects(dst[e], src[e])) { return false; diff --git a/tests/baselines/reference/maxNodeModuleJsDepthDefaultsToZero.errors.txt b/tests/baselines/reference/maxNodeModuleJsDepthDefaultsToZero.errors.txt index 2218e7910ae..94a22dc946f 100644 --- a/tests/baselines/reference/maxNodeModuleJsDepthDefaultsToZero.errors.txt +++ b/tests/baselines/reference/maxNodeModuleJsDepthDefaultsToZero.errors.txt @@ -1,6 +1,17 @@ /index.ts(4,5): error TS2339: Property 'y' does not exist on type 'typeof "shortid"'. +==== /tsconfig.json (0 errors) ==== + + { + "compileOnSave": true, + "compilerOptions": { + "module": "commonjs", + "moduleResolution": "node", + "outDir": "bin" + }, + "exclude": [ "node_modules" ] + } ==== /index.ts (1 errors) ==== /// import * as foo from "shortid"; diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution1_classic.errors.txt b/tests/baselines/reference/pathMappingBasedModuleResolution1_classic.errors.txt index 85e25ec99fb..f687e70a3cf 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution1_classic.errors.txt +++ b/tests/baselines/reference/pathMappingBasedModuleResolution1_classic.errors.txt @@ -1,7 +1,23 @@ -error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option. +c:/root/tsconfig.json(6,9): error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option. +==== c:/root/tsconfig.json (1 errors) ==== + + // paths should error in the absence of baseurl + + { + "compilerOptions": { + "paths": { + ~~~~~~~ !!! error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option. + "*": [ + "*", + "generated/*" + ] + } + } + } + ==== c:/root/f1.ts (0 errors) ==== export var x = 1; \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution1_node.errors.txt b/tests/baselines/reference/pathMappingBasedModuleResolution1_node.errors.txt index 85e25ec99fb..6a7ae059c79 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution1_node.errors.txt +++ b/tests/baselines/reference/pathMappingBasedModuleResolution1_node.errors.txt @@ -1,7 +1,22 @@ -error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option. +c:/root/tsconfig.json(5,9): error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option. +==== c:/root/tsconfig.json (1 errors) ==== + + // paths should error in the absence of baseurl + { + "compilerOptions": { + "paths": { + ~~~~~~~ !!! error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option. + "*": [ + "*", + "generated/*" + ] + } + } + } + ==== c:/root/f1.ts (0 errors) ==== export var x = 1; \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.errors.txt b/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.errors.txt index ad954bd142b..4161a67cede 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.errors.txt +++ b/tests/baselines/reference/pathMappingBasedModuleResolution2_classic.errors.txt @@ -1,8 +1,24 @@ -error TS5061: Pattern '*1*' can have at most one '*' character -error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character +tests/cases/compiler/root/tsconfig.json(9,13): error TS5061: Pattern '*1*' can have at most one '*' character +tests/cases/compiler/root/tsconfig.json(9,22): error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character +==== tests/cases/compiler/root/tsconfig.json (2 errors) ==== + + // baseurl is defined in tsconfig.json + // paths has errors + + { + "compilerOptions": { + "baseUrl": "./src", + "paths": { + "*1*": [ "*2*" ] + ~~~~~ !!! error TS5061: Pattern '*1*' can have at most one '*' character + ~~~~~ !!! error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character + } + } + } + ==== tests/cases/compiler/root/src/folder1/file1.ts (0 errors) ==== export var x = 1; \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution2_node.errors.txt b/tests/baselines/reference/pathMappingBasedModuleResolution2_node.errors.txt index ad954bd142b..4161a67cede 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution2_node.errors.txt +++ b/tests/baselines/reference/pathMappingBasedModuleResolution2_node.errors.txt @@ -1,8 +1,24 @@ -error TS5061: Pattern '*1*' can have at most one '*' character -error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character +tests/cases/compiler/root/tsconfig.json(9,13): error TS5061: Pattern '*1*' can have at most one '*' character +tests/cases/compiler/root/tsconfig.json(9,22): error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character +==== tests/cases/compiler/root/tsconfig.json (2 errors) ==== + + // baseurl is defined in tsconfig.json + // paths has errors + + { + "compilerOptions": { + "baseUrl": "./src", + "paths": { + "*1*": [ "*2*" ] + ~~~~~ !!! error TS5061: Pattern '*1*' can have at most one '*' character + ~~~~~ !!! error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character + } + } + } + ==== tests/cases/compiler/root/src/folder1/file1.ts (0 errors) ==== export var x = 1; \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_failedLookup.errors.txt b/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_failedLookup.errors.txt index 7578f730c33..fcb8564429c 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_failedLookup.errors.txt +++ b/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_failedLookup.errors.txt @@ -1,6 +1,16 @@ /a.ts(2,21): error TS2307: Cannot find module 'foo'. +==== /tsconfig.json (0 errors) ==== + { + "compilerOptions": { + "baseUrl": ".", + "paths": { + "foo": ["foo/foo.ts"] + } + } + } + ==== /a.ts (1 errors) ==== import { foo } from "foo"; diff --git a/tests/baselines/reference/pathsValidation1.errors.txt b/tests/baselines/reference/pathsValidation1.errors.txt index a2d7be5f355..f7330308da1 100644 --- a/tests/baselines/reference/pathsValidation1.errors.txt +++ b/tests/baselines/reference/pathsValidation1.errors.txt @@ -1,6 +1,16 @@ -error TS5063: Substitutions for pattern '*' should be an array. +tests/cases/compiler/tsconfig.json(5,18): error TS5063: Substitutions for pattern '*' should be an array. +==== tests/cases/compiler/tsconfig.json (1 errors) ==== + { + "compilerOptions": { + "baseUrl": ".", + "paths": { + "*": "*" + ~~~ !!! error TS5063: Substitutions for pattern '*' should be an array. + } + } + } ==== tests/cases/compiler/a.ts (0 errors) ==== let x = 1; \ No newline at end of file diff --git a/tests/baselines/reference/pathsValidation2.errors.txt b/tests/baselines/reference/pathsValidation2.errors.txt index 8956b2fc159..c8cf1617a9d 100644 --- a/tests/baselines/reference/pathsValidation2.errors.txt +++ b/tests/baselines/reference/pathsValidation2.errors.txt @@ -1,6 +1,16 @@ -error TS5064: Substitution '1' for pattern '*' has incorrect type, expected 'string', got 'number'. +tests/cases/compiler/tsconfig.json(5,19): error TS5064: Substitution '1' for pattern '*' has incorrect type, expected 'string', got 'number'. +==== tests/cases/compiler/tsconfig.json (1 errors) ==== + { + "compilerOptions": { + "baseUrl": ".", + "paths": { + "*": [1] + ~ !!! error TS5064: Substitution '1' for pattern '*' has incorrect type, expected 'string', got 'number'. + } + } + } ==== tests/cases/compiler/a.ts (0 errors) ==== let x = 1; \ No newline at end of file diff --git a/tests/baselines/reference/pathsValidation3.errors.txt b/tests/baselines/reference/pathsValidation3.errors.txt index 3bb85203e6e..d701206290b 100644 --- a/tests/baselines/reference/pathsValidation3.errors.txt +++ b/tests/baselines/reference/pathsValidation3.errors.txt @@ -1,6 +1,17 @@ -error TS5066: Substitutions for pattern 'foo' shouldn't be an empty array. +tests/cases/compiler/tsconfig.json(5,20): error TS5066: Substitutions for pattern 'foo' shouldn't be an empty array. +==== tests/cases/compiler/tsconfig.json (1 errors) ==== + { + "compilerOptions": { + "baseUrl": ".", + "paths": { + "foo": [] + ~~ !!! error TS5066: Substitutions for pattern 'foo' shouldn't be an empty array. + } + } + } + ==== tests/cases/compiler/a.ts (0 errors) ==== let x = 1; \ No newline at end of file diff --git a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/amd/emitDecoratorMetadataCommonJSISolatedModules.errors.txt b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/amd/emitDecoratorMetadataCommonJSISolatedModules.errors.txt index d6d803104c9..f6ad25fddb1 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/amd/emitDecoratorMetadataCommonJSISolatedModules.errors.txt +++ b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/amd/emitDecoratorMetadataCommonJSISolatedModules.errors.txt @@ -1,6 +1,20 @@ main.ts(1,21): error TS2307: Cannot find module 'angular2/core'. +==== tsconfig.json (0 errors) ==== + { + "compileOnSave": true, + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "isolatedModules": true + }, + "files": [ + "main.ts" + ] + } ==== main.ts (1 errors) ==== import * as ng from "angular2/core"; ~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/node/emitDecoratorMetadataCommonJSISolatedModules.errors.txt b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/node/emitDecoratorMetadataCommonJSISolatedModules.errors.txt index d6d803104c9..f6ad25fddb1 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/node/emitDecoratorMetadataCommonJSISolatedModules.errors.txt +++ b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModules/node/emitDecoratorMetadataCommonJSISolatedModules.errors.txt @@ -1,6 +1,20 @@ main.ts(1,21): error TS2307: Cannot find module 'angular2/core'. +==== tsconfig.json (0 errors) ==== + { + "compileOnSave": true, + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "isolatedModules": true + }, + "files": [ + "main.ts" + ] + } ==== main.ts (1 errors) ==== import * as ng from "angular2/core"; ~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/amd/emitDecoratorMetadataCommonJSISolatedModulesNoResolve.errors.txt b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/amd/emitDecoratorMetadataCommonJSISolatedModulesNoResolve.errors.txt index d6d803104c9..f4fe440f379 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/amd/emitDecoratorMetadataCommonJSISolatedModulesNoResolve.errors.txt +++ b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/amd/emitDecoratorMetadataCommonJSISolatedModulesNoResolve.errors.txt @@ -1,6 +1,21 @@ main.ts(1,21): error TS2307: Cannot find module 'angular2/core'. +==== tsconfig.json (0 errors) ==== + { + "compileOnSave": true, + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "isolatedModules": true, + "noResolve": true + }, + "files": [ + "main.ts" + ] + } ==== main.ts (1 errors) ==== import * as ng from "angular2/core"; ~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/node/emitDecoratorMetadataCommonJSISolatedModulesNoResolve.errors.txt b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/node/emitDecoratorMetadataCommonJSISolatedModulesNoResolve.errors.txt index d6d803104c9..f4fe440f379 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/node/emitDecoratorMetadataCommonJSISolatedModulesNoResolve.errors.txt +++ b/tests/baselines/reference/project/emitDecoratorMetadataCommonJSISolatedModulesNoResolve/node/emitDecoratorMetadataCommonJSISolatedModulesNoResolve.errors.txt @@ -1,6 +1,21 @@ main.ts(1,21): error TS2307: Cannot find module 'angular2/core'. +==== tsconfig.json (0 errors) ==== + { + "compileOnSave": true, + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "isolatedModules": true, + "noResolve": true + }, + "files": [ + "main.ts" + ] + } ==== main.ts (1 errors) ==== import * as ng from "angular2/core"; ~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/amd/emitDecoratorMetadataSystemJS.errors.txt b/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/amd/emitDecoratorMetadataSystemJS.errors.txt index d6d803104c9..bd34d2edc4e 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/amd/emitDecoratorMetadataSystemJS.errors.txt +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/amd/emitDecoratorMetadataSystemJS.errors.txt @@ -1,6 +1,19 @@ main.ts(1,21): error TS2307: Cannot find module 'angular2/core'. +==== tsconfig.json (0 errors) ==== + { + "compileOnSave": true, + "compilerOptions": { + "target": "es5", + "module": "system", + "emitDecoratorMetadata": true, + "experimentalDecorators": true + }, + "files": [ + "main.ts" + ] + } ==== main.ts (1 errors) ==== import * as ng from "angular2/core"; ~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/node/emitDecoratorMetadataSystemJS.errors.txt b/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/node/emitDecoratorMetadataSystemJS.errors.txt index d6d803104c9..bd34d2edc4e 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/node/emitDecoratorMetadataSystemJS.errors.txt +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJS/node/emitDecoratorMetadataSystemJS.errors.txt @@ -1,6 +1,19 @@ main.ts(1,21): error TS2307: Cannot find module 'angular2/core'. +==== tsconfig.json (0 errors) ==== + { + "compileOnSave": true, + "compilerOptions": { + "target": "es5", + "module": "system", + "emitDecoratorMetadata": true, + "experimentalDecorators": true + }, + "files": [ + "main.ts" + ] + } ==== main.ts (1 errors) ==== import * as ng from "angular2/core"; ~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/amd/emitDecoratorMetadataSystemJSISolatedModules.errors.txt b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/amd/emitDecoratorMetadataSystemJSISolatedModules.errors.txt index d6d803104c9..b14b090b839 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/amd/emitDecoratorMetadataSystemJSISolatedModules.errors.txt +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/amd/emitDecoratorMetadataSystemJSISolatedModules.errors.txt @@ -1,6 +1,21 @@ main.ts(1,21): error TS2307: Cannot find module 'angular2/core'. +==== tsconfig.json (0 errors) ==== + { + "compileOnSave": true, + "compilerOptions": { + "target": "es5", + "module": "system", + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "isolatedModules": true + }, + "files": [ + "main.ts" + ] + } ==== main.ts (1 errors) ==== import * as ng from "angular2/core"; ~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/node/emitDecoratorMetadataSystemJSISolatedModules.errors.txt b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/node/emitDecoratorMetadataSystemJSISolatedModules.errors.txt index d6d803104c9..b14b090b839 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/node/emitDecoratorMetadataSystemJSISolatedModules.errors.txt +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModules/node/emitDecoratorMetadataSystemJSISolatedModules.errors.txt @@ -1,6 +1,21 @@ main.ts(1,21): error TS2307: Cannot find module 'angular2/core'. +==== tsconfig.json (0 errors) ==== + { + "compileOnSave": true, + "compilerOptions": { + "target": "es5", + "module": "system", + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "isolatedModules": true + }, + "files": [ + "main.ts" + ] + } ==== main.ts (1 errors) ==== import * as ng from "angular2/core"; ~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/amd/emitDecoratorMetadataSystemJSISolatedModulesNoResolve.errors.txt b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/amd/emitDecoratorMetadataSystemJSISolatedModulesNoResolve.errors.txt index d6d803104c9..99fc00df24a 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/amd/emitDecoratorMetadataSystemJSISolatedModulesNoResolve.errors.txt +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/amd/emitDecoratorMetadataSystemJSISolatedModulesNoResolve.errors.txt @@ -1,6 +1,22 @@ main.ts(1,21): error TS2307: Cannot find module 'angular2/core'. +==== tsconfig.json (0 errors) ==== + { + "compileOnSave": true, + "compilerOptions": { + "target": "es5", + "module": "system", + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "isolatedModules": true, + "noResolve": true + }, + "files": [ + "main.ts" + ] + } ==== main.ts (1 errors) ==== import * as ng from "angular2/core"; ~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/node/emitDecoratorMetadataSystemJSISolatedModulesNoResolve.errors.txt b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/node/emitDecoratorMetadataSystemJSISolatedModulesNoResolve.errors.txt index d6d803104c9..99fc00df24a 100644 --- a/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/node/emitDecoratorMetadataSystemJSISolatedModulesNoResolve.errors.txt +++ b/tests/baselines/reference/project/emitDecoratorMetadataSystemJSISolatedModulesNoResolve/node/emitDecoratorMetadataSystemJSISolatedModulesNoResolve.errors.txt @@ -1,6 +1,22 @@ main.ts(1,21): error TS2307: Cannot find module 'angular2/core'. +==== tsconfig.json (0 errors) ==== + { + "compileOnSave": true, + "compilerOptions": { + "target": "es5", + "module": "system", + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "isolatedModules": true, + "noResolve": true + }, + "files": [ + "main.ts" + ] + } ==== main.ts (1 errors) ==== import * as ng from "angular2/core"; ~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecified/node/jsFileCompilationDifferentNamesNotSpecified.errors.txt b/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecified/node/jsFileCompilationDifferentNamesNotSpecified.errors.txt index e1a24fa3842..29ab30d47ec 100644 --- a/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecified/node/jsFileCompilationDifferentNamesNotSpecified.errors.txt +++ b/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecified/node/jsFileCompilationDifferentNamesNotSpecified.errors.txt @@ -1,6 +1,11 @@ -error TS6082: Only 'amd' and 'system' modules are supported alongside --out. +DifferentNamesNotSpecified/tsconfig.json(2,24): error TS6082: Only 'amd' and 'system' modules are supported alongside --out. +==== DifferentNamesNotSpecified/tsconfig.json (1 errors) ==== + { + "compilerOptions": { "out": "test.js" } + ~~~~~ !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --out. + } ==== DifferentNamesNotSpecified/a.ts (0 errors) ==== var test = 10; \ No newline at end of file diff --git a/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs/amd/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs.errors.txt b/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs/amd/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs.errors.txt index 67b0592c05f..f7028d06550 100644 --- a/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs/amd/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs.errors.txt +++ b/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs/amd/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs.errors.txt @@ -1,7 +1,15 @@ -error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. +DifferentNamesNotSpecifiedWithAllowJs/tsconfig.json(4,5): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. +==== DifferentNamesNotSpecifiedWithAllowJs/tsconfig.json (1 errors) ==== + { + "compilerOptions": { + "out": "test.js", + "allowJs": true + ~~~~~~~~~ !!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. + } + } ==== DifferentNamesNotSpecifiedWithAllowJs/a.ts (0 errors) ==== var test = 10; ==== DifferentNamesNotSpecifiedWithAllowJs/b.js (0 errors) ==== diff --git a/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs/node/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs.errors.txt b/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs/node/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs.errors.txt index dbebea69cce..6a3c9863cc5 100644 --- a/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs/node/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs.errors.txt +++ b/tests/baselines/reference/project/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs/node/jsFileCompilationDifferentNamesNotSpecifiedWithAllowJs.errors.txt @@ -1,9 +1,18 @@ -error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. -error TS6082: Only 'amd' and 'system' modules are supported alongside --out. +DifferentNamesNotSpecifiedWithAllowJs/tsconfig.json(3,5): error TS6082: Only 'amd' and 'system' modules are supported alongside --out. +DifferentNamesNotSpecifiedWithAllowJs/tsconfig.json(4,5): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. -!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. +==== DifferentNamesNotSpecifiedWithAllowJs/tsconfig.json (2 errors) ==== + { + "compilerOptions": { + "out": "test.js", + ~~~~~ !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --out. + "allowJs": true + ~~~~~~~~~ +!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. + } + } ==== DifferentNamesNotSpecifiedWithAllowJs/a.ts (0 errors) ==== var test = 10; ==== DifferentNamesNotSpecifiedWithAllowJs/b.js (0 errors) ==== diff --git a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/amd/jsFileCompilationDifferentNamesSpecified.errors.txt b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/amd/jsFileCompilationDifferentNamesSpecified.errors.txt index 5fa60d18af9..d737f25497c 100644 --- a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/amd/jsFileCompilationDifferentNamesSpecified.errors.txt +++ b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/amd/jsFileCompilationDifferentNamesSpecified.errors.txt @@ -2,5 +2,10 @@ error TS6054: File 'DifferentNamesSpecified/b.js' has unsupported extension. The !!! error TS6054: File 'DifferentNamesSpecified/b.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'. +==== DifferentNamesSpecified/tsconfig.json (0 errors) ==== + { + "compilerOptions": { "out": "test.js" }, + "files": [ "a.ts", "b.js" ] + } ==== DifferentNamesSpecified/a.ts (0 errors) ==== var test = 10; \ No newline at end of file diff --git a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/node/jsFileCompilationDifferentNamesSpecified.errors.txt b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/node/jsFileCompilationDifferentNamesSpecified.errors.txt index c05a142a93c..72b812099dc 100644 --- a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/node/jsFileCompilationDifferentNamesSpecified.errors.txt +++ b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecified/node/jsFileCompilationDifferentNamesSpecified.errors.txt @@ -1,8 +1,14 @@ error TS6054: File 'DifferentNamesSpecified/b.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'. -error TS6082: Only 'amd' and 'system' modules are supported alongside --out. +DifferentNamesSpecified/tsconfig.json(2,24): error TS6082: Only 'amd' and 'system' modules are supported alongside --out. !!! error TS6054: File 'DifferentNamesSpecified/b.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'. +==== DifferentNamesSpecified/tsconfig.json (1 errors) ==== + { + "compilerOptions": { "out": "test.js" }, + ~~~~~ !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --out. + "files": [ "a.ts", "b.js" ] + } ==== DifferentNamesSpecified/a.ts (0 errors) ==== var test = 10; \ No newline at end of file diff --git a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecifiedWithAllowJs/amd/jsFileCompilationDifferentNamesSpecifiedWithAllowJs.errors.txt b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecifiedWithAllowJs/amd/jsFileCompilationDifferentNamesSpecifiedWithAllowJs.errors.txt index 35c913a5835..1c5034be858 100644 --- a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecifiedWithAllowJs/amd/jsFileCompilationDifferentNamesSpecifiedWithAllowJs.errors.txt +++ b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecifiedWithAllowJs/amd/jsFileCompilationDifferentNamesSpecifiedWithAllowJs.errors.txt @@ -1,7 +1,16 @@ -error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. +DifferentNamesSpecifiedWithAllowJs/tsconfig.json(4,5): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. +==== DifferentNamesSpecifiedWithAllowJs/tsconfig.json (1 errors) ==== + { + "compilerOptions": { + "out": "test.js", + "allowJs": true + ~~~~~~~~~ !!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. + }, + "files": [ "a.ts", "b.js" ] + } ==== DifferentNamesSpecifiedWithAllowJs/a.ts (0 errors) ==== var test = 10; ==== DifferentNamesSpecifiedWithAllowJs/b.js (0 errors) ==== diff --git a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecifiedWithAllowJs/node/jsFileCompilationDifferentNamesSpecifiedWithAllowJs.errors.txt b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecifiedWithAllowJs/node/jsFileCompilationDifferentNamesSpecifiedWithAllowJs.errors.txt index c8c2ca976c6..c2849fae3a5 100644 --- a/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecifiedWithAllowJs/node/jsFileCompilationDifferentNamesSpecifiedWithAllowJs.errors.txt +++ b/tests/baselines/reference/project/jsFileCompilationDifferentNamesSpecifiedWithAllowJs/node/jsFileCompilationDifferentNamesSpecifiedWithAllowJs.errors.txt @@ -1,9 +1,19 @@ -error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. -error TS6082: Only 'amd' and 'system' modules are supported alongside --out. +DifferentNamesSpecifiedWithAllowJs/tsconfig.json(3,5): error TS6082: Only 'amd' and 'system' modules are supported alongside --out. +DifferentNamesSpecifiedWithAllowJs/tsconfig.json(4,5): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. -!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. +==== DifferentNamesSpecifiedWithAllowJs/tsconfig.json (2 errors) ==== + { + "compilerOptions": { + "out": "test.js", + ~~~~~ !!! error TS6082: Only 'amd' and 'system' modules are supported alongside --out. + "allowJs": true + ~~~~~~~~~ +!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. + }, + "files": [ "a.ts", "b.js" ] + } ==== DifferentNamesSpecifiedWithAllowJs/a.ts (0 errors) ==== var test = 10; ==== DifferentNamesSpecifiedWithAllowJs/b.js (0 errors) ==== diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDTsSpecifiedWithAllowJs.errors.txt b/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDTsSpecifiedWithAllowJs.errors.txt index cdec4ffb398..1a625b3fe7d 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDTsSpecifiedWithAllowJs.errors.txt +++ b/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDTsSpecifiedWithAllowJs.errors.txt @@ -1,6 +1,12 @@ -error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. +SameNameDTsSpecifiedWithAllowJs/tsconfig.json(2,24): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. +==== SameNameDTsSpecifiedWithAllowJs/tsconfig.json (1 errors) ==== + { + "compilerOptions": { "allowJs": true }, + ~~~~~~~~~ !!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. + "files": [ "a.d.ts" ] + } ==== SameNameDTsSpecifiedWithAllowJs/a.d.ts (0 errors) ==== declare var test: number; \ No newline at end of file diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecifiedWithAllowJs/node/jsFileCompilationSameNameDTsSpecifiedWithAllowJs.errors.txt b/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecifiedWithAllowJs/node/jsFileCompilationSameNameDTsSpecifiedWithAllowJs.errors.txt index cdec4ffb398..1a625b3fe7d 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecifiedWithAllowJs/node/jsFileCompilationSameNameDTsSpecifiedWithAllowJs.errors.txt +++ b/tests/baselines/reference/project/jsFileCompilationSameNameDTsSpecifiedWithAllowJs/node/jsFileCompilationSameNameDTsSpecifiedWithAllowJs.errors.txt @@ -1,6 +1,12 @@ -error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. +SameNameDTsSpecifiedWithAllowJs/tsconfig.json(2,24): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. +==== SameNameDTsSpecifiedWithAllowJs/tsconfig.json (1 errors) ==== + { + "compilerOptions": { "allowJs": true }, + ~~~~~~~~~ !!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. + "files": [ "a.d.ts" ] + } ==== SameNameDTsSpecifiedWithAllowJs/a.d.ts (0 errors) ==== declare var test: number; \ No newline at end of file diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.errors.txt b/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.errors.txt index 668f037a03b..ecbecb0cc91 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.errors.txt +++ b/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.errors.txt @@ -1,11 +1,14 @@ -error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. error TS5055: Cannot write file 'SameNameDTsNotSpecifiedWithAllowJs/a.js' because it would overwrite input file. Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +SameNameDTsNotSpecifiedWithAllowJs/tsconfig.json(1,24): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. -!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. !!! error TS5055: Cannot write file 'SameNameDTsNotSpecifiedWithAllowJs/a.js' because it would overwrite input file. !!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +==== SameNameDTsNotSpecifiedWithAllowJs/tsconfig.json (1 errors) ==== + { "compilerOptions": { "allowJs": true } } + ~~~~~~~~~ +!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. ==== SameNameDTsNotSpecifiedWithAllowJs/a.d.ts (0 errors) ==== declare var a: number; ==== SameNameDTsNotSpecifiedWithAllowJs/a.js (0 errors) ==== diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.errors.txt b/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.errors.txt index 668f037a03b..ecbecb0cc91 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.errors.txt +++ b/tests/baselines/reference/project/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameDtsNotSpecifiedWithAllowJs.errors.txt @@ -1,11 +1,14 @@ -error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. error TS5055: Cannot write file 'SameNameDTsNotSpecifiedWithAllowJs/a.js' because it would overwrite input file. Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +SameNameDTsNotSpecifiedWithAllowJs/tsconfig.json(1,24): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. -!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. !!! error TS5055: Cannot write file 'SameNameDTsNotSpecifiedWithAllowJs/a.js' because it would overwrite input file. !!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig +==== SameNameDTsNotSpecifiedWithAllowJs/tsconfig.json (1 errors) ==== + { "compilerOptions": { "allowJs": true } } + ~~~~~~~~~ +!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. ==== SameNameDTsNotSpecifiedWithAllowJs/a.d.ts (0 errors) ==== declare var a: number; ==== SameNameDTsNotSpecifiedWithAllowJs/a.js (0 errors) ==== diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs.errors.txt b/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs.errors.txt index 9eb81a5f9f1..99e057bb6d0 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs.errors.txt +++ b/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs/amd/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs.errors.txt @@ -1,6 +1,9 @@ -error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. +SameNameFilesNotSpecifiedWithAllowJs/tsconfig.json(1,24): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. +==== SameNameFilesNotSpecifiedWithAllowJs/tsconfig.json (1 errors) ==== + { "compilerOptions": { "allowJs": true } } + ~~~~~~~~~ !!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. ==== SameNameFilesNotSpecifiedWithAllowJs/a.ts (0 errors) ==== var test = 10; \ No newline at end of file diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs.errors.txt b/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs.errors.txt index 9eb81a5f9f1..99e057bb6d0 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs.errors.txt +++ b/tests/baselines/reference/project/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs/node/jsFileCompilationSameNameFilesNotSpecifiedWithAllowJs.errors.txt @@ -1,6 +1,9 @@ -error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. +SameNameFilesNotSpecifiedWithAllowJs/tsconfig.json(1,24): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. +==== SameNameFilesNotSpecifiedWithAllowJs/tsconfig.json (1 errors) ==== + { "compilerOptions": { "allowJs": true } } + ~~~~~~~~~ !!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. ==== SameNameFilesNotSpecifiedWithAllowJs/a.ts (0 errors) ==== var test = 10; \ No newline at end of file diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecifiedWithAllowJs/amd/jsFileCompilationSameNameFilesSpecifiedWithAllowJs.errors.txt b/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecifiedWithAllowJs/amd/jsFileCompilationSameNameFilesSpecifiedWithAllowJs.errors.txt index ddfb63686b4..f956b678084 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecifiedWithAllowJs/amd/jsFileCompilationSameNameFilesSpecifiedWithAllowJs.errors.txt +++ b/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecifiedWithAllowJs/amd/jsFileCompilationSameNameFilesSpecifiedWithAllowJs.errors.txt @@ -1,6 +1,12 @@ -error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. +SameNameTsSpecifiedWithAllowJs/tsconfig.json(2,24): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. +==== SameNameTsSpecifiedWithAllowJs/tsconfig.json (1 errors) ==== + { + "compilerOptions": { "allowJs": true }, + ~~~~~~~~~ !!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. + "files": [ "a.ts" ] + } ==== SameNameTsSpecifiedWithAllowJs/a.ts (0 errors) ==== var test = 10; \ No newline at end of file diff --git a/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecifiedWithAllowJs/node/jsFileCompilationSameNameFilesSpecifiedWithAllowJs.errors.txt b/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecifiedWithAllowJs/node/jsFileCompilationSameNameFilesSpecifiedWithAllowJs.errors.txt index ddfb63686b4..f956b678084 100644 --- a/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecifiedWithAllowJs/node/jsFileCompilationSameNameFilesSpecifiedWithAllowJs.errors.txt +++ b/tests/baselines/reference/project/jsFileCompilationSameNameFilesSpecifiedWithAllowJs/node/jsFileCompilationSameNameFilesSpecifiedWithAllowJs.errors.txt @@ -1,6 +1,12 @@ -error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. +SameNameTsSpecifiedWithAllowJs/tsconfig.json(2,24): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. +==== SameNameTsSpecifiedWithAllowJs/tsconfig.json (1 errors) ==== + { + "compilerOptions": { "allowJs": true }, + ~~~~~~~~~ !!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. + "files": [ "a.ts" ] + } ==== SameNameTsSpecifiedWithAllowJs/a.ts (0 errors) ==== var test = 10; \ No newline at end of file diff --git a/tests/baselines/reference/project/nodeModulesImportHigher/amd/nodeModulesImportHigher.errors.txt b/tests/baselines/reference/project/nodeModulesImportHigher/amd/nodeModulesImportHigher.errors.txt index 8b4e11eb606..6c8b7319c9f 100644 --- a/tests/baselines/reference/project/nodeModulesImportHigher/amd/nodeModulesImportHigher.errors.txt +++ b/tests/baselines/reference/project/nodeModulesImportHigher/amd/nodeModulesImportHigher.errors.txt @@ -1,6 +1,16 @@ importHigher/root.ts(6,1): error TS2322: Type '"10"' is not assignable to type 'number'. +==== importHigher/tsconfig.json (0 errors) ==== + { + "compilerOptions": { + "allowJs": true, + "declaration": false, + "moduleResolution": "node", + "maxNodeModuleJsDepth": 2 + } + } + ==== entry.js (0 errors) ==== var m3 = require("m3"); diff --git a/tests/baselines/reference/project/nodeModulesImportHigher/node/nodeModulesImportHigher.errors.txt b/tests/baselines/reference/project/nodeModulesImportHigher/node/nodeModulesImportHigher.errors.txt index 8b4e11eb606..6c8b7319c9f 100644 --- a/tests/baselines/reference/project/nodeModulesImportHigher/node/nodeModulesImportHigher.errors.txt +++ b/tests/baselines/reference/project/nodeModulesImportHigher/node/nodeModulesImportHigher.errors.txt @@ -1,6 +1,16 @@ importHigher/root.ts(6,1): error TS2322: Type '"10"' is not assignable to type 'number'. +==== importHigher/tsconfig.json (0 errors) ==== + { + "compilerOptions": { + "allowJs": true, + "declaration": false, + "moduleResolution": "node", + "maxNodeModuleJsDepth": 2 + } + } + ==== entry.js (0 errors) ==== var m3 = require("m3"); diff --git a/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/nodeModulesMaxDepthExceeded.errors.txt b/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/nodeModulesMaxDepthExceeded.errors.txt index 99e7b193f0c..bd62cce9843 100644 --- a/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/nodeModulesMaxDepthExceeded.errors.txt +++ b/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/amd/nodeModulesMaxDepthExceeded.errors.txt @@ -2,6 +2,17 @@ maxDepthExceeded/root.ts(3,1): error TS2322: Type '"10"' is not assignable to ty maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it is a constant or a read-only property. +==== maxDepthExceeded/tsconfig.json (0 errors) ==== + { + "compilerOptions": { + "allowJs": true, + "maxNodeModuleJsDepth": 1, // Note: Module m1 is already included as a root file + "outDir": "built" + }, + "include": ["**/*"], + "exclude": ["node_modules/m2/**/*"] + } + ==== entry.js (0 errors) ==== var m3 = require("m3"); diff --git a/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/nodeModulesMaxDepthExceeded.errors.txt b/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/nodeModulesMaxDepthExceeded.errors.txt index 99e7b193f0c..bd62cce9843 100644 --- a/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/nodeModulesMaxDepthExceeded.errors.txt +++ b/tests/baselines/reference/project/nodeModulesMaxDepthExceeded/node/nodeModulesMaxDepthExceeded.errors.txt @@ -2,6 +2,17 @@ maxDepthExceeded/root.ts(3,1): error TS2322: Type '"10"' is not assignable to ty maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it is a constant or a read-only property. +==== maxDepthExceeded/tsconfig.json (0 errors) ==== + { + "compilerOptions": { + "allowJs": true, + "maxNodeModuleJsDepth": 1, // Note: Module m1 is already included as a root file + "outDir": "built" + }, + "include": ["**/*"], + "exclude": ["node_modules/m2/**/*"] + } + ==== entry.js (0 errors) ==== var m3 = require("m3"); diff --git a/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/amd/nodeModulesMaxDepthIncreased.errors.txt b/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/amd/nodeModulesMaxDepthIncreased.errors.txt index 684821d60a2..a0edfa3a510 100644 --- a/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/amd/nodeModulesMaxDepthIncreased.errors.txt +++ b/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/amd/nodeModulesMaxDepthIncreased.errors.txt @@ -1,6 +1,14 @@ maxDepthIncreased/root.ts(7,1): error TS2322: Type '"10"' is not assignable to type 'number'. +==== maxDepthIncreased/tsconfig.json (0 errors) ==== + { + "compilerOptions": { + "allowJs": true, + "maxNodeModuleJsDepth": 3 + } + } + ==== index.js (0 errors) ==== exports.person = { "name": "John Doe", diff --git a/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/node/nodeModulesMaxDepthIncreased.errors.txt b/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/node/nodeModulesMaxDepthIncreased.errors.txt index 684821d60a2..a0edfa3a510 100644 --- a/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/node/nodeModulesMaxDepthIncreased.errors.txt +++ b/tests/baselines/reference/project/nodeModulesMaxDepthIncreased/node/nodeModulesMaxDepthIncreased.errors.txt @@ -1,6 +1,14 @@ maxDepthIncreased/root.ts(7,1): error TS2322: Type '"10"' is not assignable to type 'number'. +==== maxDepthIncreased/tsconfig.json (0 errors) ==== + { + "compilerOptions": { + "allowJs": true, + "maxNodeModuleJsDepth": 3 + } + } + ==== index.js (0 errors) ==== exports.person = { "name": "John Doe",