From d6b9d4ac18ba3076b15e889863b0ed27ebc662bb Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 10 Dec 2019 15:23:33 -0800 Subject: [PATCH 1/4] Baselining tsc --watch output --- src/compiler/builder.ts | 8 +- src/compiler/builderPublic.ts | 2 + src/compiler/tsbuildPublic.ts | 40 +- src/executeCommandLine/executeCommandLine.ts | 161 +- src/harness/fakesHosts.ts | 33 +- src/harness/sourceMapRecorder.ts | 6 +- src/harness/virtualFileSystemWithWatch.ts | 172 +- src/testRunner/unittests/tsbuild/helpers.ts | 69 +- src/testRunner/unittests/tsbuild/watchMode.ts | 944 +++---- src/testRunner/unittests/tsc/helpers.ts | 49 +- .../unittests/tscWatch/consoleClearing.ts | 110 +- src/testRunner/unittests/tscWatch/emit.ts | 1095 ++++---- .../unittests/tscWatch/emitAndErrorUpdates.ts | 329 +-- .../forceConsistentCasingInFileNames.ts | 92 +- src/testRunner/unittests/tscWatch/helpers.ts | 137 + .../unittests/tscWatch/incremental.ts | 766 +----- .../unittests/tscWatch/programUpdates.ts | 2262 ++++++++--------- .../unittests/tscWatch/resolutionCache.ts | 476 ++-- .../unittests/tscWatch/watchEnvironment.ts | 676 ++--- src/tsc/tsc.ts | 11 +- .../demo/updates-with-bad-reference.js | 331 +++ .../demo/updates-with-circular-reference.js | 586 +++++ .../does-not-emit-any-files-on-error.js | 164 ++ .../creates-solution-in-watch-mode.js | 398 +++ .../incremental-updates-in-verbose-mode.js | 787 ++++++ .../when-file-with-no-error-changes.js | 220 ++ ...ing-errors-only-changed-file-is-emitted.js | 226 ++ .../when-file-with-no-error-changes.js | 108 + ...ixing-error-files-all-files-are-emitted.js | 177 ++ .../when-preserveWatchOutput-is-not-used.js | 518 ++++ ...veWatchOutput-is-passed-on-command-line.js | 521 ++++ ...tches-config-files-that-are-not-present.js | 446 ++++ ...e-down-stream-project-and-then-fixes-it.js | 372 +++ ...ncing-project-even-for-non-local-change.js | 670 +++++ ...le-is-added,-and-its-subsequent-updates.js | 775 ++++++ ...hanges-and-reports-found-errors-message.js | 1324 ++++++++++ ...not-start-build-of-referencing-projects.js | 536 ++++ ...le-is-added,-and-its-subsequent-updates.js | 823 ++++++ ...hanges-and-reports-found-errors-message.js | 1376 ++++++++++ ...not-start-build-of-referencing-projects.js | 574 +++++ .../with-noEmitOnError.js | 6 +- .../createWatchOfConfigFile.js | 102 + ...Result-on-WatchCompilerHostOfConfigFile.js | 102 + .../consoleClearing/with---diagnostics.js | 115 + .../with---extendedDiagnostics.js | 119 + .../with---preserveWatchOutput.js | 91 + ...---diagnostics-or---extendedDiagnostics.js | 91 + ...ms-correctly-in-incremental-compilation.js | 127 + ...s-deleted-and-created-as-part-of-change.js | 110 + ...ndles-new-lines-carriageReturn-lineFeed.js | 99 + .../handles-new-lines-lineFeed.js | 99 + .../should-emit-specified-file.js | 151 ++ ...elf-if-'--isolatedModules'-is-specified.js | 175 ++ ...-if-'--out'-or-'--outFile'-is-specified.js | 229 ++ ...should-be-up-to-date-with-deleted-files.js | 169 ++ ...-be-up-to-date-with-newly-created-files.js | 187 ++ ...-to-date-with-the-reference-map-changes.js | 433 ++++ ...les-referencing-it-if-its-shape-changed.js | 237 ++ ...should-detect-changes-in-non-root-files.js | 183 ++ .../should-detect-non-existing-code-file.js | 187 ++ .../should-detect-removed-code-file.js | 129 + ...ll-files-if-a-global-file-changed-shape.js | 181 ++ ...ould-return-cascaded-affected-file-list.js | 315 +++ ...fine-for-files-with-circular-references.js | 136 + .../config-does-not-have-out-or-outFile.js | 121 + .../config-has-out.js | 115 + .../config-has-outFile.js | 115 + ...ltiple-declaration-files-in-the-program.js | 89 + ...ltiple-declaration-files-in-the-program.js | 97 + ...-recursive-directory-watcher-is-invoked.js | 124 + ...es-errors-when-deep-import-file-changes.js | 206 ++ ...import-through-declaration-file-changes.js | 153 ++ ...g-a-deep-multilevel-import-that-changes.js | 257 ++ ...n-there-are-circular-import-and-exports.js | 310 +++ ...here-are-no-circular-import-and-exports.js | 275 ++ .../with-noEmitOnError.js | 165 ++ ...es-errors-when-deep-import-file-changes.js | 181 ++ ...import-through-declaration-file-changes.js | 148 ++ ...g-a-deep-multilevel-import-that-changes.js | 213 ++ ...n-there-are-circular-import-and-exports.js | 258 ++ ...here-are-no-circular-import-and-exports.js | 233 ++ .../with-noEmitOnError.js | 151 ++ ...es-errors-when-deep-import-file-changes.js | 207 ++ ...import-through-declaration-file-changes.js | 153 ++ ...g-a-deep-multilevel-import-that-changes.js | 258 ++ ...n-there-are-circular-import-and-exports.js | 303 +++ ...here-are-no-circular-import-and-exports.js | 268 ++ .../with-noEmitOnError.js | 165 ++ ...es-errors-when-deep-import-file-changes.js | 182 ++ ...import-through-declaration-file-changes.js | 148 ++ ...g-a-deep-multilevel-import-that-changes.js | 214 ++ ...n-there-are-circular-import-and-exports.js | 251 ++ ...here-are-no-circular-import-and-exports.js | 226 ++ .../with-default-config/with-noEmitOnError.js | 157 ++ ...nging-module-name-with-different-casing.js | 136 + ...hen-renaming-file-with-different-casing.js | 126 + ...al-with-circular-references-incremental.js | 296 +++ ...remental-with-circular-references-watch.js | 344 +++ .../own-file-emit-with-errors-incremental.js | 189 ++ .../own-file-emit-with-errors-watch.js | 229 ++ ...wn-file-emit-without-errors-incremental.js | 161 ++ .../own-file-emit-without-errors-watch.js | 201 ++ .../with---out-incremental.js | 94 + .../module-compilation/with---out-watch.js | 113 + .../own-file-emit-with-errors-incremental.js | 178 ++ .../own-file-emit-with-errors-watch.js | 218 ++ ...eters-that-are-not-relative-incremental.js | 152 ++ ...-parameters-that-are-not-relative-watch.js | 192 ++ ...without-commandline-options-incremental.js | 150 ++ .../without-commandline-options-watch.js | 190 ++ .../incremental/with---out-incremental.js | 78 + .../tscWatch/incremental/with---out-watch.js | 97 + ...nerated-when-the-config-file-has-errors.js | 70 + ...configFile-contents-when-options-change.js | 126 + ...rs-document-is-not-contained-in-project.js | 62 + ...rts-errors-when-the-config-file-changes.js | 152 ++ ...nostics-when-'--noUnusedLabels'-changes.js | 143 ++ ...-a-configured-program-without-file-list.js | 113 + ...hould-remove-the-module-not-found-error.js | 107 + ...has-changed-(new-file-in-list-of-files).js | 112 + ...ot-files-has-changed-(new-file-on-disk).js | 113 + ...config-file-name-with-difference-casing.js | 59 + ...-when-set-of-root-files-was-not-changed.js | 117 + ...iles-are-reflected-in-project-structure.js | 133 + .../config-file-includes-the-file.js | 86 + .../programUpdates/config-file-is-deleted.js | 104 + ...s-changes-in-lib-section-of-config-file.js | 115 + ...te-configured-project-without-file-list.js | 81 + .../create-watch-without-config-file.js | 71 + ...eleted-files-affect-project-structure-2.js | 128 + .../deleted-files-affect-project-structure.js | 125 + ...iles-explicitly-excluded-in-config-file.js | 78 + .../handle-recreated-files-correctly.js | 160 ++ ...se-they-were-added-with-tripleSlashRefs.js | 106 + ...esnt-have-errors,-they-are-not-reported.js | 63 + ...ndle-@types-if-input-file-list-is-empty.js | 55 + ...e-tolerated-without-crashing-the-server.js | 58 + ...tore-the-states-for-configured-projects.js | 198 ++ ...estore-the-states-for-inferred-projects.js | 163 ++ ...rors-correctly-with-file-not-in-rootDir.js | 127 + ...s-errors-correctly-with-isolatedModules.js | 132 + ...non-existing-directories-in-config-file.js | 63 + ...ting-files-specified-in-the-config-file.js | 70 + .../declarationDir-is-specified.js | 157 ++ ...-outDir-and-declarationDir-is-specified.js | 157 ++ .../when-outDir-is-specified.js | 148 ++ .../with-outFile.js | 142 ++ .../without-outDir-or-outFile-is-specified.js | 148 ++ ...odule-resolution-changes-in-config-file.js | 134 + .../should-reflect-change-in-config-file.js | 115 + ...errors-and-still-try-to-build-a-project.js | 80 + ...when-file-changes-from-global-to-module.js | 115 + ...-from-config-file-path-if-config-exists.js | 68 + ...on-emit-is-disabled-in-compiler-options.js | 270 ++ .../with-default-options.js | 162 ++ .../with-skipDefaultLibCheck.js | 156 ++ .../with-skipLibCheck.js | 156 ++ .../with-default-options.js | 159 ++ .../with-skipDefaultLibCheck.js | 153 ++ .../with-skipLibCheck.js | 153 ++ ...when-ambient-modules-of-program-changes.js | 161 ++ ...es-errors-when-strictNullChecks-changes.js | 195 ++ ...and-new-file-is-added-as-part-of-change.js | 109 + ...ibCheck-and-skipDefaultLibCheck-changes.js | 378 +++ ...-file-is-changed-but-its-content-havent.js | 113 + .../watch-with-configFile.js | 101 + .../watch-without-configFile.js | 89 + ...are-global-and-installed-at-later-point.js | 115 + .../with-modules-linked-to-sibling-folder.js | 86 + ...cluded-file-with-ambient-module-changes.js | 132 + ...le-resolution-changes-to-ambient-module.js | 114 + ...der-that-already-contains-@types-folder.js | 108 + ...rogram-with-files-from-external-library.js | 157 ++ ...polling-when-renaming-file-in-subfolder.js | 98 + ...rectory-when-renaming-file-in-subfolder.js | 110 + ...tchFile-when-renaming-file-in-subfolder.js | 110 + ...ymlinks-to-folders-in-recursive-folders.js | 148 ++ .../with-non-synchronous-watch-directory.js | 376 +++ .../using-dynamic-priority-polling.js | 124 + .../with-fallbackPolling-option.js | 72 + .../with-watchDirectory-option.js | 72 + ...th-watchFile-as-watch-options-to-extend.js | 72 + .../watchOptions/with-watchFile-option.js | 72 + tests/projects/noEmitOnError/src/other.ts | 3 +- 184 files changed, 35706 insertions(+), 4202 deletions(-) create mode 100644 tests/baselines/reference/tsbuild/watchMode/demo/updates-with-bad-reference.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/demo/updates-with-circular-reference.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/noEmitOnError/does-not-emit-any-files-on-error.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/programUpdates/creates-solution-in-watch-mode.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/programUpdates/incremental-updates-in-verbose-mode.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/declarationEmitErrors/introduceError/when-file-with-no-error-changes.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/declarationEmitErrors/introduceError/when-fixing-errors-only-changed-file-is-emitted.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/declarationEmitErrors/when-file-with-no-error-changes.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/declarationEmitErrors/when-fixing-error-files-all-files-are-emitted.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-not-used.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-passed-on-command-line.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/programUpdates/watches-config-files-that-are-not-present.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/programUpdates/when-referenced-project-change-introduces-error-in-the-down-stream-project-and-then-fixes-it.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/programUpdates/when-referenced-using-prepend-builds-referencing-project-even-for-non-local-change.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/programUpdates/with-circular-project-reference/builds-when-new-file-is-added,-and-its-subsequent-updates.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/programUpdates/with-circular-project-reference/change-builds-changes-and-reports-found-errors-message.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/programUpdates/with-circular-project-reference/non-local-change-does-not-start-build-of-referencing-projects.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/programUpdates/with-simple-project-reference-graph/builds-when-new-file-is-added,-and-its-subsequent-updates.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/programUpdates/with-simple-project-reference-graph/change-builds-changes-and-reports-found-errors-message.js create mode 100644 tests/baselines/reference/tsbuild/watchMode/programUpdates/with-simple-project-reference-graph/non-local-change-does-not-start-build-of-referencing-projects.js create mode 100644 tests/baselines/reference/tscWatch/consoleClearing/when-preserveWatchOutput-is-true-in-config-file/createWatchOfConfigFile.js create mode 100644 tests/baselines/reference/tscWatch/consoleClearing/when-preserveWatchOutput-is-true-in-config-file/when-createWatchProgram-is-invoked-with-configFileParseResult-on-WatchCompilerHostOfConfigFile.js create mode 100644 tests/baselines/reference/tscWatch/consoleClearing/with---diagnostics.js create mode 100644 tests/baselines/reference/tscWatch/consoleClearing/with---extendedDiagnostics.js create mode 100644 tests/baselines/reference/tscWatch/consoleClearing/with---preserveWatchOutput.js create mode 100644 tests/baselines/reference/tscWatch/consoleClearing/without---diagnostics-or---extendedDiagnostics.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-file-content/elides-const-enums-correctly-in-incremental-compilation.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-file-content/file-is-deleted-and-created-as-part-of-change.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-file-content/handles-new-lines-carriageReturn-lineFeed.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-file-content/handles-new-lines-lineFeed.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-file-content/should-emit-specified-file.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-always-return-the-file-itself-if-'--isolatedModules'-is-specified.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-always-return-the-file-itself-if-'--out'-or-'--outFile'-is-specified.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-deleted-files.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-newly-created-files.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-the-reference-map-changes.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-contains-only-itself-if-a-module-file's-shape-didn't-change,-and-all-files-referencing-it-if-its-shape-changed.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-detect-changes-in-non-root-files.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-detect-non-existing-code-file.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-detect-removed-code-file.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-return-all-files-if-a-global-file-changed-shape.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-return-cascaded-affected-file-list.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-work-fine-for-files-with-circular-references.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/config-does-not-have-out-or-outFile.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/config-has-out.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/config-has-outFile.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/with---outFile-and-multiple-declaration-files-in-the-program.js create mode 100644 tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/without---outFile-and-multiple-declaration-files-in-the-program.js create mode 100644 tests/baselines/reference/tscWatch/emit/when-module-emit-is-specified-as-node/when-instead-of-filechanged-recursive-directory-watcher-is-invoked.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/with-noEmitOnError.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/deep-import-changes/updates-errors-when-deep-import-file-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/with-noEmitOnError.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/with-noEmitOnError.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/deep-import-changes/updates-errors-when-deep-import-file-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/with-noEmitOnError.js create mode 100644 tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-changing-module-name-with-different-casing.js create mode 100644 tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-renaming-file-with-different-casing.js create mode 100644 tests/baselines/reference/tscWatch/incremental/incremental-with-circular-references-incremental.js create mode 100644 tests/baselines/reference/tscWatch/incremental/incremental-with-circular-references-watch.js create mode 100644 tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-with-errors-incremental.js create mode 100644 tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-with-errors-watch.js create mode 100644 tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-without-errors-incremental.js create mode 100644 tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-without-errors-watch.js create mode 100644 tests/baselines/reference/tscWatch/incremental/module-compilation/with---out-incremental.js create mode 100644 tests/baselines/reference/tscWatch/incremental/module-compilation/with---out-watch.js create mode 100644 tests/baselines/reference/tscWatch/incremental/own-file-emit-with-errors-incremental.js create mode 100644 tests/baselines/reference/tscWatch/incremental/own-file-emit-with-errors-watch.js create mode 100644 tests/baselines/reference/tscWatch/incremental/own-file-emit-without-errors/with-commandline-parameters-that-are-not-relative-incremental.js create mode 100644 tests/baselines/reference/tscWatch/incremental/own-file-emit-without-errors/with-commandline-parameters-that-are-not-relative-watch.js create mode 100644 tests/baselines/reference/tscWatch/incremental/own-file-emit-without-errors/without-commandline-options-incremental.js create mode 100644 tests/baselines/reference/tscWatch/incremental/own-file-emit-without-errors/without-commandline-options-watch.js create mode 100644 tests/baselines/reference/tscWatch/incremental/with---out-incremental.js create mode 100644 tests/baselines/reference/tscWatch/incremental/with---out-watch.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/Configure-file-diagnostics-events-are-generated-when-the-config-file-has-errors.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/Options-Diagnostic-locations-reported-correctly-with-changes-in-configFile-contents-when-options-change.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/Proper-errors-document-is-not-contained-in-project.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/Reports-errors-when-the-config-file-changes.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/Updates-diagnostics-when-'--noUnusedLabels'-changes.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/add-new-files-to-a-configured-program-without-file-list.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/add-the-missing-module-file-for-inferred-project-should-remove-the-module-not-found-error.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/can-correctly-update-configured-project-when-set-of-root-files-has-changed-(new-file-in-list-of-files).js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/can-correctly-update-configured-project-when-set-of-root-files-has-changed-(new-file-on-disk).js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/can-handle-tsconfig-file-name-with-difference-casing.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/can-update-configured-project-when-set-of-root-files-was-not-changed.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/changes-in-files-are-reflected-in-project-structure.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/config-file-includes-the-file.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/config-file-is-deleted.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/correctly-handles-changes-in-lib-section-of-config-file.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/create-configured-project-without-file-list.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/create-watch-without-config-file.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/deleted-files-affect-project-structure-2.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/deleted-files-affect-project-structure.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/files-explicitly-excluded-in-config-file.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/handle-recreated-files-correctly.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/handles-the-missing-files---that-were-added-to-program-because-they-were-added-with-tripleSlashRefs.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/if-config-file-doesnt-have-errors,-they-are-not-reported.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/non-existing-directories-listed-in-config-file-input-array-should-be-able-to-handle-@types-if-input-file-list-is-empty.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/non-existing-directories-listed-in-config-file-input-array-should-be-tolerated-without-crashing-the-server.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/rename-a-module-file-and-rename-back-should-restore-the-states-for-configured-projects.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/rename-a-module-file-and-rename-back-should-restore-the-states-for-inferred-projects.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/reports-errors-correctly-with-file-not-in-rootDir.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/reports-errors-correctly-with-isolatedModules.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/should-handle-non-existing-directories-in-config-file.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/should-ignore-non-existing-files-specified-in-the-config-file.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/should-properly-handle-module-resolution-changes-in-config-file.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/should-reflect-change-in-config-file.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/should-tolerate-config-file-errors-and-still-try-to-build-a-project.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/shouldnt-report-error-about-unused-function-incorrectly-when-file-changes-from-global-to-module.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/types-should-load-from-config-file-path-if-config-exists.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/updates-errors-correctly-when-declaration-emit-is-disabled-in-compiler-options.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-module-file-with-global-definitions-changes/with-default-options.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-module-file-with-global-definitions-changes/with-skipDefaultLibCheck.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-module-file-with-global-definitions-changes/with-skipLibCheck.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-non-module-file-changes/with-default-options.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-non-module-file-changes/with-skipDefaultLibCheck.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-non-module-file-changes/with-skipLibCheck.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/updates-errors-when-ambient-modules-of-program-changes.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/updates-errors-when-strictNullChecks-changes.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/watched-files-when-file-is-deleted-and-new-file-is-added-as-part-of-change.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/when-skipLibCheck-and-skipDefaultLibCheck-changes.js create mode 100644 tests/baselines/reference/tscWatch/programUpdates/works-correctly-when-config-file-is-changed-but-its-content-havent.js create mode 100644 tests/baselines/reference/tscWatch/resolutionCache/ignores-changes-in-node_modules-that-start-with-dot/watch-with-configFile.js create mode 100644 tests/baselines/reference/tscWatch/resolutionCache/ignores-changes-in-node_modules-that-start-with-dot/watch-without-configFile.js create mode 100644 tests/baselines/reference/tscWatch/resolutionCache/when-types-in-compiler-option-are-global-and-installed-at-later-point.js create mode 100644 tests/baselines/reference/tscWatch/resolutionCache/with-modules-linked-to-sibling-folder.js create mode 100644 tests/baselines/reference/tscWatch/resolutionCache/works-when-included-file-with-ambient-module-changes.js create mode 100644 tests/baselines/reference/tscWatch/resolutionCache/works-when-module-resolution-changes-to-ambient-module.js create mode 100644 tests/baselines/reference/tscWatch/resolutionCache/works-when-renaming-node_modules-folder-that-already-contains-@types-folder.js create mode 100644 tests/baselines/reference/tscWatch/resolutionCache/works-when-reusing-program-with-files-from-external-library.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/uses-non-recursive-dynamic-polling-when-renaming-file-in-subfolder.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/uses-non-recursive-watchDirectory-when-renaming-file-in-subfolder.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/uses-watchFile-when-renaming-file-in-subfolder.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/when-there-are-symlinks-to-folders-in-recursive-folders.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/with-non-synchronous-watch-directory.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFile/using-dynamic-priority-polling.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchOptions/with-fallbackPolling-option.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchOptions/with-watchDirectory-option.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchOptions/with-watchFile-as-watch-options-to-extend.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchOptions/with-watchFile-option.js diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index a5750544d3af2..ce4a4e6645384 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -947,11 +947,7 @@ namespace ts { } else { const program = Debug.assertDefined(state.program); - // Check if program uses any prepend project references, if thats the case we cant track of the js files of those, so emit even though there are no changes - if (state.programEmitComplete || !some(program.getProjectReferences(), ref => !!ref.prepend)) { - state.programEmitComplete = true; - return undefined; - } + if (state.programEmitComplete) return undefined; affected = program; } } @@ -1159,6 +1155,7 @@ namespace ts { getCurrentDirectory: notImplemented, emitNextAffectedFile: notImplemented, getSemanticDiagnosticsOfNextAffectedFile: notImplemented, + close: noop, }; function toPath(path: string) { @@ -1190,6 +1187,7 @@ namespace ts { emit: (sourceFile, writeFile, cancellationToken, emitOnlyDts, customTransformers) => getProgram().emit(sourceFile, writeFile, cancellationToken, emitOnlyDts, customTransformers), getAllDependencies: notImplemented, getCurrentDirectory: () => getProgram().getCurrentDirectory(), + close: noop, }; function getProgram() { diff --git a/src/compiler/builderPublic.ts b/src/compiler/builderPublic.ts index 72e02941731a4..bff123b915cb5 100644 --- a/src/compiler/builderPublic.ts +++ b/src/compiler/builderPublic.ts @@ -103,6 +103,8 @@ namespace ts { * Get the current directory of the program */ getCurrentDirectory(): string; + /*@internal*/ + close(): void; } /** diff --git a/src/compiler/tsbuildPublic.ts b/src/compiler/tsbuildPublic.ts index cbc4d168977ff..c2760a1265615 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -110,6 +110,7 @@ namespace ts { // TODO: To do better with watch mode and normal build mode api that creates program and emits files // This currently helps enable --diagnostics and --extendedDiagnostics afterProgramEmitAndDiagnostics?(program: T): void; + /*@internal*/ afterEmitBundle?(config: ParsedCommandLine): void; // For testing /*@internal*/ now?(): Date; @@ -157,6 +158,7 @@ namespace ts { /*@internal*/ invalidateProject(configFilePath: ResolvedConfigFilePath, reloadLevel?: ConfigFileProgramReloadLevel): void; /*@internal*/ buildNextInvalidatedProject(): void; /*@internal*/ getAllParsedConfigs(): readonly ParsedCommandLine[]; + /*@internal*/ close(): void; } /** @@ -177,6 +179,7 @@ namespace ts { host.deleteFile = system.deleteFile ? path => system.deleteFile!(path) : noop; host.reportDiagnostic = reportDiagnostic || createDiagnosticReporter(system); host.reportSolutionBuilderStatus = reportSolutionBuilderStatus || createBuilderStatusReporter(system); + host.now = maybeBind(system, system.now); // For testing return host; } @@ -854,6 +857,7 @@ namespace ts { state, projectPath, program, + config, diagnostics, errorFlags, errorType @@ -912,6 +916,7 @@ namespace ts { state, projectPath, program, + config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file" @@ -975,6 +980,7 @@ namespace ts { state, projectPath, program, + config, emitDiagnostics, BuildResultFlags.EmitErrors, "Emit" @@ -998,7 +1004,7 @@ namespace ts { newestDeclarationFileContentChangedTime, oldestOutputFileName }); - if (program) afterProgramCreate(state, projectPath, program); + afterProgramDone(state, projectPath, program, config); state.projectCompilerOptions = state.baseCompilerOptions; step = Step.QueueReferencingProjects; buildResult = resultFlags; @@ -1239,13 +1245,23 @@ namespace ts { return readBuilderProgram(parsed.options, compilerHost) as any as T; } - function afterProgramCreate({ host, watch, builderPrograms }: SolutionBuilderState, proj: ResolvedConfigFilePath, program: T) { - if (host.afterProgramEmitAndDiagnostics) { - host.afterProgramEmitAndDiagnostics(program); + function afterProgramDone( + { host, watch, builderPrograms }: SolutionBuilderState, + proj: ResolvedConfigFilePath, + program: T | undefined, + config: ParsedCommandLine + ) { + if (program) { + if (host.afterProgramEmitAndDiagnostics) { + host.afterProgramEmitAndDiagnostics(program); + } + if (watch) { + program.releaseProgram(); + builderPrograms.set(proj, program); + } } - if (watch) { - program.releaseProgram(); - builderPrograms.set(proj, program); + else if (host.afterEmitBundle) { + host.afterEmitBundle(config); } } @@ -1253,6 +1269,7 @@ namespace ts { state: SolutionBuilderState, resolvedPath: ResolvedConfigFilePath, program: T | undefined, + config: ParsedCommandLine, diagnostics: readonly Diagnostic[], errorFlags: BuildResultFlags, errorType: string @@ -1261,7 +1278,7 @@ namespace ts { // List files if any other build error using program (emit errors already report files) if (program && state.writeFileName) listFiles(program, state.writeFileName); state.projectStatus.set(resolvedPath, { type: UpToDateStatusType.Unbuildable, reason: `${errorType} errors` }); - if (program) afterProgramCreate(state, resolvedPath, program); + afterProgramDone(state, resolvedPath, program, config); state.projectCompilerOptions = state.baseCompilerOptions; return errorFlags; } @@ -1869,6 +1886,12 @@ namespace ts { } } + function stopWatching(state: SolutionBuilderState) { + clearMap(state.allWatchedConfigFiles, closeFileWatcher); + clearMap(state.allWatchedWildcardDirectories, watchedWildcardDirectories => clearMap(watchedWildcardDirectories, closeFileWatcherOf)); + clearMap(state.allWatchedInputFiles, watchedWildcardDirectories => clearMap(watchedWildcardDirectories, closeFileWatcher)); + } + /** * A SolutionBuilder has an immutable set of rootNames that are the "entry point" projects, but * can dynamically add/remove other projects based on changes on the rootNames' references @@ -1898,6 +1921,7 @@ namespace ts { state.configFileCache.values(), config => isParsedCommandLine(config) ? config : undefined )), + close: () => stopWatching(state), }; } diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index 94d7a19f30e25..c9662f7dec26f 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -169,8 +169,9 @@ namespace ts { function executeCommandLineWorker( sys: System, - cb: ExecuteCommandLineCallbacks | undefined, + cb: ExecuteCommandLineCallbacks, commandLine: ParsedCommandLine, + maxNumberOfFilesToIterateForInvalidation: number | undefined ) { let reportDiagnostic = createDiagnosticReporter(sys); if (commandLine.options.build) { @@ -236,7 +237,7 @@ namespace ts { } else if (commandLine.fileNames.length === 0) { const searchPath = normalizePath(sys.getCurrentDirectory()); - configFileName = findConfigFile(searchPath, sys.fileExists); + configFileName = findConfigFile(searchPath, fileName => sys.fileExists(fileName)); } if (commandLine.fileNames.length === 0 && !configFileName) { @@ -273,27 +274,29 @@ namespace ts { ); if (isWatchSet(configParseResult.options)) { if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic)) return; - createWatchOfConfigFile( + return createWatchOfConfigFile( sys, + cb, reportDiagnostic, configParseResult, commandLineOptions, - commandLine.watchOptions + commandLine.watchOptions, + maxNumberOfFilesToIterateForInvalidation ); } else if (isIncrementalCompilation(configParseResult.options)) { performIncrementalCompilation( sys, - reportDiagnostic, cb, + reportDiagnostic, configParseResult ); } else { performCompilation( sys, - reportDiagnostic, cb, + reportDiagnostic, configParseResult ); } @@ -311,27 +314,29 @@ namespace ts { ); if (isWatchSet(commandLineOptions)) { if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic)) return; - createWatchOfFilesAndCompilerOptions( + return createWatchOfFilesAndCompilerOptions( sys, + cb, reportDiagnostic, commandLine.fileNames, commandLineOptions, - commandLine.watchOptions + commandLine.watchOptions, + maxNumberOfFilesToIterateForInvalidation ); } else if (isIncrementalCompilation(commandLineOptions)) { performIncrementalCompilation( sys, - reportDiagnostic, cb, + reportDiagnostic, { ...commandLine, options: commandLineOptions } ); } else { performCompilation( sys, - reportDiagnostic, cb, + reportDiagnostic, { ...commandLine, options: commandLineOptions } ); } @@ -346,23 +351,35 @@ namespace ts { return false; } - export interface ExecuteCommandLineCallbacks { - onCompilerHostCreate: (host: CompilerHost) => void; - onCompilationComplete: (config: ParsedCommandLine) => void; - onSolutionBuilderHostCreate: (host: SolutionBuilderHost | SolutionBuilderWithWatchHost) => void; - onSolutionBuildComplete: (configs: readonly ParsedCommandLine[]) => void; - } + export type ExecuteCommandLineCallbacks = (program: Program | EmitAndSemanticDiagnosticsBuilderProgram | ParsedCommandLine) => void; export function executeCommandLine( system: System, cb: ExecuteCommandLineCallbacks, commandLineArgs: readonly string[], - ): void { + maxNumberOfFilesToIterateForInvalidation?: number + ) { if (isBuild(commandLineArgs)) { - return performBuild( - system, - cb, - commandLineArgs.slice(1) - ); + const { buildOptions, watchOptions, projects, errors } = parseBuildCommand(commandLineArgs.slice(1)); + if (buildOptions.generateCpuProfile && system.enableCPUProfiler) { + system.enableCPUProfiler(buildOptions.generateCpuProfile, () => performBuild( + system, + cb, + buildOptions, + watchOptions, + projects, + errors + )); + } + else { + return performBuild( + system, + cb, + buildOptions, + watchOptions, + projects, + errors + ); + } } const commandLine = parseCommandLine(commandLineArgs, path => system.readFile(path)); @@ -370,11 +387,12 @@ namespace ts { system.enableCPUProfiler(commandLine.options.generateCpuProfile, () => executeCommandLineWorker( system, cb, - commandLine + commandLine, + maxNumberOfFilesToIterateForInvalidation )); } else { - executeCommandLineWorker(system, cb, commandLine); + return executeCommandLineWorker(system, cb, commandLine, maxNumberOfFilesToIterateForInvalidation); } } @@ -387,9 +405,9 @@ namespace ts { return false; } - function performBuildWorker( + function performBuild( sys: System, - cb: ExecuteCommandLineCallbacks | undefined, + cb: ExecuteCommandLineCallbacks, buildOptions: BuildOptions, watchOptions: WatchOptions | undefined, projects: string[], @@ -437,12 +455,10 @@ namespace ts { createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createWatchStatusReporter(sys, buildOptions) ); - if (cb && cb.onSolutionBuilderHostCreate) cb.onSolutionBuilderHostCreate(buildHost); - updateCreateProgram(sys, buildHost); - buildHost.afterProgramEmitAndDiagnostics = program => reportStatistics(sys, program.getProgram()); + updateSolutionBuilderHost(sys, cb, buildHost); const builder = createSolutionBuilderWithWatch(buildHost, projects, buildOptions, watchOptions); builder.build(); - return; + return builder; } const buildHost = createSolutionBuilderHost( @@ -452,43 +468,12 @@ namespace ts { createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createReportErrorSummary(sys, buildOptions) ); - if (cb && cb.onSolutionBuilderHostCreate) cb.onSolutionBuilderHostCreate(buildHost); - updateCreateProgram(sys, buildHost); - buildHost.afterProgramEmitAndDiagnostics = program => reportStatistics(sys, program.getProgram()); + updateSolutionBuilderHost(sys, cb, buildHost); const builder = createSolutionBuilder(buildHost, projects, buildOptions); const exitStatus = buildOptions.clean ? builder.clean() : builder.build(); - if (cb && cb.onSolutionBuildComplete) cb.onSolutionBuildComplete(builder.getAllParsedConfigs()); return sys.exit(exitStatus); } - function performBuild( - sys: System, - cb: ExecuteCommandLineCallbacks | undefined, - args: readonly string[] - ) { - const { buildOptions, watchOptions, projects, errors } = parseBuildCommand(args); - if (buildOptions.generateCpuProfile && sys.enableCPUProfiler) { - sys.enableCPUProfiler(buildOptions.generateCpuProfile, () => performBuildWorker( - sys, - cb, - buildOptions, - watchOptions, - projects, - errors - )); - } - else { - performBuildWorker( - sys, - cb, - buildOptions, - watchOptions, - projects, - errors - ); - } - } - function createReportErrorSummary(sys: System, options: CompilerOptions | BuildOptions): ReportEmitErrorSummary | undefined { return shouldBePretty(sys, options) ? errorCount => sys.write(getErrorSummaryText(errorCount, sys.newLine)) : @@ -497,13 +482,12 @@ namespace ts { function performCompilation( sys: System, + cb: ExecuteCommandLineCallbacks, reportDiagnostic: DiagnosticReporter, - cb: ExecuteCommandLineCallbacks | undefined, config: ParsedCommandLine ) { const { fileNames, options, projectReferences } = config; const host = createCompilerHostWorker(options, /*setParentPos*/ undefined, sys); - if (cb && cb.onCompilerHostCreate) cb.onCompilerHostCreate(host); const currentDirectory = host.getCurrentDirectory(); const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames()); changeCompilerHostLikeToUseCache(host, fileName => toPath(fileName, currentDirectory, getCanonicalFileName)); @@ -524,20 +508,19 @@ namespace ts { createReportErrorSummary(sys, options) ); reportStatistics(sys, program); - if (cb && cb.onCompilationComplete) cb.onCompilationComplete(config); + cb(program); return sys.exit(exitStatus); } function performIncrementalCompilation( sys: System, + cb: ExecuteCommandLineCallbacks, reportDiagnostic: DiagnosticReporter, - cb: ExecuteCommandLineCallbacks | undefined, config: ParsedCommandLine ) { const { options, fileNames, projectReferences } = config; enableStatistics(sys, options); const host = createIncrementalCompilerHost(options, sys); - if (cb && cb.onCompilerHostCreate) cb.onCompilerHostCreate(host); const exitStatus = ts.performIncrementalCompilation({ host, system: sys, @@ -547,12 +530,27 @@ namespace ts { projectReferences, reportDiagnostic, reportErrorSummary: createReportErrorSummary(sys, options), - afterProgramEmitAndDiagnostics: builderProgram => reportStatistics(sys, builderProgram.getProgram()) + afterProgramEmitAndDiagnostics: builderProgram => { + reportStatistics(sys, builderProgram.getProgram()); + cb(builderProgram); + } }); - if (cb && cb.onCompilationComplete) cb.onCompilationComplete(config); return sys.exit(exitStatus); } + function updateSolutionBuilderHost( + sys: System, + cb: ExecuteCommandLineCallbacks, + buildHost: SolutionBuilderHostBase + ) { + updateCreateProgram(sys, buildHost); + buildHost.afterProgramEmitAndDiagnostics = program => { + reportStatistics(sys, program.getProgram()); + cb(program); + }; + buildHost.afterEmitBundle = cb; + } + function updateCreateProgram(sys: System, host: { createProgram: CreateProgram; }) { const compileUsingBuilder = host.createProgram; host.createProgram = (rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences) => { @@ -564,12 +562,19 @@ namespace ts { }; } - function updateWatchCompilationHost(sys: System, watchCompilerHost: WatchCompilerHost) { + function updateWatchCompilationHost( + sys: System, + cb: ExecuteCommandLineCallbacks, + watchCompilerHost: WatchCompilerHost, + maxNumberOfFilesToIterateForInvalidation: number | undefined + ) { updateCreateProgram(sys, watchCompilerHost); + watchCompilerHost.maxNumberOfFilesToIterateForInvalidation = maxNumberOfFilesToIterateForInvalidation; const emitFilesUsingBuilder = watchCompilerHost.afterProgramCreate!; // TODO: GH#18217 watchCompilerHost.afterProgramCreate = builderProgram => { emitFilesUsingBuilder(builderProgram); reportStatistics(sys, builderProgram.getProgram()); + cb(builderProgram); }; } @@ -579,10 +584,12 @@ namespace ts { function createWatchOfConfigFile( sys: System, + cb: ExecuteCommandLineCallbacks, reportDiagnostic: DiagnosticReporter, configParseResult: ParsedCommandLine, optionsToExtend: CompilerOptions, - watchOptionsToExtend: WatchOptions | undefined + watchOptionsToExtend: WatchOptions | undefined, + maxNumberOfFilesToIterateForInvalidation: number | undefined ) { const watchCompilerHost = createWatchCompilerHostOfConfigFile( configParseResult.options.configFilePath!, @@ -593,17 +600,19 @@ namespace ts { reportDiagnostic, createWatchStatusReporter(sys, configParseResult.options) ); // TODO: GH#18217 - updateWatchCompilationHost(sys, watchCompilerHost); + updateWatchCompilationHost(sys, cb, watchCompilerHost, maxNumberOfFilesToIterateForInvalidation); watchCompilerHost.configFileParsingResult = configParseResult; - createWatchProgram(watchCompilerHost); + return createWatchProgram(watchCompilerHost); } function createWatchOfFilesAndCompilerOptions( sys: System, + cb: ExecuteCommandLineCallbacks, reportDiagnostic: DiagnosticReporter, rootFiles: string[], options: CompilerOptions, - watchOptions: WatchOptions | undefined + watchOptions: WatchOptions | undefined, + maxNumberOfFilesToIterateForInvalidation: number | undefined ) { const watchCompilerHost = createWatchCompilerHostOfFilesAndCompilerOptions( rootFiles, @@ -614,8 +623,8 @@ namespace ts { reportDiagnostic, createWatchStatusReporter(sys, options) ); - updateWatchCompilationHost(sys, watchCompilerHost); - createWatchProgram(watchCompilerHost); + updateWatchCompilationHost(sys, cb, watchCompilerHost, maxNumberOfFilesToIterateForInvalidation); + return createWatchProgram(watchCompilerHost); } function canReportDiagnostics(system: System, compilerOptions: CompilerOptions) { diff --git a/src/harness/fakesHosts.ts b/src/harness/fakesHosts.ts index 832e87408282b..0f0cfaab9947f 100644 --- a/src/harness/fakesHosts.ts +++ b/src/harness/fakesHosts.ts @@ -524,10 +524,10 @@ ${indentText}${text}`; export const version = "FakeTSVersion"; - export function patchHostForBuildInfoReadWrite(host: ts.CompilerHost | ts.SolutionBuilderHost) { - const originalReadFile = host.readFile; - host.readFile = (path, encoding) => { - const value = originalReadFile.call(host, path, encoding); + export function patchHostForBuildInfoReadWrite(sys: T) { + const originalReadFile = sys.readFile; + sys.readFile = (path, encoding) => { + const value = originalReadFile.call(sys, path, encoding); if (!value || !ts.isBuildInfoFile(path)) return value; const buildInfo = ts.getBuildInfo(value); ts.Debug.assert(buildInfo.version === version); @@ -535,24 +535,17 @@ ${indentText}${text}`; return ts.getBuildInfoText(buildInfo); }; - if (host.writeFile) { - const originalWriteFile = host.writeFile; - host.writeFile = (fileName: string, content: string, writeByteOrderMark: boolean) => { - if (!ts.isBuildInfoFile(fileName)) return originalWriteFile.call(host, fileName, content, writeByteOrderMark); + if (sys.writeFile) { + const originalWriteFile = sys.writeFile; + sys.writeFile = (fileName: string, content: string, writeByteOrderMark: boolean) => { + if (!ts.isBuildInfoFile(fileName)) return originalWriteFile.call(sys, fileName, content, writeByteOrderMark); const buildInfo = ts.getBuildInfo(content); sanitizeBuildInfoProgram(buildInfo); buildInfo.version = version; - originalWriteFile.call(host, fileName, ts.getBuildInfoText(buildInfo), writeByteOrderMark); + originalWriteFile.call(sys, fileName, ts.getBuildInfoText(buildInfo), writeByteOrderMark); }; } - } - - export function patchSolutionBuilderHost(host: ts.SolutionBuilderHost, sys: System) { - patchHostForBuildInfoReadWrite(host); - - ts.Debug.assert(host.now === undefined); - host.now = () => new Date(sys.vfs.time()); - ts.Debug.assertDefined(host.createHash); + return sys; } export class SolutionBuilderHost extends CompilerHost implements ts.SolutionBuilderHost { @@ -565,7 +558,7 @@ ${indentText}${text}`; static create(sys: System | vfs.FileSystem, options?: ts.CompilerOptions, setParentNodes?: boolean, createProgram?: ts.CreateProgram) { const host = new SolutionBuilderHost(sys, options, setParentNodes, createProgram); - patchSolutionBuilderHost(host, host.sys); + patchHostForBuildInfoReadWrite(host.sys); return host; } @@ -611,6 +604,10 @@ Actual All:: ${JSON.stringify(this.diagnostics.slice().map(diagnosticToText), /* out(diagnostic); } } + + now() { + return this.sys.now(); + } } } diff --git a/src/harness/sourceMapRecorder.ts b/src/harness/sourceMapRecorder.ts index e1df9b4b76969..668c7812366bf 100644 --- a/src/harness/sourceMapRecorder.ts +++ b/src/harness/sourceMapRecorder.ts @@ -322,11 +322,11 @@ namespace Harness.SourceMapRecorder { return sourceMapRecorder.lines.join("\r\n"); } - export function getSourceMapRecordWithVFS(fs: vfs.FileSystem, sourceMapFile: string) { + export function getSourceMapRecordWithSystem(sys: ts.System, sourceMapFile: string) { const sourceMapRecorder = new Compiler.WriterAggregator(); let prevSourceFile: documents.TextDocument | undefined; const files = ts.createMap(); - const sourceMap = ts.tryParseRawSourceMap(fs.readFileSync(sourceMapFile, "utf8")); + const sourceMap = ts.tryParseRawSourceMap(sys.readFile(sourceMapFile, "utf8")!); if (sourceMap) { const mapDirectory = ts.getDirectoryPath(sourceMapFile); const sourceRoot = sourceMap.sourceRoot ? ts.getNormalizedAbsolutePath(sourceMap.sourceRoot, mapDirectory) : mapDirectory; @@ -359,7 +359,7 @@ namespace Harness.SourceMapRecorder { function getFile(path: string) { const existing = files.get(path); if (existing) return existing; - const value = new documents.TextDocument(path, fs.readFileSync(path, "utf8")); + const value = new documents.TextDocument(path, sys.readFile(path, "utf8")!); files.set(path, value); return value; } diff --git a/src/harness/virtualFileSystemWithWatch.ts b/src/harness/virtualFileSystemWithWatch.ts index 5b29c8532e6d7..b26210a9eea65 100644 --- a/src/harness/virtualFileSystemWithWatch.ts +++ b/src/harness/virtualFileSystemWithWatch.ts @@ -99,16 +99,16 @@ interface Array { length: number; [n: number]: T; }` type FSEntry = FsFile | FsFolder | FsSymLink; - function isFsFolder(s: FSEntry): s is FsFolder { - return s && isArray((s).entries); + function isFsFolder(s: FSEntry | undefined): s is FsFolder { + return !!s && isArray((s).entries); } - function isFsFile(s: FSEntry): s is FsFile { - return s && isString((s).content); + function isFsFile(s: FSEntry | undefined): s is FsFile { + return !!s && isString((s).content); } - function isFsSymLink(s: FSEntry): s is FsSymLink { - return s && isString((s).symLink); + function isFsSymLink(s: FSEntry | undefined): s is FsSymLink { + return !!s && isString((s).symLink); } function invokeWatcherCallbacks(callbacks: readonly T[] | undefined, invokeCallback: (cb: T) => void): void { @@ -919,7 +919,7 @@ interface Array { length: number; [n: number]: T; }` } createHash(s: string): string { - return Harness.mockHash(s); + return `${ts.generateDjb2Hash(s)}-${s}`; } createSHA256Hash(s: string): string { @@ -1008,6 +1008,10 @@ interface Array { length: number; [n: number]: T; }` } } + appendFile(path: string, content: string, options?: Partial): void { + this.modifyFile(path, this.readFile(path) + content, options); + } + write(message: string) { this.output.push(message); } @@ -1021,6 +1025,56 @@ interface Array { length: number; [n: number]: T; }` this.screenClears.length = 0; } + serializeOutput(baseline: string[]) { + const output = this.getOutput(); + let start = 0; + baseline.push("Output::"); + for (const screenClear of this.screenClears) { + baselineOutputs(baseline, output, start, screenClear); + start = screenClear; + baseline.push(">> Screen clear"); + } + baselineOutputs(baseline, output, start); + baseline.push(""); + this.clearOutput(); + } + + snap(): Map { + const result = new Map(); + this.fs.forEach((value, key) => { + const cloneValue = clone(value); + if (isFsFolder(cloneValue)) { + cloneValue.entries = cloneValue.entries.map(clone) as SortedArray; + } + result.set(key, cloneValue); + }); + + return result; + } + + writtenFiles?: Map; + diff(baseline: string[], base: Map = new Map()) { + this.fs.forEach(newFsEntry => { + diffFsEntry(baseline, base.get(newFsEntry.path), newFsEntry, this.writtenFiles); + }); + base.forEach(oldFsEntry => { + const newFsEntry = this.fs.get(oldFsEntry.path); + if (!newFsEntry) { + diffFsEntry(baseline, oldFsEntry, newFsEntry, this.writtenFiles); + } + }); + baseline.push(""); + } + + serializeWatches(baseline: string[]) { + serializeMultiMap(baseline, "WatchedFiles", this.watchedFiles, ({ pollingInterval }) => ({ pollingInterval })); + baseline.push(""); + serializeMultiMap(baseline, "FsWatches", this.fsWatches, serializeTestFsWatcher); + baseline.push(""); + serializeMultiMap(baseline, "FsWatchesRecursive", this.fsWatchesRecursive, serializeTestFsWatcher); + baseline.push(""); + } + realpath(s: string): string { const fullPath = this.toNormalizedAbsolutePath(s); const path = this.toPath(fullPath); @@ -1052,16 +1106,114 @@ interface Array { length: number; [n: number]: T; }` } } - export type TestServerHostTrackingWrittenFiles = TestServerHost & { writtenFiles: Map; }; + function diffFsFile(baseline: string[], fsEntry: FsFile) { + baseline.push(`//// [${fsEntry.fullPath}]\r\n${fsEntry.content}`, ""); + } + function diffFsSymLink(baseline: string[], fsEntry: FsSymLink) { + baseline.push(`//// [${fsEntry.fullPath}] symlink(${fsEntry.symLink})`); + } + function diffFsEntry(baseline: string[], oldFsEntry: FSEntry | undefined, newFsEntry: FSEntry | undefined, writtenFiles: Map | undefined): void { + const file = newFsEntry && newFsEntry.fullPath; + if (isFsFile(oldFsEntry)) { + if (isFsFile(newFsEntry)) { + if (oldFsEntry.content !== newFsEntry.content) { + diffFsFile(baseline, newFsEntry); + } + else if (oldFsEntry.modifiedTime !== newFsEntry.modifiedTime) { + if (oldFsEntry.fullPath !== newFsEntry.fullPath) { + baseline.push(`//// [${file}] file was renamed from file ${oldFsEntry.fullPath}`); + } + else if (writtenFiles && !writtenFiles.has(newFsEntry.path)) { + baseline.push(`//// [${file}] file changed its modified time`); + } + else { + baseline.push(`//// [${file}] file written with same contents`); + } + } + } + else { + baseline.push(`//// [${oldFsEntry.fullPath}] deleted`); + if (isFsSymLink(newFsEntry)) { + diffFsSymLink(baseline, newFsEntry); + } + } + } + else if (isFsSymLink(oldFsEntry)) { + if (isFsSymLink(newFsEntry)) { + if (oldFsEntry.symLink !== newFsEntry.symLink) { + diffFsSymLink(baseline, newFsEntry); + } + else if (oldFsEntry.modifiedTime !== newFsEntry.modifiedTime) { + if (oldFsEntry.fullPath !== newFsEntry.fullPath) { + baseline.push(`//// [${file}] symlink was renamed from symlink ${oldFsEntry.fullPath}`); + } + else if (writtenFiles && !writtenFiles.has(newFsEntry.path)) { + baseline.push(`//// [${file}] symlink changed its modified time`); + } + else { + baseline.push(`//// [${file}] symlink written with same link`); + } + } + } + else { + baseline.push(`//// [${oldFsEntry.fullPath}] deleted symlink`); + if (isFsFile(newFsEntry)) { + diffFsFile(baseline, newFsEntry); + } + } + } + else if (isFsFile(newFsEntry)) { + diffFsFile(baseline, newFsEntry); + } + else if (isFsSymLink(newFsEntry)) { + diffFsSymLink(baseline, newFsEntry); + } + } + + function serializeTestFsWatcher({ fallbackPollingInterval, fallbackOptions }: TestFsWatcher) { + return { + fallbackPollingInterval, + fallbackOptions: serializeWatchOptions(fallbackOptions) + }; + } + + function serializeWatchOptions(fallbackOptions: WatchOptions | undefined) { + if (!fallbackOptions) return undefined; + const { watchFile, watchDirectory, fallbackPolling, ...rest } = fallbackOptions; + return { + watchFile: watchFile !== undefined ? WatchFileKind[watchFile] : undefined, + watchDirectory: watchDirectory !== undefined ? WatchDirectoryKind[watchDirectory] : undefined, + fallbackPolling: fallbackPolling !== undefined ? PollingWatchKind[fallbackPolling] : undefined, + ...rest + }; + } + + function serializeMultiMap(baseline: string[], caption: string, multiMap: MultiMap, valueMapper: (value: T) => U) { + baseline.push(`${caption}::`); + multiMap.forEach((values, key) => { + baseline.push(`${key}:`); + for (const value of values) { + baseline.push(` ${JSON.stringify(valueMapper(value))}`); + } + }); + } + + function baselineOutputs(baseline: string[], output: readonly string[], start: number, end = output.length) { + for (let i = start; i < end; i++) { + baseline.push(output[i].replace(/Elapsed::\s[0-9]+ms/g, "Elapsed:: *ms")); + } + } + + export type TestServerHostTrackingWrittenFiles = TestServerHost & { writtenFiles: Map; }; export function changeToHostTrackingWrittenFiles(inputHost: TestServerHost) { const host = inputHost as TestServerHostTrackingWrittenFiles; const originalWriteFile = host.writeFile; - host.writtenFiles = createMap(); + host.writtenFiles = createMap(); host.writeFile = (fileName, content) => { originalWriteFile.call(host, fileName, content); const path = host.toFullPath(fileName); - host.writtenFiles.set(path, true); + host.writtenFiles.set(path, (host.writtenFiles.get(path) || 0) + 1); }; return host; } diff --git a/src/testRunner/unittests/tsbuild/helpers.ts b/src/testRunner/unittests/tsbuild/helpers.ts index cc5dd3f855627..ced751343c8b4 100644 --- a/src/testRunner/unittests/tsbuild/helpers.ts +++ b/src/testRunner/unittests/tsbuild/helpers.ts @@ -186,40 +186,20 @@ interface Symbol { } } - export function generateSourceMapBaselineFiles(fs: vfs.FileSystem, mapFileNames: Iterator) { + export function generateSourceMapBaselineFiles(sys: System & { writtenFiles: Map; }) { + const mapFileNames = mapDefinedIterator(sys.writtenFiles.keys(), f => f.endsWith(".map") ? f : undefined); while (true) { const { value: mapFile, done } = mapFileNames.next(); if (done) break; - const text = Harness.SourceMapRecorder.getSourceMapRecordWithVFS(fs, mapFile); - fs.writeFileSync(`${mapFile}.baseline.txt`, text); + const text = Harness.SourceMapRecorder.getSourceMapRecordWithSystem(sys, mapFile); + sys.writeFile(`${mapFile}.baseline.txt`, text); } } - // [tsbuildinfo, js, dts] - export type BuildInfoSectionBaselineFiles = [string, string | undefined, string | undefined]; - function generateBuildInfoSectionBaselineFiles(fs: vfs.FileSystem, buildInfoFileNames: readonly BuildInfoSectionBaselineFiles[]) { - for (const [file, jsFile, dtsFile] of buildInfoFileNames) { - if (!fs.existsSync(file)) continue; - - const buildInfo = getBuildInfo(fs.readFileSync(file, "utf8")); - const bundle = buildInfo.bundle; - if (!bundle || (!length(bundle.js && bundle.js.sections) && !length(bundle.dts && bundle.dts.sections))) continue; - - // Write the baselines: - const baselineRecorder = new Harness.Compiler.WriterAggregator(); - generateBundleFileSectionInfo(fs, baselineRecorder, bundle.js, jsFile); - generateBundleFileSectionInfo(fs, baselineRecorder, bundle.dts, dtsFile); - baselineRecorder.Close(); - - const text = baselineRecorder.lines.join("\r\n"); - fs.writeFileSync(`${file}.baseline.txt`, text, "utf8"); - } - } - - function generateBundleFileSectionInfo(fs: vfs.FileSystem, baselineRecorder: Harness.Compiler.WriterAggregator, bundleFileInfo: BundleFileInfo | undefined, outFile: string | undefined) { + function generateBundleFileSectionInfo(sys: System, originalReadCall: System["readFile"], baselineRecorder: Harness.Compiler.WriterAggregator, bundleFileInfo: BundleFileInfo | undefined, outFile: string | undefined) { if (!length(bundleFileInfo && bundleFileInfo.sections) && !outFile) return; // Nothing to baseline - const content = outFile && fs.existsSync(outFile) ? fs.readFileSync(outFile, "utf8") : ""; + const content = outFile && sys.fileExists(outFile) ? originalReadCall.call(sys, outFile, "utf8")! : ""; baselineRecorder.WriteLine("======================================================================"); baselineRecorder.WriteLine(`File:: ${outFile}`); for (const section of bundleFileInfo ? bundleFileInfo.sections : emptyArray) { @@ -256,23 +236,28 @@ interface Symbol { } export function baselineBuildInfo( - configs: readonly ParsedCommandLine[], - fs: vfs.FileSystem, - writtenFiles: Map + options: CompilerOptions, + sys: System & { writtenFiles: Map; }, + originalReadCall?: System["readFile"] ) { - let expectedBuildInfoFiles: BuildInfoSectionBaselineFiles[] | undefined; - for (const { options } of configs) { - const out = options.outFile || options.out; - if (out) { - const { jsFilePath, declarationFilePath, buildInfoPath } = getOutputPathsForBundle(options, /*forceDts*/ false); - if (buildInfoPath && writtenFiles.has(buildInfoPath)) { - (expectedBuildInfoFiles || (expectedBuildInfoFiles = [])).push( - [buildInfoPath, jsFilePath, declarationFilePath] - ); - } - } - } - if (expectedBuildInfoFiles) generateBuildInfoSectionBaselineFiles(fs, expectedBuildInfoFiles); + const out = options.outFile || options.out; + if (!out) return; + const { buildInfoPath, jsFilePath, declarationFilePath } = getOutputPathsForBundle(options, /*forceDts*/ false); + if (!buildInfoPath || !sys.writtenFiles.has(buildInfoPath)) return; + if (!sys.fileExists(buildInfoPath!)) return; + + const buildInfo = getBuildInfo((originalReadCall || sys.readFile).call(sys, buildInfoPath, "utf8")!); + const bundle = buildInfo.bundle; + if (!bundle || (!length(bundle.js && bundle.js.sections) && !length(bundle.dts && bundle.dts.sections))) return; + + // Write the baselines: + const baselineRecorder = new Harness.Compiler.WriterAggregator(); + generateBundleFileSectionInfo(sys, originalReadCall || sys.readFile, baselineRecorder, bundle.js, jsFilePath); + generateBundleFileSectionInfo(sys, originalReadCall || sys.readFile, baselineRecorder, bundle.dts, declarationFilePath); + baselineRecorder.Close(); + + const text = baselineRecorder.lines.join("\r\n"); + sys.writeFile(`${buildInfoPath}.baseline.txt`, text); } export interface TscIncremental { diff --git a/src/testRunner/unittests/tsbuild/watchMode.ts b/src/testRunner/unittests/tsbuild/watchMode.ts index 0fa907cf11db8..921e9041a7e3b 100644 --- a/src/testRunner/unittests/tsbuild/watchMode.ts +++ b/src/testRunner/unittests/tsbuild/watchMode.ts @@ -12,29 +12,16 @@ namespace ts.tscWatch { export function createSolutionBuilder(system: WatchedSystem, rootNames: readonly string[], defaultOptions?: BuildOptions) { const host = createSolutionBuilderHost(system); - host.now = system.now.bind(system); return ts.createSolutionBuilder(host, rootNames, defaultOptions || {}); } - export function createSolutionBuilderWithWatchHost(system: WatchedSystem) { - const host = ts.createSolutionBuilderWithWatchHost(system); - host.now = system.now.bind(system); - return host; - } - - function createSolutionBuilderWithWatch(system: TsBuildWatchSystem, rootNames: readonly string[], defaultOptions?: BuildOptions) { - const host = createSolutionBuilderWithWatchHost(system); - const solutionBuilder = ts.createSolutionBuilderWithWatch(host, rootNames, defaultOptions || { watch: true }); - solutionBuilder.build(); - return solutionBuilder; - } - type OutputFileStamp = [string, Date | undefined, boolean]; function transformOutputToOutputFileStamp(f: string, host: TsBuildWatchSystem): OutputFileStamp { return [f, host.getModifiedTime(f), host.writtenFiles.has(host.toFullPath(f))] as OutputFileStamp; } describe("unittests:: tsbuild:: watchMode:: program updates", () => { + const scenario = "programUpdates"; const project = "sample1"; const enum SubProject { core = "core", @@ -99,19 +86,14 @@ namespace ts.tscWatch { return result; } - function verifyChangedFiles(actualStamps: OutputFileStamp[], oldTimeStamps: OutputFileStamp[], changedFiles: readonly string[], modifiedTimeStampFiles: readonly string[]) { - for (let i = 0; i < oldTimeStamps.length; i++) { - const actual = actualStamps[i]; - const old = oldTimeStamps[i]; - const expectedIsChanged = contains(changedFiles, actual[0]); - assert.equal(actual[2], contains(changedFiles, actual[0]), `Expected ${actual[0]} to be written.`); - if (expectedIsChanged || contains(modifiedTimeStampFiles, actual[0])) { - assert.isTrue((actual[1] || 0) > (old[1] || 0), `${actual[0]} file expected to have newer modified time because it is expected to ${expectedIsChanged ? "be changed" : "have modified time stamp"}`); - } - else { - assert.equal(actual[1], old[1], `${actual[0]} expected to not change or have timestamp modified.`); - } - } + function changeFile(sys: WatchedSystem, fileName: string, content: string, caption: string) { + sys.writeFile(fileName, content); + sys.checkTimeoutQueueLengthAndRun(1); // Builds core + return caption; + } + + function changeCore(sys: WatchedSystem, content: string, caption: string) { + return changeFile(sys, core[1].path, content, caption); } let core: SubProjectFiles; @@ -142,26 +124,12 @@ namespace ts.tscWatch { testProjectExpectedWatchedDirectoriesRecursive = undefined!; }); - function createSolutionInWatchMode(allFiles: readonly File[], defaultOptions?: BuildOptions, disableConsoleClears?: boolean) { - const host = createTsBuildWatchSystem(allFiles, { currentDirectory: projectsLocation }); - createSolutionBuilderWithWatch(host, [`${project}/${SubProject.tests}`], defaultOptions); - verifyWatches(host); - checkOutputErrorsInitial(host, emptyArray, disableConsoleClears); - const outputFileStamps = getOutputFileStamps(host); - for (const stamp of outputFileStamps) { - assert.isDefined(stamp[1], `${stamp[0]} expected to be present`); - } - return host; - } - - function verifyWatches(host: TsBuildWatchSystem) { - checkWatchedFiles(host, testProjectExpectedWatchedFiles); - checkWatchedDirectories(host, emptyArray, /*recursive*/ false); - checkWatchedDirectories(host, testProjectExpectedWatchedDirectoriesRecursive, /*recursive*/ true); - } - - it("creates solution in watch mode", () => { - createSolutionInWatchMode(allFiles); + verifyTscWatch({ + scenario, + subScenario: "creates solution in watch mode", + commandLineArgs: ["-b", "-w", `${project}/${SubProject.tests}`], + sys: () => createWatchedSystem(allFiles, { currentDirectory: projectsLocation }), + changes: emptyArray }); it("verify building references watches only those projects", () => { @@ -193,252 +161,188 @@ namespace ts.tscWatch { content: `export const newFileConst = 30;` }; - function verifyProjectChanges(allFilesGetter: () => readonly File[]) { - function createSolutionInWatchModeToVerifyChanges(additionalFiles?: readonly [SubProject, string][]) { - const host = createSolutionInWatchMode(allFilesGetter()); - return { host, verifyChangeWithFile, verifyChangeAfterTimeout, verifyWatches }; - - function verifyChangeWithFile(fileName: string, content: string, local?: boolean) { - const outputFileStamps = getOutputFileStamps(host, additionalFiles); - host.writeFile(fileName, content); - verifyChangeAfterTimeout(outputFileStamps, local); - } - - function verifyChangeAfterTimeout(outputFileStamps: OutputFileStamp[], local?: boolean) { - host.checkTimeoutQueueLengthAndRun(1); // Builds core - const changedCore = getOutputFileStamps(host, additionalFiles); - verifyChangedFiles( - changedCore, - outputFileStamps, - additionalFiles ? - getOutputFileNames(SubProject.core, newFileWithoutExtension) : - getOutputFileNames(SubProject.core, "index"), // Written files are new file or core index file thats changed - [ - ...getOutputFileNames(SubProject.core, "anotherModule"), - ...(additionalFiles ? getOutputFileNames(SubProject.core, "index") : emptyArray) - ] - ); - host.checkTimeoutQueueLengthAndRun(1); // Builds logic or updates timestamps - const changedLogic = getOutputFileStamps(host, additionalFiles); - verifyChangedFiles( - changedLogic, - changedCore, - additionalFiles || local ? - emptyArray : - getOutputFileNames(SubProject.logic, "index"), - additionalFiles || local ? - getOutputFileNames(SubProject.logic, "index") : - emptyArray - ); - host.checkTimeoutQueueLengthAndRun(1); // Builds tests - const changedTests = getOutputFileStamps(host, additionalFiles); - verifyChangedFiles( - changedTests, - changedLogic, - additionalFiles || local ? - emptyArray : - getOutputFileNames(SubProject.tests, "index"), - additionalFiles || local ? - getOutputFileNames(SubProject.tests, "index") : - emptyArray - ); - host.checkTimeoutQueueLength(0); - checkOutputErrorsIncremental(host, emptyArray); - verifyWatches(); - } - - function verifyWatches() { - checkWatchedFiles(host, additionalFiles ? testProjectExpectedWatchedFiles.concat(newFile.path) : testProjectExpectedWatchedFiles); - checkWatchedDirectories(host, emptyArray, /*recursive*/ false); - checkWatchedDirectories(host, testProjectExpectedWatchedDirectoriesRecursive, /*recursive*/ true); - } + function verifyProjectChanges(subScenario: string, allFilesGetter: () => readonly File[]) { + function buildLogicOrUpdateTimeStamps(sys: WatchedSystem) { + sys.checkTimeoutQueueLengthAndRun(1); // Builds logic or updates timestamps + return "Build logic or update time stamps"; } - it("change builds changes and reports found errors message", () => { - const { host, verifyChangeWithFile, verifyChangeAfterTimeout } = createSolutionInWatchModeToVerifyChanges(); - verifyChange(`${core[1].content} -export class someClass { }`); - - // Another change requeues and builds it - verifyChange(core[1].content); - - // Two changes together report only single time message: File change detected. Starting incremental compilation... - const outputFileStamps = getOutputFileStamps(host); - const change1 = `${core[1].content} + function buildTests(sys: WatchedSystem) { + sys.checkTimeoutQueueLengthAndRun(1); // Build tests + sys.checkTimeoutQueueLength(0); + return "Build Tests"; + } + verifyTscWatch({ + scenario, + subScenario: `${subScenario}/change builds changes and reports found errors message`, + commandLineArgs: ["-b", "-w", `${project}/${SubProject.tests}`], + sys: () => createWatchedSystem( + allFilesGetter(), + { currentDirectory: projectsLocation } + ), + changes: [ + sys => changeCore(sys, `${core[1].content} +export class someClass { }`, "Make change to core"), + buildLogicOrUpdateTimeStamps, + buildTests, + // Another change requeues and builds it + sys => changeCore(sys, core[1].content, "Revert core file"), + buildLogicOrUpdateTimeStamps, + buildTests, + sys => { + const change1 = `${core[1].content} export class someClass { }`; - host.writeFile(core[1].path, change1); - host.writeFile(core[1].path, `${change1} + sys.writeFile(core[1].path, change1); + assert.equal(sys.writtenFiles.size, 1); + sys.writtenFiles.clear(); + sys.writeFile(core[1].path, `${change1} export class someClass2 { }`); - verifyChangeAfterTimeout(outputFileStamps); - - function verifyChange(coreContent: string) { - verifyChangeWithFile(core[1].path, coreContent); - } + sys.checkTimeoutQueueLengthAndRun(1); // Builds core + return "Make two changes"; + }, + buildLogicOrUpdateTimeStamps, + buildTests, + ] }); - it("non local change does not start build of referencing projects", () => { - const { verifyChangeWithFile } = createSolutionInWatchModeToVerifyChanges(); - verifyChangeWithFile(core[1].path, `${core[1].content} -function foo() { }`, /*local*/ true); + verifyTscWatch({ + scenario, + subScenario: `${subScenario}/non local change does not start build of referencing projects`, + commandLineArgs: ["-b", "-w", `${project}/${SubProject.tests}`], + sys: () => createWatchedSystem( + allFilesGetter(), + { currentDirectory: projectsLocation } + ), + changes: [ + sys => changeCore(sys, `${core[1].content} +function foo() { }`, "Make local change to core"), + buildLogicOrUpdateTimeStamps, + buildTests + ] }); - it("builds when new file is added, and its subsequent updates", () => { - const additionalFiles: readonly [SubProject, string][] = [[SubProject.core, newFileWithoutExtension]]; - const { verifyChangeWithFile } = createSolutionInWatchModeToVerifyChanges(additionalFiles); - verifyChange(newFile.content); - - // Another change requeues and builds it - verifyChange(`${newFile.content} -export class someClass2 { }`); - - function verifyChange(newFileContent: string) { - verifyChangeWithFile(newFile.path, newFileContent); - } + function changeNewFile(sys: WatchedSystem, newFileContent: string) { + return changeFile(sys, newFile.path, newFileContent, "Change to new File and build core"); + } + verifyTscWatch({ + scenario, + subScenario: `${subScenario}/builds when new file is added, and its subsequent updates`, + commandLineArgs: ["-b", "-w", `${project}/${SubProject.tests}`], + sys: () => createWatchedSystem( + allFilesGetter(), + { currentDirectory: projectsLocation } + ), + changes: [ + sys => changeNewFile(sys, newFile.content), + buildLogicOrUpdateTimeStamps, + buildTests, + sys => changeNewFile(sys, `${newFile.content} +export class someClass2 { }`), + buildLogicOrUpdateTimeStamps, + buildTests + ] }); } describe("with simple project reference graph", () => { - verifyProjectChanges(() => allFiles); + verifyProjectChanges( + "with simple project reference graph", + () => allFiles + ); }); describe("with circular project reference", () => { - verifyProjectChanges(() => { - const [coreTsconfig, ...otherCoreFiles] = core; - const circularCoreConfig: File = { - path: coreTsconfig.path, - content: JSON.stringify({ - compilerOptions: { composite: true, declaration: true }, - references: [{ path: "../tests", circular: true }] - }) - }; - return [libFile, circularCoreConfig, ...otherCoreFiles, ...logic, ...tests]; - }); + verifyProjectChanges( + "with circular project reference", + () => { + const [coreTsconfig, ...otherCoreFiles] = core; + const circularCoreConfig: File = { + path: coreTsconfig.path, + content: JSON.stringify({ + compilerOptions: { composite: true, declaration: true }, + references: [{ path: "../tests", circular: true }] + }) + }; + return [libFile, circularCoreConfig, ...otherCoreFiles, ...logic, ...tests]; + } + ); }); }); - it("watches config files that are not present", () => { - const allFiles = [libFile, ...core, logic[1], ...tests]; - const host = createTsBuildWatchSystem(allFiles, { currentDirectory: projectsLocation }); - createSolutionBuilderWithWatch(host, [`${project}/${SubProject.tests}`]); - checkWatchedFiles(host, [core[0], core[1], core[2]!, logic[0], ...tests].map(f => f.path.toLowerCase())); - checkWatchedDirectories(host, emptyArray, /*recursive*/ false); - checkWatchedDirectories(host, [projectPath(SubProject.core)], /*recursive*/ true); - checkOutputErrorsInitial(host, [ - createCompilerDiagnostic(Diagnostics.File_0_not_found, logic[0].path) - ]); - for (const f of [ - ...getOutputFileNames(SubProject.core, "anotherModule"), - ...getOutputFileNames(SubProject.core, "index") - ]) { - assert.isTrue(host.fileExists(f), `${f} expected to be present`); - } - for (const f of [ - ...getOutputFileNames(SubProject.logic, "index"), - ...getOutputFileNames(SubProject.tests, "index") - ]) { - assert.isFalse(host.fileExists(f), `${f} expected to be absent`); - } - - // Create tsconfig file for logic and see that build succeeds - const initial = getOutputFileStamps(host); - host.writeFile(logic[0].path, logic[0].content); - host.checkTimeoutQueueLengthAndRun(1); // Builds logic - const changedLogic = getOutputFileStamps(host); - verifyChangedFiles(changedLogic, initial, getOutputFileNames(SubProject.logic, "index"), emptyArray); - host.checkTimeoutQueueLengthAndRun(1); // Builds tests - const changedTests = getOutputFileStamps(host); - verifyChangedFiles(changedTests, changedLogic, getOutputFileNames(SubProject.tests, "index"), emptyArray); - host.checkTimeoutQueueLength(0); - checkOutputErrorsIncremental(host, emptyArray); - verifyWatches(host); + verifyTscWatch({ + scenario, + subScenario: "watches config files that are not present", + commandLineArgs: ["-b", "-w", `${project}/${SubProject.tests}`], + sys: () => createWatchedSystem( + [libFile, ...core, logic[1], ...tests], + { currentDirectory: projectsLocation } + ), + changes: [ + sys => { + sys.writeFile(logic[0].path, logic[0].content); + sys.checkTimeoutQueueLengthAndRun(1); // Builds logic + return "Write logic tsconfig and build logic"; + }, + sys => { + sys.checkTimeoutQueueLengthAndRun(1); // Builds tests + sys.checkTimeoutQueueLength(0); + return "Build tests"; + } + ] }); - it("when referenced using prepend, builds referencing project even for non local change", () => { - const coreTsConfig: File = { - path: core[0].path, - content: JSON.stringify({ - compilerOptions: { composite: true, declaration: true, outFile: "index.js" } - }) - }; - const coreIndex: File = { - path: core[1].path, - content: `function foo() { return 10; }` - }; - const logicTsConfig: File = { - path: logic[0].path, - content: JSON.stringify({ - compilerOptions: { composite: true, declaration: true, outFile: "index.js" }, - references: [{ path: "../core", prepend: true }] - }) - }; - const logicIndex: File = { - path: logic[1].path, - content: `function bar() { return foo() + 1 };` - }; - - const projectFiles = [coreTsConfig, coreIndex, logicTsConfig, logicIndex]; - const host = createTsBuildWatchSystem([libFile, ...projectFiles], { currentDirectory: projectsLocation }); - createSolutionBuilderWithWatch(host, [`${project}/${SubProject.logic}`]); - verifyWatches(); - checkOutputErrorsInitial(host, emptyArray); - const outputFileStamps = getOutputFileStamps(); - for (const stamp of outputFileStamps) { - assert.isDefined(stamp[1], `${stamp[0]} expected to be present`); - } - - // Make non local change - verifyChangeInCore(`${coreIndex.content} -function myFunc() { return 10; }`); - - // TODO:: local change does not build logic.js because builder doesnt find any changes in input files to generate output - // Make local change to function bar - verifyChangeInCore(`${coreIndex.content} -function myFunc() { return 100; }`, /*isLocal*/ true); - - function verifyChangeInCore(content: string, isLocal?: boolean) { - const outputFileStamps = getOutputFileStamps(); - host.writeFile(coreIndex.path, content); - - host.checkTimeoutQueueLengthAndRun(1); // Builds core - const changedCore = getOutputFileStamps(); - verifyChangedFiles( - changedCore, - outputFileStamps, - getOutputFileNames(SubProject.core, "index"), - emptyArray - ); - host.checkTimeoutQueueLengthAndRun(1); // Builds logic - const changedLogicOutput = getOutputFileNames(SubProject.logic, "index"); - const changedLogic = getOutputFileStamps(); - verifyChangedFiles( - changedLogic, - changedCore, - // Only js file is written and d.ts is modified timestamp if its local change - isLocal ? [changedLogicOutput[0]] : getOutputFileNames(SubProject.logic, "index"), - isLocal ? [changedLogicOutput[1]] : emptyArray - ); - host.checkTimeoutQueueLength(0); - checkOutputErrorsIncremental(host, emptyArray); - verifyWatches(); - } - - function getOutputFileStamps(): OutputFileStamp[] { - const result = [ - ...getOutputStamps(host, SubProject.core, "index"), - ...getOutputStamps(host, SubProject.logic, "index"), - ]; - host.writtenFiles.clear(); - return result; - } - - function verifyWatches() { - checkWatchedFiles(host, projectFiles.map(f => f.path)); - checkWatchedDirectories(host, emptyArray, /*recursive*/ false); - checkWatchedDirectories(host, testProjectExpectedWatchedDirectoriesRecursive, /*recursive*/ true); + describe("when referenced using prepend, builds referencing project even for non local change", () => { + let coreIndex: File; + before(() => { + coreIndex = { + path: core[1].path, + content: `function foo() { return 10; }` + }; + }); + after(() => { + coreIndex = undefined!; + }); + function buildLogic(sys: WatchedSystem) { + sys.checkTimeoutQueueLengthAndRun(1); // Builds logic + sys.checkTimeoutQueueLength(0); + return "Build logic"; } + verifyTscWatch({ + scenario, + subScenario: "when referenced using prepend builds referencing project even for non local change", + commandLineArgs: ["-b", "-w", `${project}/${SubProject.logic}`], + sys: () => { + const coreTsConfig: File = { + path: core[0].path, + content: JSON.stringify({ + compilerOptions: { composite: true, declaration: true, outFile: "index.js" } + }) + }; + const logicTsConfig: File = { + path: logic[0].path, + content: JSON.stringify({ + compilerOptions: { composite: true, declaration: true, outFile: "index.js" }, + references: [{ path: "../core", prepend: true }] + }) + }; + const logicIndex: File = { + path: logic[1].path, + content: `function bar() { return foo() + 1 };` + }; + return createWatchedSystem([libFile, coreTsConfig, coreIndex, logicTsConfig, logicIndex], { currentDirectory: projectsLocation }); + }, + changes: [ + sys => changeCore(sys, `${coreIndex.content} +function myFunc() { return 10; }`, "Make non local change and build core"), + buildLogic, + sys => changeCore(sys, `${coreIndex.content} +function myFunc() { return 100; }`, "Make local change and build core"), + buildLogic, + ] + }); }); - it("when referenced project change introduces error in the down stream project and then fixes it", () => { + describe("when referenced project change introduces error in the down stream project and then fixes it", () => { const subProjectLibrary = `${projectsLocation}/${project}/Library`; const libraryTs: File = { path: `${subProjectLibrary}/library.ts`, @@ -455,77 +359,78 @@ export function createSomeObject(): SomeObject }; }` }; - const libraryTsconfig: File = { - path: `${subProjectLibrary}/tsconfig.json`, - content: JSON.stringify({ compilerOptions: { composite: true } }) - }; - const subProjectApp = `${projectsLocation}/${project}/App`; - const appTs: File = { - path: `${subProjectApp}/app.ts`, - content: `import { createSomeObject } from "../Library/library"; + verifyTscWatch({ + scenario, + subScenario: "when referenced project change introduces error in the down stream project and then fixes it", + commandLineArgs: ["-b", "-w", "App"], + sys: () => { + const libraryTsconfig: File = { + path: `${subProjectLibrary}/tsconfig.json`, + content: JSON.stringify({ compilerOptions: { composite: true } }) + }; + const subProjectApp = `${projectsLocation}/${project}/App`; + const appTs: File = { + path: `${subProjectApp}/app.ts`, + content: `import { createSomeObject } from "../Library/library"; createSomeObject().message;` - }; - const appTsconfig: File = { - path: `${subProjectApp}/tsconfig.json`, - content: JSON.stringify({ references: [{ path: "../Library" }] }) - }; + }; + const appTsconfig: File = { + path: `${subProjectApp}/tsconfig.json`, + content: JSON.stringify({ references: [{ path: "../Library" }] }) + }; + + const files = [libFile, libraryTs, libraryTsconfig, appTs, appTsconfig]; + return createWatchedSystem(files, { currentDirectory: `${projectsLocation}/${project}` }); + }, + changes: [ + sys => { + // Change message in library to message2 + sys.writeFile(libraryTs.path, libraryTs.content.replace(/message/g, "message2")); + sys.checkTimeoutQueueLengthAndRun(1); // Build library + sys.checkTimeoutQueueLengthAndRun(1); // Build App + return "Introduce error"; + }, + sys => { + // Revert library changes + sys.writeFile(libraryTs.path, libraryTs.content); + sys.checkTimeoutQueueLengthAndRun(1); // Build library + sys.checkTimeoutQueueLengthAndRun(1); // Build App + return "Fix error"; + }, + ] + }); - const files = [libFile, libraryTs, libraryTsconfig, appTs, appTsconfig]; - const host = createTsBuildWatchSystem(files, { currentDirectory: `${projectsLocation}/${project}` }); - createSolutionBuilderWithWatch(host, ["App"]); - checkOutputErrorsInitial(host, emptyArray); - - // Change message in library to message2 - host.writeFile(libraryTs.path, libraryTs.content.replace(/message/g, "message2")); - host.checkTimeoutQueueLengthAndRun(1); // Build library - host.checkTimeoutQueueLengthAndRun(1); // Build App - checkOutputErrorsIncremental(host, [ - "App/app.ts(2,20): error TS2551: Property 'message' does not exist on type 'SomeObject'. Did you mean 'message2'?\n" - ]); - - // Revert library changes - host.writeFile(libraryTs.path, libraryTs.content); - host.checkTimeoutQueueLengthAndRun(1); // Build library - host.checkTimeoutQueueLengthAndRun(1); // Build App - checkOutputErrorsIncremental(host, emptyArray); }); describe("reports errors in all projects on incremental compile", () => { - function verifyIncrementalErrors(defaultBuildOptions?: BuildOptions, disabledConsoleClear?: boolean) { - const host = createSolutionInWatchMode(allFiles, defaultBuildOptions, disabledConsoleClear); - const outputFileStamps = getOutputFileStamps(host); - - host.writeFile(logic[1].path, `${logic[1].content} + function verifyIncrementalErrors(subScenario: string, buildOptions: readonly string[]) { + verifyTscWatch({ + scenario, + subScenario: `reportErrors/${subScenario}`, + commandLineArgs: ["-b", "-w", `${project}/${SubProject.tests}`, ...buildOptions], + sys: () => createWatchedSystem(allFiles, { currentDirectory: projectsLocation }), + changes: [ + sys => { + sys.writeFile(logic[1].path, `${logic[1].content} let y: string = 10;`); - host.checkTimeoutQueueLengthAndRun(1); // Builds logic - const changedLogic = getOutputFileStamps(host); - verifyChangedFiles(changedLogic, outputFileStamps, emptyArray, emptyArray); - host.checkTimeoutQueueLength(0); - checkOutputErrorsIncremental(host, [ - `sample1/logic/index.ts(8,5): error TS2322: Type '10' is not assignable to type 'string'.\n` - ], disabledConsoleClear); - - host.writeFile(core[1].path, `${core[1].content} + sys.checkTimeoutQueueLengthAndRun(1); // Builds logic + sys.checkTimeoutQueueLength(0); + return "change logic"; + }, + sys => { + sys.writeFile(core[1].path, `${core[1].content} let x: string = 10;`); - host.checkTimeoutQueueLengthAndRun(1); // Builds core - const changedCore = getOutputFileStamps(host); - verifyChangedFiles(changedCore, changedLogic, emptyArray, emptyArray); - host.checkTimeoutQueueLength(0); - checkOutputErrorsIncremental(host, [ - `sample1/core/index.ts(5,5): error TS2322: Type '10' is not assignable to type 'string'.\n`, - `sample1/logic/index.ts(8,5): error TS2322: Type '10' is not assignable to type 'string'.\n` - ], disabledConsoleClear); + sys.checkTimeoutQueueLengthAndRun(1); // Builds core + sys.checkTimeoutQueueLength(0); + return "change core"; + } + ] + }); } - - it("when preserveWatchOutput is not used", () => { - verifyIncrementalErrors(); - }); - - it("when preserveWatchOutput is passed on command line", () => { - verifyIncrementalErrors({ preserveWatchOutput: true, watch: true }, /*disabledConsoleClear*/ true); - }); + verifyIncrementalErrors("when preserveWatchOutput is not used", emptyArray); + verifyIncrementalErrors("when preserveWatchOutput is passed on command line", ["--preserveWatchOutput"]); describe("when declaration emit errors are present", () => { const solution = "solution"; @@ -550,88 +455,84 @@ let x: string = 10;`); path: `${subProjectLocation}/tsconfig.json`, content: JSON.stringify({ compilerOptions: { composite: true } }) }; - const expectedDtsEmitErrors = [ - `${subProject}/fileWithError.ts(1,12): error TS4094: Property 'p' of exported class expression may not be private or protected.\n` - ]; - const outputs = [ - changeExtension(fileWithError.path, Extension.Js), - changeExtension(fileWithError.path, Extension.Dts), - changeExtension(fileWithoutError.path, Extension.Js), - changeExtension(fileWithoutError.path, Extension.Dts), - `${subProjectLocation}/tsconfig${Extension.TsBuildInfo}` - ]; - - function verifyDtsErrors(host: TsBuildWatchSystem, isIncremental: boolean, expectedErrors: readonly string[]) { - (isIncremental ? checkOutputErrorsIncremental : checkOutputErrorsInitial)(host, expectedErrors); - outputs.forEach(f => assert.equal(host.fileExists(f), !expectedErrors.length, `Expected file ${f} to ${!expectedErrors.length ? "exist" : "not exist"}`)); - } - function createSolutionWithWatch(withFixedError?: true) { - const files = [libFile, withFixedError ? fileWithFixedError : fileWithError, fileWithoutError, tsconfig]; - const host = createTsBuildWatchSystem(files, { currentDirectory: `${projectsLocation}/${solution}` }); - createSolutionBuilderWithWatch(host, [subProject]); - verifyDtsErrors(host, /*isIncremental*/ false, withFixedError ? emptyArray : expectedDtsEmitErrors); - return host; + function incrementalBuild(sys: WatchedSystem) { + sys.checkTimeoutQueueLengthAndRun(1); // Build the app + sys.checkTimeoutQueueLength(0); } - function incrementalBuild(host: TsBuildWatchSystem) { - host.checkTimeoutQueueLengthAndRun(1); // Build the app - host.checkTimeoutQueueLength(0); + function fixError(sys: WatchedSystem) { + // Fix error + sys.writeFile(fileWithError.path, fileWithFixedError.content); + incrementalBuild(sys); + return "Fix error in fileWithError"; } - function fixError(host: TsBuildWatchSystem) { - // Fix error - host.writeFile(fileWithError.path, fileWithFixedError.content); - host.writtenFiles.clear(); - incrementalBuild(host); - verifyDtsErrors(host, /*isIncremental*/ true, emptyArray); + function changeFileWithoutError(sys: WatchedSystem) { + sys.writeFile(fileWithoutError.path, fileWithoutError.content.replace(/myClass/g, "myClass2")); + incrementalBuild(sys); + return "Change fileWithoutError"; } - it("when fixing error files all files are emitted", () => { - const host = createSolutionWithWatch(); - fixError(host); + verifyTscWatch({ + scenario, + subScenario: "reportErrors/declarationEmitErrors/when fixing error files all files are emitted", + commandLineArgs: ["-b", "-w", subProject], + sys: () => createWatchedSystem( + [libFile, fileWithError, fileWithoutError, tsconfig], + { currentDirectory: `${projectsLocation}/${solution}` } + ), + changes: [ + fixError + ] }); - it("when file with no error changes, declaration errors are reported", () => { - const host = createSolutionWithWatch(); - host.writeFile(fileWithoutError.path, fileWithoutError.content.replace(/myClass/g, "myClass2")); - incrementalBuild(host); - verifyDtsErrors(host, /*isIncremental*/ true, expectedDtsEmitErrors); + verifyTscWatch({ + scenario, + subScenario: "reportErrors/declarationEmitErrors/when file with no error changes", + commandLineArgs: ["-b", "-w", subProject], + sys: () => createWatchedSystem( + [libFile, fileWithError, fileWithoutError, tsconfig], + { currentDirectory: `${projectsLocation}/${solution}` } + ), + changes: [ + changeFileWithoutError + ] }); describe("when reporting errors on introducing error", () => { - function createSolutionWithIncrementalError() { - const host = createSolutionWithWatch(/*withFixedError*/ true); - host.writeFile(fileWithError.path, fileWithError.content); - host.writtenFiles.clear(); - - incrementalBuild(host); - checkOutputErrorsIncremental(host, expectedDtsEmitErrors); - assert.equal(host.writtenFiles.size, 0, `Expected not to write any files: ${arrayFrom(host.writtenFiles.keys())}`); - return host; + function introduceError(sys: WatchedSystem) { + sys.writeFile(fileWithError.path, fileWithError.content); + incrementalBuild(sys); + return "Introduce error"; } - function verifyWrittenFile(host: TsBuildWatchSystem, f: string) { - assert.isTrue(host.writtenFiles.has(host.toFullPath(f)), `Expected to write ${f}: ${arrayFrom(host.writtenFiles.keys())}`); - } - - it("when fixing errors only changed file is emitted", () => { - const host = createSolutionWithIncrementalError(); - fixError(host); - assert.equal(host.writtenFiles.size, 3, `Expected to write only changed files: ${arrayFrom(host.writtenFiles.keys())}`); - verifyWrittenFile(host, outputs[0]); - verifyWrittenFile(host, outputs[1]); - verifyWrittenFile(host, outputs[4]); + verifyTscWatch({ + scenario, + subScenario: "reportErrors/declarationEmitErrors/introduceError/when fixing errors only changed file is emitted", + commandLineArgs: ["-b", "-w", subProject], + sys: () => createWatchedSystem( + [libFile, fileWithFixedError, fileWithoutError, tsconfig], + { currentDirectory: `${projectsLocation}/${solution}` } + ), + changes: [ + introduceError, + fixError + ] }); - it("when file with no error changes, declaration errors are reported", () => { - const host = createSolutionWithIncrementalError(); - host.writeFile(fileWithoutError.path, fileWithoutError.content.replace(/myClass/g, "myClass2")); - host.writtenFiles.clear(); - - incrementalBuild(host); - checkOutputErrorsIncremental(host, expectedDtsEmitErrors); - assert.equal(host.writtenFiles.size, 0, `Expected not to write any files: ${arrayFrom(host.writtenFiles.keys())}`); + verifyTscWatch({ + scenario, + subScenario: "reportErrors/declarationEmitErrors/introduceError/when file with no error changes", + commandLineArgs: ["-b", "-w", subProject], + sys: () => createWatchedSystem( + [libFile, fileWithFixedError, fileWithoutError, tsconfig], + { currentDirectory: `${projectsLocation}/${solution}` } + ), + changes: [ + introduceError, + changeFileWithoutError + ] }); }); }); @@ -1208,43 +1109,27 @@ export function gfoo() { }); }); - it("incremental updates in verbose mode", () => { - const host = createTsBuildWatchSystem(allFiles, { currentDirectory: projectsLocation }); - createSolutionBuilderWithWatch(host, [`${project}/${SubProject.tests}`], { verbose: true, watch: true }); - checkOutputErrorsInitial(host, emptyArray, /*disableConsoleClears*/ undefined, [ - `Projects in this build: \r\n * sample1/core/tsconfig.json\r\n * sample1/logic/tsconfig.json\r\n * sample1/tests/tsconfig.json\n\n`, - `Project 'sample1/core/tsconfig.json' is out of date because output file 'sample1/core/anotherModule.js' does not exist\n\n`, - `Building project '/user/username/projects/sample1/core/tsconfig.json'...\n\n`, - `Project 'sample1/logic/tsconfig.json' is out of date because output file 'sample1/logic/index.js' does not exist\n\n`, - `Building project '/user/username/projects/sample1/logic/tsconfig.json'...\n\n`, - `Project 'sample1/tests/tsconfig.json' is out of date because output file 'sample1/tests/index.js' does not exist\n\n`, - `Building project '/user/username/projects/sample1/tests/tsconfig.json'...\n\n` - ]); - verifyWatches(host); - - // Make non dts change - host.writeFile(logic[1].path, `${logic[1].content} + verifyTscWatch({ + scenario, + subScenario: "incremental updates in verbose mode", + commandLineArgs: ["-b", "-w", `${project}/${SubProject.tests}`, "-verbose"], + sys: () => createWatchedSystem(allFiles, { currentDirectory: projectsLocation }), + changes: [ + sys => { + sys.writeFile(logic[1].path, `${logic[1].content} function someFn() { }`); - host.checkTimeoutQueueLengthAndRun(1); // build logic - host.checkTimeoutQueueLengthAndRun(1); // build tests - checkOutputErrorsIncremental(host, emptyArray, /*disableConsoleClears*/ undefined, /*logsBeforeWatchDiagnostics*/ undefined, [ - `Project 'sample1/logic/tsconfig.json' is out of date because oldest output 'sample1/logic/index.js' is older than newest input 'sample1/core'\n\n`, - `Building project '/user/username/projects/sample1/logic/tsconfig.json'...\n\n`, - `Project 'sample1/tests/tsconfig.json' is up to date with .d.ts files from its dependencies\n\n`, - `Updating output timestamps of project '/user/username/projects/sample1/tests/tsconfig.json'...\n\n`, - ]); - - // Make dts change - host.writeFile(logic[1].path, `${logic[1].content} + sys.checkTimeoutQueueLengthAndRun(1); // build logic + sys.checkTimeoutQueueLengthAndRun(1); // build tests + return "Make non dts change"; + }, + sys => { + sys.writeFile(logic[1].path, `${logic[1].content} export function someFn() { }`); - host.checkTimeoutQueueLengthAndRun(1); // build logic - host.checkTimeoutQueueLengthAndRun(1); // build tests - checkOutputErrorsIncremental(host, emptyArray, /*disableConsoleClears*/ undefined, /*logsBeforeWatchDiagnostics*/ undefined, [ - `Project 'sample1/logic/tsconfig.json' is out of date because oldest output 'sample1/logic/index.js' is older than newest input 'sample1/core'\n\n`, - `Building project '/user/username/projects/sample1/logic/tsconfig.json'...\n\n`, - `Project 'sample1/tests/tsconfig.json' is out of date because oldest output 'sample1/tests/index.js' is older than newest input 'sample1/logic/tsconfig.json'\n\n`, - `Building project '/user/username/projects/sample1/tests/tsconfig.json'...\n\n`, - ]); + sys.checkTimeoutQueueLengthAndRun(1); // build logic + sys.checkTimeoutQueueLengthAndRun(1); // build tests + return "Make dts change"; + } + ], }); }); @@ -1255,14 +1140,14 @@ export function someFn() { }`); let zooFiles: File[]; let solutionFile: File; let baseConfig: File; - let allFilesExceptBase: File[]; + let allFiles: File[]; before(() => { coreFiles = subProjectFiles("core", ["tsconfig.json", "utilities.ts"]); animalFiles = subProjectFiles("animals", ["tsconfig.json", "animal.ts", "dog.ts", "index.ts"]); zooFiles = subProjectFiles("zoo", ["tsconfig.json", "zoo.ts"]); solutionFile = projectFile("tsconfig.json"); baseConfig = projectFile("tsconfig-base.json"); - allFilesExceptBase = [...coreFiles, ...animalFiles, ...zooFiles, solutionFile]; + allFiles = [...coreFiles, ...animalFiles, ...zooFiles, solutionFile, baseConfig, { path: libFile.path, content: libContent }]; }); after(() => { @@ -1271,103 +1156,59 @@ export function someFn() { }`); zooFiles = undefined!; solutionFile = undefined!; baseConfig = undefined!; - allFilesExceptBase = undefined!; + allFiles = undefined!; }); - it("updates with circular reference", () => { - const host = createTsBuildWatchSystem([ - ...allFilesExceptBase, - baseConfig, - { path: libFile.path, content: libContent } - ], { currentDirectory: projectLocation }); - host.writeFile(coreFiles[0].path, coreFiles[0].content.replace( - "}", - `}, + verifyTscWatch({ + scenario: "demo", + subScenario: "updates with circular reference", + commandLineArgs: ["-b", "-w", "-verbose"], + sys: () => { + const sys = createWatchedSystem(allFiles, { currentDirectory: projectLocation }); + sys.writeFile(coreFiles[0].path, coreFiles[0].content.replace( + "}", + `}, "references": [ { "path": "../zoo" } ]` - )); - createSolutionBuilderWithWatch(host, ["tsconfig.json"], { verbose: true, watch: true }); - checkOutputErrorsInitial(host, [ - `error TS6202: Project references may not form a circular graph. Cycle detected: /user/username/projects/demo/tsconfig.json\r\n/user/username/projects/demo/core/tsconfig.json\r\n/user/username/projects/demo/zoo/tsconfig.json\r\n/user/username/projects/demo/animals/tsconfig.json\n` - ], /*disableConsoleClears*/ undefined, [ - `Projects in this build: \r\n * animals/tsconfig.json\r\n * zoo/tsconfig.json\r\n * core/tsconfig.json\r\n * tsconfig.json\n\n` - ]); - verifyWatches(host); - - // Make changes - host.writeFile(coreFiles[0].path, coreFiles[0].content); - host.checkTimeoutQueueLengthAndRun(1); // build core - host.checkTimeoutQueueLengthAndRun(1); // build animals - host.checkTimeoutQueueLengthAndRun(1); // build zoo - host.checkTimeoutQueueLengthAndRun(1); // build solution - host.checkTimeoutQueueLength(0); - checkOutputErrorsIncremental(host, emptyArray, /*disableConsoleClears*/ undefined, /*logsBeforeWatchDiagnostics*/ undefined, [ - `Project 'core/tsconfig.json' is out of date because output file 'lib/core/utilities.js' does not exist\n\n`, - `Building project '/user/username/projects/demo/core/tsconfig.json'...\n\n`, - `Project 'animals/tsconfig.json' is out of date because output file 'lib/animals/animal.js' does not exist\n\n`, - `Building project '/user/username/projects/demo/animals/tsconfig.json'...\n\n`, - `Project 'zoo/tsconfig.json' is out of date because output file 'lib/zoo/zoo.js' does not exist\n\n`, - `Building project '/user/username/projects/demo/zoo/tsconfig.json'...\n\n`, - ]); + )); + return sys; + }, + changes: [ + sys => { + sys.writeFile(coreFiles[0].path, coreFiles[0].content); + sys.checkTimeoutQueueLengthAndRun(1); // build core + sys.checkTimeoutQueueLengthAndRun(1); // build animals + sys.checkTimeoutQueueLengthAndRun(1); // build zoo + sys.checkTimeoutQueueLengthAndRun(1); // build solution + sys.checkTimeoutQueueLength(0); + return "Fix error"; + } + ] }); - it("updates with bad reference", () => { - const host = createTsBuildWatchSystem([ - ...allFilesExceptBase, - baseConfig, - { path: libFile.path, content: libContent } - ], { currentDirectory: projectLocation }); - host.writeFile(coreFiles[1].path, `import * as A from '../animals'; + verifyTscWatch({ + scenario: "demo", + subScenario: "updates with bad reference", + commandLineArgs: ["-b", "-w", "-verbose"], + sys: () => { + const sys = createWatchedSystem(allFiles, { currentDirectory: projectLocation }); + sys.writeFile(coreFiles[1].path, `import * as A from '../animals'; ${coreFiles[1].content}`); - createSolutionBuilderWithWatch(host, ["tsconfig.json"], { verbose: true, watch: true }); - const errors = [ - `animals/index.ts(1,20): error TS6059: File '/user/username/projects/demo/animals/animal.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files.\n`, - `animals/index.ts(1,20): error TS6307: File '/user/username/projects/demo/animals/animal.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern.\n`, - `animals/index.ts(4,32): error TS6059: File '/user/username/projects/demo/animals/dog.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files.\n`, - `animals/index.ts(4,32): error TS6307: File '/user/username/projects/demo/animals/dog.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern.\n`, - `core/utilities.ts(1,1): error TS6133: 'A' is declared but its value is never read.\n`, - `core/utilities.ts(1,20): error TS6059: File '/user/username/projects/demo/animals/index.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files.\n`, - `core/utilities.ts(1,20): error TS6307: File '/user/username/projects/demo/animals/index.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern.\n` - ].map(hostOutputDiagnostic); - checkOutputErrors(host, [ - startingCompilationInWatchMode(), - hostOutputLog(`Projects in this build: \r\n * core/tsconfig.json\r\n * animals/tsconfig.json\r\n * zoo/tsconfig.json\r\n * tsconfig.json\n\n`), - hostOutputLog(`Project 'core/tsconfig.json' is out of date because output file 'lib/core/utilities.js' does not exist\n\n`), - hostOutputLog(`Building project '/user/username/projects/demo/core/tsconfig.json'...\n\n`), - ...errors, - hostOutputLog(`Project 'animals/tsconfig.json' can't be built because its dependency 'core' has errors\n\n`), - hostOutputLog(`Skipping build of project '/user/username/projects/demo/animals/tsconfig.json' because its dependency '/user/username/projects/demo/core' has errors\n\n`), - hostOutputLog(`Project 'zoo/tsconfig.json' can't be built because its dependency 'animals' was not built\n\n`), - hostOutputLog(`Skipping build of project '/user/username/projects/demo/zoo/tsconfig.json' because its dependency '/user/username/projects/demo/animals' was not built\n\n`), - foundErrorsWatching(errors) - ]); - verifyWatches(host); - - // Make changes - host.writeFile(coreFiles[1].path, ` + return sys; + }, + changes: [ + sys => { + sys.writeFile(coreFiles[1].path, ` import * as A from '../animals'; ${coreFiles[1].content}`); - const newErrors = [ - `animals/index.ts(1,20): error TS6059: File '/user/username/projects/demo/animals/animal.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files.\n`, - `animals/index.ts(1,20): error TS6307: File '/user/username/projects/demo/animals/animal.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern.\n`, - `animals/index.ts(4,32): error TS6059: File '/user/username/projects/demo/animals/dog.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files.\n`, - `animals/index.ts(4,32): error TS6307: File '/user/username/projects/demo/animals/dog.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern.\n`, - `core/utilities.ts(2,1): error TS6133: 'A' is declared but its value is never read.\n`, - `core/utilities.ts(2,20): error TS6059: File '/user/username/projects/demo/animals/index.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files.\n`, - `core/utilities.ts(2,20): error TS6307: File '/user/username/projects/demo/animals/index.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern.\n` - ].map(hostOutputDiagnostic); - host.checkTimeoutQueueLengthAndRun(1); // build core - host.checkTimeoutQueueLength(0); - checkOutputErrors(host, [ - fileChangeDetected(), - hostOutputLog(`Project 'core/tsconfig.json' is out of date because output file 'lib/core/utilities.js' does not exist\n\n`), - hostOutputLog(`Building project '/user/username/projects/demo/core/tsconfig.json'...\n\n`), - ...newErrors, - foundErrorsWatching(newErrors) - ]); + sys.checkTimeoutQueueLengthAndRun(1); // build core + sys.checkTimeoutQueueLength(0); + return "Prepend a line"; + } + ] }); function subProjectFiles(subProject: string, fileNames: readonly string[]): File[] { @@ -1377,57 +1218,32 @@ ${coreFiles[1].content}`); function projectFile(fileName: string): File { return getFileFromProject("demo", fileName); } - - function verifyWatches(host: TsBuildWatchSystem) { - checkWatchedFilesDetailed(host, allFilesExceptBase.map(f => f.path), 1); - checkWatchedDirectories(host, emptyArray, /*recursive*/ false); - checkWatchedDirectoriesDetailed( - host, - [`${projectLocation}/core`, `${projectLocation}/animals`, `${projectLocation}/zoo`], - 1, - /*recursive*/ true - ); - } }); describe("unittests:: tsbuild:: watchMode:: with noEmitOnError", () => { - it("does not emit any files on error", () => { - const projectLocation = `${projectsLocation}/noEmitOnError`; - const host = createTsBuildWatchSystem([ - ...["tsconfig.json", "shared/types/db.ts", "src/main.ts", "src/other.ts"] - .map(f => getFileFromProject("noEmitOnError", f)), - { path: libFile.path, content: libContent } - ], { currentDirectory: projectLocation }); - createSolutionBuilderWithWatch(host, ["tsconfig.json"], { verbose: true, watch: true }); - checkOutputErrorsInitial(host, [ - `src/main.ts(4,1): error TS1005: ',' expected.\n`, - ], /*disableConsoleClears*/ undefined, [ - `Projects in this build: \r\n * tsconfig.json\n\n`, - `Project 'tsconfig.json' is out of date because output file 'dev-build/shared/types/db.js' does not exist\n\n`, - `Building project '/user/username/projects/noEmitOnError/tsconfig.json'...\n\n`, - ]); - assert.equal(host.writtenFiles.size, 0, `Expected not to write any files: ${arrayFrom(host.writtenFiles.keys())}`); - - // Make changes - host.writeFile(`${projectLocation}/src/main.ts`, `import { A } from "../shared/types/db"; + verifyTscWatch({ + scenario: "noEmitOnError", + subScenario: "does not emit any files on error", + commandLineArgs: ["-b", "-w", "-verbose"], + sys: () => createWatchedSystem( + [ + ...["tsconfig.json", "shared/types/db.ts", "src/main.ts", "src/other.ts"] + .map(f => getFileFromProject("noEmitOnError", f)), + { path: libFile.path, content: libContent } + ], + { currentDirectory: `${projectsLocation}/noEmitOnError` } + ), + changes: [ + sys => { + sys.writeFile(`${projectsLocation}/noEmitOnError/src/main.ts`, `import { A } from "../shared/types/db"; const a = { lastName: 'sdsd' };`); - host.writtenFiles.clear(); - host.checkTimeoutQueueLengthAndRun(1); // build project - host.checkTimeoutQueueLength(0); - checkOutputErrorsIncremental(host, emptyArray, /*disableConsoleClears*/ undefined, /*logsBeforeWatchDiagnostics*/ undefined, [ - `Project 'tsconfig.json' is out of date because output file 'dev-build/shared/types/db.js' does not exist\n\n`, - `Building project '/user/username/projects/noEmitOnError/tsconfig.json'...\n\n`, - ]); - assert.equal(host.writtenFiles.size, 3, `Expected to write 3 files: Actual:: ${arrayFrom(host.writtenFiles.keys())}`); - for (const f of [ - `${projectLocation}/dev-build/shared/types/db.js`, - `${projectLocation}/dev-build/src/main.js`, - `${projectLocation}/dev-build/src/other.js`, - ]) { - assert.isTrue(host.writtenFiles.has(f.toLowerCase()), `Expected to write file: ${f}:: Actual:: ${arrayFrom(host.writtenFiles.keys())}`); - } + sys.checkTimeoutQueueLengthAndRun(1); // build project + sys.checkTimeoutQueueLength(0); + return "Fix error"; + } + ] }); }); } diff --git a/src/testRunner/unittests/tsc/helpers.ts b/src/testRunner/unittests/tsc/helpers.ts index ed3ac65cc9673..e2a38981ed280 100644 --- a/src/testRunner/unittests/tsc/helpers.ts +++ b/src/testRunner/unittests/tsc/helpers.ts @@ -29,6 +29,45 @@ namespace ts { baselineReadFileCalls?: boolean; } + export type CommandLineProgram = [Program, EmitAndSemanticDiagnosticsBuilderProgram?]; + export interface CommandLineCallbacks { + cb: ExecuteCommandLineCallbacks; + getPrograms: () => readonly CommandLineProgram[]; + } + + function isBuilderProgram(program: Program | EmitAndSemanticDiagnosticsBuilderProgram): program is EmitAndSemanticDiagnosticsBuilderProgram { + return !!(program as EmitAndSemanticDiagnosticsBuilderProgram).getState; + } + function isAnyProgram(program: Program | EmitAndSemanticDiagnosticsBuilderProgram | ParsedCommandLine): program is Program | EmitAndSemanticDiagnosticsBuilderProgram { + return !!(program as Program | EmitAndSemanticDiagnosticsBuilderProgram).getCompilerOptions; + } + export function commandLineCallbacks( + sys: System & { writtenFiles: Map; }, + originalReadCall?: System["readFile"] + ): CommandLineCallbacks { + let programs: CommandLineProgram[] | undefined; + + return { + cb: program => { + if (isAnyProgram(program)) { + baselineBuildInfo(program.getCompilerOptions(), sys, originalReadCall); + (programs || (programs = [])).push(isBuilderProgram(program) ? + [program.getProgram(), program] : + [program] + ); + } + else { + baselineBuildInfo(program.options, sys, originalReadCall); + } + }, + getPrograms: () => { + const result = programs || emptyArray; + programs = undefined; + return result; + } + }; + } + export function tscCompile(input: TscCompile) { const baseFs = input.fs(); const fs = baseFs.shadow(); @@ -41,6 +80,7 @@ namespace ts { // Create system const sys = new fakes.System(fs, { executingFilePath: "/lib/tsc" }) as TscCompileSystem; + fakes.patchHostForBuildInfoReadWrite(sys); const writtenFiles = sys.writtenFiles = createMap(); const originalWriteFile = sys.writeFile; sys.writeFile = (fileName, content, writeByteOrderMark) => { @@ -62,19 +102,14 @@ namespace ts { sys.exit = exitCode => sys.exitCode = exitCode; executeCommandLine( sys, - { - onCompilerHostCreate: host => fakes.patchHostForBuildInfoReadWrite(host), - onCompilationComplete: config => baselineBuildInfo([config], sys.vfs, sys.writtenFiles), - onSolutionBuilderHostCreate: host => fakes.patchSolutionBuilderHost(host, sys), - onSolutionBuildComplete: configs => baselineBuildInfo(configs, sys.vfs, sys.writtenFiles), - }, + commandLineCallbacks(sys, originalReadFile).cb, commandLineArgs, ); sys.write(`exitCode:: ExitStatus.${ExitStatus[sys.exitCode as ExitStatus]}\n`); if (baselineReadFileCalls) { sys.write(`readFiles:: ${JSON.stringify(actualReadFileMap, /*replacer*/ undefined, " ")} `); } - if (baselineSourceMap) generateSourceMapBaselineFiles(fs, mapDefinedIterator(writtenFiles.keys(), f => f.endsWith(".map") ? f : undefined)); + if (baselineSourceMap) generateSourceMapBaselineFiles(sys); // Baseline the errors fs.writeFileSync(`/lib/${buildKind || BuildKind.Initial}Output.txt`, sys.output.join("")); diff --git a/src/testRunner/unittests/tscWatch/consoleClearing.ts b/src/testRunner/unittests/tscWatch/consoleClearing.ts index cebfd5b7bc3de..27fffcd6e1272 100644 --- a/src/testRunner/unittests/tscWatch/consoleClearing.ts +++ b/src/testRunner/unittests/tscWatch/consoleClearing.ts @@ -1,71 +1,33 @@ namespace ts.tscWatch { describe("unittests:: tsc-watch:: console clearing", () => { - const currentDirectoryLog = "Current directory: / CaseSensitiveFileNames: false\n"; - const fileWatcherAddedLog = [ - "FileWatcher:: Added:: WatchInfo: /f.ts 250 undefined Source file\n", - "FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 undefined Source file\n" - ]; - + const scenario = "consoleClearing"; const file: File = { path: "/f.ts", content: "" }; - function getProgramSynchronizingLog(options: CompilerOptions) { - return [ - "Synchronizing program\n", - "CreatingProgramWith::\n", - " roots: [\"/f.ts\"]\n", - ` options: ${JSON.stringify(options)}\n` - ]; - } - - function isConsoleClearDisabled(options: CompilerOptions) { - return options.diagnostics || options.extendedDiagnostics || options.preserveWatchOutput; + function makeChangeToFile(sys: WatchedSystem) { + sys.modifyFile(file.path, "//"); + sys.runQueuedTimeoutCallbacks(); + return "Comment added to file f"; } - function verifyCompilation(host: WatchedSystem, options: CompilerOptions, initialDisableOptions?: CompilerOptions) { - const disableConsoleClear = isConsoleClearDisabled(options); - const hasLog = options.extendedDiagnostics || options.diagnostics; - checkOutputErrorsInitial(host, emptyArray, initialDisableOptions ? isConsoleClearDisabled(initialDisableOptions) : disableConsoleClear, hasLog ? [ - currentDirectoryLog, - ...getProgramSynchronizingLog(options), - ...(options.extendedDiagnostics ? fileWatcherAddedLog : emptyArray) - ] : undefined); - host.modifyFile(file.path, "//"); - host.runQueuedTimeoutCallbacks(); - checkOutputErrorsIncremental(host, emptyArray, disableConsoleClear, hasLog ? [ - "FileWatcher:: Triggered with /f.ts 1:: WatchInfo: /f.ts 250 undefined Source file\n", - "Scheduling update\n", - "Elapsed:: 0ms FileWatcher:: Triggered with /f.ts 1:: WatchInfo: /f.ts 250 undefined Source file\n" - ] : undefined, hasLog ? getProgramSynchronizingLog(options) : undefined); - } - - function checkConsoleClearingUsingCommandLineOptions(options: CompilerOptions = {}) { - const files = [file, libFile]; - const host = createWatchedSystem(files); - createWatchOfFilesAndCompilerOptions([file.path], host, options); - verifyCompilation(host, options); + function checkConsoleClearingUsingCommandLineOptions(subScenario: string, commandLineOptions?: string[]) { + verifyTscWatch({ + scenario, + subScenario, + commandLineArgs: ["--w", file.path, ...commandLineOptions || emptyArray], + sys: () => createWatchedSystem([file, libFile]), + changes: [ + makeChangeToFile + ], + }); } - it("without --diagnostics or --extendedDiagnostics", () => { - checkConsoleClearingUsingCommandLineOptions(); - }); - it("with --diagnostics", () => { - checkConsoleClearingUsingCommandLineOptions({ - diagnostics: true, - }); - }); - it("with --extendedDiagnostics", () => { - checkConsoleClearingUsingCommandLineOptions({ - extendedDiagnostics: true, - }); - }); - it("with --preserveWatchOutput", () => { - checkConsoleClearingUsingCommandLineOptions({ - preserveWatchOutput: true, - }); - }); + checkConsoleClearingUsingCommandLineOptions("without --diagnostics or --extendedDiagnostics"); + checkConsoleClearingUsingCommandLineOptions("with --diagnostics", ["--diagnostics"]); + checkConsoleClearingUsingCommandLineOptions("with --extendedDiagnostics", ["--extendedDiagnostics"]); + checkConsoleClearingUsingCommandLineOptions("with --preserveWatchOutput", ["--preserveWatchOutput"]); describe("when preserveWatchOutput is true in config file", () => { const compilerOptions: CompilerOptions = { @@ -77,20 +39,30 @@ namespace ts.tscWatch { }; const files = [file, configFile, libFile]; it("using createWatchOfConfigFile ", () => { - const host = createWatchedSystem(files); - createWatchOfConfigFile(configFile.path, host); + const sys = TestFSWithWatch.changeToHostTrackingWrittenFiles( + createWatchedSystem(files) + ); + const watch = createWatchOfConfigFile(configFile.path, sys); // Initially console is cleared if --preserveOutput is not provided since the config file is yet to be parsed - verifyCompilation(host, compilerOptions, {}); + runWatchBaseline({ + scenario, + subScenario: "when preserveWatchOutput is true in config file/createWatchOfConfigFile", + commandLineArgs: ["--w", "-p", configFile.path], + sys, + getPrograms: () => [[watch(), watch.getBuilderProgram()]], + changes: [ + makeChangeToFile + ] + }); }); - it("when createWatchProgram is invoked with configFileParseResult on WatchCompilerHostOfConfigFile", () => { - const host = createWatchedSystem(files); - const reportDiagnostic = createDiagnosticReporter(host); - const optionsToExtend: CompilerOptions = {}; - const configParseResult = parseConfigFileWithSystem(configFile.path, optionsToExtend, /*watchOptionsToExtend*/ undefined, host, reportDiagnostic)!; - const watchCompilerHost = createWatchCompilerHostOfConfigFile(configParseResult.options.configFilePath!, optionsToExtend, /*watchOptionsToExtend*/ undefined, host, /*createProgram*/ undefined, reportDiagnostic, createWatchStatusReporter(host)); - watchCompilerHost.configFileParsingResult = configParseResult; - createWatchProgram(watchCompilerHost); - verifyCompilation(host, compilerOptions); + verifyTscWatch({ + scenario, + subScenario: "when preserveWatchOutput is true in config file/when createWatchProgram is invoked with configFileParseResult on WatchCompilerHostOfConfigFile", + commandLineArgs: ["--w", "-p", configFile.path], + sys: () => createWatchedSystem(files), + changes: [ + makeChangeToFile + ], }); }); }); diff --git a/src/testRunner/unittests/tscWatch/emit.ts b/src/testRunner/unittests/tscWatch/emit.ts index 01264019962af..98be86a0f7392 100644 --- a/src/testRunner/unittests/tscWatch/emit.ts +++ b/src/testRunner/unittests/tscWatch/emit.ts @@ -1,718 +1,511 @@ namespace ts.tscWatch { - function getEmittedLineForMultiFileOutput(file: File, host: WatchedSystem) { - return `TSFILE: ${file.path.replace(".ts", ".js")}${host.newLine}`; - } - - function getEmittedLineForSingleFileOutput(filename: string, host: WatchedSystem) { - return `TSFILE: ${filename}${host.newLine}`; - } - - interface FileOrFolderEmit extends File { - output?: string; - } - - function getFileOrFolderEmit(file: File, getOutput?: (file: File) => string): FileOrFolderEmit { - const result = file as FileOrFolderEmit; - if (getOutput) { - result.output = getOutput(file); - } - return result; - } - - function getEmittedLines(files: FileOrFolderEmit[]) { - const seen = createMap(); - const result: string[] = []; - for (const { output } of files) { - if (output && !seen.has(output)) { - seen.set(output, true); - result.push(output); - } - } - return result; - } - - function checkAffectedLines(host: WatchedSystem, affectedFiles: FileOrFolderEmit[], allEmittedFiles: string[]) { - const expectedAffectedFiles = getEmittedLines(affectedFiles); - const expectedNonAffectedFiles = mapDefined(allEmittedFiles, line => contains(expectedAffectedFiles, line) ? undefined : line); - checkOutputContains(host, expectedAffectedFiles); - checkOutputDoesNotContain(host, expectedNonAffectedFiles); - } - + const scenario = "emit"; describe("unittests:: tsc-watch:: emit with outFile or out setting", () => { - function createWatchForOut(out?: string, outFile?: string) { - const host = createWatchedSystem([]); - const config: FileOrFolderEmit = { - path: "/a/tsconfig.json", - content: JSON.stringify({ - compilerOptions: { listEmittedFiles: true } - }) - }; - - let getOutput: (file: File) => string; - if (out) { - config.content = JSON.stringify({ - compilerOptions: { listEmittedFiles: true, out } - }); - getOutput = __ => getEmittedLineForSingleFileOutput(out, host); - } - else if (outFile) { - config.content = JSON.stringify({ - compilerOptions: { listEmittedFiles: true, outFile } - }); - getOutput = __ => getEmittedLineForSingleFileOutput(outFile, host); - } - else { - getOutput = file => getEmittedLineForMultiFileOutput(file, host); - } - - const f1 = getFileOrFolderEmit({ - path: "/a/a.ts", - content: "let x = 1" - }, getOutput); - const f2 = getFileOrFolderEmit({ - path: "/a/b.ts", - content: "let y = 1" - }, getOutput); - - const files = [f1, f2, config, libFile]; - host.reloadFS(files); - createWatchOfConfigFile(config.path, host); - - const allEmittedLines = getEmittedLines(files); - checkOutputContains(host, allEmittedLines); - host.clearOutput(); - - f1.content = "let x = 11"; - host.reloadFS(files); - host.runQueuedTimeoutCallbacks(); - checkAffectedLines(host, [f1], allEmittedLines); + function verifyOutAndOutFileSetting(subScenario: string, out?: string, outFile?: string) { + verifyTscWatch({ + scenario, + subScenario: `emit with outFile or out setting/${subScenario}`, + commandLineArgs: ["--w", "-p", "/a/tsconfig.json"], + sys: () => { + const config: File = { + path: "/a/tsconfig.json", + content: JSON.stringify({ compilerOptions: { out, outFile } }) + }; + const f1: File = { + path: "/a/a.ts", + content: "let x = 1" + }; + const f2: File = { + path: "/a/b.ts", + content: "let y = 1" + }; + return createWatchedSystem([f1, f2, config, libFile]); + }, + changes: [ + sys => { + sys.writeFile("/a/a.ts", "let x = 11"); + sys.runQueuedTimeoutCallbacks(); + return "Make change in the file"; + } + ] + }); } - - it("projectUsesOutFile should not be returned if not set", () => { - createWatchForOut(); - }); - - it("projectUsesOutFile should be true if out is set", () => { - const outJs = "/a/out.js"; - createWatchForOut(outJs); - }); - - it("projectUsesOutFile should be true if outFile is set", () => { - const outJs = "/a/out.js"; - createWatchForOut(/*out*/ undefined, outJs); - }); - - function verifyFilesEmittedOnce(useOutFile: boolean) { - const file1: File = { - path: "/a/b/output/AnotherDependency/file1.d.ts", - content: "declare namespace Common.SomeComponent.DynamicMenu { enum Z { Full = 0, Min = 1, Average = 2, } }" - }; - const file2: File = { - path: "/a/b/dependencies/file2.d.ts", - content: "declare namespace Dependencies.SomeComponent { export class SomeClass { version: string; } }" - }; - const file3: File = { - path: "/a/b/project/src/main.ts", - content: "namespace Main { export function fooBar() {} }" - }; - const file4: File = { - path: "/a/b/project/src/main2.ts", - content: "namespace main.file4 { import DynamicMenu = Common.SomeComponent.DynamicMenu; export function foo(a: DynamicMenu.z) { } }" - }; - const configFile: File = { - path: "/a/b/project/tsconfig.json", - content: JSON.stringify({ - compilerOptions: useOutFile ? - { outFile: "../output/common.js", target: "es5" } : - { outDir: "../output", target: "es5" }, - files: [file1.path, file2.path, file3.path, file4.path] - }) - }; - const files = [file1, file2, file3, file4]; - const allfiles = files.concat(configFile); - const host = createWatchedSystem(allfiles); - const originalWriteFile = host.writeFile.bind(host); - const mapOfFilesWritten = createMap(); - host.writeFile = (p: string, content: string) => { - const count = mapOfFilesWritten.get(p); - mapOfFilesWritten.set(p, count ? count + 1 : 1); - return originalWriteFile(p, content); - }; - createWatchOfConfigFile(configFile.path, host); - if (useOutFile) { - // Only out file - assert.equal(mapOfFilesWritten.size, 1); - } - else { - // main.js and main2.js - assert.equal(mapOfFilesWritten.size, 2); - } - mapOfFilesWritten.forEach((value, key) => { - assert.equal(value, 1, "Key: " + key); + verifyOutAndOutFileSetting("config does not have out or outFile"); + verifyOutAndOutFileSetting("config has out", "/a/out.js"); + verifyOutAndOutFileSetting("config has outFile", /*out*/ undefined, "/a/out.js"); + + function verifyFilesEmittedOnce(subScenario: string, useOutFile: boolean) { + verifyTscWatch({ + scenario, + subScenario: `emit with outFile or out setting/${subScenario}`, + commandLineArgs: ["--w", "-p", "/a/b/project/tsconfig.json"], + sys: () => { + const file1: File = { + path: "/a/b/output/AnotherDependency/file1.d.ts", + content: "declare namespace Common.SomeComponent.DynamicMenu { enum Z { Full = 0, Min = 1, Average = 2, } }" + }; + const file2: File = { + path: "/a/b/dependencies/file2.d.ts", + content: "declare namespace Dependencies.SomeComponent { export class SomeClass { version: string; } }" + }; + const file3: File = { + path: "/a/b/project/src/main.ts", + content: "namespace Main { export function fooBar() {} }" + }; + const file4: File = { + path: "/a/b/project/src/main2.ts", + content: "namespace main.file4 { import DynamicMenu = Common.SomeComponent.DynamicMenu; export function foo(a: DynamicMenu.z) { } }" + }; + const configFile: File = { + path: "/a/b/project/tsconfig.json", + content: JSON.stringify({ + compilerOptions: useOutFile ? + { outFile: "../output/common.js", target: "es5" } : + { outDir: "../output", target: "es5" }, + files: [file1.path, file2.path, file3.path, file4.path] + }) + }; + return createWatchedSystem([file1, file2, file3, file4, libFile, configFile]); + }, + changes: emptyArray }); } - - it("with --outFile and multiple declaration files in the program", () => { - verifyFilesEmittedOnce(/*useOutFile*/ true); - }); - - it("without --outFile and multiple declaration files in the program", () => { - verifyFilesEmittedOnce(/*useOutFile*/ false); - }); + verifyFilesEmittedOnce("with --outFile and multiple declaration files in the program", /*useOutFile*/ true); + verifyFilesEmittedOnce("without --outFile and multiple declaration files in the program", /*useOutFile*/ false); }); describe("unittests:: tsc-watch:: emit for configured projects", () => { const file1Consumer1Path = "/a/b/file1Consumer1.ts"; + const file1Consumer2Path = "/a/b/file1Consumer2.ts"; const moduleFile1Path = "/a/b/moduleFile1.ts"; + const moduleFile2Path = "/a/b/moduleFile2.ts"; + const globalFilePath = "/a/b/globalFile3.ts"; const configFilePath = "/a/b/tsconfig.json"; - interface InitialStateParams { + interface VerifyTscWatchEmit { + subScenario: string; /** custom config file options */ configObj?: any; - /** list of the files that will be emitted for first compilation */ - firstCompilationEmitFiles?: string[]; - /** get the emit file for file - default is multi file emit line */ - getEmitLine?(file: File, host: WatchedSystem): string; /** Additional files and folders to add */ - getAdditionalFileOrFolder?(): File[]; + getAdditionalFileOrFolder?: () => File[]; /** initial list of files to emit if not the default list */ firstReloadFileList?: string[]; + changes: TscWatchCompileChange[] } - function getInitialState({ configObj = {}, firstCompilationEmitFiles, getEmitLine, getAdditionalFileOrFolder, firstReloadFileList }: InitialStateParams = {}) { - const host = createWatchedSystem([]); - const getOutputName = getEmitLine ? (file: File) => getEmitLine(file, host) : - (file: File) => getEmittedLineForMultiFileOutput(file, host); - - const moduleFile1 = getFileOrFolderEmit({ - path: moduleFile1Path, - content: "export function Foo() { };", - }, getOutputName); - - const file1Consumer1 = getFileOrFolderEmit({ - path: file1Consumer1Path, - content: `import {Foo} from "./moduleFile1"; export var y = 10;`, - }, getOutputName); - - const file1Consumer2 = getFileOrFolderEmit({ - path: "/a/b/file1Consumer2.ts", - content: `import {Foo} from "./moduleFile1"; let z = 10;`, - }, getOutputName); - - const moduleFile2 = getFileOrFolderEmit({ - path: "/a/b/moduleFile2.ts", - content: `export var Foo4 = 10;`, - }, getOutputName); - - const globalFile3 = getFileOrFolderEmit({ - path: "/a/b/globalFile3.ts", - content: `interface GlobalFoo { age: number }` - }); - - const additionalFiles = getAdditionalFileOrFolder ? - map(getAdditionalFileOrFolder(), file => getFileOrFolderEmit(file, getOutputName)) : - []; - - (configObj.compilerOptions || (configObj.compilerOptions = {})).listEmittedFiles = true; - const configFile = getFileOrFolderEmit({ - path: configFilePath, - content: JSON.stringify(configObj) + function verifyTscWatchEmit({ + subScenario, + configObj, + getAdditionalFileOrFolder, + firstReloadFileList, + changes + }: VerifyTscWatchEmit) { + verifyTscWatch({ + scenario, + subScenario: `emit for configured projects/${subScenario}`, + commandLineArgs: ["--w", "-p", configFilePath], + sys: () => { + const moduleFile1: File = { + path: moduleFile1Path, + content: "export function Foo() { };", + }; + + const file1Consumer1: File = { + path: file1Consumer1Path, + content: `import {Foo} from "./moduleFile1"; export var y = 10;`, + }; + + const file1Consumer2: File = { + path: file1Consumer2Path, + content: `import {Foo} from "./moduleFile1"; let z = 10;`, + }; + + const moduleFile2: File = { + path: moduleFile2Path, + content: `export var Foo4 = 10;`, + }; + + const globalFile3: File = { + path: globalFilePath, + content: `interface GlobalFoo { age: number }` + }; + const configFile: File = { + path: configFilePath, + content: JSON.stringify(configObj || {}) + }; + const additionalFiles = getAdditionalFileOrFolder?.() || emptyArray; + const files = [moduleFile1, file1Consumer1, file1Consumer2, globalFile3, moduleFile2, configFile, libFile, ...additionalFiles]; + return createWatchedSystem(firstReloadFileList ? + map(firstReloadFileList, fileName => find(files, file => file.path === fileName)!) : + files + ); + }, + changes }); - - const files = [moduleFile1, file1Consumer1, file1Consumer2, globalFile3, moduleFile2, configFile, libFile, ...additionalFiles]; - let allEmittedFiles = getEmittedLines(files); - host.reloadFS(firstReloadFileList ? getFiles(firstReloadFileList) : files); - - // Initial compile - createWatchOfConfigFile(configFile.path, host); - if (firstCompilationEmitFiles) { - checkAffectedLines(host, getFiles(firstCompilationEmitFiles), allEmittedFiles); - } - else { - checkOutputContains(host, allEmittedFiles); - } - host.clearOutput(); - - return { - moduleFile1, file1Consumer1, file1Consumer2, moduleFile2, globalFile3, configFile, - files, - getFile, - verifyAffectedFiles, - verifyAffectedAllFiles, - getOutputName - }; - - function getFiles(filelist: string[]) { - return map(filelist, getFile); - } - - function getFile(fileName: string) { - return find(files, file => file.path === fileName)!; - } - - function verifyAffectedAllFiles() { - host.reloadFS(files); - host.checkTimeoutQueueLengthAndRun(1); - checkOutputContains(host, allEmittedFiles); - host.clearOutput(); - } - - function verifyAffectedFiles(expected: FileOrFolderEmit[], filesToReload?: FileOrFolderEmit[]) { - if (!filesToReload) { - filesToReload = files; - } - else if (filesToReload.length > files.length) { - allEmittedFiles = getEmittedLines(filesToReload); - } - host.reloadFS(filesToReload); - host.checkTimeoutQueueLengthAndRun(1); - checkAffectedLines(host, expected, allEmittedFiles); - host.clearOutput(); - } } - it("should contains only itself if a module file's shape didn't change, and all files referencing it if its shape changed", () => { - const { - moduleFile1, file1Consumer1, file1Consumer2, - verifyAffectedFiles - } = getInitialState(); - - // Change the content of moduleFile1 to `export var T: number;export function Foo() { };` - moduleFile1.content = `export var T: number;export function Foo() { };`; - verifyAffectedFiles([moduleFile1, file1Consumer1, file1Consumer2]); + function modifyModuleFile1Shape(sys: WatchedSystem) { + sys.writeFile(moduleFile1Path, `export var T: number;export function Foo() { };`); + } + function changeModuleFile1Shape(sys: WatchedSystem) { + modifyModuleFile1Shape(sys); + sys.checkTimeoutQueueLengthAndRun(1); + return "Change the content of moduleFile1 to `export var T: number;export function Foo() { };`"; + } - // Change the content of moduleFile1 to `export var T: number;export function Foo() { console.log('hi'); };` - moduleFile1.content = `export var T: number;export function Foo() { console.log('hi'); };`; - verifyAffectedFiles([moduleFile1]); + verifyTscWatchEmit({ + subScenario: "should contains only itself if a module file's shape didn't change, and all files referencing it if its shape changed", + changes: [ + changeModuleFile1Shape, + sys => { + sys.writeFile(moduleFile1Path, `export var T: number;export function Foo() { console.log('hi'); };`); + sys.checkTimeoutQueueLengthAndRun(1); + return "Change the content of moduleFile1 to `export var T: number;export function Foo() { console.log('hi'); };`"; + } + ] }); - it("should be up-to-date with the reference map changes", () => { - const { - moduleFile1, file1Consumer1, file1Consumer2, - verifyAffectedFiles - } = getInitialState(); - - // Change file1Consumer1 content to `export let y = Foo();` - file1Consumer1.content = `export let y = Foo();`; - verifyAffectedFiles([file1Consumer1]); - - // Change the content of moduleFile1 to `export var T: number;export function Foo() { };` - moduleFile1.content = `export var T: number;export function Foo() { };`; - verifyAffectedFiles([moduleFile1, file1Consumer2]); - - // Add the import statements back to file1Consumer1 - file1Consumer1.content = `import {Foo} from "./moduleFile1";let y = Foo();`; - verifyAffectedFiles([file1Consumer1]); - - // Change the content of moduleFile1 to `export var T: number;export var T2: string;export function Foo() { };` - moduleFile1.content = `export var T: number;export var T2: string;export function Foo() { };`; - verifyAffectedFiles([moduleFile1, file1Consumer2, file1Consumer1]); - - // Multiple file edits in one go: - - // Change file1Consumer1 content to `export let y = Foo();` - // Change the content of moduleFile1 to `export var T: number;export function Foo() { };` - file1Consumer1.content = `export let y = Foo();`; - moduleFile1.content = `export var T: number;export function Foo() { };`; - verifyAffectedFiles([moduleFile1, file1Consumer1, file1Consumer2]); + verifyTscWatchEmit({ + subScenario: "should be up-to-date with the reference map changes", + changes: [ + sys => { + sys.writeFile(file1Consumer1Path, `export let y = Foo();`); + sys.checkTimeoutQueueLengthAndRun(1); + return "Change file1Consumer1 content to `export let y = Foo();`"; + }, + changeModuleFile1Shape, + sys => { + sys.writeFile(file1Consumer1Path, `import {Foo} from "./moduleFile1";let y = Foo();`); + sys.checkTimeoutQueueLengthAndRun(1); + return "Add the import statements back to file1Consumer1"; + }, + sys => { + sys.writeFile(moduleFile1Path, `export let y = Foo();`); + sys.checkTimeoutQueueLengthAndRun(1); + return "Change the content of moduleFile1 to `export var T: number;export var T2: string;export function Foo() { };`"; + }, + sys => { + // Change file1Consumer1 content to `export let y = Foo();` + // Change the content of moduleFile1 to `export var T: number;export function Foo() { };` + sys.writeFile(file1Consumer1Path, `import {Foo} from "./moduleFile1";let y = Foo();`); + modifyModuleFile1Shape(sys); + sys.checkTimeoutQueueLengthAndRun(1); + return "Multiple file edits in one go"; + } + ] }); - it("should be up-to-date with deleted files", () => { - const { - moduleFile1, file1Consumer1, file1Consumer2, - files, - verifyAffectedFiles - } = getInitialState(); - - // Change the content of moduleFile1 to `export var T: number;export function Foo() { };` - moduleFile1.content = `export var T: number;export function Foo() { };`; - - // Delete file1Consumer2 - const filesToLoad = mapDefined(files, file => file === file1Consumer2 ? undefined : file); - verifyAffectedFiles([moduleFile1, file1Consumer1], filesToLoad); + verifyTscWatchEmit({ + subScenario: "should be up-to-date with deleted files", + changes: [ + sys => { + modifyModuleFile1Shape(sys); + sys.deleteFile(file1Consumer2Path); + sys.checkTimeoutQueueLengthAndRun(1); + return "change moduleFile1 shape and delete file1Consumer2"; + } + ] }); - it("should be up-to-date with newly created files", () => { - const { - moduleFile1, file1Consumer1, file1Consumer2, - files, - verifyAffectedFiles, - getOutputName - } = getInitialState(); - - const file1Consumer3 = getFileOrFolderEmit({ - path: "/a/b/file1Consumer3.ts", - content: `import {Foo} from "./moduleFile1"; let y = Foo();` - }, getOutputName); - moduleFile1.content = `export var T: number;export function Foo() { };`; - verifyAffectedFiles([moduleFile1, file1Consumer1, file1Consumer3, file1Consumer2], files.concat(file1Consumer3)); + verifyTscWatchEmit({ + subScenario: "should be up-to-date with newly created files", + changes: [ + sys => { + sys.writeFile("/a/b/file1Consumer3.ts", `import {Foo} from "./moduleFile1"; let y = Foo();`); + modifyModuleFile1Shape(sys); + sys.checkTimeoutQueueLengthAndRun(1); + return "change moduleFile1 shape and create file1Consumer3"; + } + ] }); - it("should detect changes in non-root files", () => { - const { - moduleFile1, file1Consumer1, - verifyAffectedFiles - } = getInitialState({ configObj: { files: [file1Consumer1Path] }, firstCompilationEmitFiles: [file1Consumer1Path, moduleFile1Path] }); - - moduleFile1.content = `export var T: number;export function Foo() { };`; - verifyAffectedFiles([moduleFile1, file1Consumer1]); - - // change file1 internal, and verify only file1 is affected - moduleFile1.content += "var T1: number;"; - verifyAffectedFiles([moduleFile1]); + verifyTscWatchEmit({ + subScenario: "should detect changes in non-root files", + configObj: { files: [file1Consumer1Path] }, + changes: [ + changeModuleFile1Shape, + sys => { + sys.appendFile(moduleFile1Path, "var T1: number;"); + sys.checkTimeoutQueueLengthAndRun(1); + return "change file1 internal, and verify only file1 is affected"; + } + ] }); - it("should return all files if a global file changed shape", () => { - const { - globalFile3, verifyAffectedAllFiles - } = getInitialState(); - - globalFile3.content += "var T2: string;"; - verifyAffectedAllFiles(); + verifyTscWatchEmit({ + subScenario: "should return all files if a global file changed shape", + changes: [ + sys => { + sys.appendFile(globalFilePath, "var T2: string;"); + sys.checkTimeoutQueueLengthAndRun(1); + return "change shape of global file"; + } + ] }); - it("should always return the file itself if '--isolatedModules' is specified", () => { - const { - moduleFile1, verifyAffectedFiles - } = getInitialState({ configObj: { compilerOptions: { isolatedModules: true } } }); - - moduleFile1.content = `export var T: number;export function Foo() { };`; - verifyAffectedFiles([moduleFile1]); + verifyTscWatchEmit({ + subScenario: "should always return the file itself if '--isolatedModules' is specified", + configObj: { compilerOptions: { isolatedModules: true } }, + changes: [ + changeModuleFile1Shape + ] }); - it("should always return the file itself if '--out' or '--outFile' is specified", () => { - const outFilePath = "/a/b/out.js"; - const { - moduleFile1, verifyAffectedFiles - } = getInitialState({ - configObj: { compilerOptions: { module: "system", outFile: outFilePath } }, - getEmitLine: (_, host) => getEmittedLineForSingleFileOutput(outFilePath, host) - }); - - moduleFile1.content = `export var T: number;export function Foo() { };`; - verifyAffectedFiles([moduleFile1]); + verifyTscWatchEmit({ + subScenario: "should always return the file itself if '--out' or '--outFile' is specified", + configObj: { compilerOptions: { module: "system", outFile: "/a/b/out.js" } }, + changes: [ + changeModuleFile1Shape + ] }); - it("should return cascaded affected file list", () => { - const file1Consumer1Consumer1: File = { + verifyTscWatchEmit({ + subScenario: "should return cascaded affected file list", + getAdditionalFileOrFolder: () => [{ path: "/a/b/file1Consumer1Consumer1.ts", content: `import {y} from "./file1Consumer1";` - }; - const { - moduleFile1, file1Consumer1, file1Consumer2, verifyAffectedFiles, getFile - } = getInitialState({ - getAdditionalFileOrFolder: () => [file1Consumer1Consumer1] - }); - - const file1Consumer1Consumer1Emit = getFile(file1Consumer1Consumer1.path); - file1Consumer1.content += "export var T: number;"; - verifyAffectedFiles([file1Consumer1, file1Consumer1Consumer1Emit]); - - // Doesnt change the shape of file1Consumer1 - moduleFile1.content = `export var T: number;export function Foo() { };`; - verifyAffectedFiles([moduleFile1, file1Consumer1, file1Consumer2]); - - // Change both files before the timeout - file1Consumer1.content += "export var T2: number;"; - moduleFile1.content = `export var T2: number;export function Foo() { };`; - verifyAffectedFiles([moduleFile1, file1Consumer1, file1Consumer2, file1Consumer1Consumer1Emit]); + }], + changes: [ + sys => { + sys.appendFile(file1Consumer1Path, "export var T: number;"); + sys.checkTimeoutQueueLengthAndRun(1); + return "change file1Consumer1"; + }, + changeModuleFile1Shape, + sys => { + sys.appendFile(file1Consumer1Path, "export var T2: number;"); + sys.writeFile(moduleFile1Path, `export var T2: number;export function Foo() { };`); + sys.checkTimeoutQueueLengthAndRun(1); + return "change file1Consumer1 and moduleFile1"; + } + ] }); - it("should work fine for files with circular references", () => { - // TODO: do not exit on such errors? Just continue to watch the files for update in watch mode - - const file1: File = { - path: "/a/b/file1.ts", - content: ` - /// - export var t1 = 10;` - }; - const file2: File = { - path: "/a/b/file2.ts", - content: ` - /// - export var t2 = 10;` - }; - const { - configFile, - getFile, - verifyAffectedFiles - } = getInitialState({ - firstCompilationEmitFiles: [file1.path, file2.path], - getAdditionalFileOrFolder: () => [file1, file2], - firstReloadFileList: [libFile.path, file1.path, file2.path, configFilePath] - }); - const file1Emit = getFile(file1.path), file2Emit = getFile(file2.path); - - file1Emit.content += "export var t3 = 10;"; - verifyAffectedFiles([file1Emit, file2Emit], [file1, file2, libFile, configFile]); - + verifyTscWatchEmit({ + subScenario: "should work fine for files with circular references", + getAdditionalFileOrFolder: () => [ + { + path: "/a/b/file1.ts", + content: `/// +export var t1 = 10;` + }, + { + path: "/a/b/file2.ts", + content: `/// +export var t2 = 10;` + } + ], + firstReloadFileList: [libFile.path, "/a/b/file1.ts", "/a/b/file2.ts", configFilePath], + changes: [ + sys => { + sys.appendFile("/a/b/file1.ts", "export var t3 = 10;"); + sys.checkTimeoutQueueLengthAndRun(1); + return "change file1"; + } + ] }); - it("should detect removed code file", () => { - const referenceFile1: File = { + verifyTscWatchEmit({ + subScenario: "should detect removed code file", + getAdditionalFileOrFolder: () => [{ path: "/a/b/referenceFile1.ts", - content: ` - /// - export var x = Foo();` - }; - const { - configFile, - getFile, - verifyAffectedFiles - } = getInitialState({ - firstCompilationEmitFiles: [referenceFile1.path, moduleFile1Path], - getAdditionalFileOrFolder: () => [referenceFile1], - firstReloadFileList: [libFile.path, referenceFile1.path, moduleFile1Path, configFilePath] - }); - - const referenceFile1Emit = getFile(referenceFile1.path); - verifyAffectedFiles([referenceFile1Emit], [libFile, referenceFile1Emit, configFile]); + content: `/// +export var x = Foo();` + }], + firstReloadFileList: [libFile.path, "/a/b/referenceFile1.ts", moduleFile1Path, configFilePath], + changes: [ + sys => { + sys.deleteFile(moduleFile1Path); + sys.checkTimeoutQueueLengthAndRun(1); + return "delete moduleFile1"; + } + ] }); - it("should detect non-existing code file", () => { - const referenceFile1: File = { + verifyTscWatchEmit({ + subScenario: "should detect non existing code file", + getAdditionalFileOrFolder: () => [{ path: "/a/b/referenceFile1.ts", - content: ` - /// - export var x = Foo();` - }; - const { - configFile, - moduleFile2, - getFile, - verifyAffectedFiles - } = getInitialState({ - firstCompilationEmitFiles: [referenceFile1.path], - getAdditionalFileOrFolder: () => [referenceFile1], - firstReloadFileList: [libFile.path, referenceFile1.path, configFilePath] - }); - - const referenceFile1Emit = getFile(referenceFile1.path); - referenceFile1Emit.content += "export var yy = Foo();"; - verifyAffectedFiles([referenceFile1Emit], [libFile, referenceFile1Emit, configFile]); - - // Create module File2 and see both files are saved - verifyAffectedFiles([referenceFile1Emit, moduleFile2], [libFile, moduleFile2, referenceFile1Emit, configFile]); + content: `/// +export var x = Foo();` + }], + firstReloadFileList: [libFile.path, "/a/b/referenceFile1.ts", configFilePath], + changes: [ + sys => { + sys.appendFile("/a/b/referenceFile1.ts", "export var yy = Foo();"); + sys.checkTimeoutQueueLengthAndRun(1); + return "edit refereceFile1"; + }, + sys => { + sys.writeFile(moduleFile2Path, "export var Foo4 = 10;"); + sys.checkTimeoutQueueLengthAndRun(1); + return "create moduleFile2"; + } + ] }); }); describe("unittests:: tsc-watch:: emit file content", () => { - interface EmittedFile extends File { - shouldBeWritten: boolean; + function verifyNewLine(subScenario: string, newLine: string) { + verifyTscWatch({ + scenario, + subScenario: `emit file content/${subScenario}`, + commandLineArgs: ["--w", "/a/app.ts"], + sys: () => createWatchedSystem( + [ + { + path: "/a/app.ts", + content: ["var x = 1;", "var y = 2;"].join(newLine) + }, + libFile + ], + { newLine } + ), + changes: [ + sys => { + sys.appendFile("/a/app.ts", newLine + "var z = 3;"); + sys.checkTimeoutQueueLengthAndRun(1); + return "Append a line"; + } + ], + }); } - function getEmittedFiles(files: FileOrFolderEmit[], contents: string[]): EmittedFile[] { - return map(contents, (content, index) => { - return { - content, - path: changeExtension(files[index].path, Extension.Js), - shouldBeWritten: true + verifyNewLine("handles new lines lineFeed", "\n"); + verifyNewLine("handles new lines carriageReturn lineFeed", "\r\n"); + + verifyTscWatch({ + scenario, + subScenario: "emit file content/should emit specified file", + commandLineArgs: ["-w", "-p", "/a/b/tsconfig.json"], + sys: () => { + const file1 = { + path: "/a/b/f1.ts", + content: `export function Foo() { return 10; }` }; - } - ); - } - function verifyEmittedFiles(host: WatchedSystem, emittedFiles: EmittedFile[]) { - for (const { path, content, shouldBeWritten } of emittedFiles) { - if (shouldBeWritten) { - assert.isTrue(host.fileExists(path), `Expected file ${path} to be present`); - assert.equal(host.readFile(path), content, `Contents of file ${path} do not match`); - } - else { - assert.isNotTrue(host.fileExists(path), `Expected file ${path} to be absent`); - } - } - } - - function verifyEmittedFileContents(newLine: string, inputFiles: File[], initialEmittedFileContents: string[], - modifyFiles: (files: FileOrFolderEmit[], emitedFiles: EmittedFile[]) => FileOrFolderEmit[], configFile?: File) { - const host = createWatchedSystem([], { newLine }); - const files = concatenate( - map(inputFiles, file => getFileOrFolderEmit(file, fileToConvert => getEmittedLineForMultiFileOutput(fileToConvert, host))), - configFile ? [libFile, configFile] : [libFile] - ); - const allEmittedFiles = getEmittedLines(files); - host.reloadFS(files); - - // Initial compile - if (configFile) { - createWatchOfConfigFile(configFile.path, host); - } - else { - // First file as the root - createWatchOfFilesAndCompilerOptions([files[0].path], host, { listEmittedFiles: true }); - } - checkOutputContains(host, allEmittedFiles); - - const emittedFiles = getEmittedFiles(files, initialEmittedFileContents); - verifyEmittedFiles(host, emittedFiles); - host.clearOutput(); - - const affectedFiles = modifyFiles(files, emittedFiles); - host.reloadFS(files); - host.checkTimeoutQueueLengthAndRun(1); - checkAffectedLines(host, affectedFiles, allEmittedFiles); - - verifyEmittedFiles(host, emittedFiles); - } - - function verifyNewLine(newLine: string) { - const lines = ["var x = 1;", "var y = 2;"]; - const fileContent = lines.join(newLine); - const f = { - path: "/a/app.ts", - content: fileContent - }; - verifyEmittedFileContents(newLine, [f], [fileContent + newLine], modifyFiles); - - function modifyFiles(files: FileOrFolderEmit[], emittedFiles: EmittedFile[]) { - files[0].content = fileContent + newLine + "var z = 3;"; - emittedFiles[0].content = files[0].content + newLine; - return [files[0]]; - } - } - - it("handles new lines: \\n", () => { - verifyNewLine("\n"); - }); - - it("handles new lines: \\r\\n", () => { - verifyNewLine("\r\n"); - }); - - it("should emit specified file", () => { - const file1 = { - path: "/a/b/f1.ts", - content: `export function Foo() { return 10; }` - }; - - const file2 = { - path: "/a/b/f2.ts", - content: `import {Foo} from "./f1"; export let y = Foo();` - }; - - const file3 = { - path: "/a/b/f3.ts", - content: `import {y} from "./f2"; let x = y;` - }; - - const configFile = { - path: "/a/b/tsconfig.json", - content: JSON.stringify({ compilerOptions: { listEmittedFiles: true } }) - }; + const file2 = { + path: "/a/b/f2.ts", + content: `import {Foo} from "./f1"; export let y = Foo();` + }; - verifyEmittedFileContents("\r\n", [file1, file2, file3], [ - `"use strict";\r\nexports.__esModule = true;\r\nfunction Foo() { return 10; }\r\nexports.Foo = Foo;\r\n`, - `"use strict";\r\nexports.__esModule = true;\r\nvar f1_1 = require("./f1");\r\nexports.y = f1_1.Foo();\r\n`, - `"use strict";\r\nexports.__esModule = true;\r\nvar f2_1 = require("./f2");\r\nvar x = f2_1.y;\r\n` - ], modifyFiles, configFile); + const file3 = { + path: "/a/b/f3.ts", + content: `import {y} from "./f2"; let x = y;` + }; - function modifyFiles(files: FileOrFolderEmit[], emittedFiles: EmittedFile[]) { - files[0].content += `export function foo2() { return 2; }`; - emittedFiles[0].content += `function foo2() { return 2; }\r\nexports.foo2 = foo2;\r\n`; - emittedFiles[2].shouldBeWritten = false; - return files.slice(0, 2); - } + const configFile = { + path: "/a/b/tsconfig.json", + content: "{}" + }; + return createWatchedSystem([file1, file2, file3, configFile, libFile]); + }, + changes: [ + sys => { + sys.appendFile("/a/b/f1.ts", "export function foo2() { return 2; }"); + sys.checkTimeoutQueueLengthAndRun(1); + return "Append content to f1"; + } + ], }); - it("Elides const enums correctly in incremental compilation", () => { - const currentDirectory = "/user/someone/projects/myproject"; - const file1: File = { - path: `${currentDirectory}/file1.ts`, - content: "export const enum E1 { V = 1 }" - }; - const file2: File = { - path: `${currentDirectory}/file2.ts`, - content: `import { E1 } from "./file1"; export const enum E2 { V = E1.V }` - }; - const file3: File = { - path: `${currentDirectory}/file3.ts`, - content: `import { E2 } from "./file2"; const v: E2 = E2.V;` - }; - const strictAndEsModule = `"use strict";\nexports.__esModule = true;\n`; - verifyEmittedFileContents("\n", [file3, file2, file1], [ - `${strictAndEsModule}var v = 1 /* V */;\n`, - strictAndEsModule, - strictAndEsModule - ], modifyFiles); - - function modifyFiles(files: FileOrFolderEmit[], emittedFiles: EmittedFile[]) { - files[0].content += `function foo2() { return 2; }`; - emittedFiles[0].content += `function foo2() { return 2; }\n`; - emittedFiles[1].shouldBeWritten = false; - emittedFiles[2].shouldBeWritten = false; - return [files[0]]; - } + verifyTscWatch({ + scenario, + subScenario: "emit file content/elides const enums correctly in incremental compilation", + commandLineArgs: ["-w", "/user/someone/projects/myproject/file3.ts"], + sys: () => { + const currentDirectory = "/user/someone/projects/myproject"; + const file1: File = { + path: `${currentDirectory}/file1.ts`, + content: "export const enum E1 { V = 1 }" + }; + const file2: File = { + path: `${currentDirectory}/file2.ts`, + content: `import { E1 } from "./file1"; export const enum E2 { V = E1.V }` + }; + const file3: File = { + path: `${currentDirectory}/file3.ts`, + content: `import { E2 } from "./file2"; const v: E2 = E2.V;` + }; + return createWatchedSystem([file1, file2, file3, libFile]); + }, + changes: [ + sys => { + sys.appendFile("/user/someone/projects/myproject/file3.ts", "function foo2() { return 2; }"); + sys.checkTimeoutQueueLengthAndRun(1); + return "Append content to file3"; + } + ], }); - it("file is deleted and created as part of change", () => { - const projectLocation = "/home/username/project"; - const file: File = { - path: `${projectLocation}/app/file.ts`, - content: "var a = 10;" - }; - const fileJs = `${projectLocation}/app/file.js`; - const configFile: File = { - path: `${projectLocation}/tsconfig.json`, - content: JSON.stringify({ - include: [ - "app/**/*.ts" - ] - }) - }; - const files = [file, configFile, libFile]; - const host = createWatchedSystem(files, { currentDirectory: projectLocation, useCaseSensitiveFileNames: true }); - createWatchOfConfigFile("tsconfig.json", host); - verifyProgram(); - - file.content += "\nvar b = 10;"; - - host.reloadFS(files, { invokeFileDeleteCreateAsPartInsteadOfChange: true }); - host.runQueuedTimeoutCallbacks(); - verifyProgram(); - - function verifyProgram() { - assert.isTrue(host.fileExists(fileJs)); - assert.equal(host.readFile(fileJs), file.content + "\n"); - } + verifyTscWatch({ + scenario, + subScenario: "emit file content/file is deleted and created as part of change", + commandLineArgs: ["-w"], + sys: () => { + const projectLocation = "/home/username/project"; + const file: File = { + path: `${projectLocation}/app/file.ts`, + content: "var a = 10;" + }; + const configFile: File = { + path: `${projectLocation}/tsconfig.json`, + content: JSON.stringify({ + include: [ + "app/**/*.ts" + ] + }) + }; + const files = [file, configFile, libFile]; + return createWatchedSystem(files, { currentDirectory: projectLocation, useCaseSensitiveFileNames: true }); + }, + changes: [ + sys => { + sys.appendFile("/home/username/project/app/file.ts", "\nvar b = 10;", { invokeFileDeleteCreateAsPartInsteadOfChange: true }); + sys.runQueuedTimeoutCallbacks(); + return "file is deleted and then created to modify content"; + } + ] }); }); describe("unittests:: tsc-watch:: emit with when module emit is specified as node", () => { - it("when instead of filechanged recursive directory watcher is invoked", () => { - const configFile: File = { - path: "/a/rootFolder/project/tsconfig.json", - content: JSON.stringify({ - compilerOptions: { - module: "none", - allowJs: true, - outDir: "Static/scripts/" - }, - include: [ - "Scripts/**/*" - ], - }) - }; - const outputFolder = "/a/rootFolder/project/Static/scripts/"; - const file1: File = { - path: "/a/rootFolder/project/Scripts/TypeScript.ts", - content: "var z = 10;" - }; - const file2: File = { - path: "/a/rootFolder/project/Scripts/Javascript.js", - content: "var zz = 10;" - }; - const files = [configFile, file1, file2, libFile]; - const host = createWatchedSystem(files); - const watch = createWatchOfConfigFile(configFile.path, host); - - checkProgramActualFiles(watch(), mapDefined(files, f => f === configFile ? undefined : f.path)); - file1.content = "var zz30 = 100;"; - host.reloadFS(files, { invokeDirectoryWatcherInsteadOfFileChanged: true }); - host.runQueuedTimeoutCallbacks(); - - checkProgramActualFiles(watch(), mapDefined(files, f => f === configFile ? undefined : f.path)); - const outputFile1 = changeExtension((outputFolder + getBaseFileName(file1.path)), ".js"); - assert.isTrue(host.fileExists(outputFile1)); - assert.equal(host.readFile(outputFile1), file1.content + host.newLine); + verifyTscWatch({ + scenario, + subScenario: "when module emit is specified as node/when instead of filechanged recursive directory watcher is invoked", + commandLineArgs: ["--w", "--p", "/a/rootFolder/project/tsconfig.json"], + sys: () => { + const configFile: File = { + path: "/a/rootFolder/project/tsconfig.json", + content: JSON.stringify({ + compilerOptions: { + module: "none", + allowJs: true, + outDir: "Static/scripts/" + }, + include: [ + "Scripts/**/*" + ], + }) + }; + const file1: File = { + path: "/a/rootFolder/project/Scripts/TypeScript.ts", + content: "var z = 10;" + }; + const file2: File = { + path: "/a/rootFolder/project/Scripts/Javascript.js", + content: "var zz = 10;" + }; + return createWatchedSystem([configFile, file1, file2, libFile]); + }, + changes: [ + sys => { + sys.modifyFile( + "/a/rootFolder/project/Scripts/TypeScript.ts", + "var zz30 = 100;", + { invokeDirectoryWatcherInsteadOfFileChanged: true }, + ); + sys.runQueuedTimeoutCallbacks(); + return "Modify typescript file"; + } + ], }); }); } diff --git a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts index e30c654075f0f..620be52e3eec9 100644 --- a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts +++ b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts @@ -4,163 +4,67 @@ namespace ts.tscWatch { path: `${projectRoot}/tsconfig.json`, content: `{}` }; - function getOutputFileStampAndError(host: WatchedSystem, watch: Watch, file: File) { - const builderProgram = watch.getBuilderProgram(); - const state = builderProgram.getState(); - return { - file, - fileStamp: host.getModifiedTime(file.path.replace(".ts", ".js")), - errors: builderProgram.getSemanticDiagnostics(watch().getSourceFileByPath(file.path as Path)), - errorsFromOldState: !!state.semanticDiagnosticsFromOldState && state.semanticDiagnosticsFromOldState.has(file.path), - dtsStamp: host.getModifiedTime(file.path.replace(".ts", ".d.ts")) - }; - } - - function getOutputFileStampsAndErrors(host: WatchedSystem, watch: Watch, directoryFiles: readonly File[]) { - return directoryFiles.map(d => getOutputFileStampAndError(host, watch, d)); - } - - function findStampAndErrors(stampsAndErrors: readonly ReturnType[], file: File) { - return find(stampsAndErrors, info => info.file === file)!; - } - - interface VerifyOutputFileStampAndErrors { - file: File; - jsEmitExpected: boolean; - dtsEmitExpected: boolean; - errorRefershExpected: boolean; - beforeChangeFileStampsAndErrors: readonly ReturnType[]; - afterChangeFileStampsAndErrors: readonly ReturnType[]; - } - function verifyOutputFileStampsAndErrors({ - file, - jsEmitExpected, - dtsEmitExpected, - errorRefershExpected, - beforeChangeFileStampsAndErrors, - afterChangeFileStampsAndErrors - }: VerifyOutputFileStampAndErrors) { - const beforeChange = findStampAndErrors(beforeChangeFileStampsAndErrors, file); - const afterChange = findStampAndErrors(afterChangeFileStampsAndErrors, file); - if (jsEmitExpected) { - assert.notStrictEqual(afterChange.fileStamp, beforeChange.fileStamp, `Expected emit for file ${file.path}`); - } - else { - assert.strictEqual(afterChange.fileStamp, beforeChange.fileStamp, `Did not expect new emit for file ${file.path}`); - } - if (dtsEmitExpected) { - assert.notStrictEqual(afterChange.dtsStamp, beforeChange.dtsStamp, `Expected emit for file ${file.path}`); - } - else { - assert.strictEqual(afterChange.dtsStamp, beforeChange.dtsStamp, `Did not expect new emit for file ${file.path}`); - } - if (errorRefershExpected) { - if (afterChange.errors !== emptyArray || beforeChange.errors !== emptyArray) { - assert.notStrictEqual(afterChange.errors, beforeChange.errors, `Expected new errors for file ${file.path}`); - } - assert.isFalse(afterChange.errorsFromOldState, `Expected errors to be not copied from old state for file ${file.path}`); - } - else { - assert.strictEqual(afterChange.errors, beforeChange.errors, `Expected errors to not change for file ${file.path}`); - assert.isTrue(afterChange.errorsFromOldState, `Expected errors to be copied from old state for file ${file.path}`); - } - } - interface VerifyEmitAndErrorUpdatesWorker extends VerifyEmitAndErrorUpdates { - configFile: File; + configFile: () => File; } function verifyEmitAndErrorUpdatesWorker({ - fileWithChange, - filesWithNewEmit, - filesWithOnlyErrorRefresh, - filesNotTouched, + subScenario, + files, + currentDirectory, + lib, configFile, - change, - getInitialErrors, - getIncrementalErrors + changes, }: VerifyEmitAndErrorUpdatesWorker) { - const nonLibFiles = [...filesWithNewEmit, ...filesWithOnlyErrorRefresh, ...filesNotTouched]; - const files = [...nonLibFiles, configFile, libFile]; - const compilerOptions = (JSON.parse(configFile.content).compilerOptions || {}) as CompilerOptions; - const host = createWatchedSystem(files, { currentDirectory: projectRoot }); - const watch = createWatchOfConfigFile("tsconfig.json", host); - checkProgramActualFiles(watch(), [...nonLibFiles.map(f => f.path), libFile.path]); - checkOutputErrorsInitial(host, getInitialErrors(watch)); - const beforeChange = getOutputFileStampsAndErrors(host, watch, nonLibFiles); - change(host); - host.runQueuedTimeoutCallbacks(); - checkOutputErrorsIncremental(host, getIncrementalErrors(watch)); - const afterChange = getOutputFileStampsAndErrors(host, watch, nonLibFiles); - filesWithNewEmit.forEach(file => verifyOutputFileStampsAndErrors({ - file, - jsEmitExpected: !compilerOptions.isolatedModules || fileWithChange === file, - dtsEmitExpected: getEmitDeclarations(compilerOptions), - errorRefershExpected: true, - beforeChangeFileStampsAndErrors: beforeChange, - afterChangeFileStampsAndErrors: afterChange - })); - filesWithOnlyErrorRefresh.forEach(file => verifyOutputFileStampsAndErrors({ - file, - jsEmitExpected: false, - dtsEmitExpected: getEmitDeclarations(compilerOptions) && !file.path.endsWith(".d.ts"), - errorRefershExpected: true, - beforeChangeFileStampsAndErrors: beforeChange, - afterChangeFileStampsAndErrors: afterChange - })); - filesNotTouched.forEach(file => verifyOutputFileStampsAndErrors({ - file, - jsEmitExpected: false, - dtsEmitExpected: false, - errorRefershExpected: false, - beforeChangeFileStampsAndErrors: beforeChange, - afterChangeFileStampsAndErrors: afterChange - })); + verifyTscWatch({ + scenario: "emitAndErrorUpdates", + subScenario, + commandLineArgs: ["--w"], + sys: () => createWatchedSystem( + [...files(), configFile(), lib?.() || libFile], + { currentDirectory: currentDirectory || projectRoot } + ), + changes + }); } function changeCompilerOptions(input: VerifyEmitAndErrorUpdates, additionalOptions: CompilerOptions): File { - const configFile = input.configFile || config; + const configFile = input.configFile?.() || config; const content = JSON.parse(configFile.content); content.compilerOptions = { ...content.compilerOptions, ...additionalOptions }; return { path: configFile.path, content: JSON.stringify(content) }; } interface VerifyEmitAndErrorUpdates { - change: (host: WatchedSystem) => void; - getInitialErrors: (watch: Watch) => readonly Diagnostic[] | readonly string[]; - getIncrementalErrors: (watch: Watch) => readonly Diagnostic[] | readonly string[]; - fileWithChange: File; - filesWithNewEmit: readonly File[]; - filesWithOnlyErrorRefresh: readonly File[]; - filesNotTouched: readonly File[]; - configFile?: File; + subScenario: string + files: () => File[]; + currentDirectory?: string; + lib?: () => File; + changes: TscWatchCompileChange[]; + configFile?: () => File; } function verifyEmitAndErrorUpdates(input: VerifyEmitAndErrorUpdates) { - it("with default config", () => { - verifyEmitAndErrorUpdatesWorker({ - ...input, - configFile: input.configFile || config - }); + verifyEmitAndErrorUpdatesWorker({ + ...input, + subScenario: `with default config/${input.subScenario}`, + configFile: () => input.configFile?.() || config }); - it("with default config and --declaration", () => { - verifyEmitAndErrorUpdatesWorker({ - ...input, - configFile: changeCompilerOptions(input, { declaration: true }) - }); + verifyEmitAndErrorUpdatesWorker({ + ...input, + subScenario: `with default config and --declaration/${input.subScenario}`, + configFile: () => changeCompilerOptions(input, { declaration: true }) }); - it("config with --isolatedModules", () => { - verifyEmitAndErrorUpdatesWorker({ - ...input, - configFile: changeCompilerOptions(input, { isolatedModules: true }) - }); + verifyEmitAndErrorUpdatesWorker({ + ...input, + subScenario: `config with --isolatedModules/${input.subScenario}`, + configFile: () => changeCompilerOptions(input, { isolatedModules: true }) }); - it("config with --isolatedModules and --declaration", () => { - verifyEmitAndErrorUpdatesWorker({ - ...input, - configFile: changeCompilerOptions(input, { isolatedModules: true, declaration: true }) - }); + verifyEmitAndErrorUpdatesWorker({ + ...input, + subScenario: `config with --isolatedModules and --declaration/${input.subScenario}`, + configFile: () => changeCompilerOptions(input, { isolatedModules: true, declaration: true }) }); } @@ -173,31 +77,18 @@ let b = new B(); console.log(b.c.d);` }; - function verifyDeepImportChange(bFile: File, cFile: File) { - const filesWithNewEmit: File[] = []; - const filesWithOnlyErrorRefresh = [aFile]; - addImportedModule(bFile); - addImportedModule(cFile); + function verifyDeepImportChange(subScenario: string, bFile: File, cFile: File) { verifyEmitAndErrorUpdates({ - fileWithChange: cFile, - filesWithNewEmit, - filesWithOnlyErrorRefresh, - filesNotTouched: emptyArray, - change: host => host.writeFile(cFile.path, cFile.content.replace("d", "d2")), - getInitialErrors: () => emptyArray, - getIncrementalErrors: watch => [ - getDiagnosticOfFileFromProgram(watch(), aFile.path, aFile.content.lastIndexOf("d"), 1, Diagnostics.Property_0_does_not_exist_on_type_1, "d", "C") - ] + subScenario: `deep import changes/${subScenario}`, + files: () => [aFile, bFile, cFile], + changes: [ + sys => { + sys.writeFile(cFile.path, cFile.content.replace("d", "d2")); + sys.runQueuedTimeoutCallbacks(); + return "Rename property d to d2 of class C"; + } + ], }); - - function addImportedModule(file: File) { - if (file.path.endsWith(".d.ts")) { - filesWithOnlyErrorRefresh.push(file); - } - else { - filesWithNewEmit.push(file); - } - } } describe("updates errors when deep import file changes", () => { @@ -216,7 +107,11 @@ export class B d = 1; }` }; - verifyDeepImportChange(bFile, cFile); + verifyDeepImportChange( + "updates errors when deep import file changes", + bFile, + cFile + ); }); describe("updates errors when deep import through declaration file changes", () => { @@ -235,7 +130,11 @@ export class B d: number; }` }; - verifyDeepImportChange(bFile, cFile); + verifyDeepImportChange( + "updates errors when deep import through declaration file changes", + bFile, + cFile + ); }); }); @@ -280,21 +179,15 @@ getPoint().c.x;` content: `import "./d";` }; verifyEmitAndErrorUpdates({ - fileWithChange: aFile, - filesWithNewEmit: [aFile, bFile], - filesWithOnlyErrorRefresh: [cFile, dFile], - filesNotTouched: [eFile], - change: host => host.writeFile(aFile.path, aFile.content.replace("x2", "x")), - getInitialErrors: watch => [ - getDiagnosticOfFileFromProgram(watch(), cFile.path, cFile.content.indexOf("x: 1"), 4, chainDiagnosticMessages( - chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, "x", "Coords"), - Diagnostics.Type_0_is_not_assignable_to_type_1, - "{ x: number; y: number; }", - "Coords" - )), - getDiagnosticOfFileFromProgram(watch(), dFile.path, dFile.content.lastIndexOf("x"), 1, Diagnostics.Property_0_does_not_exist_on_type_1, "x", "Coords") - ], - getIncrementalErrors: () => emptyArray + subScenario: "updates errors in file not exporting a deep multilevel import that changes", + files: () => [aFile, bFile, cFile, dFile, eFile], + changes: [ + sys => { + sys.writeFile(aFile.path, aFile.content.replace("x2", "x")); + sys.runQueuedTimeoutCallbacks(); + return "Rename property x2 to x of interface Coords"; + } + ] }); }); @@ -346,27 +239,25 @@ export class Data { }` }; - function verifyTransitiveExports(lib2Data: File, lib2Data2?: File) { - const filesWithNewEmit = [lib1ToolsInterface, lib1ToolsPublic]; - const filesWithOnlyErrorRefresh = [app, lib2Public, lib1Public, lib2Data]; - if (lib2Data2) { - filesWithOnlyErrorRefresh.push(lib2Data2); - } + function verifyTransitiveExports(subScenario: string, files: readonly File[]) { verifyEmitAndErrorUpdates({ - fileWithChange: lib1ToolsInterface, - filesWithNewEmit, - filesWithOnlyErrorRefresh, - filesNotTouched: emptyArray, - configFile: config, - change: host => host.writeFile(lib1ToolsInterface.path, lib1ToolsInterface.content.replace("title", "title2")), - getInitialErrors: () => emptyArray, - getIncrementalErrors: () => [ - "lib2/data.ts(5,13): error TS2322: Type '{ title: string; }' is not assignable to type 'ITest'.\n Object literal may only specify known properties, but 'title' does not exist in type 'ITest'. Did you mean to write 'title2'?\n" + subScenario: `updates errors when file transitively exported file changes/${subScenario}`, + files: () => [lib1ToolsInterface, lib1ToolsPublic, app, lib2Public, lib1Public, ...files], + configFile: () => config, + changes: [ + sys => { + sys.writeFile(lib1ToolsInterface.path, lib1ToolsInterface.content.replace("title", "title2")); + sys.runQueuedTimeoutCallbacks(); + return "Rename property title to title2 of interface ITest"; + } ] }); } describe("when there are no circular import and exports", () => { - verifyTransitiveExports(lib2Data); + verifyTransitiveExports( + "when there are no circular import and exports", + [lib2Data] + ); }); describe("when there are circular import and exports", () => { @@ -389,50 +280,30 @@ export class Data2 { public dat?: Data; }` }; - verifyTransitiveExports(lib2Data, lib2Data2); + verifyTransitiveExports( + "when there are circular import and exports", + [lib2Data, lib2Data2] + ); }); }); - it("with noEmitOnError", () => { - const projectLocation = `${TestFSWithWatch.tsbuildProjectsLocation}/noEmitOnError`; - const allFiles = ["tsconfig.json", "shared/types/db.ts", "src/main.ts", "src/other.ts"] - .map(f => TestFSWithWatch.getTsBuildProjectFile("noEmitOnError", f)); - const host = TestFSWithWatch.changeToHostTrackingWrittenFiles( - createWatchedSystem( - [...allFiles, { path: libFile.path, content: libContent }], - { currentDirectory: projectLocation } - ) - ); - const watch = createWatchOfConfigFile("tsconfig.json", host); - const mainFile = allFiles.find(f => f.path === `${projectLocation}/src/main.ts`)!; - checkOutputErrorsInitial(host, [ - getDiagnosticOfFileFromProgram( - watch(), - mainFile.path, - mainFile.content.lastIndexOf(";"), - 1, - Diagnostics._0_expected, - "," - ) - ]); - assert.equal(host.writtenFiles.size, 0, `Expected not to write any files: ${arrayFrom(host.writtenFiles.keys())}`); - - // Make changes - host.writeFile(mainFile.path, `import { A } from "../shared/types/db"; + verifyEmitAndErrorUpdates({ + subScenario: "with noEmitOnError", + currentDirectory: `${TestFSWithWatch.tsbuildProjectsLocation}/noEmitOnError`, + files: () => ["shared/types/db.ts", "src/main.ts", "src/other.ts"] + .map(f => TestFSWithWatch.getTsBuildProjectFile("noEmitOnError", f)), + lib: () => ({ path: libFile.path, content: libContent }), + configFile: () => TestFSWithWatch.getTsBuildProjectFile("noEmitOnError", "tsconfig.json"), + changes: [ + sys => { + sys.writeFile(`${TestFSWithWatch.tsbuildProjectsLocation}/noEmitOnError/src/main.ts`, `import { A } from "../shared/types/db"; const a = { lastName: 'sdsd' };`); - host.writtenFiles.clear(); - host.checkTimeoutQueueLengthAndRun(1); // build project - checkOutputErrorsIncremental(host, emptyArray); - assert.equal(host.writtenFiles.size, 3, `Expected to write 3 files: Actual:: ${arrayFrom(host.writtenFiles.keys())}`); - for (const f of [ - `${projectLocation}/dev-build/shared/types/db.js`, - `${projectLocation}/dev-build/src/main.js`, - `${projectLocation}/dev-build/src/other.js`, - ]) { - assert.isTrue(host.writtenFiles.has(f.toLowerCase()), `Expected to write file: ${f}:: Actual:: ${arrayFrom(host.writtenFiles.keys())}`); - } + sys.checkTimeoutQueueLengthAndRun(1); // build project + return "Fix the error"; + } + ] }); }); } diff --git a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts index 4a9e3d196ca02..cae63450b0860 100644 --- a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts +++ b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts @@ -1,62 +1,50 @@ namespace ts.tscWatch { describe("unittests:: tsc-watch:: forceConsistentCasingInFileNames", () => { - function createWatch() { - const loggerFile: File = { - path: `${projectRoot}/logger.ts`, - content: `export class logger { }` - }; - const anotherFile: File = { - path: `${projectRoot}/another.ts`, - content: `import { logger } from "./logger"; new logger();` - }; - const tsconfig: File = { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ - compilerOptions: { forceConsistentCasingInFileNames: true } - }) - }; + const loggerFile: File = { + path: `${projectRoot}/logger.ts`, + content: `export class logger { }` + }; + const anotherFile: File = { + path: `${projectRoot}/another.ts`, + content: `import { logger } from "./logger"; new logger();` + }; + const tsconfig: File = { + path: `${projectRoot}/tsconfig.json`, + content: JSON.stringify({ + compilerOptions: { forceConsistentCasingInFileNames: true } + }) + }; - const host = createWatchedSystem([loggerFile, anotherFile, tsconfig, libFile, tsconfig]); - const watch = createWatchOfConfigFile(tsconfig.path, host); - checkProgramActualFiles(watch(), [loggerFile.path, anotherFile.path, libFile.path]); - checkOutputErrorsInitial(host, emptyArray); - return { host, watch, anotherFile, loggerFile }; + function verifyConsistentFileNames({ subScenario, changes }: { subScenario: string; changes: TscWatchCompileChange[]; }) { + verifyTscWatch({ + scenario: "forceConsistentCasingInFileNames", + subScenario, + commandLineArgs: ["--w", "--p", tsconfig.path], + sys: () => createWatchedSystem([loggerFile, anotherFile, tsconfig, libFile, tsconfig]), + changes + }); } - it("when changing module name with different casing", () => { - const { host, watch, anotherFile, loggerFile } = createWatch(); - host.writeFile(anotherFile.path, anotherFile.content.replace("./logger", "./Logger")); - host.runQueuedTimeoutCallbacks(); - checkProgramActualFiles(watch(), [`${projectRoot}/Logger.ts`, anotherFile.path, libFile.path]); - checkOutputErrorsIncremental(host, [ - getDiagnosticOfFileFromProgram( - watch(), - anotherFile.path, - anotherFile.content.indexOf(`"./logger"`), - `"./logger"`.length, - Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, - `${projectRoot}/Logger.ts`, - loggerFile.path, - ), - ]); + verifyConsistentFileNames({ + subScenario: "when changing module name with different casing", + changes: [ + sys => { + sys.writeFile(anotherFile.path, anotherFile.content.replace("./logger", "./Logger")); + sys.runQueuedTimeoutCallbacks(); + return "Change module name from logger to Logger"; + } + ] }); - it("when renaming file with different casing", () => { - const { host, watch, anotherFile, loggerFile } = createWatch(); - host.renameFile(loggerFile.path, `${projectRoot}/Logger.ts`); - host.runQueuedTimeoutCallbacks(); - checkProgramActualFiles(watch(), [`${projectRoot}/Logger.ts`, anotherFile.path, libFile.path]); - checkOutputErrorsIncremental(host, [ - getDiagnosticOfFileFromProgram( - watch(), - anotherFile.path, - anotherFile.content.indexOf(`"./logger"`), - `"./logger"`.length, - Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, - loggerFile.path, - `${projectRoot}/Logger.ts` - ), - ]); + verifyConsistentFileNames({ + subScenario: "when renaming file with different casing", + changes: [ + sys => { + sys.renameFile(loggerFile.path, `${projectRoot}/Logger.ts`); + sys.runQueuedTimeoutCallbacks(); + return "Change name of file from logger to Logger"; + } + ] }); }); } diff --git a/src/testRunner/unittests/tscWatch/helpers.ts b/src/testRunner/unittests/tscWatch/helpers.ts index 94df77891aebc..5ba5db2622a27 100644 --- a/src/testRunner/unittests/tscWatch/helpers.ts +++ b/src/testRunner/unittests/tscWatch/helpers.ts @@ -280,4 +280,141 @@ namespace ts.tscWatch { const quotedModuleName = `"${moduleName}"`; return getDiagnosticOfFileFromProgram(program, file.path, file.content.indexOf(quotedModuleName), quotedModuleName.length, Diagnostics.Cannot_find_module_0, moduleName); } + + export type TscWatchCompileChange = (sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles, programs: readonly CommandLineProgram[]) => string; + export interface TscWatchCheckOptions { + baselineSourceMap?: boolean; + } + export interface TscWatchCompileBase extends TscWatchCheckOptions { + scenario: string; + subScenario: string; + commandLineArgs: readonly string[]; + changes: TscWatchCompileChange[]; + } + export interface TscWatchCompile extends TscWatchCompileBase { + sys: () => WatchedSystem; + maxNumberOfFilesToIterateForInvalidation?: number; + } + + export type SystemSnap = ReturnType; + function tscWatchCompile(input: TscWatchCompile) { + it("Generates files matching the baseline", () => { + const sys = TestFSWithWatch.changeToHostTrackingWrittenFiles( + fakes.patchHostForBuildInfoReadWrite(input.sys()) + ); + const { + scenario, subScenario, + commandLineArgs, changes, + baselineSourceMap + } = input; + + const { cb, getPrograms } = commandLineCallbacks(sys); + executeCommandLine( + sys, + cb, + commandLineArgs, + input.maxNumberOfFilesToIterateForInvalidation + ); + runWatchBaseline({ + scenario, + subScenario, + commandLineArgs, + sys, + getPrograms, + baselineSourceMap, + changes + }); + }); + } + + export interface RunWatchBaseline extends TscWatchCompileBase { + sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles; + getPrograms: () => readonly CommandLineProgram[]; + } + export function runWatchBaseline({ + scenario, subScenario, commandLineArgs, + getPrograms, sys, + baselineSourceMap, + changes + }: RunWatchBaseline) { + const baseline: string[] = []; + baseline.push(`${sys.getExecutingFilePath()} ${commandLineArgs.join(" ")}`); + let programs = watchBaseline({ + baseline, + getPrograms, + sys, + oldSnap: undefined, + baselineSourceMap + }); + + for (const change of changes) { + const oldSnap = sys.snap(); + const caption = change(sys, programs); + baseline.push(`Change:: ${caption}`, ""); + programs = watchBaseline({ + baseline, + getPrograms, + sys, + oldSnap, + baselineSourceMap + }); + } + Harness.Baseline.runBaseline(`${isBuild(commandLineArgs) ? "tsbuild/watchMode" : "tscWatch"}/${scenario}/${subScenario.split(" ").join("-")}.js`, baseline.join("\r\n")); + } + + export interface WatchBaseline extends TscWatchCheckOptions { + baseline: string[]; + sys: TestFSWithWatch.TestServerHostTrackingWrittenFiles; + getPrograms: () => readonly CommandLineProgram[]; + oldSnap: SystemSnap | undefined; + } + export function watchBaseline({ baseline, getPrograms, sys, oldSnap, baselineSourceMap }: WatchBaseline) { + if (baselineSourceMap) generateSourceMapBaselineFiles(sys); + sys.diff(baseline, oldSnap); + sys.serializeOutput(baseline); + const programs = getPrograms(); + for (const program of programs) { + baselineProgram(baseline, program); + } + sys.serializeWatches(baseline); + baseline.push(`exitCode:: ExitStatus.${ExitStatus[sys.exitCode as ExitStatus]}`, ""); + sys.writtenFiles.forEach((value, key) => { + assert.equal(value, 1, `Expected to write file ${key} only once`); + }); + sys.writtenFiles.clear(); + return programs; + } + + function baselineProgram(baseline: string[], [program, builderProgram]: CommandLineProgram) { + const options = program.getCompilerOptions(); + baseline.push(`Program root files: ${JSON.stringify(program.getRootFileNames())}`); + baseline.push(`Program options: ${JSON.stringify(options)}`); + baseline.push("Program files::"); + for (const file of program.getSourceFiles()) { + baseline.push(file.fileName); + } + baseline.push(""); + if (!builderProgram) return; + const state = builderProgram.getState(); + if (state.semanticDiagnosticsPerFile?.size) { + baseline.push("Semantic diagnostics in builder refreshed for::"); + for (const file of program.getSourceFiles()) { + if (!state.semanticDiagnosticsFromOldState || !state.semanticDiagnosticsFromOldState.has(file.path)) { + baseline.push(file.fileName); + } + } + } + else { + baseline.push("No cached semantic diagnostics in the builder::"); + } + baseline.push(""); + } + + export function verifyTscWatch(input: TscWatchCompile) { + describe(input.scenario, () => { + describe(input.subScenario, () => { + tscWatchCompile(input); + }); + }); + } } diff --git a/src/testRunner/unittests/tscWatch/incremental.ts b/src/testRunner/unittests/tscWatch/incremental.ts index b6e32dabe9503..845d72e216070 100644 --- a/src/testRunner/unittests/tscWatch/incremental.ts +++ b/src/testRunner/unittests/tscWatch/incremental.ts @@ -8,149 +8,62 @@ namespace ts.tscWatch { }; interface VerifyIncrementalWatchEmitInput { - files: readonly File[]; - optionsToExtend?: CompilerOptions; - expectedInitialEmit: readonly File[]; - expectedInitialErrors: readonly string[]; + subScenario: string; + files: () => readonly File[]; + optionsToExtend?: readonly string[]; modifyFs?: (host: WatchedSystem) => void; - expectedIncrementalEmit?: readonly File[]; - expectedIncrementalErrors?: readonly string[]; } - function verifyIncrementalWatchEmit(input: () => VerifyIncrementalWatchEmitInput) { - it("with tsc --w", () => { - verifyIncrementalWatchEmitWorker({ - input: input(), - emitAndReportErrors: createWatchOfConfigFile, - verifyErrors: checkOutputErrorsInitial + function verifyIncrementalWatchEmit(input: VerifyIncrementalWatchEmitInput) { + describe(input.subScenario, () => { + it("with tsc --w", () => { + verifyIncrementalWatchEmitWorker(input, /*incremental*/ false); }); - }); - it("with tsc", () => { - verifyIncrementalWatchEmitWorker({ - input: input(), - emitAndReportErrors: incrementalBuild, - verifyErrors: checkNormalBuildErrors + it("with tsc", () => { + verifyIncrementalWatchEmitWorker(input, /*incremental*/ true); }); }); } - function incrementalBuild(configFile: string, host: WatchedSystem, optionsToExtend?: CompilerOptions) { - const reportDiagnostic = createDiagnosticReporter(host); - const config = parseConfigFileWithSystem(configFile, optionsToExtend || {}, /*watchOptionsToExtend*/ undefined, host, reportDiagnostic); - if (config) { - performIncrementalCompilation({ - rootNames: config.fileNames, - options: config.options, - projectReferences: config.projectReferences, - configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config), - reportDiagnostic, - system: host - }); - } - return { close: noop }; - } + function verifyIncrementalWatchEmitWorker( + { subScenario, files, optionsToExtend, modifyFs }: VerifyIncrementalWatchEmitInput, + incremental: boolean + ) { + const sys = TestFSWithWatch.changeToHostTrackingWrittenFiles( + fakes.patchHostForBuildInfoReadWrite(createWatchedSystem(files(), { currentDirectory: project })) + ); + if (incremental) sys.exit = exitCode => sys.exitCode = exitCode; + const argsToPass = [incremental ? "-i" : "-w", ...(optionsToExtend || emptyArray)]; + const baseline: string[] = []; + baseline.push(`${sys.getExecutingFilePath()} ${argsToPass.join(" ")}`); + const { cb, getPrograms } = commandLineCallbacks(sys); + build(/*oldSnap*/ undefined); - interface VerifyIncrementalWatchEmitWorkerInput { - input: VerifyIncrementalWatchEmitInput; - emitAndReportErrors: (configFile: string, host: WatchedSystem, optionsToExtend?: CompilerOptions) => { close(): void; }; - verifyErrors: (host: WatchedSystem, errors: readonly string[]) => void; - } - function verifyIncrementalWatchEmitWorker({ - input: { - files, optionsToExtend, - expectedInitialEmit, expectedInitialErrors, - modifyFs, expectedIncrementalEmit, expectedIncrementalErrors - }, - emitAndReportErrors, - verifyErrors - }: VerifyIncrementalWatchEmitWorkerInput) { - const host = createWatchedSystem(files, { currentDirectory: project }); - const originalWriteFile = host.writeFile; - const writtenFiles = createMap(); - host.writeFile = (path, content) => { - assert.isFalse(writtenFiles.has(path)); - writtenFiles.set(path, content); - originalWriteFile.call(host, path, content); - }; - verifyBuild({ - host, - optionsToExtend, - writtenFiles, - emitAndReportErrors, - verifyErrors, - expectedEmit: expectedInitialEmit, - expectedErrors: expectedInitialErrors - }); if (modifyFs) { - modifyFs(host); - verifyBuild({ - host, - optionsToExtend, - writtenFiles, - emitAndReportErrors, - verifyErrors, - expectedEmit: Debug.assertDefined(expectedIncrementalEmit), - expectedErrors: Debug.assertDefined(expectedIncrementalErrors) - }); + const oldSnap = sys.snap(); + modifyFs(sys); + baseline.push(`Change::`, ""); + build(oldSnap); } - } - interface VerifyBuildWorker { - host: WatchedSystem; - optionsToExtend?: CompilerOptions; - writtenFiles: Map; - emitAndReportErrors: VerifyIncrementalWatchEmitWorkerInput["emitAndReportErrors"]; - verifyErrors: VerifyIncrementalWatchEmitWorkerInput["verifyErrors"]; - expectedEmit: readonly File[]; - expectedErrors: readonly string[]; - } - function verifyBuild({ - host, optionsToExtend, writtenFiles, emitAndReportErrors, - verifyErrors, expectedEmit, expectedErrors - }: VerifyBuildWorker) { - writtenFiles.clear(); - const result = emitAndReportErrors("tsconfig.json", host, optionsToExtend); - checkFileEmit(writtenFiles, expectedEmit); - verifyErrors(host, expectedErrors); - result.close(); - } + Harness.Baseline.runBaseline(`${isBuild(argsToPass) ? "tsbuild/watchMode" : "tscWatch"}/incremental/${subScenario.split(" ").join("-")}-${incremental ? "incremental" : "watch"}.js`, baseline.join("\r\n")); - function sanitizeBuildInfo(content: string) { - const buildInfo = getBuildInfo(content); - fakes.sanitizeBuildInfoProgram(buildInfo); - return getBuildInfoText(buildInfo); - } - - function checkFileEmit(actual: Map, expected: readonly File[]) { - assert.equal(actual.size, expected.length, `Actual: ${JSON.stringify(arrayFrom(actual.entries()), /*replacer*/ undefined, " ")}\nExpected: ${JSON.stringify(expected, /*replacer*/ undefined, " ")}`); - for (const file of expected) { - let expectedContent = file.content; - let actualContent = actual.get(file.path); - if (isBuildInfoFile(file.path)) { - actualContent = actualContent && sanitizeBuildInfo(actualContent); - expectedContent = sanitizeBuildInfo(expectedContent); - } - assert.equal(actualContent, expectedContent, `Emit for ${file.path}`); + function build(oldSnap: SystemSnap | undefined) { + const closer = executeCommandLine( + sys, + cb, + argsToPass, + ); + watchBaseline({ + baseline, + getPrograms, + sys, + oldSnap + }); + if (closer) closer.close(); } } - const libFileInfo: BuilderState.FileInfo = { - version: Harness.mockHash(libFile.content), - signature: Harness.mockHash(libFile.content) - }; - - const getCanonicalFileName = createGetCanonicalFileName(/*useCaseSensitiveFileNames*/ false); - function relativeToBuildInfo(buildInfoPath: string, path: string) { - return getRelativePathFromFile(buildInfoPath, path, getCanonicalFileName); - } - - const buildInfoPath = `${project}/tsconfig.tsbuildinfo`; - const [libFilePath, file1Path, file2Path] = [libFile.path, `${project}/file1.ts`, `${project}/file2.ts`].map(path => relativeToBuildInfo(buildInfoPath, path)); - describe("non module compilation", () => { - function getFileInfo(content: string): BuilderState.FileInfo { - return { version: Harness.mockHash(content), signature: Harness.mockHash(`declare ${content}\n`) }; - } - const file1: File = { path: `${project}/file1.ts`, content: "const x = 10;" @@ -159,221 +72,39 @@ namespace ts.tscWatch { path: `${project}/file2.ts`, content: "const y = 20;" }; - const file1Js: File = { - path: `${project}/file1.js`, - content: "var x = 10;\n" - }; - const file2Js: File = { - path: `${project}/file2.js`, - content: "var y = 20;\n" - }; describe("own file emit without errors", () => { - function verify(optionsToExtend?: CompilerOptions, expectedBuildinfoOptions?: CompilerOptions) { + function verify(subScenario: string, optionsToExtend?: readonly string[]) { const modifiedFile2Content = file2.content.replace("y", "z").replace("20", "10"); - verifyIncrementalWatchEmit(() => ({ - files: [libFile, file1, file2, configFile], + verifyIncrementalWatchEmit({ + files: () => [libFile, file1, file2, configFile], optionsToExtend, - expectedInitialEmit: [ - file1Js, - file2Js, - { - path: `${project}/tsconfig.tsbuildinfo`, - content: getBuildInfoText({ - program: { - fileInfos: { - [libFilePath]: libFileInfo, - [file1Path]: getFileInfo(file1.content), - [file2Path]: getFileInfo(file2.content) - }, - options: { - incremental: true, - ...expectedBuildinfoOptions, - configFilePath: "./tsconfig.json" - }, - referencedMap: {}, - exportedModulesMap: {}, - semanticDiagnosticsPerFile: [libFilePath, file1Path, file2Path] - }, - version: ts.version // eslint-disable-line @typescript-eslint/no-unnecessary-qualifier - }) - } - ], - expectedInitialErrors: emptyArray, + subScenario: `own file emit without errors/${subScenario}`, modifyFs: host => host.writeFile(file2.path, modifiedFile2Content), - expectedIncrementalEmit: [ - file1Js, - { path: file2Js.path, content: file2Js.content.replace("y", "z").replace("20", "10") }, - { - path: `${project}/tsconfig.tsbuildinfo`, - content: getBuildInfoText({ - program: { - fileInfos: { - [libFilePath]: libFileInfo, - [file1Path]: getFileInfo(file1.content), - [file2Path]: getFileInfo(modifiedFile2Content) - }, - options: { - incremental: true, - ...expectedBuildinfoOptions, - configFilePath: "./tsconfig.json" - }, - referencedMap: {}, - exportedModulesMap: {}, - semanticDiagnosticsPerFile: [libFilePath, file1Path, file2Path] - }, - version: ts.version // eslint-disable-line @typescript-eslint/no-unnecessary-qualifier - }) - } - ], - expectedIncrementalErrors: emptyArray, - })); + }); } - verify(); - describe("with commandline parameters that are not relative", () => { - verify({ project: "tsconfig.json" }, { project: "./tsconfig.json" }); - }); + verify("without commandline options"); + verify("with commandline parameters that are not relative", ["-p", "tsconfig.json"]); }); - describe("own file emit with errors", () => { - const fileModified: File = { + verifyIncrementalWatchEmit({ + files: () => [libFile, file1, configFile, { path: file2.path, content: `const y: string = 20;` - }; - const file2FileInfo: BuilderState.FileInfo = { - version: Harness.mockHash(fileModified.content), - signature: Harness.mockHash("declare const y: string;\n") - }; - const file2ReuasableError: ProgramBuildInfoDiagnostic = [ - file2Path, [ - { - file: file2Path, - start: 6, - length: 1, - code: Diagnostics.Type_0_is_not_assignable_to_type_1.code, - category: Diagnostics.Type_0_is_not_assignable_to_type_1.category, - messageText: "Type '20' is not assignable to type 'string'." - } - ] - ]; - const file2Errors = [ - "file2.ts(1,7): error TS2322: Type '20' is not assignable to type 'string'.\n" - ]; - const modifiedFile1Content = file1.content.replace("x", "z"); - verifyIncrementalWatchEmit(() => ({ - files: [libFile, file1, fileModified, configFile], - expectedInitialEmit: [ - file1Js, - file2Js, - { - path: `${project}/tsconfig.tsbuildinfo`, - content: getBuildInfoText({ - program: { - fileInfos: { - [libFilePath]: libFileInfo, - [file1Path]: getFileInfo(file1.content), - [file2Path]: file2FileInfo - }, - options: { - incremental: true, - configFilePath: "./tsconfig.json" - }, - referencedMap: {}, - exportedModulesMap: {}, - semanticDiagnosticsPerFile: [ - libFilePath, - file1Path, - file2ReuasableError - ] - }, - version: ts.version // eslint-disable-line @typescript-eslint/no-unnecessary-qualifier - }) - } - ], - expectedInitialErrors: file2Errors, - modifyFs: host => host.writeFile(file1.path, modifiedFile1Content), - expectedIncrementalEmit: [ - { path: file1Js.path, content: file1Js.content.replace("x", "z") }, - file2Js, - { - path: `${project}/tsconfig.tsbuildinfo`, - content: getBuildInfoText({ - program: { - fileInfos: { - [libFilePath]: libFileInfo, - [file1Path]: getFileInfo(modifiedFile1Content), - [file2Path]: file2FileInfo - }, - options: { - incremental: true, - configFilePath: "./tsconfig.json" - }, - referencedMap: {}, - exportedModulesMap: {}, - semanticDiagnosticsPerFile: [ - libFilePath, - file1Path, - file2ReuasableError - ] - }, - version: ts.version // eslint-disable-line @typescript-eslint/no-unnecessary-qualifier - }) - } - ], - expectedIncrementalErrors: file2Errors, - })); + }], + subScenario: "own file emit with errors", + modifyFs: host => host.writeFile(file1.path, file1.content.replace("x", "z")), }); - describe("with --out", () => { - const config: File = { + verifyIncrementalWatchEmit({ + files: () => [libFile, file1, file2, { path: configFile.path, content: JSON.stringify({ compilerOptions: { incremental: true, outFile: "out.js" } }) - }; - const outFile: File = { - path: `${project}/out.js`, - content: "var x = 10;\nvar y = 20;\n" - }; - verifyIncrementalWatchEmit(() => ({ - files: [libFile, file1, file2, config], - expectedInitialEmit: [ - outFile, - { - path: `${project}/out.tsbuildinfo`, - content: getBuildInfoText({ - bundle: { - commonSourceDirectory: relativeToBuildInfo(`${project}/out.tsbuildinfo`, `${project}/`), - sourceFiles: [file1Path, file2Path], - js: { - sections: [ - { pos: 0, end: outFile.content.length, kind: BundleFileSectionKind.Text } - ] - }, - }, - version: ts.version // eslint-disable-line @typescript-eslint/no-unnecessary-qualifier - }) - } - ], - expectedInitialErrors: emptyArray - })); + }], + subScenario: "with --out", }); - }); describe("module compilation", () => { - function getFileInfo(content: string): BuilderState.FileInfo { - return { - version: Harness.mockHash(content), - signature: Harness.mockHash(`${content.replace("export ", "export declare ")}\n`) - }; - } - - function getEmitContent(varName: string, value: string) { - return `define(["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.${varName} = ${value}; -}); -`; - } const file1: File = { path: `${project}/file1.ts`, content: "export const x = 10;" @@ -382,76 +113,15 @@ namespace ts.tscWatch { path: `${project}/file2.ts`, content: "export const y = 20;" }; - const file1Js: File = { - path: `${project}/file1.js`, - content: getEmitContent("x", "10") - }; - const file2Js: File = { - path: `${project}/file2.js`, - content: getEmitContent("y", "20") - }; const config: File = { path: configFile.path, content: JSON.stringify({ compilerOptions: { incremental: true, module: "amd" } }) }; - describe("own file emit without errors", () => { - const modifiedFile2Content = file2.content.replace("y", "z").replace("20", "10"); - verifyIncrementalWatchEmit(() => ({ - files: [libFile, file1, file2, config], - expectedInitialEmit: [ - file1Js, - file2Js, - { - path: `${project}/tsconfig.tsbuildinfo`, - content: getBuildInfoText({ - program: { - fileInfos: { - [libFilePath]: libFileInfo, - [file1Path]: getFileInfo(file1.content), - [file2Path]: getFileInfo(file2.content) - }, - options: { - incremental: true, - module: ModuleKind.AMD, - configFilePath: "./tsconfig.json" - }, - referencedMap: {}, - exportedModulesMap: {}, - semanticDiagnosticsPerFile: [libFilePath, file1Path, file2Path] - }, - version: ts.version // eslint-disable-line @typescript-eslint/no-unnecessary-qualifier - }) - } - ], - expectedInitialErrors: emptyArray, - modifyFs: host => host.writeFile(file2.path, modifiedFile2Content), - expectedIncrementalEmit: [ - { path: `${project}/file2.js`, content: getEmitContent("z", "10") }, - { - path: `${project}/tsconfig.tsbuildinfo`, - content: getBuildInfoText({ - program: { - fileInfos: { - [libFilePath]: libFileInfo, - [file1Path]: getFileInfo(file1.content), - [file2Path]: getFileInfo(modifiedFile2Content) - }, - options: { - incremental: true, - module: ModuleKind.AMD, - configFilePath: "./tsconfig.json" - }, - referencedMap: {}, - exportedModulesMap: {}, - semanticDiagnosticsPerFile: [libFilePath, file1Path, file2Path] - }, - version: ts.version // eslint-disable-line @typescript-eslint/no-unnecessary-qualifier - }) - } - ], - expectedIncrementalErrors: emptyArray, - })); + verifyIncrementalWatchEmit({ + files: () => [libFile, file1, file2, config], + subScenario: "module compilation/own file emit without errors", + modifyFs: host => host.writeFile(file2.path, file2.content.replace("y", "z").replace("20", "10")), }); describe("own file emit with errors", () => { @@ -459,93 +129,25 @@ namespace ts.tscWatch { path: file2.path, content: `export const y: string = 20;` }; - const file2FileInfo: BuilderState.FileInfo = { - version: Harness.mockHash(fileModified.content), - signature: Harness.mockHash("export declare const y: string;\n") - }; - const file2ReuasableError: ProgramBuildInfoDiagnostic = [ - file2Path, [ - { - file: file2Path, - start: 13, - length: 1, - code: Diagnostics.Type_0_is_not_assignable_to_type_1.code, - category: Diagnostics.Type_0_is_not_assignable_to_type_1.category, - messageText: "Type '20' is not assignable to type 'string'." - } - ] - ]; - const file2Errors = [ - "file2.ts(1,14): error TS2322: Type '20' is not assignable to type 'string'.\n" - ]; - const modifiedFile1Content = file1.content.replace("x = 10", "z = 10"); - verifyIncrementalWatchEmit(() => ({ - files: [libFile, file1, fileModified, config], - expectedInitialEmit: [ - file1Js, - file2Js, - { - path: `${project}/tsconfig.tsbuildinfo`, - content: getBuildInfoText({ - program: { - fileInfos: { - [libFilePath]: libFileInfo, - [file1Path]: getFileInfo(file1.content), - [file2Path]: file2FileInfo - }, - options: { - incremental: true, - module: ModuleKind.AMD, - configFilePath: "./tsconfig.json" - }, - referencedMap: {}, - exportedModulesMap: {}, - semanticDiagnosticsPerFile: [ - libFilePath, - file1Path, - file2ReuasableError - ] - }, - version: ts.version // eslint-disable-line @typescript-eslint/no-unnecessary-qualifier - }) - } - ], - expectedInitialErrors: file2Errors, - modifyFs: host => host.writeFile(file1.path, modifiedFile1Content), - expectedIncrementalEmit: [ - { path: file1Js.path, content: file1Js.content.replace("x = 10", "z = 10") }, - { - path: `${project}/tsconfig.tsbuildinfo`, - content: getBuildInfoText({ - program: { - fileInfos: { - [libFilePath]: libFileInfo, - [file1Path]: getFileInfo(modifiedFile1Content), - [file2Path]: file2FileInfo - }, - options: { - incremental: true, - module: ModuleKind.AMD, - configFilePath: "./tsconfig.json" - }, - referencedMap: {}, - exportedModulesMap: {}, - semanticDiagnosticsPerFile: [ - libFilePath, - file2ReuasableError, - file1Path - ] - }, - version: ts.version // eslint-disable-line @typescript-eslint/no-unnecessary-qualifier - }) - } - ], - expectedIncrementalErrors: file2Errors, - })); + + verifyIncrementalWatchEmit({ + files: () => [libFile, file1, fileModified, config], + subScenario: "module compilation/own file emit with errors", + modifyFs: host => host.writeFile(file1.path, file1.content.replace("x = 10", "z = 10")), + }); it("verify that state is read correctly", () => { const system = createWatchedSystem([libFile, file1, fileModified, config], { currentDirectory: project }); - incrementalBuild("tsconfig.json", system); + const reportDiagnostic = createDiagnosticReporter(system); + const parsedConfig = parseConfigFileWithSystem("tsconfig.json", {}, /*watchOptionsToExtend*/ undefined, system, reportDiagnostic)!; + performIncrementalCompilation({ + rootNames: parsedConfig.fileNames, + options: parsedConfig.options, + projectReferences: parsedConfig.projectReferences, + configFileParsingDiagnostics: getConfigFileParsingDiagnostics(parsedConfig), + reportDiagnostic, + system + }); const command = parseConfigFileWithSystem("tsconfig.json", {}, /*watchOptionsToExtend*/ undefined, system, noop)!; const builderProgram = createIncrementalProgram({ @@ -560,9 +162,18 @@ namespace ts.tscWatch { assert.equal(state.changedFilesSet!.size, 0, "changes"); assert.equal(state.fileInfos.size, 3, "FileInfo size"); - assert.deepEqual(state.fileInfos.get(libFile.path), libFileInfo); - assert.deepEqual(state.fileInfos.get(file1.path), getFileInfo(file1.content)); - assert.deepEqual(state.fileInfos.get(file2.path), file2FileInfo); + assert.deepEqual(state.fileInfos.get(libFile.path), { + version: system.createHash(libFile.content), + signature: system.createHash(libFile.content) + }); + assert.deepEqual(state.fileInfos.get(file1.path), { + version: system.createHash(file1.content), + signature: system.createHash(`${file1.content.replace("export ", "export declare ")}\n`) + }); + assert.deepEqual(state.fileInfos.get(file2.path), { + version: system.createHash(fileModified.content), + signature: system.createHash("export declare const y: string;\n") + }); assert.deepEqual(state.compilerOptions, { incremental: true, @@ -576,10 +187,13 @@ namespace ts.tscWatch { assert.equal(state.semanticDiagnosticsPerFile!.size, 3); assert.deepEqual(state.semanticDiagnosticsPerFile!.get(libFile.path), emptyArray); assert.deepEqual(state.semanticDiagnosticsPerFile!.get(file1.path), emptyArray); - const { file: _, relatedInformation: __, ...rest } = file2ReuasableError[1][0]; assert.deepEqual(state.semanticDiagnosticsPerFile!.get(file2.path), [{ - ...rest, file: state.program!.getSourceFileByPath(file2.path as Path)!, + start: 13, + length: 1, + code: Diagnostics.Type_0_is_not_assignable_to_type_1.code, + category: Diagnostics.Type_0_is_not_assignable_to_type_1.category, + messageText: "Type '20' is not assignable to type 'string'.", relatedInformation: undefined, reportsUnnecessary: undefined, source: undefined @@ -587,179 +201,69 @@ namespace ts.tscWatch { }); }); - describe("with --out", () => { - const config: File = { + verifyIncrementalWatchEmit({ + files: () => [libFile, file1, file2, { path: configFile.path, content: JSON.stringify({ compilerOptions: { incremental: true, module: "amd", outFile: "out.js" } }) - }; - const outFile: File = { - path: `${project}/out.js`, - content: `${getEmitContent("file1", "x", "10")}${getEmitContent("file2", "y", "20")}` - }; - function getEmitContent(file: string, varName: string, value: string) { - return `define("${file}", ["require", "exports"], function (require, exports) { - "use strict"; - exports.__esModule = true; - exports.${varName} = ${value}; -}); -`; - } - verifyIncrementalWatchEmit(() => ({ - files: [libFile, file1, file2, config], - expectedInitialEmit: [ - outFile, - { - path: `${project}/out.tsbuildinfo`, - content: getBuildInfoText({ - bundle: { - commonSourceDirectory: relativeToBuildInfo(`${project}/out.tsbuildinfo`, `${project}/`), - sourceFiles: [file1Path, file2Path], - js: { - sections: [ - { pos: 0, end: outFile.content.length, kind: BundleFileSectionKind.Text } - ] - }, - }, - version: ts.version // eslint-disable-line @typescript-eslint/no-unnecessary-qualifier - }) - } - ], - expectedInitialErrors: emptyArray - })); + }], + subScenario: "module compilation/with --out", }); }); - describe("incremental with circular references", () => { - function getFileInfo(content: string): BuilderState.FileInfo { - const signature = Harness.mockHash(content); - return { version: signature, signature }; - } - const config: File = { - path: configFile.path, - content: JSON.stringify({ - compilerOptions: { - incremental: true, - target: "es5", - module: "commonjs", - declaration: true, - emitDeclarationOnly: true - } - }) - }; - const aTs: File = { - path: `${project}/a.ts`, - content: `import { B } from "./b"; + verifyIncrementalWatchEmit({ + files: () => { + const config: File = { + path: configFile.path, + content: JSON.stringify({ + compilerOptions: { + incremental: true, + target: "es5", + module: "commonjs", + declaration: true, + emitDeclarationOnly: true + } + }) + }; + const aTs: File = { + path: `${project}/a.ts`, + content: `import { B } from "./b"; export interface A { b: B; } ` - }; - const bTs: File = { - path: `${project}/b.ts`, - content: `import { C } from "./c"; + }; + const bTs: File = { + path: `${project}/b.ts`, + content: `import { C } from "./c"; export interface B { b: C; } ` - }; - const cTs: File = { - path: `${project}/c.ts`, - content: `import { A } from "./a"; + }; + const cTs: File = { + path: `${project}/c.ts`, + content: `import { A } from "./a"; export interface C { a: A; } ` - }; - const indexTs: File = { - path: `${project}/index.ts`, - content: `export { A } from "./a"; + }; + const indexTs: File = { + path: `${project}/index.ts`, + content: `export { A } from "./a"; export { B } from "./b"; export { C } from "./c"; ` - }; - - verifyIncrementalWatchEmit(() => { - const referencedMap: MapLike = { - "./a.ts": ["./b.ts"], - "./b.ts": ["./c.ts"], - "./c.ts": ["./a.ts"], - "./index.ts": ["./a.ts", "./b.ts", "./c.ts"], - }; - const initialProgram: ProgramBuildInfo = { - fileInfos: { - [libFilePath]: libFileInfo, - "./c.ts": getFileInfo(cTs.content), - "./b.ts": getFileInfo(bTs.content), - "./a.ts": getFileInfo(aTs.content), - "./index.ts": getFileInfo(indexTs.content) - }, - options: { - incremental: true, - target: ScriptTarget.ES5, - module: ModuleKind.CommonJS, - declaration: true, - emitDeclarationOnly: true, - configFilePath: "./tsconfig.json" - }, - referencedMap, - exportedModulesMap: referencedMap, - semanticDiagnosticsPerFile: [ - libFilePath, - "./a.ts", - "./b.ts", - "./c.ts", - "./index.ts", - ] - }; - const { fileInfos, ...rest } = initialProgram; - const expectedADts: File = { path: `${project}/a.d.ts`, content: aTs.content }; - const expectedBDts: File = { path: `${project}/b.d.ts`, content: bTs.content }; - const expectedCDts: File = { path: `${project}/c.d.ts`, content: cTs.content }; - const expectedIndexDts: File = { path: `${project}/index.d.ts`, content: indexTs.content }; - const modifiedATsContent = aTs.content.replace("b: B;", `b: B; - foo: any;`); - return { - files: [libFile, aTs, bTs, cTs, indexTs, config], - expectedInitialEmit: [ - expectedADts, - expectedBDts, - expectedCDts, - expectedIndexDts, - { - path: `${project}/tsconfig.tsbuildinfo`, - content: getBuildInfoText({ - program: initialProgram, - version: ts.version // eslint-disable-line @typescript-eslint/no-unnecessary-qualifier - }) - } - ], - expectedInitialErrors: emptyArray, - modifyFs: host => host.writeFile(aTs.path, modifiedATsContent), - expectedIncrementalEmit: [ - { path: expectedADts.path, content: modifiedATsContent }, - expectedBDts, - expectedCDts, - expectedIndexDts, - { - path: `${project}/tsconfig.tsbuildinfo`, - content: getBuildInfoText({ - program: { - fileInfos: { - [libFilePath]: libFileInfo, - "./c.ts": getFileInfo(cTs.content), - "./b.ts": getFileInfo(bTs.content), - "./a.ts": getFileInfo(modifiedATsContent), - "./index.ts": getFileInfo(indexTs.content) - }, - ...rest - }, - version: ts.version // eslint-disable-line @typescript-eslint/no-unnecessary-qualifier - }) - } - ], - expectedIncrementalErrors: emptyArray }; - }); + return [libFile, aTs, bTs, cTs, indexTs, config]; + }, + subScenario: "incremental with circular references", + modifyFs: host => host.writeFile(`${project}/a.ts`, `import { B } from "./b"; +export interface A { + b: B; + foo: any; +} +`) }); }); } diff --git a/src/testRunner/unittests/tscWatch/programUpdates.ts b/src/testRunner/unittests/tscWatch/programUpdates.ts index ee7b4019cf224..a8539eff38bbc 100644 --- a/src/testRunner/unittests/tscWatch/programUpdates.ts +++ b/src/testRunner/unittests/tscWatch/programUpdates.ts @@ -1,411 +1,440 @@ namespace ts.tscWatch { describe("unittests:: tsc-watch:: program updates", () => { - it("create watch without config file", () => { - const appFile: File = { - path: "/a/b/c/app.ts", - content: ` + const scenario = "programUpdates"; + const configFilePath = "/a/b/tsconfig.json"; + const configFile: File = { + path: configFilePath, + content: `{}` + }; + verifyTscWatch({ + scenario, + subScenario: "create watch without config file", + commandLineArgs: ["-w", "/a/b/c/app.ts"], + sys: () => { + const appFile: File = { + path: "/a/b/c/app.ts", + content: ` import {f} from "./module" console.log(f) ` - }; - - const moduleFile: File = { - path: "/a/b/c/module.d.ts", - content: `export let x: number` - }; - const host = createWatchedSystem([appFile, moduleFile, libFile]); - const watch = createWatchOfFilesAndCompilerOptions([appFile.path], host); - - checkProgramActualFiles(watch(), [appFile.path, libFile.path, moduleFile.path]); - - // TODO: Should we watch creation of config files in the root file's file hierarchy? + }; - // const configFileLocations = ["/a/b/c/", "/a/b/", "/a/", "/"]; - // const configFiles = flatMap(configFileLocations, location => [location + "tsconfig.json", location + "jsconfig.json"]); - // checkWatchedFiles(host, configFiles.concat(libFile.path, moduleFile.path)); + const moduleFile: File = { + path: "/a/b/c/module.d.ts", + content: `export let x: number` + }; + return createWatchedSystem([appFile, moduleFile, libFile]); + }, + changes: emptyArray }); - it("can handle tsconfig file name with difference casing", () => { - const f1 = { - path: "/a/b/app.ts", - content: "let x = 1" - }; - const config = { - path: "/a/b/tsconfig.json", - content: JSON.stringify({ - include: ["app.ts"] - }) - }; - - const host = createWatchedSystem([f1, config], { useCaseSensitiveFileNames: false }); - const upperCaseConfigFilePath = combinePaths(getDirectoryPath(config.path).toUpperCase(), getBaseFileName(config.path)); - const watch = createWatchOfConfigFile(upperCaseConfigFilePath, host); - checkProgramActualFiles(watch(), [combinePaths(getDirectoryPath(upperCaseConfigFilePath), getBaseFileName(f1.path))]); + verifyTscWatch({ + scenario, + subScenario: "can handle tsconfig file name with difference casing", + commandLineArgs: ["-w", "-p", "/A/B/tsconfig.json"], + sys: () => { + const f1 = { + path: "/a/b/app.ts", + content: "let x = 1" + }; + const config = { + path: configFilePath, + content: JSON.stringify({ + include: ["app.ts"] + }) + }; + return createWatchedSystem([f1, libFile, config], { useCaseSensitiveFileNames: false }); + }, + changes: emptyArray }); - it("create configured project without file list", () => { - const configFile: File = { - path: "/a/b/tsconfig.json", - content: ` + verifyTscWatch({ + scenario, + subScenario: "create configured project without file list", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + const configFile: File = { + path: configFilePath, + content: ` { "compilerOptions": {}, "exclude": [ "e" ] }` - }; - const file1: File = { - path: "/a/b/c/f1.ts", - content: "let x = 1" - }; - const file2: File = { - path: "/a/b/d/f2.ts", - content: "let y = 1" - }; - const file3: File = { - path: "/a/b/e/f3.ts", - content: "let z = 1" - }; - - const host = createWatchedSystem([configFile, libFile, file1, file2, file3]); - const watch = createWatchProgram(createWatchCompilerHostOfConfigFile(configFile.path, {}, /*watchOptionsToExtend*/ undefined, host, /*createProgram*/ undefined, notImplemented)); - - checkProgramActualFiles(watch.getCurrentProgram().getProgram(), [file1.path, libFile.path, file2.path]); - checkProgramRootFiles(watch.getCurrentProgram().getProgram(), [file1.path, file2.path]); - checkWatchedFiles(host, [configFile.path, file1.path, file2.path, libFile.path]); - const configDir = getDirectoryPath(configFile.path); - checkWatchedDirectories(host, [configDir, combinePaths(configDir, projectSystem.nodeModulesAtTypes)], /*recursive*/ true); + }; + const file1: File = { + path: "/a/b/c/f1.ts", + content: "let x = 1" + }; + const file2: File = { + path: "/a/b/d/f2.ts", + content: "let y = 1" + }; + const file3: File = { + path: "/a/b/e/f3.ts", + content: "let z = 1" + }; + return createWatchedSystem([configFile, libFile, file1, file2, file3]); + }, + changes: emptyArray }); - // TODO: if watching for config file creation - // it("add and then remove a config file in a folder with loose files", () => { - // }); - - it("add new files to a configured program without file list", () => { - const configFile: File = { - path: "/a/b/tsconfig.json", - content: `{}` - }; - const host = createWatchedSystem([commonFile1, libFile, configFile]); - const watch = createWatchOfConfigFile(configFile.path, host); - const configDir = getDirectoryPath(configFile.path); - checkWatchedDirectories(host, [configDir, combinePaths(configDir, projectSystem.nodeModulesAtTypes)], /*recursive*/ true); - - checkProgramRootFiles(watch(), [commonFile1.path]); - - // add a new ts file - host.reloadFS([commonFile1, commonFile2, libFile, configFile]); - host.checkTimeoutQueueLengthAndRun(1); - checkProgramRootFiles(watch(), [commonFile1.path, commonFile2.path]); + verifyTscWatch({ + scenario, + subScenario: "add new files to a configured program without file list", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => createWatchedSystem([commonFile1, libFile, configFile]), + changes: [ + sys => { + sys.writeFile(commonFile2.path, commonFile2.content); + sys.checkTimeoutQueueLengthAndRun(1); + return "Create commonFile2"; + } + ] }); - it("should ignore non-existing files specified in the config file", () => { - const configFile: File = { - path: "/a/b/tsconfig.json", - content: `{ + verifyTscWatch({ + scenario, + subScenario: "should ignore non-existing files specified in the config file", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + const configFile: File = { + path: configFilePath, + content: `{ "compilerOptions": {}, "files": [ "commonFile1.ts", "commonFile3.ts" ] }` - }; - const host = createWatchedSystem([commonFile1, commonFile2, configFile]); - const watch = createWatchOfConfigFile(configFile.path, host); - - const commonFile3 = "/a/b/commonFile3.ts"; - checkProgramRootFiles(watch(), [commonFile1.path, commonFile3]); - checkProgramActualFiles(watch(), [commonFile1.path]); + }; + return createWatchedSystem([commonFile1, commonFile2, libFile, configFile]); + }, + changes: emptyArray }); - it("handle recreated files correctly", () => { - const configFile: File = { - path: "/a/b/tsconfig.json", - content: `{}` - }; - const host = createWatchedSystem([commonFile1, commonFile2, configFile]); - const watch = createWatchOfConfigFile(configFile.path, host); - checkProgramRootFiles(watch(), [commonFile1.path, commonFile2.path]); - - // delete commonFile2 - host.reloadFS([commonFile1, configFile]); - host.checkTimeoutQueueLengthAndRun(1); - checkProgramRootFiles(watch(), [commonFile1.path]); - - // re-add commonFile2 - host.reloadFS([commonFile1, commonFile2, configFile]); - host.checkTimeoutQueueLengthAndRun(1); - checkProgramRootFiles(watch(), [commonFile1.path, commonFile2.path]); + verifyTscWatch({ + scenario, + subScenario: "handle recreated files correctly", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + return createWatchedSystem([libFile, commonFile1, commonFile2, configFile]); + }, + changes: [ + sys => { + sys.deleteFile(commonFile2.path); + sys.checkTimeoutQueueLengthAndRun(1); + return "delete file2"; + }, + sys => { + sys.writeFile(commonFile2.path, commonFile2.content); + sys.checkTimeoutQueueLengthAndRun(1); + return "recreate file2"; + } + ] }); - it("handles the missing files - that were added to program because they were added with /// { - const commonFile2Name = "commonFile2.ts"; - const file1: File = { - path: "/a/b/commonFile1.ts", - content: `/// + verifyTscWatch({ + scenario, + subScenario: "handles the missing files - that were added to program because they were added with tripleSlashRefs", + commandLineArgs: ["-w", "/a/b/commonFile1.ts"], + sys: () => { + const file1: File = { + path: commonFile1.path, + content: `/// let x = y` - }; - const host = createWatchedSystem([file1, libFile]); - const watch = createWatchOfFilesAndCompilerOptions([file1.path], host); - - checkProgramRootFiles(watch(), [file1.path]); - checkProgramActualFiles(watch(), [file1.path, libFile.path]); - checkOutputErrorsInitial(host, [ - getDiagnosticOfFileFromProgram(watch(), file1.path, file1.content.indexOf(commonFile2Name), commonFile2Name.length, Diagnostics.File_0_not_found, commonFile2.path), - getDiagnosticOfFileFromProgram(watch(), file1.path, file1.content.indexOf("y"), 1, Diagnostics.Cannot_find_name_0, "y") - ]); - - host.reloadFS([file1, commonFile2, libFile]); - host.runQueuedTimeoutCallbacks(); - checkProgramRootFiles(watch(), [file1.path]); - checkProgramActualFiles(watch(), [file1.path, libFile.path, commonFile2.path]); - checkOutputErrorsIncremental(host, emptyArray); + }; + return createWatchedSystem([file1, libFile]); + }, + changes: [ + sys => { + sys.writeFile(commonFile2.path, commonFile2.content); + sys.checkTimeoutQueueLengthAndRun(1); + return "create file2"; + } + ] }); - it("should reflect change in config file", () => { - const configFile: File = { - path: "/a/b/tsconfig.json", - content: `{ + verifyTscWatch({ + scenario, + subScenario: "should reflect change in config file", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + const configFile: File = { + path: configFilePath, + content: `{ "compilerOptions": {}, "files": ["${commonFile1.path}", "${commonFile2.path}"] }` - }; - const files = [commonFile1, commonFile2, configFile]; - const host = createWatchedSystem(files); - const watch = createWatchOfConfigFile(configFile.path, host); - - checkProgramRootFiles(watch(), [commonFile1.path, commonFile2.path]); - configFile.content = `{ - "compilerOptions": {}, - "files": ["${commonFile1.path}"] - }`; - - host.reloadFS(files); - host.checkTimeoutQueueLengthAndRun(1); // reload the configured project - checkProgramRootFiles(watch(), [commonFile1.path]); + }; + return createWatchedSystem([libFile, commonFile1, commonFile2, configFile]); + }, + changes: [ + sys => { + sys.writeFile(configFilePath, `{ + "compilerOptions": {}, + "files": ["${commonFile1.path}"] + }`); + sys.checkTimeoutQueueLengthAndRun(1); + return "Change config"; + } + ] }); - it("works correctly when config file is changed but its content havent", () => { - const configFile: File = { - path: "/a/b/tsconfig.json", - content: `{ + verifyTscWatch({ + scenario, + subScenario: "works correctly when config file is changed but its content havent", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + const configFile: File = { + path: configFilePath, + content: `{ "compilerOptions": {}, "files": ["${commonFile1.path}", "${commonFile2.path}"] }` - }; - const files = [libFile, commonFile1, commonFile2, configFile]; - const host = createWatchedSystem(files); - const watch = createWatchOfConfigFile(configFile.path, host); - - checkProgramActualFiles(watch(), [libFile.path, commonFile1.path, commonFile2.path]); - checkOutputErrorsInitial(host, emptyArray); - - host.modifyFile(configFile.path, configFile.content); - host.checkTimeoutQueueLengthAndRun(1); // reload the configured project - - checkProgramActualFiles(watch(), [libFile.path, commonFile1.path, commonFile2.path]); - checkOutputErrorsIncremental(host, emptyArray); + }; + return createWatchedSystem([libFile, commonFile1, commonFile2, configFile]); + }, + changes: [ + sys => { + sys.modifyFile(configFilePath, `{ + "compilerOptions": {}, + "files": ["${commonFile1.path}", "${commonFile2.path}"] + }`); + sys.checkTimeoutQueueLengthAndRun(1); + return "Modify config without changing content"; + } + ] }); - it("Updates diagnostics when '--noUnusedLabels' changes", () => { - const aTs: File = { path: "/a.ts", content: "label: while (1) {}" }; - const files = [libFile, aTs]; - const paths = files.map(f => f.path); - const options = (allowUnusedLabels: boolean) => `{ "compilerOptions": { "allowUnusedLabels": ${allowUnusedLabels} } }`; - const tsconfig: File = { path: "/tsconfig.json", content: options(/*allowUnusedLabels*/ true) }; - - const host = createWatchedSystem([...files, tsconfig]); - const watch = createWatchOfConfigFile(tsconfig.path, host); - - checkProgramActualFiles(watch(), paths); - checkOutputErrorsInitial(host, emptyArray); - - host.modifyFile(tsconfig.path, options(/*allowUnusedLabels*/ false)); - host.checkTimeoutQueueLengthAndRun(1); // reload the configured project - - checkProgramActualFiles(watch(), paths); - checkOutputErrorsIncremental(host, [ - getDiagnosticOfFileFromProgram(watch(), aTs.path, 0, "label".length, Diagnostics.Unused_label), - ]); - - host.modifyFile(tsconfig.path, options(/*allowUnusedLabels*/ true)); - host.checkTimeoutQueueLengthAndRun(1); // reload the configured project - checkProgramActualFiles(watch(), paths); - checkOutputErrorsIncremental(host, emptyArray); + verifyTscWatch({ + scenario, + subScenario: "Updates diagnostics when '--noUnusedLabels' changes", + commandLineArgs: ["-w", "-p", "/tsconfig.json"], + sys: () => { + const aTs: File = { + path: "/a.ts", + content: "label: while (1) {}" + }; + const tsconfig: File = { + path: "/tsconfig.json", + content: JSON.stringify({ + compilerOptions: { allowUnusedLabels: true } + }) + }; + return createWatchedSystem([libFile, aTs, tsconfig]); + }, + changes: [ + sys => { + sys.modifyFile("/tsconfig.json", JSON.stringify({ + compilerOptions: { allowUnusedLabels: false } + })); + sys.checkTimeoutQueueLengthAndRun(1); + return "Disable allowUnsusedLabels"; + }, + sys => { + sys.modifyFile("/tsconfig.json", JSON.stringify({ + compilerOptions: { allowUnusedLabels: true } + })); + sys.checkTimeoutQueueLengthAndRun(1); + return "Enable allowUnsusedLabels"; + } + ] }); - it("files explicitly excluded in config file", () => { - const configFile: File = { - path: "/a/b/tsconfig.json", - content: `{ + verifyTscWatch({ + scenario, + subScenario: "files explicitly excluded in config file", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + const configFile: File = { + path: configFilePath, + content: `{ "compilerOptions": {}, "exclude": ["/a/c"] }` - }; - const excludedFile1: File = { - path: "/a/c/excluedFile1.ts", - content: `let t = 1;` - }; - - const host = createWatchedSystem([commonFile1, commonFile2, excludedFile1, configFile]); - const watch = createWatchOfConfigFile(configFile.path, host); - checkProgramRootFiles(watch(), [commonFile1.path, commonFile2.path]); + }; + const excludedFile1: File = { + path: "/a/c/excluedFile1.ts", + content: `let t = 1;` + }; + return createWatchedSystem([libFile, commonFile1, commonFile2, excludedFile1, configFile]); + }, + changes: emptyArray }); - it("should properly handle module resolution changes in config file", () => { - const file1: File = { - path: "/a/b/file1.ts", - content: `import { T } from "module1";` - }; - const nodeModuleFile: File = { - path: "/a/b/node_modules/module1.ts", - content: `export interface T {}` - }; - const classicModuleFile: File = { - path: "/a/module1.ts", - content: `export interface T {}` - }; - const configFile: File = { - path: "/a/b/tsconfig.json", - content: `{ + verifyTscWatch({ + scenario, + subScenario: "should properly handle module resolution changes in config file", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + const file1: File = { + path: "/a/b/file1.ts", + content: `import { T } from "module1";` + }; + const nodeModuleFile: File = { + path: "/a/b/node_modules/module1.ts", + content: `export interface T {}` + }; + const classicModuleFile: File = { + path: "/a/module1.ts", + content: `export interface T {}` + }; + const configFile: File = { + path: configFilePath, + content: `{ "compilerOptions": { "moduleResolution": "node" }, "files": ["${file1.path}"] }` - }; - const files = [file1, nodeModuleFile, classicModuleFile, configFile]; - const host = createWatchedSystem(files); - const watch = createWatchOfConfigFile(configFile.path, host); - checkProgramRootFiles(watch(), [file1.path]); - checkProgramActualFiles(watch(), [file1.path, nodeModuleFile.path]); - - configFile.content = `{ - "compilerOptions": { - "moduleResolution": "classic" - }, - "files": ["${file1.path}"] - }`; - host.reloadFS(files); - host.checkTimeoutQueueLengthAndRun(1); - checkProgramRootFiles(watch(), [file1.path]); - checkProgramActualFiles(watch(), [file1.path, classicModuleFile.path]); + }; + return createWatchedSystem([libFile, file1, nodeModuleFile, classicModuleFile, configFile]); + }, + changes: [ + sys => { + sys.writeFile(configFile.path, `{ + "compilerOptions": { + "moduleResolution": "classic" + }, + "files": ["/a/b/file1.ts"] + }`); + sys.checkTimeoutQueueLengthAndRun(1); + return "Change module resolution to classic"; + } + ] }); - it("should tolerate config file errors and still try to build a project", () => { - const configFile: File = { - path: "/a/b/tsconfig.json", - content: `{ - "compilerOptions": { - "target": "es6", - "allowAnything": true - }, - "someOtherProperty": {} - }` - }; - const host = createWatchedSystem([commonFile1, commonFile2, libFile, configFile]); - const watch = createWatchOfConfigFile(configFile.path, host); - checkProgramRootFiles(watch(), [commonFile1.path, commonFile2.path]); + verifyTscWatch({ + scenario, + subScenario: "should tolerate config file errors and still try to build a project", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + const configFile: File = { + path: configFilePath, + content: `{ + "compilerOptions": { + "module": "none", + "allowAnything": true + }, + "someOtherProperty": {} + }` + }; + return createWatchedSystem([commonFile1, commonFile2, libFile, configFile]); + }, + changes: emptyArray }); - it("changes in files are reflected in project structure", () => { - const file1 = { - path: "/a/b/f1.ts", - content: `export * from "./f2"` - }; - const file2 = { - path: "/a/b/f2.ts", - content: `export let x = 1` - }; - const file3 = { - path: "/a/c/f3.ts", - content: `export let y = 1;` - }; - const host = createWatchedSystem([file1, file2, file3]); - const watch = createWatchOfFilesAndCompilerOptions([file1.path], host); - checkProgramRootFiles(watch(), [file1.path]); - checkProgramActualFiles(watch(), [file1.path, file2.path]); - - const modifiedFile2 = { - path: file2.path, - content: `export * from "../c/f3"` // now inferred project should inclule file3 - }; - - host.reloadFS([file1, modifiedFile2, file3]); - host.checkTimeoutQueueLengthAndRun(1); - checkProgramRootFiles(watch(), [file1.path]); - checkProgramActualFiles(watch(), [file1.path, modifiedFile2.path, file3.path]); + verifyTscWatch({ + scenario, + subScenario: "changes in files are reflected in project structure", + commandLineArgs: ["-w", "/a/b/f1.ts"], + sys: () => { + const file1 = { + path: "/a/b/f1.ts", + content: `export * from "./f2"` + }; + const file2 = { + path: "/a/b/f2.ts", + content: `export let x = 1` + }; + const file3 = { + path: "/a/c/f3.ts", + content: `export let y = 1;` + }; + return createWatchedSystem([file1, file2, file3, libFile]); + }, + changes: [ + sys => { + // now inferred project should inclule file3 + sys.modifyFile("/a/b/f2.ts", `export * from "../c/f3"`); + sys.checkTimeoutQueueLengthAndRun(1); + return "Modify f2 to include f3"; + } + ] }); - it("deleted files affect project structure", () => { - const file1 = { - path: "/a/b/f1.ts", - content: `export * from "./f2"` - }; - const file2 = { - path: "/a/b/f2.ts", - content: `export * from "../c/f3"` - }; - const file3 = { - path: "/a/c/f3.ts", - content: `export let y = 1;` - }; - const host = createWatchedSystem([file1, file2, file3]); - const watch = createWatchOfFilesAndCompilerOptions([file1.path], host); - checkProgramActualFiles(watch(), [file1.path, file2.path, file3.path]); - - host.reloadFS([file1, file3]); - host.checkTimeoutQueueLengthAndRun(1); - - checkProgramActualFiles(watch(), [file1.path]); + verifyTscWatch({ + scenario, + subScenario: "deleted files affect project structure", + commandLineArgs: ["-w", "/a/b/f1.ts"], + sys: () => { + const file1 = { + path: "/a/b/f1.ts", + content: `export * from "./f2"` + }; + const file2 = { + path: "/a/b/f2.ts", + content: `export * from "../c/f3"` + }; + const file3 = { + path: "/a/c/f3.ts", + content: `export let y = 1;` + }; + return createWatchedSystem([file1, file2, file3, libFile]); + }, + changes: [ + sys => { + sys.deleteFile("/a/b/f2.ts"); + sys.checkTimeoutQueueLengthAndRun(1); + return "Delete f2"; + } + ] }); - it("deleted files affect project structure - 2", () => { - const file1 = { - path: "/a/b/f1.ts", - content: `export * from "./f2"` - }; - const file2 = { - path: "/a/b/f2.ts", - content: `export * from "../c/f3"` - }; - const file3 = { - path: "/a/c/f3.ts", - content: `export let y = 1;` - }; - const host = createWatchedSystem([file1, file2, file3]); - const watch = createWatchOfFilesAndCompilerOptions([file1.path, file3.path], host); - checkProgramActualFiles(watch(), [file1.path, file2.path, file3.path]); - - host.reloadFS([file1, file3]); - host.checkTimeoutQueueLengthAndRun(1); - - checkProgramActualFiles(watch(), [file1.path, file3.path]); + verifyTscWatch({ + scenario, + subScenario: "deleted files affect project structure-2", + commandLineArgs: ["-w", "/a/b/f1.ts", "/a/c/f3.ts"], + sys: () => { + const file1 = { + path: "/a/b/f1.ts", + content: `export * from "./f2"` + }; + const file2 = { + path: "/a/b/f2.ts", + content: `export * from "../c/f3"` + }; + const file3 = { + path: "/a/c/f3.ts", + content: `export let y = 1;` + }; + return createWatchedSystem([file1, file2, file3, libFile]); + }, + changes: [ + sys => { + sys.deleteFile("/a/b/f2.ts"); + sys.checkTimeoutQueueLengthAndRun(1); + return "Delete f2"; + } + ] }); - it("config file includes the file", () => { - const file1 = { - path: "/a/b/f1.ts", - content: "export let x = 5" - }; - const file2 = { - path: "/a/c/f2.ts", - content: `import {x} from "../b/f1"` - }; - const file3 = { - path: "/a/c/f3.ts", - content: "export let y = 1" - }; - const configFile = { - path: "/a/c/tsconfig.json", - content: JSON.stringify({ compilerOptions: {}, files: ["f2.ts", "f3.ts"] }) - }; - - const host = createWatchedSystem([file1, file2, file3, configFile]); - const watch = createWatchOfConfigFile(configFile.path, host); - - checkProgramRootFiles(watch(), [file2.path, file3.path]); - checkProgramActualFiles(watch(), [file1.path, file2.path, file3.path]); + verifyTscWatch({ + scenario, + subScenario: "config file includes the file", + commandLineArgs: ["-w", "-p", "/a/c/tsconfig.json"], + sys: () => { + const file1 = { + path: "/a/b/f1.ts", + content: "export let x = 5" + }; + const file2 = { + path: "/a/c/f2.ts", + content: `import {x} from "../b/f1"` + }; + const file3 = { + path: "/a/c/f3.ts", + content: "export let y = 1" + }; + const configFile = { + path: "/a/c/tsconfig.json", + content: JSON.stringify({ compilerOptions: {}, files: ["f2.ts", "f3.ts"] }) + }; + return createWatchedSystem([file1, file2, file3, libFile, configFile]); + }, + changes: emptyArray }); it("correctly migrate files between projects", () => { @@ -435,433 +464,427 @@ namespace ts.tscWatch { host.checkTimeoutQueueLength(0); }); - it("can correctly update configured project when set of root files has changed (new file on disk)", () => { - const file1 = { - path: "/a/b/f1.ts", - content: "let x = 1" - }; - const file2 = { - path: "/a/b/f2.ts", - content: "let y = 1" - }; - const configFile = { - path: "/a/b/tsconfig.json", - content: JSON.stringify({ compilerOptions: {} }) - }; - - const host = createWatchedSystem([file1, configFile]); - const watch = createWatchOfConfigFile(configFile.path, host); - checkProgramActualFiles(watch(), [file1.path]); - - host.reloadFS([file1, file2, configFile]); - host.checkTimeoutQueueLengthAndRun(1); - - checkProgramActualFiles(watch(), [file1.path, file2.path]); - checkProgramRootFiles(watch(), [file1.path, file2.path]); + verifyTscWatch({ + scenario, + subScenario: "can correctly update configured project when set of root files has changed (new file on disk)", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + const file1 = { + path: "/a/b/f1.ts", + content: "let x = 1" + }; + return createWatchedSystem([file1, libFile, configFile]); + }, + changes: [ + sys => { + sys.writeFile("/a/b/f2.ts", "let y = 1"); + sys.checkTimeoutQueueLengthAndRun(1); + return "Write f2"; + } + ] }); - it("can correctly update configured project when set of root files has changed (new file in list of files)", () => { - const file1 = { - path: "/a/b/f1.ts", - content: "let x = 1" - }; - const file2 = { - path: "/a/b/f2.ts", - content: "let y = 1" - }; - const configFile = { - path: "/a/b/tsconfig.json", - content: JSON.stringify({ compilerOptions: {}, files: ["f1.ts"] }) - }; - - const host = createWatchedSystem([file1, file2, configFile]); - const watch = createWatchOfConfigFile(configFile.path, host); - - checkProgramActualFiles(watch(), [file1.path]); - - const modifiedConfigFile = { - path: configFile.path, - content: JSON.stringify({ compilerOptions: {}, files: ["f1.ts", "f2.ts"] }) - }; - - host.reloadFS([file1, file2, modifiedConfigFile]); - host.checkTimeoutQueueLengthAndRun(1); - checkProgramRootFiles(watch(), [file1.path, file2.path]); - checkProgramActualFiles(watch(), [file1.path, file2.path]); + verifyTscWatch({ + scenario, + subScenario: "can correctly update configured project when set of root files has changed (new file in list of files)", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + const file1 = { + path: "/a/b/f1.ts", + content: "let x = 1" + }; + const file2 = { + path: "/a/b/f2.ts", + content: "let y = 1" + }; + const configFile = { + path: configFilePath, + content: JSON.stringify({ compilerOptions: {}, files: ["f1.ts"] }) + }; + return createWatchedSystem([file1, file2, libFile, configFile]); + }, + changes: [ + sys => { + sys.writeFile(configFilePath, JSON.stringify({ compilerOptions: {}, files: ["f1.ts", "f2.ts"] })); + sys.checkTimeoutQueueLengthAndRun(1); + return "Modify config to make f2 as root too"; + } + ] }); - it("can update configured project when set of root files was not changed", () => { - const file1 = { - path: "/a/b/f1.ts", - content: "let x = 1" - }; - const file2 = { - path: "/a/b/f2.ts", - content: "let y = 1" - }; - const configFile = { - path: "/a/b/tsconfig.json", - content: JSON.stringify({ compilerOptions: {}, files: ["f1.ts", "f2.ts"] }) - }; - - const host = createWatchedSystem([file1, file2, configFile]); - const watch = createWatchOfConfigFile(configFile.path, host); - checkProgramActualFiles(watch(), [file1.path, file2.path]); - - const modifiedConfigFile = { - path: configFile.path, - content: JSON.stringify({ compilerOptions: { outFile: "out.js" }, files: ["f1.ts", "f2.ts"] }) - }; - - host.reloadFS([file1, file2, modifiedConfigFile]); - host.checkTimeoutQueueLengthAndRun(1); - checkProgramRootFiles(watch(), [file1.path, file2.path]); - checkProgramActualFiles(watch(), [file1.path, file2.path]); + verifyTscWatch({ + scenario, + subScenario: "can update configured project when set of root files was not changed", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + const file1 = { + path: "/a/b/f1.ts", + content: "let x = 1" + }; + const file2 = { + path: "/a/b/f2.ts", + content: "let y = 1" + }; + const configFile = { + path: configFilePath, + content: JSON.stringify({ compilerOptions: {}, files: ["f1.ts", "f2.ts"] }) + }; + return createWatchedSystem([file1, file2, libFile, configFile]); + }, + changes: [ + sys => { + sys.writeFile(configFilePath, JSON.stringify({ compilerOptions: { outFile: "out.js" }, files: ["f1.ts", "f2.ts"] })); + sys.checkTimeoutQueueLengthAndRun(1); + return "Modify config to set outFile option"; + } + ] }); - it("config file is deleted", () => { - const file1 = { - path: "/a/b/f1.ts", - content: "let x = 1;" - }; - const file2 = { - path: "/a/b/f2.ts", - content: "let y = 2;" - }; - const config = { - path: "/a/b/tsconfig.json", - content: JSON.stringify({ compilerOptions: {} }) - }; - const host = createWatchedSystem([file1, file2, libFile, config]); - const watch = createWatchOfConfigFile(config.path, host); - - checkProgramActualFiles(watch(), [file1.path, file2.path, libFile.path]); - checkOutputErrorsInitial(host, emptyArray); - - host.reloadFS([file1, file2, libFile]); - host.checkTimeoutQueueLengthAndRun(1); - - checkOutputErrorsIncrementalWithExit(host, [ - getDiagnosticWithoutFile(Diagnostics.File_0_not_found, config.path) - ], ExitStatus.DiagnosticsPresent_OutputsSkipped); + verifyTscWatch({ + scenario, + subScenario: "config file is deleted", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + const file1 = { + path: "/a/b/f1.ts", + content: "let x = 1;" + }; + const file2 = { + path: "/a/b/f2.ts", + content: "let y = 2;" + }; + return createWatchedSystem([file1, file2, libFile, configFile]); + }, + changes: [ + sys => { + sys.deleteFile(configFilePath); + sys.checkTimeoutQueueLengthAndRun(1); + return "Delete config file"; + } + ] }); - it("Proper errors: document is not contained in project", () => { - const file1 = { - path: "/a/b/app.ts", - content: "" - }; - const corruptedConfig = { - path: "/a/b/tsconfig.json", - content: "{" - }; - const host = createWatchedSystem([file1, corruptedConfig]); - const watch = createWatchOfConfigFile(corruptedConfig.path, host); - - checkProgramActualFiles(watch(), [file1.path]); + verifyTscWatch({ + scenario, + subScenario: "Proper errors document is not contained in project", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + const file1 = { + path: "/a/b/app.ts", + content: "" + }; + const corruptedConfig = { + path: configFilePath, + content: "{" + }; + return createWatchedSystem([file1, libFile, corruptedConfig]); + }, + changes: emptyArray }); - it("correctly handles changes in lib section of config file", () => { - const libES5 = { - path: "/compiler/lib.es5.d.ts", - content: "declare const eval: any" - }; - const libES2015Promise = { - path: "/compiler/lib.es2015.promise.d.ts", - content: "declare class Promise {}" - }; - const app = { - path: "/src/app.ts", - content: "var x: Promise;" - }; - const config1 = { - path: "/src/tsconfig.json", - content: JSON.stringify( - { - compilerOptions: { - module: "commonjs", - target: "es5", - noImplicitAny: true, - sourceMap: false, - lib: [ - "es5" - ] - } - }) - }; - const config2 = { - path: config1.path, - content: JSON.stringify( - { - compilerOptions: { - module: "commonjs", - target: "es5", - noImplicitAny: true, - sourceMap: false, - lib: [ - "es5", - "es2015.promise" - ] - } - }) - }; - const host = createWatchedSystem([libES5, libES2015Promise, app, config1], { executingFilePath: "/compiler/tsc.js" }); - const watch = createWatchOfConfigFile(config1.path, host); - - checkProgramActualFiles(watch(), [libES5.path, app.path]); - - host.reloadFS([libES5, libES2015Promise, app, config2]); - host.checkTimeoutQueueLengthAndRun(1); - checkProgramActualFiles(watch(), [libES5.path, libES2015Promise.path, app.path]); + verifyTscWatch({ + scenario, + subScenario: "correctly handles changes in lib section of config file", + commandLineArgs: ["-w", "-p", "/src/tsconfig.json"], + sys: () => { + const libES5 = { + path: "/compiler/lib.es5.d.ts", + content: `${libFile.content} +declare const eval: any` + }; + const libES2015Promise = { + path: "/compiler/lib.es2015.promise.d.ts", + content: `declare class Promise {}` + }; + const app = { + path: "/src/app.ts", + content: "var x: Promise;" + }; + const config1 = { + path: "/src/tsconfig.json", + content: JSON.stringify( + { + compilerOptions: { + module: "commonjs", + target: "es5", + noImplicitAny: true, + sourceMap: false, + lib: [ + "es5" + ] + } + }) + }; + return createWatchedSystem([libES5, libES2015Promise, app, config1], { executingFilePath: "/compiler/tsc.js" }); + }, + changes: [ + sys => { + sys.writeFile("/src/tsconfig.json", JSON.stringify( + { + compilerOptions: { + module: "commonjs", + target: "es5", + noImplicitAny: true, + sourceMap: false, + lib: [ + "es5", + "es2015.promise" + ] + } + }) + ); + sys.checkTimeoutQueueLengthAndRun(1); + return "Change the lib in config"; + } + ] }); - it("should handle non-existing directories in config file", () => { - const f = { - path: "/a/src/app.ts", - content: "let x = 1;" - }; - const config = { - path: "/a/tsconfig.json", - content: JSON.stringify({ - compilerOptions: {}, - include: [ - "src/**/*", - "notexistingfolder/*" - ] - }) - }; - const host = createWatchedSystem([f, config]); - const watch = createWatchOfConfigFile(config.path, host); - checkProgramActualFiles(watch(), [f.path]); + verifyTscWatch({ + scenario, + subScenario: "should handle non-existing directories in config file", + commandLineArgs: ["-w", "-p", "/a/tsconfig.json"], + sys: () => { + const f = { + path: "/a/src/app.ts", + content: "let x = 1;" + }; + const config = { + path: "/a/tsconfig.json", + content: JSON.stringify({ + compilerOptions: {}, + include: [ + "src/**/*", + "notexistingfolder/*" + ] + }) + }; + return createWatchedSystem([f, config, libFile]); + }, + changes: emptyArray }); - it("rename a module file and rename back should restore the states for inferred projects", () => { - const moduleFile = { - path: "/a/b/moduleFile.ts", - content: "export function bar() { };" - }; - const file1 = { - path: "/a/b/file1.ts", - content: 'import * as T from "./moduleFile"; T.bar();' - }; - const host = createWatchedSystem([moduleFile, file1, libFile]); - const watch = createWatchOfFilesAndCompilerOptions([file1.path], host); - checkOutputErrorsInitial(host, emptyArray); - - const moduleFileOldPath = moduleFile.path; - const moduleFileNewPath = "/a/b/moduleFile1.ts"; - moduleFile.path = moduleFileNewPath; - host.reloadFS([moduleFile, file1, libFile]); - host.runQueuedTimeoutCallbacks(); - checkOutputErrorsIncremental(host, [ - getDiagnosticModuleNotFoundOfFile(watch(), file1, "./moduleFile") - ]); - - moduleFile.path = moduleFileOldPath; - host.reloadFS([moduleFile, file1, libFile]); - host.runQueuedTimeoutCallbacks(); - checkOutputErrorsIncremental(host, emptyArray); + function changeModuleFileToModuleFile1(sys: WatchedSystem) { + sys.renameFile("/a/b/moduleFile.ts", "/a/b/moduleFile1.ts"); + sys.deleteFile("/a/b/moduleFile.js"); + sys.runQueuedTimeoutCallbacks(); + return "Rename moduleFile to moduleFile1"; + } + function changeModuleFile1ToModuleFile(sys: WatchedSystem) { + sys.renameFile("/a/b/moduleFile1.ts", "/a/b/moduleFile.ts"); + sys.runQueuedTimeoutCallbacks(); + return "Rename moduleFile1 back to moduleFile"; + } + + verifyTscWatch({ + scenario, + subScenario: "rename a module file and rename back should restore the states for inferred projects", + commandLineArgs: ["-w", "/a/b/file1.ts"], + sys: () => { + const moduleFile = { + path: "/a/b/moduleFile.ts", + content: "export function bar() { };" + }; + const file1 = { + path: "/a/b/file1.ts", + content: 'import * as T from "./moduleFile"; T.bar();' + }; + return createWatchedSystem([moduleFile, file1, libFile]); + }, + changes: [ + changeModuleFileToModuleFile1, + changeModuleFile1ToModuleFile + ] }); - it("rename a module file and rename back should restore the states for configured projects", () => { - const moduleFile = { - path: "/a/b/moduleFile.ts", - content: "export function bar() { };" - }; - const file1 = { - path: "/a/b/file1.ts", - content: 'import * as T from "./moduleFile"; T.bar();' - }; - const configFile = { - path: "/a/b/tsconfig.json", - content: `{}` - }; - const host = createWatchedSystem([moduleFile, file1, configFile, libFile]); - const watch = createWatchOfConfigFile(configFile.path, host); - checkOutputErrorsInitial(host, emptyArray); - - const moduleFileOldPath = moduleFile.path; - const moduleFileNewPath = "/a/b/moduleFile1.ts"; - moduleFile.path = moduleFileNewPath; - host.reloadFS([moduleFile, file1, configFile, libFile]); - host.runQueuedTimeoutCallbacks(); - checkOutputErrorsIncremental(host, [ - getDiagnosticModuleNotFoundOfFile(watch(), file1, "./moduleFile") - ]); - - moduleFile.path = moduleFileOldPath; - host.reloadFS([moduleFile, file1, configFile, libFile]); - host.runQueuedTimeoutCallbacks(); - checkOutputErrorsIncremental(host, emptyArray); + verifyTscWatch({ + scenario, + subScenario: "rename a module file and rename back should restore the states for configured projects", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + const moduleFile = { + path: "/a/b/moduleFile.ts", + content: "export function bar() { };" + }; + const file1 = { + path: "/a/b/file1.ts", + content: 'import * as T from "./moduleFile"; T.bar();' + }; + return createWatchedSystem([moduleFile, file1, configFile, libFile]); + }, + changes: [ + changeModuleFileToModuleFile1, + changeModuleFile1ToModuleFile + ] }); - it("types should load from config file path if config exists", () => { - const f1 = { - path: "/a/b/app.ts", - content: "let x = 1" - }; - const config = { - path: "/a/b/tsconfig.json", - content: JSON.stringify({ compilerOptions: { types: ["node"], typeRoots: [] } }) - }; - const node = { - path: "/a/b/node_modules/@types/node/index.d.ts", - content: "declare var process: any" - }; - const cwd = { - path: "/a/c" - }; - const host = createWatchedSystem([f1, config, node, cwd], { currentDirectory: cwd.path }); - const watch = createWatchOfConfigFile(config.path, host); - - checkProgramActualFiles(watch(), [f1.path, node.path]); + verifyTscWatch({ + scenario, + subScenario: "types should load from config file path if config exists", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + const f1 = { + path: "/a/b/app.ts", + content: "let x = 1" + }; + const config = { + path: configFilePath, + content: JSON.stringify({ compilerOptions: { types: ["node"], typeRoots: [] } }) + }; + const node = { + path: "/a/b/node_modules/@types/node/index.d.ts", + content: "declare var process: any" + }; + const cwd = { + path: "/a/c" + }; + return createWatchedSystem([f1, config, node, cwd, libFile], { currentDirectory: cwd.path }); + }, + changes: emptyArray }); - it("add the missing module file for inferred project: should remove the `module not found` error", () => { - const moduleFile = { - path: "/a/b/moduleFile.ts", - content: "export function bar() { };" - }; - const file1 = { - path: "/a/b/file1.ts", - content: 'import * as T from "./moduleFile"; T.bar();' - }; - const host = createWatchedSystem([file1, libFile]); - const watch = createWatchOfFilesAndCompilerOptions([file1.path], host); - - checkOutputErrorsInitial(host, [ - getDiagnosticModuleNotFoundOfFile(watch(), file1, "./moduleFile") - ]); - - host.reloadFS([file1, moduleFile, libFile]); - host.runQueuedTimeoutCallbacks(); - checkOutputErrorsIncremental(host, emptyArray); + verifyTscWatch({ + scenario, + subScenario: "add the missing module file for inferred project-should remove the module not found error", + commandLineArgs: ["-w", "/a/b/file1.ts"], + sys: () => { + const file1 = { + path: "/a/b/file1.ts", + content: 'import * as T from "./moduleFile"; T.bar();' + }; + return createWatchedSystem([file1, libFile]); + }, + changes: [ + sys => { + sys.writeFile("/a/b/moduleFile.ts", "export function bar() { }"); + sys.runQueuedTimeoutCallbacks(); + return "Create module file"; + } + ] }); - it("Configure file diagnostics events are generated when the config file has errors", () => { - const file = { - path: "/a/b/app.ts", - content: "let x = 10" - }; - const configFile = { - path: "/a/b/tsconfig.json", - content: `{ + verifyTscWatch({ + scenario, + subScenario: "Configure file diagnostics events are generated when the config file has errors", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + const file = { + path: "/a/b/app.ts", + content: "let x = 10" + }; + const configFile = { + path: configFilePath, + content: `{ "compilerOptions": { "foo": "bar", "allowJS": true } }` - }; - - const host = createWatchedSystem([file, configFile, libFile]); - const watch = createWatchOfConfigFile(configFile.path, host); - checkOutputErrorsInitial(host, [ - getUnknownCompilerOption(watch(), configFile, "foo"), - getUnknownDidYouMeanCompilerOption(watch(), configFile, "allowJS", "allowJs") - ]); + }; + return createWatchedSystem([file, configFile, libFile]); + }, + changes: emptyArray }); - it("If config file doesnt have errors, they are not reported", () => { - const file = { - path: "/a/b/app.ts", - content: "let x = 10" - }; - const configFile = { - path: "/a/b/tsconfig.json", - content: `{ + verifyTscWatch({ + scenario, + subScenario: "if config file doesnt have errors, they are not reported", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + const file = { + path: "/a/b/app.ts", + content: "let x = 10" + }; + const configFile = { + path: configFilePath, + content: `{ "compilerOptions": {} }` - }; - - const host = createWatchedSystem([file, configFile, libFile]); - createWatchOfConfigFile(configFile.path, host); - checkOutputErrorsInitial(host, emptyArray); + }; + return createWatchedSystem([file, configFile, libFile]); + }, + changes: emptyArray }); - it("Reports errors when the config file changes", () => { - const file = { - path: "/a/b/app.ts", - content: "let x = 10" - }; - const configFile = { - path: "/a/b/tsconfig.json", - content: `{ - "compilerOptions": {} - }` - }; - - const host = createWatchedSystem([file, configFile, libFile]); - const watch = createWatchOfConfigFile(configFile.path, host); - checkOutputErrorsInitial(host, emptyArray); - - configFile.content = `{ - "compilerOptions": { - "haha": 123 - } - }`; - host.reloadFS([file, configFile, libFile]); - host.runQueuedTimeoutCallbacks(); - checkOutputErrorsIncremental(host, [ - getUnknownCompilerOption(watch(), configFile, "haha") - ]); - - configFile.content = `{ - "compilerOptions": {} - }`; - host.reloadFS([file, configFile, libFile]); - host.runQueuedTimeoutCallbacks(); - checkOutputErrorsIncremental(host, emptyArray); + verifyTscWatch({ + scenario, + subScenario: "Reports errors when the config file changes", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + const file = { + path: "/a/b/app.ts", + content: "let x = 10" + }; + return createWatchedSystem([file, configFile, libFile]); + }, + changes: [ + sys => { + sys.writeFile(configFilePath, `{ + "compilerOptions": { + "haha": 123 + } + }`); + sys.runQueuedTimeoutCallbacks(); + return "change config file to add error"; + }, + sys => { + sys.writeFile(configFilePath, `{ + "compilerOptions": { + } + }`); + sys.runQueuedTimeoutCallbacks(); + return "change config file to remove error"; + } + ] }); - it("non-existing directories listed in config file input array should be tolerated without crashing the server", () => { - const configFile = { - path: "/a/b/tsconfig.json", - content: `{ + verifyTscWatch({ + scenario, + subScenario: "non-existing directories listed in config file input array should be tolerated without crashing the server", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + const configFile = { + path: configFilePath, + content: `{ "compilerOptions": {}, "include": ["app/*", "test/**/*", "something"] }` - }; - const file1 = { - path: "/a/b/file1.ts", - content: "let t = 10;" - }; - - const host = createWatchedSystem([file1, configFile, libFile]); - const watch = createWatchOfConfigFile(configFile.path, host); - - checkProgramActualFiles(watch(), emptyArray); - checkOutputErrorsInitial(host, [ - "error TS18003: No inputs were found in config file '/a/b/tsconfig.json'. Specified 'include' paths were '[\"app/*\",\"test/**/*\",\"something\"]' and 'exclude' paths were '[]'.\n" - ]); + }; + const file1 = { + path: "/a/b/file1.ts", + content: "let t = 10;" + }; + return createWatchedSystem([file1, configFile, libFile]); + }, + changes: emptyArray }); - it("non-existing directories listed in config file input array should be able to handle @types if input file list is empty", () => { - const f = { - path: "/a/app.ts", - content: "let x = 1" - }; - const config = { - path: "/a/tsconfig.json", - content: JSON.stringify({ - compiler: {}, - files: [] - }) - }; - const t1 = { - path: "/a/node_modules/@types/typings/index.d.ts", - content: `export * from "./lib"` - }; - const t2 = { - path: "/a/node_modules/@types/typings/lib.d.ts", - content: `export const x: number` - }; - const host = createWatchedSystem([f, config, t1, t2], { currentDirectory: getDirectoryPath(f.path) }); - const watch = createWatchOfConfigFile(config.path, host); - - checkProgramActualFiles(watch(), emptyArray); - checkOutputErrorsInitial(host, [ - "tsconfig.json(1,24): error TS18002: The 'files' list in config file '/a/tsconfig.json' is empty.\n" - ]); + verifyTscWatch({ + scenario, + subScenario: "non-existing directories listed in config file input array should be able to handle @types if input file list is empty", + commandLineArgs: ["-w", "-p", "/a/tsconfig.json"], + sys: () => { + const f = { + path: "/a/app.ts", + content: "let x = 1" + }; + const config = { + path: "/a/tsconfig.json", + content: JSON.stringify({ + compiler: {}, + files: [] + }) + }; + const t1 = { + path: "/a/node_modules/@types/typings/index.d.ts", + content: `export * from "./lib"` + }; + const t2 = { + path: "/a/node_modules/@types/typings/lib.d.ts", + content: `export const x: number` + }; + return createWatchedSystem([f, config, t1, t2, libFile], { currentDirectory: getDirectoryPath(f.path) }); + }, + changes: emptyArray }); it("should support files without extensions", () => { @@ -874,269 +897,262 @@ namespace ts.tscWatch { checkProgramActualFiles(watch(), [f.path, libFile.path]); }); - it("Options Diagnostic locations reported correctly with changes in configFile contents when options change", () => { - const file = { - path: "/a/b/app.ts", - content: "let x = 10" - }; - const configFileContentBeforeComment = `{`; - const configFileContentComment = ` - // comment - // More comment`; - const configFileContentAfterComment = ` - "compilerOptions": { - "inlineSourceMap": true, - "mapRoot": "./" - } - }`; - const configFileContentWithComment = configFileContentBeforeComment + configFileContentComment + configFileContentAfterComment; - const configFileContentWithoutCommentLine = configFileContentBeforeComment + configFileContentAfterComment; - const configFile = { - path: "/a/b/tsconfig.json", - content: configFileContentWithComment - }; - - const files = [file, libFile, configFile]; - const host = createWatchedSystem(files); - const watch = createWatchOfConfigFile(configFile.path, host); - const errors = () => [ - getDiagnosticOfFile(watch().getCompilerOptions().configFile!, configFile.content.indexOf('"inlineSourceMap"'), '"inlineSourceMap"'.length, Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap"), - getDiagnosticOfFile(watch().getCompilerOptions().configFile!, configFile.content.indexOf('"mapRoot"'), '"mapRoot"'.length, Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap"), - getDiagnosticOfFile(watch().getCompilerOptions().configFile!, configFile.content.indexOf('"mapRoot"'), '"mapRoot"'.length, Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "mapRoot", "sourceMap", "declarationMap") - ]; - const intialErrors = errors(); - checkOutputErrorsInitial(host, intialErrors); - - configFile.content = configFileContentWithoutCommentLine; - host.reloadFS(files); - host.runQueuedTimeoutCallbacks(); - const nowErrors = errors(); - checkOutputErrorsIncremental(host, nowErrors); - assert.equal(nowErrors[0].start, intialErrors[0].start! - configFileContentComment.length); - assert.equal(nowErrors[1].start, intialErrors[1].start! - configFileContentComment.length); - }); - - describe("should not trigger should not trigger recompilation because of program emit", () => { - function verifyWithOptions(options: CompilerOptions, outputFiles: readonly string[]) { - const file1: File = { - path: `${projectRoot}/file1.ts`, - content: "export const c = 30;" - }; - const file2: File = { - path: `${projectRoot}/src/file2.ts`, - content: `import {c} from "file1"; export const d = 30;` + verifyTscWatch({ + scenario, + subScenario: "Options Diagnostic locations reported correctly with changes in configFile contents when options change", + commandLineArgs: ["-w", "-p", configFilePath], + sys: () => { + const file = { + path: "/a/b/app.ts", + content: "let x = 10" }; - const tsconfig: File = { - path: `${projectRoot}/tsconfig.json`, - content: generateTSConfig(options, emptyArray, "\n") + const configFile = { + path: configFilePath, + content: ` +{ + // comment + // More comment + "compilerOptions": { + "inlineSourceMap": true, + "mapRoot": "./" + } +}` }; - const host = createWatchedSystem([file1, file2, libFile, tsconfig], { currentDirectory: projectRoot }); - const watch = createWatchOfConfigFile(tsconfig.path, host, /*optionsToExtend*/ undefined, /*watchOptionsToExtend*/ undefined, /*maxNumberOfFilesToIterateForInvalidation*/1); - checkProgramActualFiles(watch(), [file1.path, file2.path, libFile.path]); - - outputFiles.forEach(f => host.fileExists(f)); + return createWatchedSystem([file, libFile, configFile]); + }, + changes: [ + sys => { + sys.writeFile(configFilePath, ` +{ + "compilerOptions": { + "inlineSourceMap": true, + "mapRoot": "./" + } +}`); + sys.runQueuedTimeoutCallbacks(); + return "Remove the comment from config file"; + } + ] + }); - // This should be 0 - host.checkTimeoutQueueLengthAndRun(0); + describe("should not trigger recompilation because of program emit", () => { + function verifyWithOptions(subScenario: string, options: CompilerOptions) { + verifyTscWatch({ + scenario, + subScenario: `should not trigger recompilation because of program emit/${subScenario}`, + commandLineArgs: ["-w", "-p", `${projectRoot}/tsconfig.json`], + maxNumberOfFilesToIterateForInvalidation: 1, + sys: () => { + const file1: File = { + path: `${projectRoot}/file1.ts`, + content: "export const c = 30;" + }; + const file2: File = { + path: `${projectRoot}/src/file2.ts`, + content: `import {c} from "file1"; export const d = 30;` + }; + const tsconfig: File = { + path: `${projectRoot}/tsconfig.json`, + content: generateTSConfig(options, emptyArray, "\n") + }; + return createWatchedSystem([file1, file2, libFile, tsconfig], { currentDirectory: projectRoot }); + }, + changes: emptyArray + }); } - it("without outDir or outFile is specified", () => { - verifyWithOptions({ module: ModuleKind.AMD }, ["file1.js", "src/file2.js"]); - }); - - it("with outFile", () => { - verifyWithOptions({ module: ModuleKind.AMD, outFile: "build/outFile.js" }, ["build/outFile.js"]); - }); - - it("when outDir is specified", () => { - verifyWithOptions({ module: ModuleKind.AMD, outDir: "build" }, ["build/file1.js", "build/src/file2.js"]); - }); - - it("when outDir and declarationDir is specified", () => { - verifyWithOptions({ module: ModuleKind.AMD, outDir: "build", declaration: true, declarationDir: "decls" }, - ["build/file1.js", "build/src/file2.js", "decls/file1.d.ts", "decls/src/file2.d.ts"]); - }); - - it("declarationDir is specified", () => { - verifyWithOptions({ module: ModuleKind.AMD, declaration: true, declarationDir: "decls" }, - ["file1.js", "src/file2.js", "decls/file1.d.ts", "decls/src/file2.d.ts"]); - }); + verifyWithOptions( + "without outDir or outFile is specified", + { module: ModuleKind.AMD } + ); + + verifyWithOptions( + "with outFile", + { module: ModuleKind.AMD, outFile: "build/outFile.js" } + ); + + verifyWithOptions( + "when outDir is specified", + { module: ModuleKind.AMD, outDir: "build" } + ); + + verifyWithOptions( + "when outDir and declarationDir is specified", + { module: ModuleKind.AMD, outDir: "build", declaration: true, declarationDir: "decls" } + ); + + verifyWithOptions( + "declarationDir is specified", + { module: ModuleKind.AMD, declaration: true, declarationDir: "decls" } + ); }); - it("shouldnt report error about unused function incorrectly when file changes from global to module", () => { - const getFileContent = (asModule: boolean) => ` - function one() {} - ${asModule ? "export " : ""}function two() { - return function three() { - one(); - } - }`; - const file: File = { - path: "/a/b/file.ts", - content: getFileContent(/*asModule*/ false) - }; - const files = [file, libFile]; - const host = createWatchedSystem(files); - const watch = createWatchOfFilesAndCompilerOptions([file.path], host, { - noUnusedLocals: true - }); - checkProgramActualFiles(watch(), files.map(file => file.path)); - checkOutputErrorsInitial(host, []); - - file.content = getFileContent(/*asModule*/ true); - host.reloadFS(files); - host.runQueuedTimeoutCallbacks(); - checkProgramActualFiles(watch(), files.map(file => file.path)); - checkOutputErrorsIncremental(host, emptyArray); + verifyTscWatch({ + scenario, + subScenario: "shouldnt report error about unused function incorrectly when file changes from global to module", + commandLineArgs: ["-w", "/a/b/file.ts", "--noUnusedLocals"], + sys: () => { + const file: File = { + path: "/a/b/file.ts", + content: `function one() {} +function two() { + return function three() { + one(); + } +}` + }; + return createWatchedSystem([file, libFile]); + }, + changes: [ + sys => { + sys.writeFile("/a/b/file.ts", `function one() {} +export function two() { + return function three() { + one(); + } +}`); + sys.runQueuedTimeoutCallbacks(); + return "Change file to module"; + } + ] }); - it("watched files when file is deleted and new file is added as part of change", () => { - const projectLocation = "/home/username/project"; - const file: File = { - path: `${projectLocation}/src/file1.ts`, - content: "var a = 10;" - }; - const configFile: File = { - path: `${projectLocation}/tsconfig.json`, - content: "{}" - }; - const files = [file, libFile, configFile]; - const host = createWatchedSystem(files); - const watch = createWatchOfConfigFile(configFile.path, host); - verifyProgram(); - - file.path = file.path.replace("file1", "file2"); - host.reloadFS(files); - host.runQueuedTimeoutCallbacks(); - verifyProgram(); - - function verifyProgram() { - checkProgramActualFiles(watch(), mapDefined(files, f => f === configFile ? undefined : f.path)); - checkWatchedDirectories(host, [], /*recursive*/ false); - checkWatchedDirectories(host, [projectLocation, `${projectLocation}/node_modules/@types`], /*recursive*/ true); - checkWatchedFiles(host, files.map(f => f.path)); - } + verifyTscWatch({ + scenario, + subScenario: "watched files when file is deleted and new file is added as part of change", + commandLineArgs: ["-w", "-p", "/home/username/project/tsconfig.json"], + sys: () => { + const projectLocation = "/home/username/project"; + const file: File = { + path: `${projectLocation}/src/file1.ts`, + content: "var a = 10;" + }; + const configFile: File = { + path: `${projectLocation}/tsconfig.json`, + content: "{}" + }; + return createWatchedSystem([file, libFile, configFile]); + }, + changes: [ + sys => { + sys.renameFile("/home/username/project/src/file1.ts", "/home/username/project/src/file2.ts"); + sys.runQueuedTimeoutCallbacks(); + return "Rename file1 to file2"; + } + ] }); - it("updates errors correctly when declaration emit is disabled in compiler options", () => { - const aFile: File = { - path: `${projectRoot}/a.ts`, - content: `import test from './b'; + function changeParameterTypeOfBFile(sys: WatchedSystem, parameterName: string, toType: string) { + const oldContent = sys.readFile(`${projectRoot}/b.ts`)!; + sys.writeFile(`${projectRoot}/b.ts`, oldContent.replace(new RegExp(`${parameterName}\: [a-z]*`), `${parameterName}: ${toType}`)); + sys.runQueuedTimeoutCallbacks(); + return `Changed ${parameterName} type to ${toType}`; + } + + verifyTscWatch({ + scenario, + subScenario: "updates errors correctly when declaration emit is disabled in compiler options", + commandLineArgs: ["-w"], + sys: () => { + const aFile: File = { + path: `${projectRoot}/a.ts`, + content: `import test from './b'; test(4, 5);` - }; - const bFileContent = `function test(x: number, y: number) { + }; + const bFile: File = { + path: `${projectRoot}/b.ts`, + content: `function test(x: number, y: number) { return x + y / 5; } -export default test;`; - const bFile: File = { - path: `${projectRoot}/b.ts`, - content: bFileContent - }; - const tsconfigFile: File = { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ - compilerOptions: { - module: "commonjs", - noEmit: true, - strict: true, - } - }) - }; - const files = [aFile, bFile, libFile, tsconfigFile]; - const host = createWatchedSystem(files, { currentDirectory: projectRoot }); - const watch = createWatchOfConfigFile("tsconfig.json", host); - checkOutputErrorsInitial(host, emptyArray); - - changeParameterType("x", "string", [ - getDiagnosticOfFileFromProgram(watch(), aFile.path, aFile.content.indexOf("4"), 1, Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1, "4", "string") - ]); - changeParameterType("y", "string", [ - getDiagnosticOfFileFromProgram(watch(), aFile.path, aFile.content.indexOf("5"), 1, Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1, "5", "string"), - getDiagnosticOfFileFromProgram(watch(), bFile.path, bFile.content.indexOf("y /"), 1, Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type) - ]); - - function changeParameterType(parameterName: string, toType: string, expectedErrors: readonly Diagnostic[]) { - const newContent = bFileContent.replace(new RegExp(`${parameterName}\: [a-z]*`), `${parameterName}: ${toType}`); - - verifyErrorsWithBFileContents(newContent, expectedErrors); - verifyErrorsWithBFileContents(bFileContent, emptyArray); - } - - function verifyErrorsWithBFileContents(content: string, expectedErrors: readonly Diagnostic[]) { - host.writeFile(bFile.path, content); - host.runQueuedTimeoutCallbacks(); - checkOutputErrorsIncremental(host, expectedErrors); - } +export default test;` + }; + const tsconfigFile: File = { + path: `${projectRoot}/tsconfig.json`, + content: JSON.stringify({ + compilerOptions: { + module: "commonjs", + noEmit: true, + strict: true, + } + }) + }; + return createWatchedSystem([aFile, bFile, libFile, tsconfigFile], { currentDirectory: projectRoot }); + }, + changes: [ + sys => changeParameterTypeOfBFile(sys, "x", "string"), + sys => changeParameterTypeOfBFile(sys, "x", "number"), + sys => changeParameterTypeOfBFile(sys, "y", "string"), + sys => changeParameterTypeOfBFile(sys, "y", "number"), + ] }); - it("updates errors when strictNullChecks changes", () => { - const aFile: File = { - path: `${projectRoot}/a.ts`, - content: `declare function foo(): null | { hello: any }; + verifyTscWatch({ + scenario, + subScenario: "updates errors when strictNullChecks changes", + commandLineArgs: ["-w"], + sys: () => { + const aFile: File = { + path: `${projectRoot}/a.ts`, + content: `declare function foo(): null | { hello: any }; foo().hello` - }; - const config: File = { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ compilerOptions: {} }) - }; - const files = [aFile, config, libFile]; - const host = createWatchedSystem(files, { currentDirectory: projectRoot }); - const watch = createWatchOfConfigFile("tsconfig.json", host); - checkProgramActualFiles(watch(), [aFile.path, libFile.path]); - checkOutputErrorsInitial(host, emptyArray); - const modifiedTimeOfAJs = host.getModifiedTime(`${projectRoot}/a.js`); - host.writeFile(config.path, JSON.stringify({ compilerOptions: { strictNullChecks: true } })); - host.runQueuedTimeoutCallbacks(); - const expectedStrictNullErrors = [ - getDiagnosticOfFileFromProgram(watch(), aFile.path, aFile.content.lastIndexOf("foo()"), 5, Diagnostics.Object_is_possibly_null) - ]; - checkOutputErrorsIncremental(host, expectedStrictNullErrors); - // File a need not be rewritten - assert.equal(host.getModifiedTime(`${projectRoot}/a.js`), modifiedTimeOfAJs); - host.writeFile(config.path, JSON.stringify({ compilerOptions: { strict: true, alwaysStrict: false } })); // Avoid changing 'alwaysStrict' or must re-bind - host.runQueuedTimeoutCallbacks(); - checkOutputErrorsIncremental(host, expectedStrictNullErrors); - // File a need not be rewritten - assert.equal(host.getModifiedTime(`${projectRoot}/a.js`), modifiedTimeOfAJs); - host.writeFile(config.path, JSON.stringify({ compilerOptions: {} })); - host.runQueuedTimeoutCallbacks(); - checkOutputErrorsIncremental(host, emptyArray); - // File a need not be rewritten - assert.equal(host.getModifiedTime(`${projectRoot}/a.js`), modifiedTimeOfAJs); + }; + const config: File = { + path: `${projectRoot}/tsconfig.json`, + content: JSON.stringify({ compilerOptions: {} }) + }; + return createWatchedSystem([aFile, config, libFile], { currentDirectory: projectRoot }); + }, + changes: [ + sys => { + sys.writeFile(`${projectRoot}/tsconfig.json`, JSON.stringify({ compilerOptions: { strictNullChecks: true } })); + sys.runQueuedTimeoutCallbacks(); + return "Enable strict null checks"; + }, + sys => { + sys.writeFile(`${projectRoot}/tsconfig.json`, JSON.stringify({ compilerOptions: { strict: true, alwaysStrict: false } })); // Avoid changing 'alwaysStrict' or must re-bind + sys.runQueuedTimeoutCallbacks(); + return "Set always strict false"; + }, + sys => { + sys.writeFile(`${projectRoot}/tsconfig.json`, JSON.stringify({ compilerOptions: {} })); + sys.runQueuedTimeoutCallbacks(); + return "Disable strict"; + }, + ] }); - it("updates errors when ambient modules of program changes", () => { - const aFile: File = { - path: `${projectRoot}/a.ts`, - content: `declare module 'a' { + verifyTscWatch({ + scenario, + subScenario: "updates errors when ambient modules of program changes", + commandLineArgs: ["-w"], + sys: () => { + const aFile: File = { + path: `${projectRoot}/a.ts`, + content: `declare module 'a' { type foo = number; }` - }; - const config: File = { - path: `${projectRoot}/tsconfig.json`, - content: "{}" - }; - const files = [aFile, config, libFile]; - const host = createWatchedSystem(files, { currentDirectory: projectRoot }); - const watch = createWatchOfConfigFile("tsconfig.json", host); - checkProgramActualFiles(watch(), [aFile.path, libFile.path]); - checkOutputErrorsInitial(host, emptyArray); - - // Create bts with same file contents - const bTsPath = `${projectRoot}/b.ts`; - host.writeFile(bTsPath, aFile.content); - host.runQueuedTimeoutCallbacks(); - checkProgramActualFiles(watch(), [aFile.path, bTsPath, libFile.path]); - checkOutputErrorsIncremental(host, [ - "a.ts(2,8): error TS2300: Duplicate identifier 'foo'.\n", - "b.ts(2,8): error TS2300: Duplicate identifier 'foo'.\n" - ]); - - // Delete bTs - host.deleteFile(bTsPath); - host.runQueuedTimeoutCallbacks(); - checkProgramActualFiles(watch(), [aFile.path, libFile.path]); - checkOutputErrorsIncremental(host, emptyArray); + }; + const config: File = { + path: `${projectRoot}/tsconfig.json`, + content: "{}" + }; + return createWatchedSystem([aFile, config, libFile], { currentDirectory: projectRoot }); + }, + changes: [ + sys => { + // Create bts with same file contents + sys.writeFile(`${projectRoot}/b.ts`, `declare module 'a' { + type foo = number; +}`); + sys.runQueuedTimeoutCallbacks(); + return "Create b.ts with same content"; + }, + sys => { + sys.deleteFile(`${projectRoot}/b.ts`); + sys.runQueuedTimeoutCallbacks(); + return "Delete b.ts"; + }, + ] }); describe("updates errors in lib file", () => { @@ -1153,46 +1169,31 @@ interface Document { }` }; - function getDiagnostic(program: Program, file: File) { - return getDiagnosticOfFileFromProgram(program, file.path, file.content.indexOf(field), field.length, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, field); - } - - function verifyLibFileErrorsWith(aFile: File) { - const files = [aFile, libFileWithDocument]; - - function verifyLibErrors(options: CompilerOptions) { - const host = createWatchedSystem(files, { currentDirectory: projectRoot }); - const watch = createWatchOfFilesAndCompilerOptions([aFile.path], host, options); - checkProgramActualFiles(watch(), [aFile.path, libFile.path]); - checkOutputErrorsInitial(host, getErrors()); - - host.writeFile(aFile.path, aFile.content.replace(fieldWithoutReadonly, "var x: string;")); - host.runQueuedTimeoutCallbacks(); - checkProgramActualFiles(watch(), [aFile.path, libFile.path]); - checkOutputErrorsIncremental(host, emptyArray); - - host.writeFile(aFile.path, aFile.content); - host.runQueuedTimeoutCallbacks(); - checkProgramActualFiles(watch(), [aFile.path, libFile.path]); - checkOutputErrorsIncremental(host, getErrors()); - - function getErrors() { - return [ - ...(options.skipLibCheck || options.skipDefaultLibCheck ? [] : [getDiagnostic(watch(), libFileWithDocument)]), - getDiagnostic(watch(), aFile) - ]; - } + function verifyLibFileErrorsWith(subScenario: string, aFile: File) { + function verifyLibErrors(subScenario: string, commandLineOptions: readonly string[]) { + verifyTscWatch({ + scenario, + subScenario: `updates errors in lib file/${subScenario}`, + commandLineArgs: ["-w", aFile.path, ...commandLineOptions], + sys: () => createWatchedSystem([aFile, libFileWithDocument], { currentDirectory: projectRoot }), + changes: [ + sys => { + sys.writeFile(aFile.path, aFile.content.replace(fieldWithoutReadonly, "var x: string;")); + sys.runQueuedTimeoutCallbacks(); + return "Remove document declaration from file"; + }, + sys => { + sys.writeFile(aFile.path, aFile.content); + sys.runQueuedTimeoutCallbacks(); + return "Rever the file to contain document declaration"; + }, + ] + }); } - it("with default options", () => { - verifyLibErrors({}); - }); - it("with skipLibCheck", () => { - verifyLibErrors({ skipLibCheck: true }); - }); - it("with skipDefaultLibCheck", () => { - verifyLibErrors({ skipDefaultLibCheck: true }); - }); + verifyLibErrors(`${subScenario}/with default options`, emptyArray); + verifyLibErrors(`${subScenario}/with skipLibCheck`, ["--skipLibCheck"]); + verifyLibErrors(`${subScenario}/with skipDefaultLibCheck`, ["--skipDefaultLibCheck"]); } describe("when non module file changes", () => { @@ -1201,7 +1202,7 @@ interface Document { content: `${fieldWithoutReadonly} var y: number;` }; - verifyLibFileErrorsWith(aFile); + verifyLibFileErrorsWith("when non module file changes", aFile); }); describe("when module file with global definitions changes", () => { @@ -1213,157 +1214,124 @@ ${fieldWithoutReadonly} var y: number; }` }; - verifyLibFileErrorsWith(aFile); + verifyLibFileErrorsWith("when module file with global definitions changes", aFile); }); }); - it("when skipLibCheck and skipDefaultLibCheck changes", () => { - const field = "fullscreen"; - const aFile: File = { - path: `${projectRoot}/a.ts`, - content: `interface Document { + function changeWhenLibCheckChanges(sys: WatchedSystem, compilerOptions: CompilerOptions) { + const configFileContent = JSON.stringify({ compilerOptions }); + sys.writeFile(`${projectRoot}/tsconfig.json`, configFileContent); + sys.runQueuedTimeoutCallbacks(); + return `Changing config to ${configFileContent}`; + } + + verifyTscWatch({ + scenario, + subScenario: "when skipLibCheck and skipDefaultLibCheck changes", + commandLineArgs: ["-w"], + sys: () => { + const field = "fullscreen"; + const aFile: File = { + path: `${projectRoot}/a.ts`, + content: `interface Document { ${field}: boolean; }` - }; - const bFile: File = { - path: `${projectRoot}/b.d.ts`, - content: `interface Document { + }; + const bFile: File = { + path: `${projectRoot}/b.d.ts`, + content: `interface Document { ${field}: boolean; }` - }; - const libFileWithDocument: File = { - path: libFile.path, - content: `${libFile.content} + }; + const libFileWithDocument: File = { + path: libFile.path, + content: `${libFile.content} interface Document { readonly ${field}: boolean; }` - }; - const configFile: File = { - path: `${projectRoot}/tsconfig.json`, - content: "{}" - }; - - const files = [aFile, bFile, configFile, libFileWithDocument]; - - const host = createWatchedSystem(files, { currentDirectory: projectRoot }); - const watch = createWatchOfConfigFile("tsconfig.json", host); - verifyProgramFiles(); - checkOutputErrorsInitial(host, [ - getDiagnostic(libFileWithDocument), - getDiagnostic(aFile), - getDiagnostic(bFile) - ]); - - verifyConfigChange({ skipLibCheck: true }, [aFile]); - verifyConfigChange({ skipDefaultLibCheck: true }, [aFile, bFile]); - verifyConfigChange({}, [libFileWithDocument, aFile, bFile]); - verifyConfigChange({ skipDefaultLibCheck: true }, [aFile, bFile]); - verifyConfigChange({ skipLibCheck: true }, [aFile]); - verifyConfigChange({}, [libFileWithDocument, aFile, bFile]); - - function verifyConfigChange(compilerOptions: CompilerOptions, errorInFiles: readonly File[]) { - host.writeFile(configFile.path, JSON.stringify({ compilerOptions })); - host.runQueuedTimeoutCallbacks(); - verifyProgramFiles(); - checkOutputErrorsIncremental(host, errorInFiles.map(getDiagnostic)); - } - - function getDiagnostic(file: File) { - return getDiagnosticOfFileFromProgram(watch(), file.path, file.content.indexOf(field), field.length, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, field); - } - - function verifyProgramFiles() { - checkProgramActualFiles(watch(), [aFile.path, bFile.path, libFile.path]); - } + }; + const configFile: File = { + path: `${projectRoot}/tsconfig.json`, + content: "{}" + }; + return createWatchedSystem([aFile, bFile, configFile, libFileWithDocument], { currentDirectory: projectRoot }); + }, + changes: [ + sys => changeWhenLibCheckChanges(sys, { skipLibCheck: true }), + sys => changeWhenLibCheckChanges(sys, { skipDefaultLibCheck: true }), + sys => changeWhenLibCheckChanges(sys, {}), + sys => changeWhenLibCheckChanges(sys, { skipDefaultLibCheck: true }), + sys => changeWhenLibCheckChanges(sys, { skipLibCheck: true }), + sys => changeWhenLibCheckChanges(sys, {}), + ] }); - it("reports errors correctly with isolatedModules", () => { - const aFile: File = { - path: `${projectRoot}/a.ts`, - content: `export const a: string = "";` - }; - const bFile: File = { - path: `${projectRoot}/b.ts`, - content: `import { a } from "./a"; + verifyTscWatch({ + scenario, + subScenario: "reports errors correctly with isolatedModules", + commandLineArgs: ["-w"], + sys: () => { + const aFile: File = { + path: `${projectRoot}/a.ts`, + content: `export const a: string = "";` + }; + const bFile: File = { + path: `${projectRoot}/b.ts`, + content: `import { a } from "./a"; const b: string = a;` - }; - const configFile: File = { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ - compilerOptions: { - isolatedModules: true - } - }) - }; - - const files = [aFile, bFile, libFile, configFile]; - - const host = createWatchedSystem(files, { currentDirectory: projectRoot }); - const watch = createWatchOfConfigFile("tsconfig.json", host); - verifyProgramFiles(); - checkOutputErrorsInitial(host, emptyArray); - assert.equal(host.readFile(`${projectRoot}/a.js`), `"use strict"; -exports.__esModule = true; -exports.a = ""; -`, "Contents of a.js"); - assert.equal(host.readFile(`${projectRoot}/b.js`), `"use strict"; -exports.__esModule = true; -var a_1 = require("./a"); -var b = a_1.a; -`, "Contents of b.js"); - const modifiedTime = host.getModifiedTime(`${projectRoot}/b.js`); - - host.writeFile(aFile.path, `export const a: number = 1`); - host.runQueuedTimeoutCallbacks(); - verifyProgramFiles(); - checkOutputErrorsIncremental(host, [ - getDiagnosticOfFileFromProgram(watch(), bFile.path, bFile.content.indexOf("b"), 1, Diagnostics.Type_0_is_not_assignable_to_type_1, "number", "string") - ]); - assert.equal(host.readFile(`${projectRoot}/a.js`), `"use strict"; -exports.__esModule = true; -exports.a = 1; -`, "Contents of a.js"); - assert.equal(host.getModifiedTime(`${projectRoot}/b.js`), modifiedTime, "Timestamp of b.js"); - - function verifyProgramFiles() { - checkProgramActualFiles(watch(), [aFile.path, bFile.path, libFile.path]); - } + }; + const configFile: File = { + path: `${projectRoot}/tsconfig.json`, + content: JSON.stringify({ + compilerOptions: { + isolatedModules: true + } + }) + }; + return createWatchedSystem([aFile, bFile, configFile, libFile], { currentDirectory: projectRoot }); + }, + changes: [ + sys => { + sys.writeFile(`${projectRoot}/a.ts`, `export const a: number = 1`); + sys.runQueuedTimeoutCallbacks(); + return "Change shape of a"; + }, + ] }); - it("reports errors correctly with file not in rootDir", () => { - const aFile: File = { - path: `${projectRoot}/a.ts`, - content: `import { x } from "../b";` - }; - const bFile: File = { - path: `/user/username/projects/b.ts`, - content: `export const x = 10;` - }; - const configFile: File = { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ - compilerOptions: { - rootDir: ".", - outDir: "lib" - } - }) - }; - - const files = [aFile, bFile, libFile, configFile]; - - const host = createWatchedSystem(files, { currentDirectory: projectRoot }); - const watch = createWatchOfConfigFile("tsconfig.json", host); - checkOutputErrorsInitial(host, [ - getDiagnosticOfFileFromProgram(watch(), aFile.path, aFile.content.indexOf(`"../b"`), `"../b"`.length, Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, bFile.path, projectRoot) - ]); - const aContent = ` - -${aFile.content}`; - host.writeFile(aFile.path, aContent); - host.runQueuedTimeoutCallbacks(); - checkOutputErrorsIncremental(host, [ - getDiagnosticOfFileFromProgram(watch(), aFile.path, aContent.indexOf(`"../b"`), `"../b"`.length, Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, bFile.path, projectRoot) - ]); + verifyTscWatch({ + scenario, + subScenario: "reports errors correctly with file not in rootDir", + commandLineArgs: ["-w"], + sys: () => { + const aFile: File = { + path: `${projectRoot}/a.ts`, + content: `import { x } from "../b";` + }; + const bFile: File = { + path: `/user/username/projects/b.ts`, + content: `export const x = 10;` + }; + const configFile: File = { + path: `${projectRoot}/tsconfig.json`, + content: JSON.stringify({ + compilerOptions: { + rootDir: ".", + outDir: "lib" + } + }) + }; + return createWatchedSystem([aFile, bFile, configFile, libFile], { currentDirectory: projectRoot }); + }, + changes: [ + sys => { + sys.writeFile(`${projectRoot}/a.ts`, ` + +import { x } from "../b";`); + sys.runQueuedTimeoutCallbacks(); + return "Make changes to file a"; + }, + ] }); }); } diff --git a/src/testRunner/unittests/tscWatch/resolutionCache.ts b/src/testRunner/unittests/tscWatch/resolutionCache.ts index c87a5c618b38f..2d974af594cf0 100644 --- a/src/testRunner/unittests/tscWatch/resolutionCache.ts +++ b/src/testRunner/unittests/tscWatch/resolutionCache.ts @@ -1,5 +1,6 @@ namespace ts.tscWatch { describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch module resolution caching", () => { + const scenario = "resolutionCache"; it("works", () => { const root = { path: "/a/d/f0.ts", @@ -175,312 +176,263 @@ namespace ts.tscWatch { assert.isTrue(fileExistsCalledForBar, "'fileExists' should be called."); }); - it("works when module resolution changes to ambient module", () => { - const root = { + verifyTscWatch({ + scenario, + subScenario: "works when module resolution changes to ambient module", + commandLineArgs: ["-w", "/a/b/foo.ts"], + sys: () => createWatchedSystem([{ path: "/a/b/foo.ts", content: `import * as fs from "fs";` - }; - - const packageJson = { - path: "/a/b/node_modules/@types/node/package.json", - content: ` + }, libFile], { currentDirectory: "/a/b" }), + changes: [ + sys => { + sys.ensureFileOrFolder({ + path: "/a/b/node_modules/@types/node/package.json", + content: ` { "main": "" } ` - }; - - const nodeType = { - path: "/a/b/node_modules/@types/node/index.d.ts", - content: ` + }); + sys.ensureFileOrFolder({ + path: "/a/b/node_modules/@types/node/index.d.ts", + content: ` declare module "fs" { export interface Stats { isFile(): boolean; } }` - }; - - const files = [root, libFile]; - const filesWithNodeType = files.concat(packageJson, nodeType); - const host = createWatchedSystem(files, { currentDirectory: "/a/b" }); - - const watch = createWatchOfFilesAndCompilerOptions([root.path], host, { }); - - checkOutputErrorsInitial(host, [ - getDiagnosticModuleNotFoundOfFile(watch(), root, "fs") - ]); - - host.reloadFS(filesWithNodeType); - host.runQueuedTimeoutCallbacks(); - checkOutputErrorsIncremental(host, emptyArray); + }); + sys.runQueuedTimeoutCallbacks(); + return "npm install node types"; + } + ] }); - it("works when included file with ambient module changes", () => { - const root = { - path: "/a/b/foo.ts", - content: ` + verifyTscWatch({ + scenario, + subScenario: "works when included file with ambient module changes", + commandLineArgs: ["--w", "/a/b/foo.ts", "/a/b/bar.d.ts"], + sys: () => { + const root = { + path: "/a/b/foo.ts", + content: ` import * as fs from "fs"; import * as u from "url"; ` - }; + }; - const file = { - path: "/a/b/bar.d.ts", - content: ` + const file = { + path: "/a/b/bar.d.ts", + content: ` declare module "url" { export interface Url { href?: string; } } ` - }; - - const fileContentWithFS = ` + }; + return createWatchedSystem([root, file, libFile], { currentDirectory: "/a/b" }); + }, + changes: [ + sys => { + sys.appendFile("/a/b/bar.d.ts", ` declare module "fs" { export interface Stats { isFile(): boolean; } } -`; - - const files = [root, file, libFile]; - const host = createWatchedSystem(files, { currentDirectory: "/a/b" }); - - const watch = createWatchOfFilesAndCompilerOptions([root.path, file.path], host, {}); - - checkOutputErrorsInitial(host, [ - getDiagnosticModuleNotFoundOfFile(watch(), root, "fs") - ]); - - file.content += fileContentWithFS; - host.reloadFS(files); - host.runQueuedTimeoutCallbacks(); - checkOutputErrorsIncremental(host, emptyArray); +`); + sys.runQueuedTimeoutCallbacks(); + return "Add fs definition"; + } + ] }); - it("works when reusing program with files from external library", () => { - interface ExpectedFile { path: string; isExpectedToEmit?: boolean; content?: string; } - const configDir = "/a/b/projects/myProject/src/"; - const file1: File = { - path: configDir + "file1.ts", - content: 'import module1 = require("module1");\nmodule1("hello");' - }; - const file2: File = { - path: configDir + "file2.ts", - content: 'import module11 = require("module1");\nmodule11("hello");' - }; - const module1: File = { - path: "/a/b/projects/myProject/node_modules/module1/index.js", - content: "module.exports = options => { return options.toString(); }" - }; - const configFile: File = { - path: configDir + "tsconfig.json", - content: JSON.stringify({ - compilerOptions: { - allowJs: true, - rootDir: ".", - outDir: "../dist", - moduleResolution: "node", - maxNodeModuleJsDepth: 1 - } - }) - }; - const outDirFolder = "/a/b/projects/myProject/dist/"; - const programFiles = [file1, file2, module1, libFile]; - const host = createWatchedSystem(programFiles.concat(configFile), { currentDirectory: "/a/b/projects/myProject/" }); - const watch = createWatchOfConfigFile(configFile.path, host); - checkProgramActualFiles(watch(), programFiles.map(f => f.path)); - checkOutputErrorsInitial(host, emptyArray); - const expectedFiles: ExpectedFile[] = [ - createExpectedEmittedFile(file1), - createExpectedEmittedFile(file2), - createExpectedToNotEmitFile("index.js"), - createExpectedToNotEmitFile("src/index.js"), - createExpectedToNotEmitFile("src/file1.js"), - createExpectedToNotEmitFile("src/file2.js"), - createExpectedToNotEmitFile("lib.js"), - createExpectedToNotEmitFile("lib.d.ts") - ]; - verifyExpectedFiles(expectedFiles); - - file1.content += "\n;"; - expectedFiles[0].content += ";\n"; // Only emit file1 with this change - expectedFiles[1].isExpectedToEmit = false; - host.reloadFS(programFiles.concat(configFile)); - host.runQueuedTimeoutCallbacks(); - checkProgramActualFiles(watch(), programFiles.map(f => f.path)); - checkOutputErrorsIncremental(host, emptyArray); - verifyExpectedFiles(expectedFiles); - - - function verifyExpectedFiles(expectedFiles: ExpectedFile[]) { - forEach(expectedFiles, f => { - assert.equal(!!host.fileExists(f.path), f.isExpectedToEmit, "File " + f.path + " is expected to " + (f.isExpectedToEmit ? "emit" : "not emit")); - if (f.isExpectedToEmit) { - assert.equal(host.readFile(f.path), f.content, "Expected contents of " + f.path); - } - }); - } - - function createExpectedToNotEmitFile(fileName: string): ExpectedFile { - return { - path: outDirFolder + fileName, - isExpectedToEmit: false + verifyTscWatch({ + scenario, + subScenario: "works when reusing program with files from external library", + commandLineArgs: ["--w", "-p", "/a/b/projects/myProject/src"], + sys: () => { + const configDir = "/a/b/projects/myProject/src/"; + const file1: File = { + path: configDir + "file1.ts", + content: 'import module1 = require("module1");\nmodule1("hello");' }; - } - - function createExpectedEmittedFile(file: File): ExpectedFile { - return { - path: removeFileExtension(file.path.replace(configDir, outDirFolder)) + Extension.Js, - isExpectedToEmit: true, - content: '"use strict";\nexports.__esModule = true;\n' + file.content.replace("import", "var") + "\n" + const file2: File = { + path: configDir + "file2.ts", + content: 'import module11 = require("module1");\nmodule11("hello");' }; - } + const module1: File = { + path: "/a/b/projects/myProject/node_modules/module1/index.js", + content: "module.exports = options => { return options.toString(); }" + }; + const configFile: File = { + path: configDir + "tsconfig.json", + content: JSON.stringify({ + compilerOptions: { + allowJs: true, + rootDir: ".", + outDir: "../dist", + moduleResolution: "node", + maxNodeModuleJsDepth: 1 + } + }) + }; + return createWatchedSystem([file1, file2, module1, libFile, configFile], { currentDirectory: "/a/b/projects/myProject/" }); + }, + changes: [ + sys => { + sys.appendFile("/a/b/projects/myProject/src/file1.ts", "\n;"); + sys.runQueuedTimeoutCallbacks(); + return "Add new line to file1"; + } + ] }); - it("works when renaming node_modules folder that already contains @types folder", () => { - const file: File = { - path: `${projectRoot}/a.ts`, - content: `import * as q from "qqq";` - }; - const module: File = { - path: `${projectRoot}/node_modules2/@types/qqq/index.d.ts`, - content: "export {}" - }; - const files = [file, module, libFile]; - const host = createWatchedSystem(files, { currentDirectory: projectRoot }); - const watch = createWatchOfFilesAndCompilerOptions([file.path], host); - - checkProgramActualFiles(watch(), [file.path, libFile.path]); - checkOutputErrorsInitial(host, [getDiagnosticModuleNotFoundOfFile(watch(), file, "qqq")]); - checkWatchedDirectories(host, emptyArray, /*recursive*/ false); - checkWatchedDirectories(host, [`${projectRoot}/node_modules`, `${projectRoot}/node_modules/@types`], /*recursive*/ true); - - host.renameFolder(`${projectRoot}/node_modules2`, `${projectRoot}/node_modules`); - host.runQueuedTimeoutCallbacks(); - checkProgramActualFiles(watch(), [file.path, libFile.path, `${projectRoot}/node_modules/@types/qqq/index.d.ts`]); - checkOutputErrorsIncremental(host, emptyArray); + verifyTscWatch({ + scenario, + subScenario: "works when renaming node_modules folder that already contains @types folder", + commandLineArgs: ["--w", `${projectRoot}/a.ts`], + sys: () => { + const file: File = { + path: `${projectRoot}/a.ts`, + content: `import * as q from "qqq";` + }; + const module: File = { + path: `${projectRoot}/node_modules2/@types/qqq/index.d.ts`, + content: "export {}" + }; + return createWatchedSystem([file, libFile, module], { currentDirectory: projectRoot }); + }, + changes: [ + sys => { + sys.renameFolder(`${projectRoot}/node_modules2`, `${projectRoot}/node_modules`); + sys.runQueuedTimeoutCallbacks(); + return "npm install"; + } + ] }); describe("ignores files/folder changes in node_modules that start with '.'", () => { - const npmCacheFile: File = { - path: `${projectRoot}/node_modules/.cache/babel-loader/89c02171edab901b9926470ba6d5677e.ts`, - content: JSON.stringify({ something: 10 }) - }; - const file1: File = { - path: `${projectRoot}/test.ts`, - content: `import { x } from "somemodule";` - }; - const file2: File = { - path: `${projectRoot}/node_modules/somemodule/index.d.ts`, - content: `export const x = 10;` - }; - const files = [libFile, file1, file2]; - const expectedFiles = files.map(f => f.path); - it("when watching node_modules in inferred project for failed lookup", () => { - const host = createWatchedSystem(files); - const watch = createWatchOfFilesAndCompilerOptions([file1.path], host, {}, /*watchOptions*/ undefined, /*maxNumberOfFilesToIterateForInvalidation*/ 1); - checkProgramActualFiles(watch(), expectedFiles); - host.checkTimeoutQueueLength(0); - - host.ensureFileOrFolder(npmCacheFile); - host.checkTimeoutQueueLength(0); - }); - it("when watching node_modules as part of wild card directories in config project", () => { - const config: File = { - path: `${projectRoot}/tsconfig.json`, - content: "{}" - }; - const host = createWatchedSystem(files.concat(config)); - const watch = createWatchOfConfigFile(config.path, host); - checkProgramActualFiles(watch(), expectedFiles); - host.checkTimeoutQueueLength(0); - - host.ensureFileOrFolder(npmCacheFile); - host.checkTimeoutQueueLength(0); - }); + function verifyIgnore(subScenario: string, commandLineArgs: readonly string[]) { + verifyTscWatch({ + scenario, + subScenario: `ignores changes in node_modules that start with dot/${subScenario}`, + commandLineArgs, + maxNumberOfFilesToIterateForInvalidation: 1, + sys: () => { + const file1: File = { + path: `${projectRoot}/test.ts`, + content: `import { x } from "somemodule";` + }; + const file2: File = { + path: `${projectRoot}/node_modules/somemodule/index.d.ts`, + content: `export const x = 10;` + }; + const config: File = { + path: `${projectRoot}/tsconfig.json`, + content: "{}" + }; + return createWatchedSystem([libFile, file1, file2, config]); + }, + changes: [ + sys => { + const npmCacheFile: File = { + path: `${projectRoot}/node_modules/.cache/babel-loader/89c02171edab901b9926470ba6d5677e.ts`, + content: JSON.stringify({ something: 10 }) + }; + sys.ensureFileOrFolder(npmCacheFile); + sys.checkTimeoutQueueLength(0); + return "npm install file and folder that start with '.'"; + } + ] + }); + } + verifyIgnore("watch without configFile", ["--w", `${projectRoot}/test.ts`]); + verifyIgnore("watch with configFile", ["--w", "-p", `${projectRoot}/tsconfig.json`]); }); - it("when types in compiler option are global and installed at later point", () => { - const projectRoot = "/user/username/projects/myproject"; - const app: File = { - path: `${projectRoot}/lib/app.ts`, - content: `myapp.component("hello");` - }; - const tsconfig: File = { - path: `${projectRoot}/tsconfig.json`, - content: JSON.stringify({ - compilerOptions: { - module: "none", - types: ["@myapp/ts-types"] - } - }) - }; - const host = createWatchedSystem([app, tsconfig, libFile]); - const watch = createWatchOfConfigFile(tsconfig.path, host); - checkProgramActualFiles(watch(), [app.path, libFile.path]); - host.checkTimeoutQueueLength(0); - checkOutputErrorsInitial(host, [ - createCompilerDiagnostic(Diagnostics.Cannot_find_type_definition_file_for_0, "@myapp/ts-types") - ]); - - host.ensureFileOrFolder({ - path: `${projectRoot}/node_modules/@myapp/ts-types/package.json`, - content: JSON.stringify({ - version: "1.65.1", - types: "types/somefile.define.d.ts" - }) - }); - host.ensureFileOrFolder({ - path: `${projectRoot}/node_modules/@myapp/ts-types/types/somefile.define.d.ts`, - content: ` + verifyTscWatch({ + scenario, + subScenario: "when types in compiler option are global and installed at later point", + commandLineArgs: ["--w", "-p", `${projectRoot}/tsconfig.json`], + sys: () => { + const app: File = { + path: `${projectRoot}/lib/app.ts`, + content: `myapp.component("hello");` + }; + const tsconfig: File = { + path: `${projectRoot}/tsconfig.json`, + content: JSON.stringify({ + compilerOptions: { + module: "none", + types: ["@myapp/ts-types"] + } + }) + }; + return createWatchedSystem([app, tsconfig, libFile]); + }, + changes: [ + sys => { + sys.ensureFileOrFolder({ + path: `${projectRoot}/node_modules/@myapp/ts-types/package.json`, + content: JSON.stringify({ + version: "1.65.1", + types: "types/somefile.define.d.ts" + }) + }); + sys.ensureFileOrFolder({ + path: `${projectRoot}/node_modules/@myapp/ts-types/types/somefile.define.d.ts`, + content: ` declare namespace myapp { function component(str: string): number; }` - }); - host.checkTimeoutQueueLengthAndRun(1); - checkOutputErrorsIncremental(host, emptyArray); + }); + sys.checkTimeoutQueueLengthAndRun(1); + return "npm install ts-types"; + } + ] }); - }); - describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch with modules linked to sibling folder", () => { - const mainPackageRoot = `${projectRoot}/main`; - const linkedPackageRoot = `${projectRoot}/linked-package`; - const mainFile: File = { - path: `${mainPackageRoot}/index.ts`, - content: "import { Foo } from '@scoped/linked-package'" - }; - const config: File = { - path: `${mainPackageRoot}/tsconfig.json`, - content: JSON.stringify({ - compilerOptions: { module: "commonjs", moduleResolution: "node", baseUrl: ".", rootDir: "." }, - files: ["index.ts"] - }) - }; - const linkedPackageInMain: SymLink = { - path: `${mainPackageRoot}/node_modules/@scoped/linked-package`, - symLink: `${linkedPackageRoot}` - }; - const linkedPackageJson: File = { - path: `${linkedPackageRoot}/package.json`, - content: JSON.stringify({ name: "@scoped/linked-package", version: "0.0.1", types: "dist/index.d.ts", main: "dist/index.js" }) - }; - const linkedPackageIndex: File = { - path: `${linkedPackageRoot}/dist/index.d.ts`, - content: "export * from './other';" - }; - const linkedPackageOther: File = { - path: `${linkedPackageRoot}/dist/other.d.ts`, - content: 'export declare const Foo = "BAR";' - }; - - it("verify watched directories", () => { - const files = [libFile, mainFile, config, linkedPackageInMain, linkedPackageJson, linkedPackageIndex, linkedPackageOther]; - const host = createWatchedSystem(files, { currentDirectory: mainPackageRoot }); - createWatchOfConfigFile("tsconfig.json", host); - checkWatchedFilesDetailed(host, [libFile.path, mainFile.path, config.path, linkedPackageIndex.path, linkedPackageOther.path], 1); - checkWatchedDirectories(host, emptyArray, /*recursive*/ false); - checkWatchedDirectoriesDetailed(host, [`${mainPackageRoot}/@scoped`, `${mainPackageRoot}/node_modules`, linkedPackageRoot, `${mainPackageRoot}/node_modules/@types`, `${projectRoot}/node_modules/@types`], 1, /*recursive*/ true); + verifyTscWatch({ + scenario, + subScenario: "with modules linked to sibling folder", + commandLineArgs: ["-w"], + sys: () => { + const mainPackageRoot = `${projectRoot}/main`; + const linkedPackageRoot = `${projectRoot}/linked-package`; + const mainFile: File = { + path: `${mainPackageRoot}/index.ts`, + content: "import { Foo } from '@scoped/linked-package'" + }; + const config: File = { + path: `${mainPackageRoot}/tsconfig.json`, + content: JSON.stringify({ + compilerOptions: { module: "commonjs", moduleResolution: "node", baseUrl: ".", rootDir: "." }, + files: ["index.ts"] + }) + }; + const linkedPackageInMain: SymLink = { + path: `${mainPackageRoot}/node_modules/@scoped/linked-package`, + symLink: `${linkedPackageRoot}` + }; + const linkedPackageJson: File = { + path: `${linkedPackageRoot}/package.json`, + content: JSON.stringify({ name: "@scoped/linked-package", version: "0.0.1", types: "dist/index.d.ts", main: "dist/index.js" }) + }; + const linkedPackageIndex: File = { + path: `${linkedPackageRoot}/dist/index.d.ts`, + content: "export * from './other';" + }; + const linkedPackageOther: File = { + path: `${linkedPackageRoot}/dist/other.d.ts`, + content: 'export declare const Foo = "BAR";' + }; + const files = [libFile, mainFile, config, linkedPackageInMain, linkedPackageJson, linkedPackageIndex, linkedPackageOther]; + return createWatchedSystem(files, { currentDirectory: mainPackageRoot }); + }, + changes: emptyArray }); }); } diff --git a/src/testRunner/unittests/tscWatch/watchEnvironment.ts b/src/testRunner/unittests/tscWatch/watchEnvironment.ts index a9d5a85110764..3df1e2f4aea94 100644 --- a/src/testRunner/unittests/tscWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tscWatch/watchEnvironment.ts @@ -1,69 +1,65 @@ namespace ts.tscWatch { import Tsc_WatchDirectory = TestFSWithWatch.Tsc_WatchDirectory; describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different polling/non polling options", () => { - it("watchFile using dynamic priority polling", () => { - const projectFolder = "/a/username/project"; - const file1: File = { - path: `${projectFolder}/typescript.ts`, - content: "var z = 10;" - }; - const files = [file1, libFile]; - const environmentVariables = createMap(); - environmentVariables.set("TSC_WATCHFILE", TestFSWithWatch.Tsc_WatchFile.DynamicPolling); - const host = createWatchedSystem(files, { environmentVariables }); - const watch = createWatchOfFilesAndCompilerOptions([file1.path], host); - - const initialProgram = watch(); - verifyProgram(); - - const mediumPollingIntervalThreshold = unchangedPollThresholds[PollingInterval.Medium]; - for (let index = 0; index < mediumPollingIntervalThreshold; index++) { - // Transition libFile and file1 to low priority queue - host.checkTimeoutQueueLengthAndRun(1); - assert.deepEqual(watch(), initialProgram); - } - - // Make a change to file - file1.content = "var zz30 = 100;"; - host.reloadFS(files); - - // This should detect change in the file - host.checkTimeoutQueueLengthAndRun(1); - assert.deepEqual(watch(), initialProgram); - - // Callbacks: medium priority + high priority queue and scheduled program update - host.checkTimeoutQueueLengthAndRun(3); - // During this timeout the file would be detected as unchanged - let fileUnchangeDetected = 1; - const newProgram = watch(); - assert.notStrictEqual(newProgram, initialProgram); - - verifyProgram(); - const outputFile1 = changeExtension(file1.path, ".js"); - assert.isTrue(host.fileExists(outputFile1)); - assert.equal(host.readFile(outputFile1), file1.content + host.newLine); - - const newThreshold = unchangedPollThresholds[PollingInterval.Low] + mediumPollingIntervalThreshold; - for (; fileUnchangeDetected < newThreshold; fileUnchangeDetected++) { - // For high + Medium/low polling interval - host.checkTimeoutQueueLengthAndRun(2); - assert.deepEqual(watch(), newProgram); - } - - // Everything goes in high polling interval queue - host.checkTimeoutQueueLengthAndRun(1); - assert.deepEqual(watch(), newProgram); - - function verifyProgram() { - checkProgramActualFiles(watch(), files.map(f => f.path)); - checkWatchedFiles(host, []); - checkWatchedDirectories(host, [], /*recursive*/ false); - checkWatchedDirectories(host, [], /*recursive*/ true); - } + const scenario = "watchEnvironment"; + verifyTscWatch({ + scenario, + subScenario: "watchFile/using dynamic priority polling", + commandLineArgs: ["--w", `/a/username/project/typescript.ts`], + sys: () => { + const projectFolder = "/a/username/project"; + const file1: File = { + path: `${projectFolder}/typescript.ts`, + content: "var z = 10;" + }; + const environmentVariables = createMap(); + environmentVariables.set("TSC_WATCHFILE", TestFSWithWatch.Tsc_WatchFile.DynamicPolling); + return createWatchedSystem([file1, libFile], { environmentVariables }); + }, + changes: [ + (sys, programs) => { + const initialProgram = programs[0][0]; + const mediumPollingIntervalThreshold = unchangedPollThresholds[PollingInterval.Medium]; + for (let index = 0; index < mediumPollingIntervalThreshold; index++) { + // Transition libFile and file1 to low priority queue + sys.checkTimeoutQueueLengthAndRun(1); + assert.deepEqual(programs[0][0], initialProgram); + } + return "Time spent to Transition libFile and file1 to low priority queue"; + }, + sys => { + // Make a change to file + sys.writeFile("/a/username/project/typescript.ts", "var zz30 = 100;"); + + // During this timeout the file would be detected as unchanged + sys.checkTimeoutQueueLengthAndRun(1); + return "Make change to file"; + }, + sys => { + // Callbacks: medium priority + high priority queue and scheduled program update + sys.checkTimeoutQueueLengthAndRun(3); + // This should detect change in the file + return "Callbacks: medium priority + high priority queue and scheduled program update"; + }, + (sys, programs) => { + const initialProgram = programs[0][0]; + const mediumPollingIntervalThreshold = unchangedPollThresholds[PollingInterval.Medium]; + const newThreshold = unchangedPollThresholds[PollingInterval.Low] + mediumPollingIntervalThreshold; + for (let fileUnchangeDetected = 1; fileUnchangeDetected < newThreshold; fileUnchangeDetected++) { + // For high + Medium/low polling interval + sys.checkTimeoutQueueLengthAndRun(2); + assert.deepEqual(programs[0][0], initialProgram); + } + + // Everything goes in high polling interval queue + sys.checkTimeoutQueueLengthAndRun(1); + return "Polling queues polled and everything is in the high polling queue"; + } + ] }); describe("tsc-watch when watchDirectories implementation", () => { - function verifyRenamingFileInSubFolder(tscWatchDirectory: Tsc_WatchDirectory) { + function verifyRenamingFileInSubFolder(subScenario: string, tscWatchDirectory: Tsc_WatchDirectory) { const projectFolder = "/a/username/project"; const projectSrcFolder = `${projectFolder}/src`; const configFile: File = { @@ -78,375 +74,225 @@ namespace ts.tscWatch { path: `${projectSrcFolder}/file1.ts`, content: "" }; - const programFiles = [file, libFile]; - const files = [file, configFile, libFile]; - const environmentVariables = createMap(); - environmentVariables.set("TSC_WATCHDIRECTORY", tscWatchDirectory); - const host = createWatchedSystem(files, { environmentVariables }); - const watch = createWatchOfConfigFile(configFile.path, host); - const projectFolders = [projectFolder, projectSrcFolder, `${projectFolder}/node_modules/@types`]; - // Watching files config file, file, lib file - const expectedWatchedFiles = files.map(f => f.path); - const expectedWatchedDirectories = tscWatchDirectory === Tsc_WatchDirectory.NonRecursiveWatchDirectory ? projectFolders : emptyArray; - if (tscWatchDirectory === Tsc_WatchDirectory.WatchFile) { - expectedWatchedFiles.push(...projectFolders); - } - - verifyProgram(checkOutputErrorsInitial); - - // Rename the file: - file.path = file.path.replace("file1.ts", "file2.ts"); - expectedWatchedFiles[0] = file.path; - host.reloadFS(files); - if (tscWatchDirectory === Tsc_WatchDirectory.DynamicPolling) { - // With dynamic polling the fs change would be detected only by running timeouts - host.runQueuedTimeoutCallbacks(); - } - // Delayed update program - host.runQueuedTimeoutCallbacks(); - verifyProgram(checkOutputErrorsIncremental); - - function verifyProgram(checkOutputErrors: (host: WatchedSystem, errors: readonly Diagnostic[]) => void) { - checkProgramActualFiles(watch(), programFiles.map(f => f.path)); - checkOutputErrors(host, emptyArray); - - const outputFile = changeExtension(file.path, ".js"); - assert(host.fileExists(outputFile)); - assert.equal(host.readFile(outputFile), file.content); - - checkWatchedDirectories(host, emptyArray, /*recursive*/ true); - - // Watching config file, file, lib file and directories - checkWatchedFilesDetailed(host, expectedWatchedFiles, 1); - checkWatchedDirectoriesDetailed(host, expectedWatchedDirectories, 1, /*recursive*/ false); - } + verifyTscWatch({ + scenario, + subScenario: `watchDirectories/${subScenario}`, + commandLineArgs: ["--w", "-p", configFile.path], + sys: () => { + const files = [file, configFile, libFile]; + const environmentVariables = createMap(); + environmentVariables.set("TSC_WATCHDIRECTORY", tscWatchDirectory); + return createWatchedSystem(files, { environmentVariables }); + }, + changes: [ + sys => { + // Rename the file: + sys.renameFile(file.path, file.path.replace("file1.ts", "file2.ts")); + if (tscWatchDirectory === Tsc_WatchDirectory.DynamicPolling) { + // With dynamic polling the fs change would be detected only by running timeouts + sys.runQueuedTimeoutCallbacks(); + } + // Delayed update program + sys.runQueuedTimeoutCallbacks(); + return "Rename file1 to file2"; + }, + ], + }); } - it("uses watchFile when renaming file in subfolder", () => { - verifyRenamingFileInSubFolder(Tsc_WatchDirectory.WatchFile); - }); - - it("uses non recursive watchDirectory when renaming file in subfolder", () => { - verifyRenamingFileInSubFolder(Tsc_WatchDirectory.NonRecursiveWatchDirectory); - }); - - it("uses non recursive dynamic polling when renaming file in subfolder", () => { - verifyRenamingFileInSubFolder(Tsc_WatchDirectory.DynamicPolling); - }); - - it("when there are symlinks to folders in recursive folders", () => { - const cwd = "/home/user/projects/myproject"; - const file1: File = { - path: `${cwd}/src/file.ts`, - content: `import * as a from "a"` - }; - const tsconfig: File = { - path: `${cwd}/tsconfig.json`, - content: `{ "compilerOptions": { "extendedDiagnostics": true, "traceResolution": true }}` - }; - const realA: File = { - path: `${cwd}/node_modules/reala/index.d.ts`, - content: `export {}` - }; - const realB: File = { - path: `${cwd}/node_modules/realb/index.d.ts`, - content: `export {}` - }; - const symLinkA: SymLink = { - path: `${cwd}/node_modules/a`, - symLink: `${cwd}/node_modules/reala` - }; - const symLinkB: SymLink = { - path: `${cwd}/node_modules/b`, - symLink: `${cwd}/node_modules/realb` - }; - const symLinkBInA: SymLink = { - path: `${cwd}/node_modules/reala/node_modules/b`, - symLink: `${cwd}/node_modules/b` - }; - const symLinkAInB: SymLink = { - path: `${cwd}/node_modules/realb/node_modules/a`, - symLink: `${cwd}/node_modules/a` - }; - const files = [file1, tsconfig, realA, realB, symLinkA, symLinkB, symLinkBInA, symLinkAInB]; - const environmentVariables = createMap(); - environmentVariables.set("TSC_WATCHDIRECTORY", Tsc_WatchDirectory.NonRecursiveWatchDirectory); - const host = createWatchedSystem(files, { environmentVariables, currentDirectory: cwd }); - createWatchOfConfigFile("tsconfig.json", host); - checkWatchedDirectories(host, emptyArray, /*recursive*/ true); - checkWatchedDirectories(host, [cwd, `${cwd}/node_modules`, `${cwd}/node_modules/@types`, `${cwd}/node_modules/reala`, `${cwd}/node_modules/realb`, - `${cwd}/node_modules/reala/node_modules`, `${cwd}/node_modules/realb/node_modules`, `${cwd}/src`], /*recursive*/ false); + verifyRenamingFileInSubFolder("uses watchFile when renaming file in subfolder", Tsc_WatchDirectory.WatchFile); + + verifyRenamingFileInSubFolder("uses non recursive watchDirectory when renaming file in subfolder", Tsc_WatchDirectory.NonRecursiveWatchDirectory); + + verifyRenamingFileInSubFolder("uses non recursive dynamic polling when renaming file in subfolder", Tsc_WatchDirectory.DynamicPolling); + + verifyTscWatch({ + scenario, + subScenario: "watchDirectories/when there are symlinks to folders in recursive folders", + commandLineArgs: ["--w"], + sys: () => { + const cwd = "/home/user/projects/myproject"; + const file1: File = { + path: `${cwd}/src/file.ts`, + content: `import * as a from "a"` + }; + const tsconfig: File = { + path: `${cwd}/tsconfig.json`, + content: `{ "compilerOptions": { "extendedDiagnostics": true, "traceResolution": true }}` + }; + const realA: File = { + path: `${cwd}/node_modules/reala/index.d.ts`, + content: `export {}` + }; + const realB: File = { + path: `${cwd}/node_modules/realb/index.d.ts`, + content: `export {}` + }; + const symLinkA: SymLink = { + path: `${cwd}/node_modules/a`, + symLink: `${cwd}/node_modules/reala` + }; + const symLinkB: SymLink = { + path: `${cwd}/node_modules/b`, + symLink: `${cwd}/node_modules/realb` + }; + const symLinkBInA: SymLink = { + path: `${cwd}/node_modules/reala/node_modules/b`, + symLink: `${cwd}/node_modules/b` + }; + const symLinkAInB: SymLink = { + path: `${cwd}/node_modules/realb/node_modules/a`, + symLink: `${cwd}/node_modules/a` + }; + const files = [libFile, file1, tsconfig, realA, realB, symLinkA, symLinkB, symLinkBInA, symLinkAInB]; + const environmentVariables = createMap(); + environmentVariables.set("TSC_WATCHDIRECTORY", Tsc_WatchDirectory.NonRecursiveWatchDirectory); + return createWatchedSystem(files, { environmentVariables, currentDirectory: cwd }); + }, + changes: emptyArray }); - it("with non synchronous watch directory", () => { - const configFile: File = { - path: `${projectRoot}/tsconfig.json`, - content: "{}" - }; - const file1: File = { - path: `${projectRoot}/src/file1.ts`, - content: `import { x } from "file2";` - }; - const file2: File = { - path: `${projectRoot}/node_modules/file2/index.d.ts`, - content: `export const x = 10;` - }; - const files = [libFile, file1, file2, configFile]; - const host = createWatchedSystem(files, { runWithoutRecursiveWatches: true }); - const watch = createWatchOfConfigFile(configFile.path, host); - checkProgramActualFiles(watch(), mapDefined(files, f => f === configFile ? undefined : f.path)); - checkOutputErrorsInitial(host, emptyArray); - const watchedDirectories = [`${projectRoot}`, `${projectRoot}/src`, `${projectRoot}/node_modules`, `${projectRoot}/node_modules/file2`, `${projectRoot}/node_modules/@types`]; - checkWatchesWithFile2(); - host.checkTimeoutQueueLengthAndRun(1); // To update directory callbacks for file1.js output - host.checkTimeoutQueueLengthAndRun(1); // Update program again - host.checkTimeoutQueueLength(0); - checkOutputErrorsIncremental(host, emptyArray); - checkWatchesWithFile2(); - - // Remove directory node_modules - host.deleteFolder(`${projectRoot}/node_modules`, /*recursive*/ true); - host.checkTimeoutQueueLength(2); // 1. For updating program and 2. for updating child watches - host.runQueuedTimeoutCallbacks(host.getNextTimeoutId() - 2); // Update program - checkOutputErrorsIncremental(host, [ - getDiagnosticModuleNotFoundOfFile(watch(), file1, "file2") - ]); - checkWatchesWithoutFile2(); - - host.checkTimeoutQueueLengthAndRun(1); // To update directory watchers - host.checkTimeoutQueueLengthAndRun(1); // To Update program - host.checkTimeoutQueueLength(0); - checkWatchesWithoutFile2(); - checkOutputErrorsIncremental(host, [ - getDiagnosticModuleNotFoundOfFile(watch(), file1, "file2") - ]); - - // npm install - host.createDirectory(`${projectRoot}/node_modules`); - host.checkTimeoutQueueLength(1); // To update folder structure - assert.deepEqual(host.getOutput(), emptyArray); - checkWatchesWithoutFile2(); - host.createDirectory(`${projectRoot}/node_modules/file2`); - host.checkTimeoutQueueLength(1); // To update folder structure - assert.deepEqual(host.getOutput(), emptyArray); - checkWatchesWithoutFile2(); - host.writeFile(file2.path, file2.content); - host.checkTimeoutQueueLength(1); // To update folder structure - assert.deepEqual(host.getOutput(), emptyArray); - checkWatchesWithoutFile2(); - - host.runQueuedTimeoutCallbacks(); - host.checkTimeoutQueueLength(1); // To Update the program - assert.deepEqual(host.getOutput(), emptyArray); - checkWatchedFiles(files.filter(f => f !== file2)); // Files like without file2 - checkWatchedDirectories(host, emptyArray, /*recursive*/ true); - checkNonRecursiveWatchedDirectories(watchedDirectories); // Directories like with file2 - - host.runQueuedTimeoutCallbacks(); - host.checkTimeoutQueueLength(0); - checkOutputErrorsIncremental(host, emptyArray); - checkWatchesWithFile2(); - - function checkWatchesWithFile2() { - checkWatchedFiles(files); - checkWatchedDirectories(host, emptyArray, /*recursive*/ true); - checkNonRecursiveWatchedDirectories(watchedDirectories); - } - - function checkWatchesWithoutFile2() { - checkWatchedFiles(files.filter(f => f !== file2)); - checkWatchedDirectories(host, emptyArray, /*recursive*/ true); - checkNonRecursiveWatchedDirectories(watchedDirectories.filter(f => f !== `${projectRoot}/node_modules/file2`)); - } - - function checkWatchedFiles(files: readonly File[]) { - checkWatchedFilesDetailed( - host, - files.map(f => f.path.toLowerCase()), - 1, - arrayToMap( - files, - f => f.path.toLowerCase(), - () => [PollingInterval.Low] - ) - ); - } - - function checkNonRecursiveWatchedDirectories(directories: readonly string[]) { - checkWatchedDirectoriesDetailed( - host, - directories, - 1, - /*recursive*/ false, - arrayToMap( - directories, - identity, - () => [{ - fallbackPollingInterval: PollingInterval.Medium, - fallbackOptions: { watchFile: WatchFileKind.PriorityPollingInterval } - }] - ) - ); - } + verifyTscWatch({ + scenario, + subScenario: "watchDirectories/with non synchronous watch directory", + commandLineArgs: ["--w", "-p", `${projectRoot}/tsconfig.json`], + sys: () => { + const configFile: File = { + path: `${projectRoot}/tsconfig.json`, + content: "{}" + }; + const file1: File = { + path: `${projectRoot}/src/file1.ts`, + content: `import { x } from "file2";` + }; + const file2: File = { + path: `${projectRoot}/node_modules/file2/index.d.ts`, + content: `export const x = 10;` + }; + const files = [libFile, file1, file2, configFile]; + return createWatchedSystem(files, { runWithoutRecursiveWatches: true }); + }, + changes: [ + sys => { + sys.checkTimeoutQueueLengthAndRun(1); // To update directory callbacks for file1.js output + sys.checkTimeoutQueueLengthAndRun(1); // Update program again + sys.checkTimeoutQueueLength(0); + return "Pending updates because of file1.js creation"; + }, + sys => { + // Remove directory node_modules + sys.deleteFolder(`${projectRoot}/node_modules`, /*recursive*/ true); + sys.checkTimeoutQueueLength(2); // 1. For updating program and 2. for updating child watches + sys.runQueuedTimeoutCallbacks(sys.getNextTimeoutId() - 2); // Update program + return "Remove directory node_modules"; + }, + sys => { + sys.checkTimeoutQueueLengthAndRun(1); // To update directory watchers + sys.checkTimeoutQueueLengthAndRun(1); // To Update program + sys.checkTimeoutQueueLength(0); + return "Pending directory watchers and program update"; + }, + sys => { + // npm install + sys.createDirectory(`${projectRoot}/node_modules`); + sys.checkTimeoutQueueLength(1); // To update folder structure + return "Start npm install"; + }, + sys => { + sys.createDirectory(`${projectRoot}/node_modules/file2`); + sys.checkTimeoutQueueLength(1); // To update folder structure + return "npm install folder creation of file2"; + }, + sys => { + sys.writeFile(`${projectRoot}/node_modules/file2/index.d.ts`, `export const x = 10;`); + sys.checkTimeoutQueueLength(1); // To update folder structure + return "npm install index file in file2"; + }, + sys => { + sys.runQueuedTimeoutCallbacks(); + sys.checkTimeoutQueueLength(1); // To Update the program + return "Updates the program"; + }, + sys => { + sys.runQueuedTimeoutCallbacks(); + sys.checkTimeoutQueueLength(0); + return "Pending updates"; + } + ], }); }); describe("handles watch compiler options", () => { - it("with watchFile option", () => { - const configFile: File = { - path: "/a/b/tsconfig.json", - content: JSON.stringify({ - watchOptions: { - watchFile: "UseFsEvents" - } - }) - }; - const files = [libFile, commonFile1, commonFile2, configFile]; - const host = createWatchedSystem(files); - const watch = createWatchOfConfigFile(configFile.path, host, { extendedDiagnostics: true }); - checkProgramActualFiles(watch(), mapDefined(files, f => f === configFile ? undefined : f.path)); - - // Instead of polling watch (= watchedFiles), uses fsWatch - checkWatchedFiles(host, emptyArray); - checkWatchedDirectoriesDetailed( - host, - files.map(f => f.path.toLowerCase()), - 1, - /*recursive*/ false, - arrayToMap( - files, - f => f.path.toLowerCase(), - f => [{ - fallbackPollingInterval: f === configFile ? PollingInterval.High : PollingInterval.Low, - fallbackOptions: { watchFile: WatchFileKind.PriorityPollingInterval } - }] - ) - ); - checkWatchedDirectoriesDetailed( - host, - ["/a/b", "/a/b/node_modules/@types"], - 1, - /*recursive*/ true, - arrayToMap( - ["/a/b", "/a/b/node_modules/@types"], - identity, - () => [{ - fallbackPollingInterval: PollingInterval.Medium, - fallbackOptions: { watchFile: WatchFileKind.PriorityPollingInterval } - }] - ) - ); + verifyTscWatch({ + scenario, + subScenario: "watchOptions/with watchFile option", + commandLineArgs: ["-w", "-p", "/a/b/tsconfig.json"], + sys: () => { + const configFile: File = { + path: "/a/b/tsconfig.json", + content: JSON.stringify({ + watchOptions: { + watchFile: "UseFsEvents" + } + }) + }; + const files = [libFile, commonFile1, commonFile2, configFile]; + return createWatchedSystem(files); + }, + changes: emptyArray }); - it("with watchDirectory option", () => { - const configFile: File = { - path: "/a/b/tsconfig.json", - content: JSON.stringify({ - watchOptions: { - watchDirectory: "UseFsEvents" - } - }) - }; - const files = [libFile, commonFile1, commonFile2, configFile]; - const host = createWatchedSystem(files, { runWithoutRecursiveWatches: true }); - const watch = createWatchOfConfigFile(configFile.path, host, { extendedDiagnostics: true }); - checkProgramActualFiles(watch(), mapDefined(files, f => f === configFile ? undefined : f.path)); - - checkWatchedFilesDetailed( - host, - files.map(f => f.path.toLowerCase()), - 1, - arrayToMap( - files, - f => f.path.toLowerCase(), - () => [PollingInterval.Low] - ) - ); - checkWatchedDirectoriesDetailed( - host, - ["/a/b", "/a/b/node_modules/@types"], - 1, - /*recursive*/ false, - arrayToMap( - ["/a/b", "/a/b/node_modules/@types"], - identity, - () => [{ - fallbackPollingInterval: PollingInterval.Medium, - fallbackOptions: { watchFile: WatchFileKind.PriorityPollingInterval } - }] - ) - ); - checkWatchedDirectories(host, emptyArray, /*recursive*/ true); + verifyTscWatch({ + scenario, + subScenario: "watchOptions/with watchDirectory option", + commandLineArgs: ["-w", "-p", "/a/b/tsconfig.json"], + sys: () => { + const configFile: File = { + path: "/a/b/tsconfig.json", + content: JSON.stringify({ + watchOptions: { + watchDirectory: "UseFsEvents" + } + }) + }; + const files = [libFile, commonFile1, commonFile2, configFile]; + return createWatchedSystem(files, { runWithoutRecursiveWatches: true }); + }, + changes: emptyArray }); - it("with fallbackPolling option", () => { - const configFile: File = { - path: "/a/b/tsconfig.json", - content: JSON.stringify({ - watchOptions: { - fallbackPolling: "PriorityInterval" - } - }) - }; - const files = [libFile, commonFile1, commonFile2, configFile]; - const host = createWatchedSystem(files, { runWithoutRecursiveWatches: true, runWithFallbackPolling: true }); - const watch = createWatchOfConfigFile(configFile.path, host, { extendedDiagnostics: true }); - checkProgramActualFiles(watch(), mapDefined(files, f => f === configFile ? undefined : f.path)); - const filePaths = files.map(f => f.path.toLowerCase()); - checkWatchedFilesDetailed( - host, - filePaths.concat(["/a/b", "/a/b/node_modules/@types"]), - 1, - arrayToMap( - filePaths.concat(["/a/b", "/a/b/node_modules/@types"]), - identity, - f => [contains(filePaths, f) ? PollingInterval.Low : PollingInterval.Medium] - ) - ); - checkWatchedDirectories(host, emptyArray, /*recursive*/ false); - checkWatchedDirectories(host, emptyArray, /*recursive*/ true); + verifyTscWatch({ + scenario, + subScenario: "watchOptions/with fallbackPolling option", + commandLineArgs: ["-w", "-p", "/a/b/tsconfig.json"], + sys: () => { + const configFile: File = { + path: "/a/b/tsconfig.json", + content: JSON.stringify({ + watchOptions: { + fallbackPolling: "PriorityInterval" + } + }) + }; + const files = [libFile, commonFile1, commonFile2, configFile]; + return createWatchedSystem(files, { runWithoutRecursiveWatches: true, runWithFallbackPolling: true }); + }, + changes: emptyArray }); - it("with watchFile as watch options to extend", () => { - const configFile: File = { - path: "/a/b/tsconfig.json", - content: "{}" - }; - const files = [libFile, commonFile1, commonFile2, configFile]; - const host = createWatchedSystem(files); - const watch = createWatchOfConfigFile(configFile.path, host, { extendedDiagnostics: true }, { watchFile: WatchFileKind.UseFsEvents }); - checkProgramActualFiles(watch(), mapDefined(files, f => f === configFile ? undefined : f.path)); - - // Instead of polling watch (= watchedFiles), uses fsWatch - checkWatchedFiles(host, emptyArray); - checkWatchedDirectoriesDetailed( - host, - files.map(f => f.path.toLowerCase()), - 1, - /*recursive*/ false, - arrayToMap( - files, - f => f.path.toLowerCase(), - f => [{ - fallbackPollingInterval: f === configFile ? PollingInterval.High : PollingInterval.Low, - fallbackOptions: { watchFile: WatchFileKind.PriorityPollingInterval } - }] - ) - ); - checkWatchedDirectoriesDetailed( - host, - ["/a/b", "/a/b/node_modules/@types"], - 1, - /*recursive*/ true, - arrayToMap( - ["/a/b", "/a/b/node_modules/@types"], - identity, - () => [{ - fallbackPollingInterval: PollingInterval.Medium, - fallbackOptions: { watchFile: WatchFileKind.PriorityPollingInterval } - }] - ) - ); + verifyTscWatch({ + scenario, + subScenario: "watchOptions/with watchFile as watch options to extend", + commandLineArgs: ["-w", "-p", "/a/b/tsconfig.json", "--watchFile", "UseFsEvents"], + sys: () => { + const configFile: File = { + path: "/a/b/tsconfig.json", + content: "{}" + }; + const files = [libFile, commonFile1, commonFile2, configFile]; + return createWatchedSystem(files); + }, + changes: emptyArray }); }); }); diff --git a/src/tsc/tsc.ts b/src/tsc/tsc.ts index 20c270a5b61d8..306f6e3284744 100644 --- a/src/tsc/tsc.ts +++ b/src/tsc/tsc.ts @@ -1,12 +1,3 @@ namespace ts {} // empty ts module so the module migration script knows this file depends on the `ts` project namespace // This file actually uses arguments passed on commandline and executes it -ts.executeCommandLine( - ts.sys, - { - onCompilerHostCreate: ts.noop, - onCompilationComplete: ts.noop, - onSolutionBuilderHostCreate: ts.noop, - onSolutionBuildComplete: ts.noop - }, - ts.sys.args -); +ts.executeCommandLine(ts.sys, ts.noop, ts.sys.args); diff --git a/tests/baselines/reference/tsbuild/watchMode/demo/updates-with-bad-reference.js b/tests/baselines/reference/tsbuild/watchMode/demo/updates-with-bad-reference.js new file mode 100644 index 0000000000000..488265e249a45 --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/demo/updates-with-bad-reference.js @@ -0,0 +1,331 @@ +/a/lib/tsc.js -b -w -verbose +//// [/user/username/projects/demo/core/tsconfig.json] +{ + "extends": "../tsconfig-base.json", + "compilerOptions": { + "outDir": "../lib/core", + "rootDir": "." + } +} + +//// [/user/username/projects/demo/core/utilities.ts] +import * as A from '../animals'; + +export function makeRandomName() { + return "Bob!?! "; +} + +export function lastElementOf(arr: T[]): T | undefined { + if (arr.length === 0) return undefined; + return arr[arr.length - 1]; +} + + + +//// [/user/username/projects/demo/animals/tsconfig.json] +{ + "extends": "../tsconfig-base.json", + "compilerOptions": { + "outDir": "../lib/animals", + "rootDir": ".", + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/user/username/projects/demo/animals/animal.ts] +export type Size = "small" | "medium" | "large"; +export default interface Animal { + size: Size; +} + + +//// [/user/username/projects/demo/animals/dog.ts] +import Animal from '.'; +import { makeRandomName } from '../core/utilities'; + +export interface Dog extends Animal { + woof(): void; + name: string; +} + +export function createDog(): Dog { + return ({ + size: "medium", + woof: function(this: Dog) { + console.log(`${this.name} says "Woof"!`); + }, + name: makeRandomName() + }); +} + + + +//// [/user/username/projects/demo/animals/index.ts] +import Animal from './animal'; + +export default Animal; +import { createDog, Dog } from './dog'; +export { createDog, Dog }; + + +//// [/user/username/projects/demo/zoo/tsconfig.json] +{ + "extends": "../tsconfig-base.json", + "compilerOptions": { + "outDir": "../lib/zoo", + "rootDir": "." + }, + "references": [ + { + "path": "../animals" + } + ] +} + +//// [/user/username/projects/demo/zoo/zoo.ts] +import { Dog, createDog } from '../animals/index'; + +export function createZoo(): Array { + return [ + createDog() + ]; +} + + + +//// [/user/username/projects/demo/tsconfig.json] +{ + "files": [], + "references": [ + { + "path": "./core" + }, + { + "path": "./animals" + }, + { + "path": "./zoo" + } + ] +} + +//// [/user/username/projects/demo/tsconfig-base.json] +{ + "compilerOptions": { + "declaration": true, + "target": "es5", + "module": "commonjs", + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "composite": true + } +} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + + +Output:: +>> Screen clear +12:00:46 AM - Starting compilation in watch mode... + + +12:00:47 AM - Projects in this build: + * core/tsconfig.json + * animals/tsconfig.json + * zoo/tsconfig.json + * tsconfig.json + + +12:00:48 AM - Project 'core/tsconfig.json' is out of date because output file 'lib/core/utilities.js' does not exist + + +12:00:49 AM - Building project '/user/username/projects/demo/core/tsconfig.json'... + + +animals/index.ts(1,20): error TS6059: File '/user/username/projects/demo/animals/animal.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files. + +animals/index.ts(1,20): error TS6307: File '/user/username/projects/demo/animals/animal.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern. + +animals/index.ts(4,32): error TS6059: File '/user/username/projects/demo/animals/dog.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files. + +animals/index.ts(4,32): error TS6307: File '/user/username/projects/demo/animals/dog.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern. + +core/utilities.ts(1,1): error TS6133: 'A' is declared but its value is never read. + +core/utilities.ts(1,20): error TS6059: File '/user/username/projects/demo/animals/index.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files. + +core/utilities.ts(1,20): error TS6307: File '/user/username/projects/demo/animals/index.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern. + +12:00:50 AM - Project 'animals/tsconfig.json' can't be built because its dependency 'core' has errors + + +12:00:51 AM - Skipping build of project '/user/username/projects/demo/animals/tsconfig.json' because its dependency '/user/username/projects/demo/core' has errors + + +12:00:52 AM - Project 'zoo/tsconfig.json' can't be built because its dependency 'animals' was not built + + +12:00:53 AM - Skipping build of project '/user/username/projects/demo/zoo/tsconfig.json' because its dependency '/user/username/projects/demo/animals' was not built + + + +12:00:54 AM - Found 7 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/demo/core/utilities.ts"] +Program options: {"declaration":true,"target":1,"module":1,"strict":true,"noUnusedLocals":true,"noUnusedParameters":true,"noImplicitReturns":true,"noFallthroughCasesInSwitch":true,"composite":true,"outDir":"/user/username/projects/demo/lib/core","rootDir":"/user/username/projects/demo/core","watch":true,"configFilePath":"/user/username/projects/demo/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/demo/animals/animal.ts +/user/username/projects/demo/animals/dog.ts +/user/username/projects/demo/animals/index.ts +/user/username/projects/demo/core/utilities.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/demo/animals/animal.ts +/user/username/projects/demo/animals/dog.ts +/user/username/projects/demo/animals/index.ts +/user/username/projects/demo/core/utilities.ts + +WatchedFiles:: +/user/username/projects/demo/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/demo/core/utilities.ts: + {"pollingInterval":250} +/user/username/projects/demo/animals/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/demo/animals/animal.ts: + {"pollingInterval":250} +/user/username/projects/demo/animals/dog.ts: + {"pollingInterval":250} +/user/username/projects/demo/animals/index.ts: + {"pollingInterval":250} +/user/username/projects/demo/zoo/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/demo/zoo/zoo.ts: + {"pollingInterval":250} +/user/username/projects/demo/tsconfig.json: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/demo/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/demo/animals: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/demo/zoo: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Prepend a line + +//// [/user/username/projects/demo/core/utilities.ts] + +import * as A from '../animals'; + +export function makeRandomName() { + return "Bob!?! "; +} + +export function lastElementOf(arr: T[]): T | undefined { + if (arr.length === 0) return undefined; + return arr[arr.length - 1]; +} + + + + +Output:: +>> Screen clear +12:00:58 AM - File change detected. Starting incremental compilation... + + +12:00:59 AM - Project 'core/tsconfig.json' is out of date because output file 'lib/core/utilities.js' does not exist + + +12:01:00 AM - Building project '/user/username/projects/demo/core/tsconfig.json'... + + +animals/index.ts(1,20): error TS6059: File '/user/username/projects/demo/animals/animal.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files. + +animals/index.ts(1,20): error TS6307: File '/user/username/projects/demo/animals/animal.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern. + +animals/index.ts(4,32): error TS6059: File '/user/username/projects/demo/animals/dog.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files. + +animals/index.ts(4,32): error TS6307: File '/user/username/projects/demo/animals/dog.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern. + +core/utilities.ts(2,1): error TS6133: 'A' is declared but its value is never read. + +core/utilities.ts(2,20): error TS6059: File '/user/username/projects/demo/animals/index.ts' is not under 'rootDir' '/user/username/projects/demo/core'. 'rootDir' is expected to contain all source files. + +core/utilities.ts(2,20): error TS6307: File '/user/username/projects/demo/animals/index.ts' is not listed within the file list of project '/user/username/projects/demo/core/tsconfig.json'. Projects must list all files or use an 'include' pattern. + + +12:01:01 AM - Found 7 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/demo/core/utilities.ts"] +Program options: {"declaration":true,"target":1,"module":1,"strict":true,"noUnusedLocals":true,"noUnusedParameters":true,"noImplicitReturns":true,"noFallthroughCasesInSwitch":true,"composite":true,"outDir":"/user/username/projects/demo/lib/core","rootDir":"/user/username/projects/demo/core","watch":true,"configFilePath":"/user/username/projects/demo/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/demo/animals/animal.ts +/user/username/projects/demo/animals/dog.ts +/user/username/projects/demo/animals/index.ts +/user/username/projects/demo/core/utilities.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/demo/core/utilities.ts + +WatchedFiles:: +/user/username/projects/demo/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/demo/core/utilities.ts: + {"pollingInterval":250} +/user/username/projects/demo/animals/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/demo/animals/animal.ts: + {"pollingInterval":250} +/user/username/projects/demo/animals/dog.ts: + {"pollingInterval":250} +/user/username/projects/demo/animals/index.ts: + {"pollingInterval":250} +/user/username/projects/demo/zoo/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/demo/zoo/zoo.ts: + {"pollingInterval":250} +/user/username/projects/demo/tsconfig.json: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/demo/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/demo/animals: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/demo/zoo: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuild/watchMode/demo/updates-with-circular-reference.js b/tests/baselines/reference/tsbuild/watchMode/demo/updates-with-circular-reference.js new file mode 100644 index 0000000000000..8074bbe652271 --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/demo/updates-with-circular-reference.js @@ -0,0 +1,586 @@ +/a/lib/tsc.js -b -w -verbose +//// [/user/username/projects/demo/core/tsconfig.json] +{ + "extends": "../tsconfig-base.json", + "compilerOptions": { + "outDir": "../lib/core", + "rootDir": "." + }, + "references": [ + { + "path": "../zoo" + } + ] +} + +//// [/user/username/projects/demo/core/utilities.ts] + +export function makeRandomName() { + return "Bob!?! "; +} + +export function lastElementOf(arr: T[]): T | undefined { + if (arr.length === 0) return undefined; + return arr[arr.length - 1]; +} + + + +//// [/user/username/projects/demo/animals/tsconfig.json] +{ + "extends": "../tsconfig-base.json", + "compilerOptions": { + "outDir": "../lib/animals", + "rootDir": ".", + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/user/username/projects/demo/animals/animal.ts] +export type Size = "small" | "medium" | "large"; +export default interface Animal { + size: Size; +} + + +//// [/user/username/projects/demo/animals/dog.ts] +import Animal from '.'; +import { makeRandomName } from '../core/utilities'; + +export interface Dog extends Animal { + woof(): void; + name: string; +} + +export function createDog(): Dog { + return ({ + size: "medium", + woof: function(this: Dog) { + console.log(`${this.name} says "Woof"!`); + }, + name: makeRandomName() + }); +} + + + +//// [/user/username/projects/demo/animals/index.ts] +import Animal from './animal'; + +export default Animal; +import { createDog, Dog } from './dog'; +export { createDog, Dog }; + + +//// [/user/username/projects/demo/zoo/tsconfig.json] +{ + "extends": "../tsconfig-base.json", + "compilerOptions": { + "outDir": "../lib/zoo", + "rootDir": "." + }, + "references": [ + { + "path": "../animals" + } + ] +} + +//// [/user/username/projects/demo/zoo/zoo.ts] +import { Dog, createDog } from '../animals/index'; + +export function createZoo(): Array { + return [ + createDog() + ]; +} + + + +//// [/user/username/projects/demo/tsconfig.json] +{ + "files": [], + "references": [ + { + "path": "./core" + }, + { + "path": "./animals" + }, + { + "path": "./zoo" + } + ] +} + +//// [/user/username/projects/demo/tsconfig-base.json] +{ + "compilerOptions": { + "declaration": true, + "target": "es5", + "module": "commonjs", + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "composite": true + } +} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + + +Output:: +>> Screen clear +12:00:46 AM - Starting compilation in watch mode... + + +12:00:47 AM - Projects in this build: + * animals/tsconfig.json + * zoo/tsconfig.json + * core/tsconfig.json + * tsconfig.json + + +error TS6202: Project references may not form a circular graph. Cycle detected: /user/username/projects/demo/tsconfig.json +/user/username/projects/demo/core/tsconfig.json +/user/username/projects/demo/zoo/tsconfig.json +/user/username/projects/demo/animals/tsconfig.json + + +12:00:48 AM - Found 1 error. Watching for file changes. + + +WatchedFiles:: +/user/username/projects/demo/animals/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/demo/animals/animal.ts: + {"pollingInterval":250} +/user/username/projects/demo/animals/dog.ts: + {"pollingInterval":250} +/user/username/projects/demo/animals/index.ts: + {"pollingInterval":250} +/user/username/projects/demo/zoo/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/demo/zoo/zoo.ts: + {"pollingInterval":250} +/user/username/projects/demo/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/demo/core/utilities.ts: + {"pollingInterval":250} +/user/username/projects/demo/tsconfig.json: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/demo/animals: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/demo/zoo: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/demo/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Fix error + +//// [/user/username/projects/demo/core/tsconfig.json] +{ + "extends": "../tsconfig-base.json", + "compilerOptions": { + "outDir": "../lib/core", + "rootDir": "." + } +} + +//// [/user/username/projects/demo/lib/core/utilities.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +function makeRandomName() { + return "Bob!?! "; +} +exports.makeRandomName = makeRandomName; +function lastElementOf(arr) { + if (arr.length === 0) + return undefined; + return arr[arr.length - 1]; +} +exports.lastElementOf = lastElementOf; + + +//// [/user/username/projects/demo/lib/core/utilities.d.ts] +export declare function makeRandomName(): string; +export declare function lastElementOf(arr: T[]): T | undefined; + + +//// [/user/username/projects/demo/lib/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" + }, + "../../core/utilities.ts": { + "version": "25274411612-\r\nexport function makeRandomName() {\r\n return \"Bob!?! \";\r\n}\r\n\r\nexport function lastElementOf(arr: T[]): T | undefined {\r\n if (arr.length === 0) return undefined;\r\n return arr[arr.length - 1];\r\n}\r\n\r\n", + "signature": "-11345568166-export declare function makeRandomName(): string;\nexport declare function lastElementOf(arr: T[]): T | undefined;\n" + } + }, + "options": { + "declaration": true, + "target": 1, + "module": 1, + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "composite": true, + "outDir": "./", + "rootDir": "../../core", + "watch": true, + "configFilePath": "../../core/tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "../../core/utilities.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/demo/lib/animals/animal.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + + +//// [/user/username/projects/demo/lib/animals/animal.d.ts] +export declare type Size = "small" | "medium" | "large"; +export default interface Animal { + size: Size; +} + + +//// [/user/username/projects/demo/lib/animals/index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var animal_1 = require("./animal"); +var dog_1 = require("./dog"); +exports.createDog = dog_1.createDog; + + +//// [/user/username/projects/demo/lib/animals/index.d.ts] +import Animal from './animal'; +export default Animal; +import { createDog, Dog } from './dog'; +export { createDog, Dog }; + + +//// [/user/username/projects/demo/lib/animals/dog.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var utilities_1 = require("../core/utilities"); +function createDog() { + return ({ + size: "medium", + woof: function () { + console.log(this.name + " says \"Woof\"!"); + }, + name: utilities_1.makeRandomName() + }); +} +exports.createDog = createDog; + + +//// [/user/username/projects/demo/lib/animals/dog.d.ts] +import Animal from '.'; +export interface Dog extends Animal { + woof(): void; + name: string; +} +export declare function createDog(): Dog; + + +//// [/user/username/projects/demo/lib/animals/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" + }, + "../../animals/animal.ts": { + "version": "-14984181202-export type Size = \"small\" | \"medium\" | \"large\";\r\nexport default interface Animal {\r\n size: Size;\r\n}\r\n", + "signature": "-10510161654-export declare type Size = \"small\" | \"medium\" | \"large\";\nexport default interface Animal {\n size: Size;\n}\n" + }, + "../../animals/index.ts": { + "version": "-5382672599-import Animal from './animal';\r\n\r\nexport default Animal;\r\nimport { createDog, Dog } from './dog';\r\nexport { createDog, Dog };\r\n", + "signature": "1096904574-import Animal from './animal';\nexport default Animal;\nimport { createDog, Dog } from './dog';\nexport { createDog, Dog };\n" + }, + "../../core/utilities.ts": { + "version": "-11345568166-export declare function makeRandomName(): string;\nexport declare function lastElementOf(arr: T[]): T | undefined;\n", + "signature": "-11345568166-export declare function makeRandomName(): string;\nexport declare function lastElementOf(arr: T[]): T | undefined;\n" + }, + "../../animals/dog.ts": { + "version": "-10991948013-import Animal from '.';\r\nimport { makeRandomName } from '../core/utilities';\r\n\r\nexport interface Dog extends Animal {\r\n woof(): void;\r\n name: string;\r\n}\r\n\r\nexport function createDog(): Dog {\r\n return ({\r\n size: \"medium\",\r\n woof: function(this: Dog) {\r\n console.log(`${this.name} says \"Woof\"!`);\r\n },\r\n name: makeRandomName()\r\n });\r\n}\r\n\r\n", + "signature": "6032048049-import Animal from '.';\nexport interface Dog extends Animal {\n woof(): void;\n name: string;\n}\nexport declare function createDog(): Dog;\n" + } + }, + "options": { + "declaration": true, + "target": 1, + "module": 1, + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "composite": true, + "outDir": "./", + "rootDir": "../../animals", + "watch": true, + "configFilePath": "../../animals/tsconfig.json" + }, + "referencedMap": { + "../../animals/dog.ts": [ + "../../animals/index.ts", + "../core/utilities.d.ts" + ], + "../../animals/index.ts": [ + "../../animals/animal.ts", + "../../animals/dog.ts" + ] + }, + "exportedModulesMap": { + "../../animals/dog.ts": [ + "../../animals/index.ts" + ], + "../../animals/index.ts": [ + "../../animals/animal.ts", + "../../animals/dog.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "../../animals/animal.ts", + "../../animals/dog.ts", + "../../animals/index.ts", + "../../core/utilities.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/demo/lib/zoo/zoo.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var index_1 = require("../animals/index"); +function createZoo() { + return [ + index_1.createDog() + ]; +} +exports.createZoo = createZoo; + + +//// [/user/username/projects/demo/lib/zoo/zoo.d.ts] +import { Dog } from '../animals/index'; +export declare function createZoo(): Array; + + +//// [/user/username/projects/demo/lib/zoo/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../../a/lib/lib.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };" + }, + "../../animals/animal.ts": { + "version": "-10510161654-export declare type Size = \"small\" | \"medium\" | \"large\";\nexport default interface Animal {\n size: Size;\n}\n", + "signature": "-10510161654-export declare type Size = \"small\" | \"medium\" | \"large\";\nexport default interface Animal {\n size: Size;\n}\n" + }, + "../../animals/dog.ts": { + "version": "6032048049-import Animal from '.';\nexport interface Dog extends Animal {\n woof(): void;\n name: string;\n}\nexport declare function createDog(): Dog;\n", + "signature": "6032048049-import Animal from '.';\nexport interface Dog extends Animal {\n woof(): void;\n name: string;\n}\nexport declare function createDog(): Dog;\n" + }, + "../../animals/index.ts": { + "version": "1096904574-import Animal from './animal';\nexport default Animal;\nimport { createDog, Dog } from './dog';\nexport { createDog, Dog };\n", + "signature": "1096904574-import Animal from './animal';\nexport default Animal;\nimport { createDog, Dog } from './dog';\nexport { createDog, Dog };\n" + }, + "../../zoo/zoo.ts": { + "version": "8797123924-import { Dog, createDog } from '../animals/index';\r\n\r\nexport function createZoo(): Array {\r\n return [\r\n createDog()\r\n ];\r\n}\r\n\r\n", + "signature": "10305066551-import { Dog } from '../animals/index';\nexport declare function createZoo(): Array;\n" + } + }, + "options": { + "declaration": true, + "target": 1, + "module": 1, + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "composite": true, + "outDir": "./", + "rootDir": "../../zoo", + "watch": true, + "configFilePath": "../../zoo/tsconfig.json" + }, + "referencedMap": { + "../../animals/dog.ts": [ + "../animals/index.d.ts" + ], + "../../animals/index.ts": [ + "../animals/animal.d.ts", + "../animals/dog.d.ts" + ], + "../../zoo/zoo.ts": [ + "../animals/index.d.ts" + ] + }, + "exportedModulesMap": { + "../../animals/dog.ts": [ + "../animals/index.d.ts" + ], + "../../animals/index.ts": [ + "../animals/animal.d.ts", + "../animals/dog.d.ts" + ], + "../../zoo/zoo.ts": [ + "../animals/index.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../../a/lib/lib.d.ts", + "../../animals/animal.ts", + "../../animals/dog.ts", + "../../animals/index.ts", + "../../zoo/zoo.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:52 AM - File change detected. Starting incremental compilation... + + +12:00:53 AM - Project 'core/tsconfig.json' is out of date because output file 'lib/core/utilities.js' does not exist + + +12:00:54 AM - Building project '/user/username/projects/demo/core/tsconfig.json'... + + +12:01:06 AM - Project 'animals/tsconfig.json' is out of date because output file 'lib/animals/animal.js' does not exist + + +12:01:07 AM - Building project '/user/username/projects/demo/animals/tsconfig.json'... + + +12:01:25 AM - Project 'zoo/tsconfig.json' is out of date because output file 'lib/zoo/zoo.js' does not exist + + +12:01:26 AM - Building project '/user/username/projects/demo/zoo/tsconfig.json'... + + + +12:01:36 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/demo/core/utilities.ts"] +Program options: {"declaration":true,"target":1,"module":1,"strict":true,"noUnusedLocals":true,"noUnusedParameters":true,"noImplicitReturns":true,"noFallthroughCasesInSwitch":true,"composite":true,"outDir":"/user/username/projects/demo/lib/core","rootDir":"/user/username/projects/demo/core","watch":true,"configFilePath":"/user/username/projects/demo/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/demo/core/utilities.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/demo/core/utilities.ts + +Program root files: ["/user/username/projects/demo/animals/animal.ts","/user/username/projects/demo/animals/dog.ts","/user/username/projects/demo/animals/index.ts"] +Program options: {"declaration":true,"target":1,"module":1,"strict":true,"noUnusedLocals":true,"noUnusedParameters":true,"noImplicitReturns":true,"noFallthroughCasesInSwitch":true,"composite":true,"outDir":"/user/username/projects/demo/lib/animals","rootDir":"/user/username/projects/demo/animals","watch":true,"configFilePath":"/user/username/projects/demo/animals/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/demo/animals/animal.ts +/user/username/projects/demo/animals/index.ts +/user/username/projects/demo/lib/core/utilities.d.ts +/user/username/projects/demo/animals/dog.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/demo/animals/animal.ts +/user/username/projects/demo/animals/index.ts +/user/username/projects/demo/lib/core/utilities.d.ts +/user/username/projects/demo/animals/dog.ts + +Program root files: ["/user/username/projects/demo/zoo/zoo.ts"] +Program options: {"declaration":true,"target":1,"module":1,"strict":true,"noUnusedLocals":true,"noUnusedParameters":true,"noImplicitReturns":true,"noFallthroughCasesInSwitch":true,"composite":true,"outDir":"/user/username/projects/demo/lib/zoo","rootDir":"/user/username/projects/demo/zoo","watch":true,"configFilePath":"/user/username/projects/demo/zoo/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/demo/lib/animals/animal.d.ts +/user/username/projects/demo/lib/animals/dog.d.ts +/user/username/projects/demo/lib/animals/index.d.ts +/user/username/projects/demo/zoo/zoo.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/demo/lib/animals/animal.d.ts +/user/username/projects/demo/lib/animals/dog.d.ts +/user/username/projects/demo/lib/animals/index.d.ts +/user/username/projects/demo/zoo/zoo.ts + +WatchedFiles:: +/user/username/projects/demo/animals/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/demo/animals/animal.ts: + {"pollingInterval":250} +/user/username/projects/demo/animals/dog.ts: + {"pollingInterval":250} +/user/username/projects/demo/animals/index.ts: + {"pollingInterval":250} +/user/username/projects/demo/zoo/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/demo/zoo/zoo.ts: + {"pollingInterval":250} +/user/username/projects/demo/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/demo/core/utilities.ts: + {"pollingInterval":250} +/user/username/projects/demo/tsconfig.json: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/demo/animals: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/demo/zoo: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/demo/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuild/watchMode/noEmitOnError/does-not-emit-any-files-on-error.js b/tests/baselines/reference/tsbuild/watchMode/noEmitOnError/does-not-emit-any-files-on-error.js new file mode 100644 index 0000000000000..f6ab27a5f59ee --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/noEmitOnError/does-not-emit-any-files-on-error.js @@ -0,0 +1,164 @@ +/a/lib/tsc.js -b -w -verbose +//// [/user/username/projects/noEmitOnError/tsconfig.json] +{ + "compilerOptions": { + "outDir": "./dev-build", + "noEmitOnError": true + } +} + + +//// [/user/username/projects/noEmitOnError/shared/types/db.ts] +export interface A { + name: string; +} + +//// [/user/username/projects/noEmitOnError/src/main.ts] +import { A } from "../shared/types/db"; +const a = { + lastName: 'sdsd' +; + +//// [/user/username/projects/noEmitOnError/src/other.ts] +console.log("hi"); +export { } + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + + +Output:: +>> Screen clear +12:00:31 AM - Starting compilation in watch mode... + + +12:00:32 AM - Projects in this build: + * tsconfig.json + + +12:00:33 AM - Project 'tsconfig.json' is out of date because output file 'dev-build/shared/types/db.js' does not exist + + +12:00:34 AM - Building project '/user/username/projects/noEmitOnError/tsconfig.json'... + + +src/main.ts(4,1): error TS1005: ',' expected. + + +12:00:35 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/noemitonerror/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/noemitonerror/shared/types/db.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/main.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/other.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/noemitonerror: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Fix error + +//// [/user/username/projects/noEmitOnError/src/main.ts] +import { A } from "../shared/types/db"; +const a = { + lastName: 'sdsd' +}; + +//// [/user/username/projects/noEmitOnError/dev-build/shared/types/db.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/noEmitOnError/dev-build/src/main.js] +"use strict"; +exports.__esModule = true; +var a = { + lastName: 'sdsd' +}; + + +//// [/user/username/projects/noEmitOnError/dev-build/src/other.js] +"use strict"; +exports.__esModule = true; +console.log("hi"); + + + +Output:: +>> Screen clear +12:00:39 AM - File change detected. Starting incremental compilation... + + +12:00:40 AM - Project 'tsconfig.json' is out of date because output file 'dev-build/shared/types/db.js' does not exist + + +12:00:41 AM - Building project '/user/username/projects/noEmitOnError/tsconfig.json'... + + + +12:00:58 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +WatchedFiles:: +/user/username/projects/noemitonerror/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/noemitonerror/shared/types/db.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/main.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/other.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/noemitonerror: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/creates-solution-in-watch-mode.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/creates-solution-in-watch-mode.js new file mode 100644 index 0000000000000..3c979b38e643e --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/creates-solution-in-watch-mode.js @@ -0,0 +1,398 @@ +/a/lib/tsc.js -b -w sample1/tests +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/sample1/core/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/user/username/projects/sample1/core/anotherModule.ts] +export const World = "hello"; + + +//// [/user/username/projects/sample1/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/user/username/projects/sample1/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/tests/index.ts] +import * as c from '../core/index'; +import * as logic from '../logic/index'; + +c.leftPad("", 10); +logic.getSecondsInDay(); + +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/ui/tsconfig.json] +{ + "compilerOptions": { + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../logic/index" } + ] +} + + +//// [/user/username/projects/sample1/ui/index.ts] +import * as logic from '../logic'; + +export function run() { + console.log(logic.getSecondsInDay()); +} + + +//// [/user/username/projects/sample1/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = "hello"; + + +//// [/user/username/projects/sample1/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/user/username/projects/sample1/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/user/username/projects/sample1/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/user/username/projects/sample1/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} + +//// [/user/username/projects/sample1/logic/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +//# sourceMappingURL=index.js.map + +//// [/user/username/projects/sample1/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/tests/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/user/username/projects/sample1/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:45 AM - Starting compilation in watch mode... + + + +12:01:14 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/incremental-updates-in-verbose-mode.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/incremental-updates-in-verbose-mode.js new file mode 100644 index 0000000000000..dcbcd27bca575 --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/incremental-updates-in-verbose-mode.js @@ -0,0 +1,787 @@ +/a/lib/tsc.js -b -w sample1/tests -verbose +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/sample1/core/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/user/username/projects/sample1/core/anotherModule.ts] +export const World = "hello"; + + +//// [/user/username/projects/sample1/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/user/username/projects/sample1/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/tests/index.ts] +import * as c from '../core/index'; +import * as logic from '../logic/index'; + +c.leftPad("", 10); +logic.getSecondsInDay(); + +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/ui/tsconfig.json] +{ + "compilerOptions": { + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../logic/index" } + ] +} + + +//// [/user/username/projects/sample1/ui/index.ts] +import * as logic from '../logic'; + +export function run() { + console.log(logic.getSecondsInDay()); +} + + +//// [/user/username/projects/sample1/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = "hello"; + + +//// [/user/username/projects/sample1/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/user/username/projects/sample1/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/user/username/projects/sample1/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/user/username/projects/sample1/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} + +//// [/user/username/projects/sample1/logic/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +//# sourceMappingURL=index.js.map + +//// [/user/username/projects/sample1/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/tests/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/user/username/projects/sample1/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:45 AM - Starting compilation in watch mode... + + +12:00:46 AM - Projects in this build: + * sample1/core/tsconfig.json + * sample1/logic/tsconfig.json + * sample1/tests/tsconfig.json + + +12:00:47 AM - Project 'sample1/core/tsconfig.json' is out of date because output file 'sample1/core/anotherModule.js' does not exist + + +12:00:48 AM - Building project '/user/username/projects/sample1/core/tsconfig.json'... + + +12:01:03 AM - Project 'sample1/logic/tsconfig.json' is out of date because output file 'sample1/logic/index.js' does not exist + + +12:01:04 AM - Building project '/user/username/projects/sample1/logic/tsconfig.json'... + + +12:01:13 AM - Project 'sample1/tests/tsconfig.json' is out of date because output file 'sample1/tests/index.js' does not exist + + +12:01:14 AM - Building project '/user/username/projects/sample1/tests/tsconfig.json'... + + + +12:01:21 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Make non dts change + +//// [/user/username/projects/sample1/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + +function someFn() { } + +//// [/user/username/projects/sample1/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC;AAErB,SAAS,MAAM,KAAK,CAAC"} + +//// [/user/username/projects/sample1/logic/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +function someFn() { } +//# sourceMappingURL=index.js.map + +//// [/user/username/projects/sample1/logic/index.d.ts] file written with same contents +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "937092231-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n\nfunction someFn() { }", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/tests/index.js] file changed its modified time +//// [/user/username/projects/sample1/tests/index.d.ts] file changed its modified time +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] file changed its modified time + +Output:: +>> Screen clear +12:01:25 AM - File change detected. Starting incremental compilation... + + +12:01:26 AM - Project 'sample1/logic/tsconfig.json' is out of date because oldest output 'sample1/logic/index.js' is older than newest input 'sample1/core' + + +12:01:27 AM - Building project '/user/username/projects/sample1/logic/tsconfig.json'... + + +12:01:40 AM - Project 'sample1/tests/tsconfig.json' is up to date with .d.ts files from its dependencies + + +12:01:42 AM - Updating output timestamps of project '/user/username/projects/sample1/tests/tsconfig.json'... + + + +12:01:43 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/logic/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Make dts change + +//// [/user/username/projects/sample1/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + +export function someFn() { } + +//// [/user/username/projects/sample1/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC;AAErB,SAAgB,MAAM,KAAK,CAAC;AAA5B,wBAA4B"} + +//// [/user/username/projects/sample1/logic/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +function someFn() { } +exports.someFn = someFn; +//# sourceMappingURL=index.js.map + +//// [/user/username/projects/sample1/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; +export declare function someFn(): void; + + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-3093967383-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n\nexport function someFn() { }", + "signature": "-8742548750-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare function someFn(): void;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/tests/index.js] file written with same contents +//// [/user/username/projects/sample1/tests/index.d.ts] file written with same contents +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-8742548750-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare function someFn(): void;\n", + "signature": "-8742548750-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\nexport declare function someFn(): void;\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:01:47 AM - File change detected. Starting incremental compilation... + + +12:01:48 AM - Project 'sample1/logic/tsconfig.json' is out of date because oldest output 'sample1/logic/index.js' is older than newest input 'sample1/core' + + +12:01:49 AM - Building project '/user/username/projects/sample1/logic/tsconfig.json'... + + +12:02:02 AM - Project 'sample1/tests/tsconfig.json' is out of date because oldest output 'sample1/tests/index.js' is older than newest input 'sample1/logic/tsconfig.json' + + +12:02:03 AM - Building project '/user/username/projects/sample1/tests/tsconfig.json'... + + + +12:02:13 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/logic/index.ts + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/declarationEmitErrors/introduceError/when-file-with-no-error-changes.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/declarationEmitErrors/introduceError/when-file-with-no-error-changes.js new file mode 100644 index 0000000000000..5e0372b652d8f --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/declarationEmitErrors/introduceError/when-file-with-no-error-changes.js @@ -0,0 +1,220 @@ +/a/lib/tsc.js -b -w app +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/solution/app/fileWithError.ts] +export var myClassWithError = class { + tags() { } + + }; + +//// [/user/username/projects/solution/app/fileWithoutError.ts] +export class myClass { } + +//// [/user/username/projects/solution/app/tsconfig.json] +{"compilerOptions":{"composite":true}} + +//// [/user/username/projects/solution/app/fileWithError.js] +"use strict"; +exports.__esModule = true; +exports.myClassWithError = /** @class */ (function () { + function myClassWithError() { + } + myClassWithError.prototype.tags = function () { }; + return myClassWithError; +}()); + + +//// [/user/username/projects/solution/app/fileWithError.d.ts] +export declare var myClassWithError: { + new (): { + tags(): void; + }; +}; + + +//// [/user/username/projects/solution/app/fileWithoutError.js] +"use strict"; +exports.__esModule = true; +var myClass = /** @class */ (function () { + function myClass() { + } + return myClass; +}()); +exports.myClass = myClass; + + +//// [/user/username/projects/solution/app/fileWithoutError.d.ts] +export declare class myClass { +} + + +//// [/user/username/projects/solution/app/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./filewitherror.ts": { + "version": "-8106435186-export var myClassWithError = class {\n tags() { }\n \n };", + "signature": "6892461904-export declare var myClassWithError: {\n new (): {\n tags(): void;\n };\n};\n" + }, + "./filewithouterror.ts": { + "version": "-11785903855-export class myClass { }", + "signature": "-7432826827-export declare class myClass {\n}\n" + } + }, + "options": { + "composite": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./filewitherror.ts", + "./filewithouterror.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:36 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/solution/app/fileWithError.ts","/user/username/projects/solution/app/fileWithoutError.ts"] +Program options: {"composite":true,"watch":true,"configFilePath":"/user/username/projects/solution/app/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/solution/app/fileWithError.ts +/user/username/projects/solution/app/fileWithoutError.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/solution/app/fileWithError.ts +/user/username/projects/solution/app/fileWithoutError.ts + +WatchedFiles:: +/user/username/projects/solution/app/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/solution/app/filewitherror.ts: + {"pollingInterval":250} +/user/username/projects/solution/app/filewithouterror.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/solution/app: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Introduce error + +//// [/user/username/projects/solution/app/fileWithError.ts] +export var myClassWithError = class { + tags() { } + private p = 12 + }; + + +Output:: +>> Screen clear +12:00:40 AM - File change detected. Starting incremental compilation... + + +app/fileWithError.ts(1,12): error TS4094: Property 'p' of exported class expression may not be private or protected. + + +12:00:41 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/solution/app/fileWithError.ts","/user/username/projects/solution/app/fileWithoutError.ts"] +Program options: {"composite":true,"watch":true,"configFilePath":"/user/username/projects/solution/app/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/solution/app/fileWithError.ts +/user/username/projects/solution/app/fileWithoutError.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/solution/app/fileWithError.ts + +WatchedFiles:: +/user/username/projects/solution/app/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/solution/app/filewitherror.ts: + {"pollingInterval":250} +/user/username/projects/solution/app/filewithouterror.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/solution/app: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change fileWithoutError + +//// [/user/username/projects/solution/app/fileWithoutError.ts] +export class myClass2 { } + + +Output:: +>> Screen clear +12:00:45 AM - File change detected. Starting incremental compilation... + + +app/fileWithError.ts(1,12): error TS4094: Property 'p' of exported class expression may not be private or protected. + + +12:00:46 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/solution/app/fileWithError.ts","/user/username/projects/solution/app/fileWithoutError.ts"] +Program options: {"composite":true,"watch":true,"configFilePath":"/user/username/projects/solution/app/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/solution/app/fileWithError.ts +/user/username/projects/solution/app/fileWithoutError.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/solution/app/fileWithoutError.ts + +WatchedFiles:: +/user/username/projects/solution/app/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/solution/app/filewitherror.ts: + {"pollingInterval":250} +/user/username/projects/solution/app/filewithouterror.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/solution/app: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/declarationEmitErrors/introduceError/when-fixing-errors-only-changed-file-is-emitted.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/declarationEmitErrors/introduceError/when-fixing-errors-only-changed-file-is-emitted.js new file mode 100644 index 0000000000000..ca1701e11a86b --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/declarationEmitErrors/introduceError/when-fixing-errors-only-changed-file-is-emitted.js @@ -0,0 +1,226 @@ +/a/lib/tsc.js -b -w app +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/solution/app/fileWithError.ts] +export var myClassWithError = class { + tags() { } + + }; + +//// [/user/username/projects/solution/app/fileWithoutError.ts] +export class myClass { } + +//// [/user/username/projects/solution/app/tsconfig.json] +{"compilerOptions":{"composite":true}} + +//// [/user/username/projects/solution/app/fileWithError.js] +"use strict"; +exports.__esModule = true; +exports.myClassWithError = /** @class */ (function () { + function myClassWithError() { + } + myClassWithError.prototype.tags = function () { }; + return myClassWithError; +}()); + + +//// [/user/username/projects/solution/app/fileWithError.d.ts] +export declare var myClassWithError: { + new (): { + tags(): void; + }; +}; + + +//// [/user/username/projects/solution/app/fileWithoutError.js] +"use strict"; +exports.__esModule = true; +var myClass = /** @class */ (function () { + function myClass() { + } + return myClass; +}()); +exports.myClass = myClass; + + +//// [/user/username/projects/solution/app/fileWithoutError.d.ts] +export declare class myClass { +} + + +//// [/user/username/projects/solution/app/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./filewitherror.ts": { + "version": "-8106435186-export var myClassWithError = class {\n tags() { }\n \n };", + "signature": "6892461904-export declare var myClassWithError: {\n new (): {\n tags(): void;\n };\n};\n" + }, + "./filewithouterror.ts": { + "version": "-11785903855-export class myClass { }", + "signature": "-7432826827-export declare class myClass {\n}\n" + } + }, + "options": { + "composite": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./filewitherror.ts", + "./filewithouterror.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:36 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/solution/app/fileWithError.ts","/user/username/projects/solution/app/fileWithoutError.ts"] +Program options: {"composite":true,"watch":true,"configFilePath":"/user/username/projects/solution/app/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/solution/app/fileWithError.ts +/user/username/projects/solution/app/fileWithoutError.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/solution/app/fileWithError.ts +/user/username/projects/solution/app/fileWithoutError.ts + +WatchedFiles:: +/user/username/projects/solution/app/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/solution/app/filewitherror.ts: + {"pollingInterval":250} +/user/username/projects/solution/app/filewithouterror.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/solution/app: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Introduce error + +//// [/user/username/projects/solution/app/fileWithError.ts] +export var myClassWithError = class { + tags() { } + private p = 12 + }; + + +Output:: +>> Screen clear +12:00:40 AM - File change detected. Starting incremental compilation... + + +app/fileWithError.ts(1,12): error TS4094: Property 'p' of exported class expression may not be private or protected. + + +12:00:41 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/solution/app/fileWithError.ts","/user/username/projects/solution/app/fileWithoutError.ts"] +Program options: {"composite":true,"watch":true,"configFilePath":"/user/username/projects/solution/app/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/solution/app/fileWithError.ts +/user/username/projects/solution/app/fileWithoutError.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/solution/app/fileWithError.ts + +WatchedFiles:: +/user/username/projects/solution/app/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/solution/app/filewitherror.ts: + {"pollingInterval":250} +/user/username/projects/solution/app/filewithouterror.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/solution/app: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Fix error in fileWithError + +//// [/user/username/projects/solution/app/fileWithError.ts] +export var myClassWithError = class { + tags() { } + + }; + +//// [/user/username/projects/solution/app/fileWithError.js] file written with same contents +//// [/user/username/projects/solution/app/fileWithError.d.ts] file written with same contents +//// [/user/username/projects/solution/app/fileWithoutError.js] file changed its modified time +//// [/user/username/projects/solution/app/fileWithoutError.d.ts] file changed its modified time +//// [/user/username/projects/solution/app/tsconfig.tsbuildinfo] file written with same contents + +Output:: +>> Screen clear +12:00:45 AM - File change detected. Starting incremental compilation... + + + +12:00:56 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/solution/app/fileWithError.ts","/user/username/projects/solution/app/fileWithoutError.ts"] +Program options: {"composite":true,"watch":true,"configFilePath":"/user/username/projects/solution/app/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/solution/app/fileWithError.ts +/user/username/projects/solution/app/fileWithoutError.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/solution/app/fileWithError.ts + +WatchedFiles:: +/user/username/projects/solution/app/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/solution/app/filewitherror.ts: + {"pollingInterval":250} +/user/username/projects/solution/app/filewithouterror.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/solution/app: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/declarationEmitErrors/when-file-with-no-error-changes.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/declarationEmitErrors/when-file-with-no-error-changes.js new file mode 100644 index 0000000000000..8b920fe4def28 --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/declarationEmitErrors/when-file-with-no-error-changes.js @@ -0,0 +1,108 @@ +/a/lib/tsc.js -b -w app +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/solution/app/fileWithError.ts] +export var myClassWithError = class { + tags() { } + private p = 12 + }; + +//// [/user/username/projects/solution/app/fileWithoutError.ts] +export class myClass { } + +//// [/user/username/projects/solution/app/tsconfig.json] +{"compilerOptions":{"composite":true}} + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + +app/fileWithError.ts(1,12): error TS4094: Property 'p' of exported class expression may not be private or protected. + + +12:00:26 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/solution/app/fileWithError.ts","/user/username/projects/solution/app/fileWithoutError.ts"] +Program options: {"composite":true,"watch":true,"configFilePath":"/user/username/projects/solution/app/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/solution/app/fileWithError.ts +/user/username/projects/solution/app/fileWithoutError.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/solution/app/fileWithError.ts +/user/username/projects/solution/app/fileWithoutError.ts + +WatchedFiles:: +/user/username/projects/solution/app/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/solution/app/filewitherror.ts: + {"pollingInterval":250} +/user/username/projects/solution/app/filewithouterror.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/solution/app: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change fileWithoutError + +//// [/user/username/projects/solution/app/fileWithoutError.ts] +export class myClass2 { } + + +Output:: +>> Screen clear +12:00:30 AM - File change detected. Starting incremental compilation... + + +app/fileWithError.ts(1,12): error TS4094: Property 'p' of exported class expression may not be private or protected. + + +12:00:31 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/solution/app/fileWithError.ts","/user/username/projects/solution/app/fileWithoutError.ts"] +Program options: {"composite":true,"watch":true,"configFilePath":"/user/username/projects/solution/app/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/solution/app/fileWithError.ts +/user/username/projects/solution/app/fileWithoutError.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/solution/app/fileWithoutError.ts + +WatchedFiles:: +/user/username/projects/solution/app/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/solution/app/filewitherror.ts: + {"pollingInterval":250} +/user/username/projects/solution/app/filewithouterror.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/solution/app: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/declarationEmitErrors/when-fixing-error-files-all-files-are-emitted.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/declarationEmitErrors/when-fixing-error-files-all-files-are-emitted.js new file mode 100644 index 0000000000000..811a6a0a7f1e6 --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/declarationEmitErrors/when-fixing-error-files-all-files-are-emitted.js @@ -0,0 +1,177 @@ +/a/lib/tsc.js -b -w app +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/solution/app/fileWithError.ts] +export var myClassWithError = class { + tags() { } + private p = 12 + }; + +//// [/user/username/projects/solution/app/fileWithoutError.ts] +export class myClass { } + +//// [/user/username/projects/solution/app/tsconfig.json] +{"compilerOptions":{"composite":true}} + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + +app/fileWithError.ts(1,12): error TS4094: Property 'p' of exported class expression may not be private or protected. + + +12:00:26 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/solution/app/fileWithError.ts","/user/username/projects/solution/app/fileWithoutError.ts"] +Program options: {"composite":true,"watch":true,"configFilePath":"/user/username/projects/solution/app/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/solution/app/fileWithError.ts +/user/username/projects/solution/app/fileWithoutError.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/solution/app/fileWithError.ts +/user/username/projects/solution/app/fileWithoutError.ts + +WatchedFiles:: +/user/username/projects/solution/app/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/solution/app/filewitherror.ts: + {"pollingInterval":250} +/user/username/projects/solution/app/filewithouterror.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/solution/app: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Fix error in fileWithError + +//// [/user/username/projects/solution/app/fileWithError.ts] +export var myClassWithError = class { + tags() { } + + }; + +//// [/user/username/projects/solution/app/fileWithError.js] +"use strict"; +exports.__esModule = true; +exports.myClassWithError = /** @class */ (function () { + function myClassWithError() { + } + myClassWithError.prototype.tags = function () { }; + return myClassWithError; +}()); + + +//// [/user/username/projects/solution/app/fileWithError.d.ts] +export declare var myClassWithError: { + new (): { + tags(): void; + }; +}; + + +//// [/user/username/projects/solution/app/fileWithoutError.js] +"use strict"; +exports.__esModule = true; +var myClass = /** @class */ (function () { + function myClass() { + } + return myClass; +}()); +exports.myClass = myClass; + + +//// [/user/username/projects/solution/app/fileWithoutError.d.ts] +export declare class myClass { +} + + +//// [/user/username/projects/solution/app/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./filewitherror.ts": { + "version": "-8106435186-export var myClassWithError = class {\n tags() { }\n \n };", + "signature": "6892461904-export declare var myClassWithError: {\n new (): {\n tags(): void;\n };\n};\n" + }, + "./filewithouterror.ts": { + "version": "-11785903855-export class myClass { }", + "signature": "-7432826827-export declare class myClass {\n}\n" + } + }, + "options": { + "composite": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./filewitherror.ts", + "./filewithouterror.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:30 AM - File change detected. Starting incremental compilation... + + + +12:00:41 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/solution/app/fileWithError.ts","/user/username/projects/solution/app/fileWithoutError.ts"] +Program options: {"composite":true,"watch":true,"configFilePath":"/user/username/projects/solution/app/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/solution/app/fileWithError.ts +/user/username/projects/solution/app/fileWithoutError.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/solution/app/fileWithError.ts + +WatchedFiles:: +/user/username/projects/solution/app/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/solution/app/filewitherror.ts: + {"pollingInterval":250} +/user/username/projects/solution/app/filewithouterror.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/solution/app: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-not-used.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-not-used.js new file mode 100644 index 0000000000000..3141ffbef97b6 --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-not-used.js @@ -0,0 +1,518 @@ +/a/lib/tsc.js -b -w sample1/tests +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/sample1/core/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/user/username/projects/sample1/core/anotherModule.ts] +export const World = "hello"; + + +//// [/user/username/projects/sample1/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/user/username/projects/sample1/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/tests/index.ts] +import * as c from '../core/index'; +import * as logic from '../logic/index'; + +c.leftPad("", 10); +logic.getSecondsInDay(); + +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/ui/tsconfig.json] +{ + "compilerOptions": { + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../logic/index" } + ] +} + + +//// [/user/username/projects/sample1/ui/index.ts] +import * as logic from '../logic'; + +export function run() { + console.log(logic.getSecondsInDay()); +} + + +//// [/user/username/projects/sample1/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = "hello"; + + +//// [/user/username/projects/sample1/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/user/username/projects/sample1/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/user/username/projects/sample1/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/user/username/projects/sample1/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} + +//// [/user/username/projects/sample1/logic/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +//# sourceMappingURL=index.js.map + +//// [/user/username/projects/sample1/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/tests/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/user/username/projects/sample1/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:45 AM - Starting compilation in watch mode... + + + +12:01:14 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: change logic + +//// [/user/username/projects/sample1/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + +let y: string = 10; + + +Output:: +>> Screen clear +12:01:18 AM - File change detected. Starting incremental compilation... + + +sample1/logic/index.ts(8,5): error TS2322: Type '10' is not assignable to type 'string'. + + +12:01:19 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/logic/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: change core + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + +let x: string = 10; + + +Output:: +>> Screen clear +12:01:23 AM - File change detected. Starting incremental compilation... + + +sample1/core/index.ts(5,5): error TS2322: Type '10' is not assignable to type 'string'. + +sample1/logic/index.ts(8,5): error TS2322: Type '10' is not assignable to type 'string'. + + +12:01:24 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-passed-on-command-line.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-passed-on-command-line.js new file mode 100644 index 0000000000000..cb0d103cd8bf5 --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/reportErrors/when-preserveWatchOutput-is-passed-on-command-line.js @@ -0,0 +1,521 @@ +/a/lib/tsc.js -b -w sample1/tests --preserveWatchOutput +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/sample1/core/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/user/username/projects/sample1/core/anotherModule.ts] +export const World = "hello"; + + +//// [/user/username/projects/sample1/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/user/username/projects/sample1/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/tests/index.ts] +import * as c from '../core/index'; +import * as logic from '../logic/index'; + +c.leftPad("", 10); +logic.getSecondsInDay(); + +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/ui/tsconfig.json] +{ + "compilerOptions": { + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../logic/index" } + ] +} + + +//// [/user/username/projects/sample1/ui/index.ts] +import * as logic from '../logic'; + +export function run() { + console.log(logic.getSecondsInDay()); +} + + +//// [/user/username/projects/sample1/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = "hello"; + + +//// [/user/username/projects/sample1/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/user/username/projects/sample1/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/user/username/projects/sample1/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/user/username/projects/sample1/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "watch": true, + "preserveWatchOutput": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} + +//// [/user/username/projects/sample1/logic/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +//# sourceMappingURL=index.js.map + +//// [/user/username/projects/sample1/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "preserveWatchOutput": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/tests/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/user/username/projects/sample1/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "preserveWatchOutput": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +12:00:45 AM - Starting compilation in watch mode... + + + +12:01:14 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"watch":true,"preserveWatchOutput":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"preserveWatchOutput":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"preserveWatchOutput":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: change logic + +//// [/user/username/projects/sample1/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + +let y: string = 10; + + +Output:: + +12:01:18 AM - File change detected. Starting incremental compilation... + + +sample1/logic/index.ts(8,5): error TS2322: Type '10' is not assignable to type 'string'. + + +12:01:19 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"preserveWatchOutput":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/logic/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: change core + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + +let x: string = 10; + + +Output:: + +12:01:23 AM - File change detected. Starting incremental compilation... + + +sample1/core/index.ts(5,5): error TS2322: Type '10' is not assignable to type 'string'. + +sample1/logic/index.ts(8,5): error TS2322: Type '10' is not assignable to type 'string'. + + +12:01:24 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"watch":true,"preserveWatchOutput":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/watches-config-files-that-are-not-present.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/watches-config-files-that-are-not-present.js new file mode 100644 index 0000000000000..def7e890e0608 --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/watches-config-files-that-are-not-present.js @@ -0,0 +1,446 @@ +/a/lib/tsc.js -b -w sample1/tests +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/sample1/core/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/user/username/projects/sample1/core/anotherModule.ts] +export const World = "hello"; + + +//// [/user/username/projects/sample1/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/tests/index.ts] +import * as c from '../core/index'; +import * as logic from '../logic/index'; + +c.leftPad("", 10); +logic.getSecondsInDay(); + +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = "hello"; + + +//// [/user/username/projects/sample1/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/user/username/projects/sample1/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/user/username/projects/sample1/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/user/username/projects/sample1/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:37 AM - Starting compilation in watch mode... + + +error TS6053: File '/user/username/projects/sample1/logic/tsconfig.json' not found. + + +12:00:52 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Write logic tsconfig and build logic + +//// [/user/username/projects/sample1/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/user/username/projects/sample1/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} + +//// [/user/username/projects/sample1/logic/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +//# sourceMappingURL=index.js.map + +//// [/user/username/projects/sample1/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:55 AM - File change detected. Starting incremental compilation... + + + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build tests + +//// [/user/username/projects/sample1/tests/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/user/username/projects/sample1/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +12:01:10 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/when-referenced-project-change-introduces-error-in-the-down-stream-project-and-then-fixes-it.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/when-referenced-project-change-introduces-error-in-the-down-stream-project-and-then-fixes-it.js new file mode 100644 index 0000000000000..88dcb6efe8d46 --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/when-referenced-project-change-introduces-error-in-the-down-stream-project-and-then-fixes-it.js @@ -0,0 +1,372 @@ +/a/lib/tsc.js -b -w App +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/sample1/Library/library.ts] + +interface SomeObject +{ + message: string; +} + +export function createSomeObject(): SomeObject +{ + return { + message: "new Object" + }; +} + +//// [/user/username/projects/sample1/Library/tsconfig.json] +{"compilerOptions":{"composite":true}} + +//// [/user/username/projects/sample1/App/app.ts] +import { createSomeObject } from "../Library/library"; +createSomeObject().message; + +//// [/user/username/projects/sample1/App/tsconfig.json] +{"references":[{"path":"../Library"}]} + +//// [/user/username/projects/sample1/Library/library.js] +"use strict"; +exports.__esModule = true; +function createSomeObject() { + return { + message: "new Object" + }; +} +exports.createSomeObject = createSomeObject; + + +//// [/user/username/projects/sample1/Library/library.d.ts] +interface SomeObject { + message: string; +} +export declare function createSomeObject(): SomeObject; +export {}; + + +//// [/user/username/projects/sample1/Library/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./library.ts": { + "version": "5256469508-\ninterface SomeObject\n{\n message: string;\n}\n\nexport function createSomeObject(): SomeObject\n{\n return {\n message: \"new Object\"\n };\n}", + "signature": "-18933614215-interface SomeObject {\n message: string;\n}\nexport declare function createSomeObject(): SomeObject;\nexport {};\n" + } + }, + "options": { + "composite": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./library.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/App/app.js] +"use strict"; +exports.__esModule = true; +var library_1 = require("../Library/library"); +library_1.createSomeObject().message; + + + +Output:: +>> Screen clear +12:00:29 AM - Starting compilation in watch mode... + + + +12:00:38 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/Library/library.ts"] +Program options: {"composite":true,"watch":true,"configFilePath":"/user/username/projects/sample1/Library/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/Library/library.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/Library/library.ts + +Program root files: ["/user/username/projects/sample1/App/app.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/sample1/App/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/Library/library.d.ts +/user/username/projects/sample1/App/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/Library/library.d.ts +/user/username/projects/sample1/App/app.ts + +WatchedFiles:: +/user/username/projects/sample1/library/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/library/library.ts: + {"pollingInterval":250} +/user/username/projects/sample1/app/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/app/app.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/library: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/app: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Introduce error + +//// [/user/username/projects/sample1/Library/library.ts] + +interface SomeObject +{ + message2: string; +} + +export function createSomeObject(): SomeObject +{ + return { + message2: "new Object" + }; +} + +//// [/user/username/projects/sample1/Library/library.js] +"use strict"; +exports.__esModule = true; +function createSomeObject() { + return { + message2: "new Object" + }; +} +exports.createSomeObject = createSomeObject; + + +//// [/user/username/projects/sample1/Library/library.d.ts] +interface SomeObject { + message2: string; +} +export declare function createSomeObject(): SomeObject; +export {}; + + +//// [/user/username/projects/sample1/Library/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./library.ts": { + "version": "-9741349880-\ninterface SomeObject\n{\n message2: string;\n}\n\nexport function createSomeObject(): SomeObject\n{\n return {\n message2: \"new Object\"\n };\n}", + "signature": "1956297931-interface SomeObject {\n message2: string;\n}\nexport declare function createSomeObject(): SomeObject;\nexport {};\n" + } + }, + "options": { + "composite": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./library.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:42 AM - File change detected. Starting incremental compilation... + + +App/app.ts(2,20): error TS2551: Property 'message' does not exist on type 'SomeObject'. Did you mean 'message2'? + + +12:00:52 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/Library/library.ts"] +Program options: {"composite":true,"watch":true,"configFilePath":"/user/username/projects/sample1/Library/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/Library/library.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/Library/library.ts + +Program root files: ["/user/username/projects/sample1/App/app.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/sample1/App/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/Library/library.d.ts +/user/username/projects/sample1/App/app.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/Library/library.d.ts +/user/username/projects/sample1/App/app.ts + +WatchedFiles:: +/user/username/projects/sample1/library/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/library/library.ts: + {"pollingInterval":250} +/user/username/projects/sample1/app/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/app/app.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/library: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/app: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Fix error + +//// [/user/username/projects/sample1/Library/library.ts] + +interface SomeObject +{ + message: string; +} + +export function createSomeObject(): SomeObject +{ + return { + message: "new Object" + }; +} + +//// [/user/username/projects/sample1/Library/library.js] +"use strict"; +exports.__esModule = true; +function createSomeObject() { + return { + message: "new Object" + }; +} +exports.createSomeObject = createSomeObject; + + +//// [/user/username/projects/sample1/Library/library.d.ts] +interface SomeObject { + message: string; +} +export declare function createSomeObject(): SomeObject; +export {}; + + +//// [/user/username/projects/sample1/Library/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./library.ts": { + "version": "5256469508-\ninterface SomeObject\n{\n message: string;\n}\n\nexport function createSomeObject(): SomeObject\n{\n return {\n message: \"new Object\"\n };\n}", + "signature": "-18933614215-interface SomeObject {\n message: string;\n}\nexport declare function createSomeObject(): SomeObject;\nexport {};\n" + } + }, + "options": { + "composite": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./library.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/App/app.js] file written with same contents + +Output:: +>> Screen clear +12:00:56 AM - File change detected. Starting incremental compilation... + + + +12:01:09 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/Library/library.ts"] +Program options: {"composite":true,"watch":true,"configFilePath":"/user/username/projects/sample1/Library/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/Library/library.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/Library/library.ts + +Program root files: ["/user/username/projects/sample1/App/app.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/sample1/App/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/Library/library.d.ts +/user/username/projects/sample1/App/app.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/Library/library.d.ts +/user/username/projects/sample1/App/app.ts + +WatchedFiles:: +/user/username/projects/sample1/library/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/library/library.ts: + {"pollingInterval":250} +/user/username/projects/sample1/app/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/app/app.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/library: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/app: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/when-referenced-using-prepend-builds-referencing-project-even-for-non-local-change.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/when-referenced-using-prepend-builds-referencing-project-even-for-non-local-change.js new file mode 100644 index 0000000000000..df9dd7ebde715 --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/when-referenced-using-prepend-builds-referencing-project-even-for-non-local-change.js @@ -0,0 +1,670 @@ +/a/lib/tsc.js -b -w sample1/logic +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/sample1/core/tsconfig.json] +{"compilerOptions":{"composite":true,"declaration":true,"outFile":"index.js"}} + +//// [/user/username/projects/sample1/core/index.ts] +function foo() { return 10; } + +//// [/user/username/projects/sample1/logic/tsconfig.json] +{"compilerOptions":{"composite":true,"declaration":true,"outFile":"index.js"},"references":[{"path":"../core","prepend":true}]} + +//// [/user/username/projects/sample1/logic/index.ts] +function bar() { return foo() + 1 }; + +//// [/user/username/projects/sample1/core/index.js] +function foo() { return 10; } + + +//// [/user/username/projects/sample1/core/index.d.ts] +declare function foo(): number; + + +//// [/user/username/projects/sample1/core/index.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "./", + "sourceFiles": [ + "./index.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 30, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 32, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/core/index.tsbuildinfo.baseline.txt] +====================================================================== +File:: /user/username/projects/sample1/core/index.js +---------------------------------------------------------------------- +text: (0-30) +function foo() { return 10; } + +====================================================================== +====================================================================== +File:: /user/username/projects/sample1/core/index.d.ts +---------------------------------------------------------------------- +text: (0-32) +declare function foo(): number; + +====================================================================== + +//// [/user/username/projects/sample1/logic/index.js] +function foo() { return 10; } +function bar() { return foo() + 1; } +; + + +//// [/user/username/projects/sample1/logic/index.d.ts] +declare function foo(): number; +declare function bar(): number; + + +//// [/user/username/projects/sample1/logic/index.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "./", + "sourceFiles": [ + "./index.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 30, + "kind": "prepend", + "data": "../core/index.js", + "texts": [ + { + "pos": 0, + "end": 30, + "kind": "text" + } + ] + }, + { + "pos": 30, + "end": 69, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 32, + "kind": "prepend", + "data": "../core/index.d.ts", + "texts": [ + { + "pos": 0, + "end": 32, + "kind": "text" + } + ] + }, + { + "pos": 32, + "end": 64, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/logic/index.tsbuildinfo.baseline.txt] +====================================================================== +File:: /user/username/projects/sample1/logic/index.js +---------------------------------------------------------------------- +prepend: (0-30):: ../core/index.js texts:: 1 +>>-------------------------------------------------------------------- +text: (0-30) +function foo() { return 10; } + +---------------------------------------------------------------------- +text: (30-69) +function bar() { return foo() + 1; } +; + +====================================================================== +====================================================================== +File:: /user/username/projects/sample1/logic/index.d.ts +---------------------------------------------------------------------- +prepend: (0-32):: ../core/index.d.ts texts:: 1 +>>-------------------------------------------------------------------- +text: (0-32) +declare function foo(): number; + +---------------------------------------------------------------------- +text: (32-64) +declare function bar(): number; + +====================================================================== + + +Output:: +>> Screen clear +12:00:29 AM - Starting compilation in watch mode... + + + +12:00:46 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"outFile":"/user/username/projects/sample1/core/index.js","watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.ts + +No cached semantic diagnostics in the builder:: + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"outFile":"/user/username/projects/sample1/logic/index.js","watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/logic/index.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Make non local change and build core + +//// [/user/username/projects/sample1/core/index.ts] +function foo() { return 10; } +function myFunc() { return 10; } + +//// [/user/username/projects/sample1/core/index.js] +function foo() { return 10; } +function myFunc() { return 10; } + + +//// [/user/username/projects/sample1/core/index.d.ts] +declare function foo(): number; +declare function myFunc(): number; + + +//// [/user/username/projects/sample1/core/index.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "./", + "sourceFiles": [ + "./index.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 63, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 67, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/core/index.tsbuildinfo.baseline.txt] +====================================================================== +File:: /user/username/projects/sample1/core/index.js +---------------------------------------------------------------------- +text: (0-63) +function foo() { return 10; } +function myFunc() { return 10; } + +====================================================================== +====================================================================== +File:: /user/username/projects/sample1/core/index.d.ts +---------------------------------------------------------------------- +text: (0-67) +declare function foo(): number; +declare function myFunc(): number; + +====================================================================== + + +Output:: +>> Screen clear +12:00:50 AM - File change detected. Starting incremental compilation... + + + +Program root files: ["/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"outFile":"/user/username/projects/sample1/core/index.js","watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build logic + +//// [/user/username/projects/sample1/logic/index.js] +function foo() { return 10; } +function myFunc() { return 10; } +function bar() { return foo() + 1; } +; + + +//// [/user/username/projects/sample1/logic/index.d.ts] +declare function foo(): number; +declare function myFunc(): number; +declare function bar(): number; + + +//// [/user/username/projects/sample1/logic/index.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "./", + "sourceFiles": [ + "./index.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 63, + "kind": "prepend", + "data": "../core/index.js", + "texts": [ + { + "pos": 0, + "end": 63, + "kind": "text" + } + ] + }, + { + "pos": 63, + "end": 102, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 67, + "kind": "prepend", + "data": "../core/index.d.ts", + "texts": [ + { + "pos": 0, + "end": 67, + "kind": "text" + } + ] + }, + { + "pos": 67, + "end": 99, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/logic/index.tsbuildinfo.baseline.txt] +====================================================================== +File:: /user/username/projects/sample1/logic/index.js +---------------------------------------------------------------------- +prepend: (0-63):: ../core/index.js texts:: 1 +>>-------------------------------------------------------------------- +text: (0-63) +function foo() { return 10; } +function myFunc() { return 10; } + +---------------------------------------------------------------------- +text: (63-102) +function bar() { return foo() + 1; } +; + +====================================================================== +====================================================================== +File:: /user/username/projects/sample1/logic/index.d.ts +---------------------------------------------------------------------- +prepend: (0-67):: ../core/index.d.ts texts:: 1 +>>-------------------------------------------------------------------- +text: (0-67) +declare function foo(): number; +declare function myFunc(): number; + +---------------------------------------------------------------------- +text: (67-99) +declare function bar(): number; + +====================================================================== + + +Output:: + +12:01:15 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"outFile":"/user/username/projects/sample1/logic/index.js","watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/logic/index.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Make local change and build core + +//// [/user/username/projects/sample1/core/index.ts] +function foo() { return 10; } +function myFunc() { return 100; } + +//// [/user/username/projects/sample1/core/index.js] +function foo() { return 10; } +function myFunc() { return 100; } + + +//// [/user/username/projects/sample1/core/index.d.ts] file written with same contents +//// [/user/username/projects/sample1/core/index.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "./", + "sourceFiles": [ + "./index.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 64, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 67, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/core/index.tsbuildinfo.baseline.txt] +====================================================================== +File:: /user/username/projects/sample1/core/index.js +---------------------------------------------------------------------- +text: (0-64) +function foo() { return 10; } +function myFunc() { return 100; } + +====================================================================== +====================================================================== +File:: /user/username/projects/sample1/core/index.d.ts +---------------------------------------------------------------------- +text: (0-67) +declare function foo(): number; +declare function myFunc(): number; + +====================================================================== + + +Output:: +>> Screen clear +12:01:19 AM - File change detected. Starting incremental compilation... + + + +Program root files: ["/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"outFile":"/user/username/projects/sample1/core/index.js","watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build logic + +//// [/user/username/projects/sample1/logic/index.js] +function foo() { return 10; } +function myFunc() { return 100; } +function bar() { return foo() + 1; } +; + + +//// [/user/username/projects/sample1/logic/index.d.ts] file changed its modified time +//// [/user/username/projects/sample1/logic/index.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "./", + "sourceFiles": [ + "./index.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 64, + "kind": "prepend", + "data": "../core/index.js", + "texts": [ + { + "pos": 0, + "end": 64, + "kind": "text" + } + ] + }, + { + "pos": 64, + "end": 103, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 67, + "kind": "prepend", + "data": "../core/index.d.ts", + "texts": [ + { + "pos": 0, + "end": 67, + "kind": "text" + } + ] + }, + { + "pos": 67, + "end": 99, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/logic/index.tsbuildinfo.baseline.txt] +====================================================================== +File:: /user/username/projects/sample1/logic/index.js +---------------------------------------------------------------------- +prepend: (0-64):: ../core/index.js texts:: 1 +>>-------------------------------------------------------------------- +text: (0-64) +function foo() { return 10; } +function myFunc() { return 100; } + +---------------------------------------------------------------------- +text: (64-103) +function bar() { return foo() + 1; } +; + +====================================================================== +====================================================================== +File:: /user/username/projects/sample1/logic/index.d.ts +---------------------------------------------------------------------- +prepend: (0-67):: ../core/index.d.ts texts:: 1 +>>-------------------------------------------------------------------- +text: (0-67) +declare function foo(): number; +declare function myFunc(): number; + +---------------------------------------------------------------------- +text: (67-99) +declare function bar(): number; + +====================================================================== + + +Output:: + +12:01:42 AM - Found 0 errors. Watching for file changes. + + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/with-circular-project-reference/builds-when-new-file-is-added,-and-its-subsequent-updates.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/with-circular-project-reference/builds-when-new-file-is-added,-and-its-subsequent-updates.js new file mode 100644 index 0000000000000..215cde7aaa21e --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/with-circular-project-reference/builds-when-new-file-is-added,-and-its-subsequent-updates.js @@ -0,0 +1,775 @@ +/a/lib/tsc.js -b -w sample1/tests +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/sample1/core/tsconfig.json] +{"compilerOptions":{"composite":true,"declaration":true},"references":[{"path":"../tests","circular":true}]} + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/user/username/projects/sample1/core/anotherModule.ts] +export const World = "hello"; + + +//// [/user/username/projects/sample1/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/user/username/projects/sample1/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/tests/index.ts] +import * as c from '../core/index'; +import * as logic from '../logic/index'; + +c.leftPad("", 10); +logic.getSecondsInDay(); + +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = "hello"; + + +//// [/user/username/projects/sample1/core/anotherModule.d.ts] +export declare const World = "hello"; + + +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/user/username/projects/sample1/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; + + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} + +//// [/user/username/projects/sample1/logic/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +//# sourceMappingURL=index.js.map + +//// [/user/username/projects/sample1/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n" + }, + "../core/anothermodule.ts": { + "version": "-9234818176-export declare const World = \"hello\";\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/tests/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/user/username/projects/sample1/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n" + }, + "../core/anothermodule.ts": { + "version": "-9234818176-export declare const World = \"hello\";\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "../logic/index.ts": { + "version": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:39 AM - Starting compilation in watch mode... + + + +12:01:04 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change to new File and build core + +//// [/user/username/projects/sample1/core/anotherModule.js] file changed its modified time +//// [/user/username/projects/sample1/core/anotherModule.d.ts] file changed its modified time +//// [/user/username/projects/sample1/core/index.js] file changed its modified time +//// [/user/username/projects/sample1/core/index.d.ts] file changed its modified time +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n" + }, + "./newfile.ts": { + "version": "-16320201030-export const newFileConst = 30;", + "signature": "-22941483372-export declare const newFileConst = 30;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts", + "./newfile.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/core/newfile.ts] +export const newFileConst = 30; + +//// [/user/username/projects/sample1/core/newfile.js] +"use strict"; +exports.__esModule = true; +exports.newFileConst = 30; + + +//// [/user/username/projects/sample1/core/newfile.d.ts] +export declare const newFileConst = 30; + + + +Output:: +>> Screen clear +12:01:07 AM - File change detected. Starting incremental compilation... + + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts","/user/username/projects/sample1/core/newfile.ts"] +Program options: {"composite":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts +/user/username/projects/sample1/core/newfile.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/newfile.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/newfile.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build logic or update time stamps + +//// [/user/username/projects/sample1/logic/index.js.map] file changed its modified time +//// [/user/username/projects/sample1/logic/index.js] file changed its modified time +//// [/user/username/projects/sample1/logic/index.d.ts] file changed its modified time +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] file changed its modified time + +Output:: + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/newfile.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build Tests + +//// [/user/username/projects/sample1/tests/index.js] file changed its modified time +//// [/user/username/projects/sample1/tests/index.d.ts] file changed its modified time +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] file changed its modified time + +Output:: + +12:01:18 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/newfile.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change to new File and build core + +//// [/user/username/projects/sample1/core/anotherModule.js] file changed its modified time +//// [/user/username/projects/sample1/core/anotherModule.d.ts] file changed its modified time +//// [/user/username/projects/sample1/core/index.js] file changed its modified time +//// [/user/username/projects/sample1/core/index.d.ts] file changed its modified time +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n" + }, + "./newfile.ts": { + "version": "-9703836816-export const newFileConst = 30;\nexport class someClass2 { }", + "signature": "-12384508924-export declare const newFileConst = 30;\nexport declare class someClass2 {\n}\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts", + "./newfile.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/core/newfile.ts] +export const newFileConst = 30; +export class someClass2 { } + +//// [/user/username/projects/sample1/core/newfile.js] +"use strict"; +exports.__esModule = true; +exports.newFileConst = 30; +var someClass2 = /** @class */ (function () { + function someClass2() { + } + return someClass2; +}()); +exports.someClass2 = someClass2; + + +//// [/user/username/projects/sample1/core/newfile.d.ts] +export declare const newFileConst = 30; +export declare class someClass2 { +} + + + +Output:: +>> Screen clear +12:01:22 AM - File change detected. Starting incremental compilation... + + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts","/user/username/projects/sample1/core/newfile.ts"] +Program options: {"composite":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts +/user/username/projects/sample1/core/newfile.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/newfile.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/newfile.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build logic or update time stamps + +//// [/user/username/projects/sample1/logic/index.js.map] file changed its modified time +//// [/user/username/projects/sample1/logic/index.js] file changed its modified time +//// [/user/username/projects/sample1/logic/index.d.ts] file changed its modified time +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] file changed its modified time + +Output:: + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/newfile.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build Tests + +//// [/user/username/projects/sample1/tests/index.js] file changed its modified time +//// [/user/username/projects/sample1/tests/index.d.ts] file changed its modified time +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] file changed its modified time + +Output:: + +12:01:35 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/newfile.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/with-circular-project-reference/change-builds-changes-and-reports-found-errors-message.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/with-circular-project-reference/change-builds-changes-and-reports-found-errors-message.js new file mode 100644 index 0000000000000..7ecc1cd59ee85 --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/with-circular-project-reference/change-builds-changes-and-reports-found-errors-message.js @@ -0,0 +1,1324 @@ +/a/lib/tsc.js -b -w sample1/tests +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/sample1/core/tsconfig.json] +{"compilerOptions":{"composite":true,"declaration":true},"references":[{"path":"../tests","circular":true}]} + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/user/username/projects/sample1/core/anotherModule.ts] +export const World = "hello"; + + +//// [/user/username/projects/sample1/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/user/username/projects/sample1/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/tests/index.ts] +import * as c from '../core/index'; +import * as logic from '../logic/index'; + +c.leftPad("", 10); +logic.getSecondsInDay(); + +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = "hello"; + + +//// [/user/username/projects/sample1/core/anotherModule.d.ts] +export declare const World = "hello"; + + +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/user/username/projects/sample1/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; + + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} + +//// [/user/username/projects/sample1/logic/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +//# sourceMappingURL=index.js.map + +//// [/user/username/projects/sample1/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n" + }, + "../core/anothermodule.ts": { + "version": "-9234818176-export declare const World = \"hello\";\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/tests/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/user/username/projects/sample1/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n" + }, + "../core/anothermodule.ts": { + "version": "-9234818176-export declare const World = \"hello\";\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "../logic/index.ts": { + "version": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:39 AM - Starting compilation in watch mode... + + + +12:01:04 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Make change to core + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + +export class someClass { } + +//// [/user/username/projects/sample1/core/anotherModule.js] file changed its modified time +//// [/user/username/projects/sample1/core/anotherModule.d.ts] file changed its modified time +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; +var someClass = /** @class */ (function () { + function someClass() { + } + return someClass; +}()); +exports.someClass = someClass; + + +//// [/user/username/projects/sample1/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +export declare class someClass { +} + + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "./index.ts": { + "version": "-13387000654-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n\nexport class someClass { }", + "signature": "-2489663677-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:01:08 AM - File change detected. Starting incremental compilation... + + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build logic or update time stamps + +//// [/user/username/projects/sample1/logic/index.js.map] file written with same contents +//// [/user/username/projects/sample1/logic/index.js] file written with same contents +//// [/user/username/projects/sample1/logic/index.d.ts] file written with same contents +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-2489663677-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\n", + "signature": "-2489663677-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\n" + }, + "../core/anothermodule.ts": { + "version": "-9234818176-export declare const World = \"hello\";\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/logic/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build Tests + +//// [/user/username/projects/sample1/tests/index.js] file written with same contents +//// [/user/username/projects/sample1/tests/index.d.ts] file written with same contents +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-2489663677-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\n", + "signature": "-2489663677-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\n" + }, + "../core/anothermodule.ts": { + "version": "-9234818176-export declare const World = \"hello\";\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "../logic/index.ts": { + "version": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +12:01:40 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/tests/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Revert core file + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/user/username/projects/sample1/core/anotherModule.js] file changed its modified time +//// [/user/username/projects/sample1/core/anotherModule.d.ts] file changed its modified time +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/user/username/projects/sample1/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; + + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:01:44 AM - File change detected. Starting incremental compilation... + + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build logic or update time stamps + +//// [/user/username/projects/sample1/logic/index.js.map] file written with same contents +//// [/user/username/projects/sample1/logic/index.js] file written with same contents +//// [/user/username/projects/sample1/logic/index.d.ts] file written with same contents +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n" + }, + "../core/anothermodule.ts": { + "version": "-9234818176-export declare const World = \"hello\";\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/logic/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build Tests + +//// [/user/username/projects/sample1/tests/index.js] file written with same contents +//// [/user/username/projects/sample1/tests/index.d.ts] file written with same contents +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n" + }, + "../core/anothermodule.ts": { + "version": "-9234818176-export declare const World = \"hello\";\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "../logic/index.ts": { + "version": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +12:02:16 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/tests/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Make two changes + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + +export class someClass { } +export class someClass2 { } + +//// [/user/username/projects/sample1/core/anotherModule.js] file changed its modified time +//// [/user/username/projects/sample1/core/anotherModule.d.ts] file changed its modified time +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; +var someClass = /** @class */ (function () { + function someClass() { + } + return someClass; +}()); +exports.someClass = someClass; +var someClass2 = /** @class */ (function () { + function someClass2() { + } + return someClass2; +}()); +exports.someClass2 = someClass2; + + +//// [/user/username/projects/sample1/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +export declare class someClass { +} +export declare class someClass2 { +} + + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "./index.ts": { + "version": "-8266060440-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n\nexport class someClass { }\nexport class someClass2 { }", + "signature": "-1938481101-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\nexport declare class someClass2 {\n}\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:02:23 AM - File change detected. Starting incremental compilation... + + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build logic or update time stamps + +//// [/user/username/projects/sample1/logic/index.js.map] file written with same contents +//// [/user/username/projects/sample1/logic/index.js] file written with same contents +//// [/user/username/projects/sample1/logic/index.d.ts] file written with same contents +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-1938481101-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\nexport declare class someClass2 {\n}\n", + "signature": "-1938481101-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\nexport declare class someClass2 {\n}\n" + }, + "../core/anothermodule.ts": { + "version": "-9234818176-export declare const World = \"hello\";\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/logic/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build Tests + +//// [/user/username/projects/sample1/tests/index.js] file written with same contents +//// [/user/username/projects/sample1/tests/index.d.ts] file written with same contents +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-1938481101-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\nexport declare class someClass2 {\n}\n", + "signature": "-1938481101-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\nexport declare class someClass2 {\n}\n" + }, + "../core/anothermodule.ts": { + "version": "-9234818176-export declare const World = \"hello\";\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "../logic/index.ts": { + "version": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +12:02:55 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/tests/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/with-circular-project-reference/non-local-change-does-not-start-build-of-referencing-projects.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/with-circular-project-reference/non-local-change-does-not-start-build-of-referencing-projects.js new file mode 100644 index 0000000000000..3c9719ebab394 --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/with-circular-project-reference/non-local-change-does-not-start-build-of-referencing-projects.js @@ -0,0 +1,536 @@ +/a/lib/tsc.js -b -w sample1/tests +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/sample1/core/tsconfig.json] +{"compilerOptions":{"composite":true,"declaration":true},"references":[{"path":"../tests","circular":true}]} + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/user/username/projects/sample1/core/anotherModule.ts] +export const World = "hello"; + + +//// [/user/username/projects/sample1/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/user/username/projects/sample1/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/tests/index.ts] +import * as c from '../core/index'; +import * as logic from '../logic/index'; + +c.leftPad("", 10); +logic.getSecondsInDay(); + +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = "hello"; + + +//// [/user/username/projects/sample1/core/anotherModule.d.ts] +export declare const World = "hello"; + + +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/user/username/projects/sample1/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; + + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} + +//// [/user/username/projects/sample1/logic/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +//# sourceMappingURL=index.js.map + +//// [/user/username/projects/sample1/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n" + }, + "../core/anothermodule.ts": { + "version": "-9234818176-export declare const World = \"hello\";\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/tests/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/user/username/projects/sample1/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n" + }, + "../core/anothermodule.ts": { + "version": "-9234818176-export declare const World = \"hello\";\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "../logic/index.ts": { + "version": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:39 AM - Starting compilation in watch mode... + + + +12:01:04 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Make local change to core + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + +function foo() { } + +//// [/user/username/projects/sample1/core/anotherModule.js] file changed its modified time +//// [/user/username/projects/sample1/core/anotherModule.d.ts] file changed its modified time +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; +function foo() { } + + +//// [/user/username/projects/sample1/core/index.d.ts] file written with same contents +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-9234818176-export declare const World = \"hello\";\n" + }, + "./index.ts": { + "version": "-21447768693-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n\nfunction foo() { }", + "signature": "-7362568283-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:01:08 AM - File change detected. Starting incremental compilation... + + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build logic or update time stamps + +//// [/user/username/projects/sample1/logic/index.js.map] file changed its modified time +//// [/user/username/projects/sample1/logic/index.js] file changed its modified time +//// [/user/username/projects/sample1/logic/index.d.ts] file changed its modified time +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] file changed its modified time + +Output:: + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build Tests + +//// [/user/username/projects/sample1/tests/index.js] file changed its modified time +//// [/user/username/projects/sample1/tests/index.d.ts] file changed its modified time +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] file changed its modified time + +Output:: + +12:01:21 AM - Found 0 errors. Watching for file changes. + + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/with-simple-project-reference-graph/builds-when-new-file-is-added,-and-its-subsequent-updates.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/with-simple-project-reference-graph/builds-when-new-file-is-added,-and-its-subsequent-updates.js new file mode 100644 index 0000000000000..1ea2c537136d2 --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/with-simple-project-reference-graph/builds-when-new-file-is-added,-and-its-subsequent-updates.js @@ -0,0 +1,823 @@ +/a/lib/tsc.js -b -w sample1/tests +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/sample1/core/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/user/username/projects/sample1/core/anotherModule.ts] +export const World = "hello"; + + +//// [/user/username/projects/sample1/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/user/username/projects/sample1/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/tests/index.ts] +import * as c from '../core/index'; +import * as logic from '../logic/index'; + +c.leftPad("", 10); +logic.getSecondsInDay(); + +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/ui/tsconfig.json] +{ + "compilerOptions": { + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../logic/index" } + ] +} + + +//// [/user/username/projects/sample1/ui/index.ts] +import * as logic from '../logic'; + +export function run() { + console.log(logic.getSecondsInDay()); +} + + +//// [/user/username/projects/sample1/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = "hello"; + + +//// [/user/username/projects/sample1/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/user/username/projects/sample1/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/user/username/projects/sample1/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/user/username/projects/sample1/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} + +//// [/user/username/projects/sample1/logic/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +//# sourceMappingURL=index.js.map + +//// [/user/username/projects/sample1/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/tests/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/user/username/projects/sample1/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:45 AM - Starting compilation in watch mode... + + + +12:01:14 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change to new File and build core + +//// [/user/username/projects/sample1/core/anotherModule.js] file changed its modified time +//// [/user/username/projects/sample1/core/anotherModule.d.ts.map] file changed its modified time +//// [/user/username/projects/sample1/core/anotherModule.d.ts] file changed its modified time +//// [/user/username/projects/sample1/core/index.js] file changed its modified time +//// [/user/username/projects/sample1/core/index.d.ts.map] file changed its modified time +//// [/user/username/projects/sample1/core/index.d.ts] file changed its modified time +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "./newfile.ts": { + "version": "-16320201030-export const newFileConst = 30;", + "signature": "-7097248545-export declare const newFileConst = 30;\n//# sourceMappingURL=newfile.d.ts.map" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts", + "./newfile.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/core/newfile.ts] +export const newFileConst = 30; + +//// [/user/username/projects/sample1/core/newfile.js] +"use strict"; +exports.__esModule = true; +exports.newFileConst = 30; + + +//// [/user/username/projects/sample1/core/newfile.d.ts.map] +{"version":3,"file":"newfile.d.ts","sourceRoot":"","sources":["newfile.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,KAAK,CAAC"} + +//// [/user/username/projects/sample1/core/newfile.d.ts] +export declare const newFileConst = 30; +//# sourceMappingURL=newfile.d.ts.map + + +Output:: +>> Screen clear +12:01:17 AM - File change detected. Starting incremental compilation... + + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts","/user/username/projects/sample1/core/newfile.ts"] +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts +/user/username/projects/sample1/core/newfile.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/newfile.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/newfile.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build logic or update time stamps + +//// [/user/username/projects/sample1/logic/index.js.map] file changed its modified time +//// [/user/username/projects/sample1/logic/index.js] file changed its modified time +//// [/user/username/projects/sample1/logic/index.d.ts] file changed its modified time +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] file changed its modified time + +Output:: + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/newfile.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build Tests + +//// [/user/username/projects/sample1/tests/index.js] file changed its modified time +//// [/user/username/projects/sample1/tests/index.d.ts] file changed its modified time +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] file changed its modified time + +Output:: + +12:01:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/newfile.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change to new File and build core + +//// [/user/username/projects/sample1/core/anotherModule.js] file changed its modified time +//// [/user/username/projects/sample1/core/anotherModule.d.ts.map] file changed its modified time +//// [/user/username/projects/sample1/core/anotherModule.d.ts] file changed its modified time +//// [/user/username/projects/sample1/core/index.js] file changed its modified time +//// [/user/username/projects/sample1/core/index.d.ts.map] file changed its modified time +//// [/user/username/projects/sample1/core/index.d.ts] file changed its modified time +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "./newfile.ts": { + "version": "-9703836816-export const newFileConst = 30;\nexport class someClass2 { }", + "signature": "-23735967665-export declare const newFileConst = 30;\nexport declare class someClass2 {\n}\n//# sourceMappingURL=newfile.d.ts.map" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts", + "./newfile.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/core/newfile.ts] +export const newFileConst = 30; +export class someClass2 { } + +//// [/user/username/projects/sample1/core/newfile.js] +"use strict"; +exports.__esModule = true; +exports.newFileConst = 30; +var someClass2 = /** @class */ (function () { + function someClass2() { + } + return someClass2; +}()); +exports.someClass2 = someClass2; + + +//// [/user/username/projects/sample1/core/newfile.d.ts.map] +{"version":3,"file":"newfile.d.ts","sourceRoot":"","sources":["newfile.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,qBAAa,UAAU;CAAI"} + +//// [/user/username/projects/sample1/core/newfile.d.ts] +export declare const newFileConst = 30; +export declare class someClass2 { +} +//# sourceMappingURL=newfile.d.ts.map + + +Output:: +>> Screen clear +12:01:34 AM - File change detected. Starting incremental compilation... + + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts","/user/username/projects/sample1/core/newfile.ts"] +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts +/user/username/projects/sample1/core/newfile.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/newfile.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/newfile.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build logic or update time stamps + +//// [/user/username/projects/sample1/logic/index.js.map] file changed its modified time +//// [/user/username/projects/sample1/logic/index.js] file changed its modified time +//// [/user/username/projects/sample1/logic/index.d.ts] file changed its modified time +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] file changed its modified time + +Output:: + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/newfile.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build Tests + +//// [/user/username/projects/sample1/tests/index.js] file changed its modified time +//// [/user/username/projects/sample1/tests/index.d.ts] file changed its modified time +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] file changed its modified time + +Output:: + +12:01:50 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/newfile.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/with-simple-project-reference-graph/change-builds-changes-and-reports-found-errors-message.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/with-simple-project-reference-graph/change-builds-changes-and-reports-found-errors-message.js new file mode 100644 index 0000000000000..1c0d211ab96e5 --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/with-simple-project-reference-graph/change-builds-changes-and-reports-found-errors-message.js @@ -0,0 +1,1376 @@ +/a/lib/tsc.js -b -w sample1/tests +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/sample1/core/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/user/username/projects/sample1/core/anotherModule.ts] +export const World = "hello"; + + +//// [/user/username/projects/sample1/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/user/username/projects/sample1/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/tests/index.ts] +import * as c from '../core/index'; +import * as logic from '../logic/index'; + +c.leftPad("", 10); +logic.getSecondsInDay(); + +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/ui/tsconfig.json] +{ + "compilerOptions": { + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../logic/index" } + ] +} + + +//// [/user/username/projects/sample1/ui/index.ts] +import * as logic from '../logic'; + +export function run() { + console.log(logic.getSecondsInDay()); +} + + +//// [/user/username/projects/sample1/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = "hello"; + + +//// [/user/username/projects/sample1/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/user/username/projects/sample1/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/user/username/projects/sample1/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/user/username/projects/sample1/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} + +//// [/user/username/projects/sample1/logic/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +//# sourceMappingURL=index.js.map + +//// [/user/username/projects/sample1/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/tests/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/user/username/projects/sample1/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:45 AM - Starting compilation in watch mode... + + + +12:01:14 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Make change to core + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + +export class someClass { } + +//// [/user/username/projects/sample1/core/anotherModule.js] file changed its modified time +//// [/user/username/projects/sample1/core/anotherModule.d.ts.map] file changed its modified time +//// [/user/username/projects/sample1/core/anotherModule.d.ts] file changed its modified time +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; +var someClass = /** @class */ (function () { + function someClass() { + } + return someClass; +}()); +exports.someClass = someClass; + + +//// [/user/username/projects/sample1/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAEhE,qBAAa,SAAS;CAAI"} + +//// [/user/username/projects/sample1/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +export declare class someClass { +} +//# sourceMappingURL=index.d.ts.map + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-13387000654-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n\nexport class someClass { }", + "signature": "-1428376100-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\n//# sourceMappingURL=index.d.ts.map" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:01:18 AM - File change detected. Starting incremental compilation... + + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build logic or update time stamps + +//// [/user/username/projects/sample1/logic/index.js.map] file written with same contents +//// [/user/username/projects/sample1/logic/index.js] file written with same contents +//// [/user/username/projects/sample1/logic/index.d.ts] file written with same contents +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-1428376100-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\n//# sourceMappingURL=index.d.ts.map", + "signature": "-1428376100-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/logic/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build Tests + +//// [/user/username/projects/sample1/tests/index.js] file written with same contents +//// [/user/username/projects/sample1/tests/index.d.ts] file written with same contents +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-1428376100-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\n//# sourceMappingURL=index.d.ts.map", + "signature": "-1428376100-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +12:01:53 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/tests/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Revert core file + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/user/username/projects/sample1/core/anotherModule.js] file changed its modified time +//// [/user/username/projects/sample1/core/anotherModule.d.ts.map] file changed its modified time +//// [/user/username/projects/sample1/core/anotherModule.d.ts] file changed its modified time +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/user/username/projects/sample1/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/user/username/projects/sample1/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:01:57 AM - File change detected. Starting incremental compilation... + + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build logic or update time stamps + +//// [/user/username/projects/sample1/logic/index.js.map] file written with same contents +//// [/user/username/projects/sample1/logic/index.js] file written with same contents +//// [/user/username/projects/sample1/logic/index.d.ts] file written with same contents +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/logic/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build Tests + +//// [/user/username/projects/sample1/tests/index.js] file written with same contents +//// [/user/username/projects/sample1/tests/index.d.ts] file written with same contents +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +12:02:32 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/tests/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Make two changes + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + +export class someClass { } +export class someClass2 { } + +//// [/user/username/projects/sample1/core/anotherModule.js] file changed its modified time +//// [/user/username/projects/sample1/core/anotherModule.d.ts.map] file changed its modified time +//// [/user/username/projects/sample1/core/anotherModule.d.ts] file changed its modified time +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; +var someClass = /** @class */ (function () { + function someClass() { + } + return someClass; +}()); +exports.someClass = someClass; +var someClass2 = /** @class */ (function () { + function someClass2() { + } + return someClass2; +}()); +exports.someClass2 = someClass2; + + +//// [/user/username/projects/sample1/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAEhE,qBAAa,SAAS;CAAI;AAC1B,qBAAa,UAAU;CAAI"} + +//// [/user/username/projects/sample1/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +export declare class someClass { +} +export declare class someClass2 { +} +//# sourceMappingURL=index.d.ts.map + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-8266060440-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n\nexport class someClass { }\nexport class someClass2 { }", + "signature": "-8987447092-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\nexport declare class someClass2 {\n}\n//# sourceMappingURL=index.d.ts.map" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:02:39 AM - File change detected. Starting incremental compilation... + + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build logic or update time stamps + +//// [/user/username/projects/sample1/logic/index.js.map] file written with same contents +//// [/user/username/projects/sample1/logic/index.js] file written with same contents +//// [/user/username/projects/sample1/logic/index.d.ts] file written with same contents +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-8987447092-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\nexport declare class someClass2 {\n}\n//# sourceMappingURL=index.d.ts.map", + "signature": "-8987447092-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\nexport declare class someClass2 {\n}\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/logic/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build Tests + +//// [/user/username/projects/sample1/tests/index.js] file written with same contents +//// [/user/username/projects/sample1/tests/index.d.ts] file written with same contents +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-8987447092-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\nexport declare class someClass2 {\n}\n//# sourceMappingURL=index.d.ts.map", + "signature": "-8987447092-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\nexport declare class someClass {\n}\nexport declare class someClass2 {\n}\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +12:03:14 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/tests/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuild/watchMode/programUpdates/with-simple-project-reference-graph/non-local-change-does-not-start-build-of-referencing-projects.js b/tests/baselines/reference/tsbuild/watchMode/programUpdates/with-simple-project-reference-graph/non-local-change-does-not-start-build-of-referencing-projects.js new file mode 100644 index 0000000000000..68721441d072d --- /dev/null +++ b/tests/baselines/reference/tsbuild/watchMode/programUpdates/with-simple-project-reference-graph/non-local-change-does-not-start-build-of-referencing-projects.js @@ -0,0 +1,574 @@ +/a/lib/tsc.js -b -w sample1/tests +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/sample1/core/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + + +//// [/user/username/projects/sample1/core/anotherModule.ts] +export const World = "hello"; + + +//// [/user/username/projects/sample1/logic/tsconfig.json] +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../core" } + ] +} + + +//// [/user/username/projects/sample1/logic/index.ts] +import * as c from '../core/index'; +export function getSecondsInDay() { + return c.multiply(10, 15); +} +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.json] +{ + "references": [ + { "path": "../core" }, + { "path": "../logic" } + ], + "files": ["index.ts"], + "compilerOptions": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true + } +} + +//// [/user/username/projects/sample1/tests/index.ts] +import * as c from '../core/index'; +import * as logic from '../logic/index'; + +c.leftPad("", 10); +logic.getSecondsInDay(); + +import * as mod from '../core/anotherModule'; +export const m = mod; + + +//// [/user/username/projects/sample1/ui/tsconfig.json] +{ + "compilerOptions": { + "skipDefaultLibCheck": true + }, + "references": [ + { "path": "../logic/index" } + ] +} + + +//// [/user/username/projects/sample1/ui/index.ts] +import * as logic from '../logic'; + +export function run() { + console.log(logic.getSecondsInDay()); +} + + +//// [/user/username/projects/sample1/core/anotherModule.js] +"use strict"; +exports.__esModule = true; +exports.World = "hello"; + + +//// [/user/username/projects/sample1/core/anotherModule.d.ts.map] +{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"} + +//// [/user/username/projects/sample1/core/anotherModule.d.ts] +export declare const World = "hello"; +//# sourceMappingURL=anotherModule.d.ts.map + +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; + + +//// [/user/username/projects/sample1/core/index.d.ts.map] +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"} + +//// [/user/username/projects/sample1/core/index.d.ts] +export declare const someString: string; +export declare function leftPad(s: string, n: number): string; +export declare function multiply(a: number, b: number): number; +//# sourceMappingURL=index.d.ts.map + +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-18749805970-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/logic/index.js.map] +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"} + +//// [/user/username/projects/sample1/logic/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +function getSecondsInDay() { + return c.multiply(10, 15); +} +exports.getSecondsInDay = getSecondsInDay; +var mod = require("../core/anotherModule"); +exports.m = mod; +//# sourceMappingURL=index.js.map + +//// [/user/username/projects/sample1/logic/index.d.ts] +export declare function getSecondsInDay(): number; +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts" + ] + }, + "exportedModulesMap": { + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + +//// [/user/username/projects/sample1/tests/index.js] +"use strict"; +exports.__esModule = true; +var c = require("../core/index"); +var logic = require("../logic/index"); +c.leftPad("", 10); +logic.getSecondsInDay(); +var mod = require("../core/anotherModule"); +exports.m = mod; + + +//// [/user/username/projects/sample1/tests/index.d.ts] +import * as mod from '../core/anotherModule'; +export declare const m: typeof mod; + + +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "../core/index.ts": { + "version": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + }, + "../core/anothermodule.ts": { + "version": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "../logic/index.ts": { + "version": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n", + "signature": "-9659407152-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + }, + "./index.ts": { + "version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n", + "signature": "2702201019-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n" + } + }, + "options": { + "composite": true, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts", + "../core/index.d.ts", + "../logic/index.d.ts" + ] + }, + "exportedModulesMap": { + "../logic/index.ts": [ + "../core/anothermodule.d.ts" + ], + "./index.ts": [ + "../core/anothermodule.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "../core/anothermodule.ts", + "../core/index.ts", + "../logic/index.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:45 AM - Starting compilation in watch mode... + + + +12:01:14 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Program root files: ["/user/username/projects/sample1/logic/index.ts"] +Program options: {"composite":true,"declaration":true,"sourceMap":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/logic/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.ts + +Program root files: ["/user/username/projects/sample1/tests/index.ts"] +Program options: {"composite":true,"declaration":true,"forceConsistentCasingInFileNames":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/tests/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/index.d.ts +/user/username/projects/sample1/core/anotherModule.d.ts +/user/username/projects/sample1/logic/index.d.ts +/user/username/projects/sample1/tests/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Make local change to core + +//// [/user/username/projects/sample1/core/index.ts] +export const someString: string = "HELLO WORLD"; +export function leftPad(s: string, n: number) { return s + n; } +export function multiply(a: number, b: number) { return a * b; } + +function foo() { } + +//// [/user/username/projects/sample1/core/anotherModule.js] file changed its modified time +//// [/user/username/projects/sample1/core/anotherModule.d.ts.map] file changed its modified time +//// [/user/username/projects/sample1/core/anotherModule.d.ts] file changed its modified time +//// [/user/username/projects/sample1/core/index.js] +"use strict"; +exports.__esModule = true; +exports.someString = "HELLO WORLD"; +function leftPad(s, n) { return s + n; } +exports.leftPad = leftPad; +function multiply(a, b) { return a * b; } +exports.multiply = multiply; +function foo() { } + + +//// [/user/username/projects/sample1/core/index.d.ts.map] file written with same contents +//// [/user/username/projects/sample1/core/index.d.ts] file written with same contents +//// [/user/username/projects/sample1/core/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./anothermodule.ts": { + "version": "-2676574883-export const World = \"hello\";\r\n", + "signature": "-4454971016-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map" + }, + "./index.ts": { + "version": "-21447768693-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n\nfunction foo() { }", + "signature": "-9047123202-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map" + } + }, + "options": { + "composite": true, + "declaration": true, + "declarationMap": true, + "skipDefaultLibCheck": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../../a/lib/lib.d.ts", + "./anothermodule.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:01:18 AM - File change detected. Starting incremental compilation... + + + +Program root files: ["/user/username/projects/sample1/core/anotherModule.ts","/user/username/projects/sample1/core/index.ts"] +Program options: {"composite":true,"declaration":true,"declarationMap":true,"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/sample1/core/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/sample1/core/anotherModule.ts +/user/username/projects/sample1/core/index.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/sample1/core/index.ts + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build logic or update time stamps + +//// [/user/username/projects/sample1/logic/index.js.map] file changed its modified time +//// [/user/username/projects/sample1/logic/index.js] file changed its modified time +//// [/user/username/projects/sample1/logic/index.d.ts] file changed its modified time +//// [/user/username/projects/sample1/logic/tsconfig.tsbuildinfo] file changed its modified time + +Output:: + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Build Tests + +//// [/user/username/projects/sample1/tests/index.js] file changed its modified time +//// [/user/username/projects/sample1/tests/index.d.ts] file changed its modified time +//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] file changed its modified time + +Output:: + +12:01:34 AM - Found 0 errors. Watching for file changes. + + +WatchedFiles:: +/user/username/projects/sample1/core/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/core/anothermodule.ts: + {"pollingInterval":250} +/user/username/projects/sample1/core/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/logic/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/logic/index.ts: + {"pollingInterval":250} +/user/username/projects/sample1/tests/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/sample1/tests/index.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/sample1/core: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/sample1/logic: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsc/incremental/incremental-declaration-doesnt-change/with-noEmitOnError.js b/tests/baselines/reference/tsc/incremental/incremental-declaration-doesnt-change/with-noEmitOnError.js index 95c27619b6ab5..1347db0957d1c 100644 --- a/tests/baselines/reference/tsc/incremental/incremental-declaration-doesnt-change/with-noEmitOnError.js +++ b/tests/baselines/reference/tsc/incremental/incremental-declaration-doesnt-change/with-noEmitOnError.js @@ -17,6 +17,8 @@ var a = { //// [/src/dev-build/src/other.js] +"use strict"; +exports.__esModule = true; console.log("hi"); @@ -37,8 +39,8 @@ console.log("hi"); "signature": "-4882119183-export {};\r\n" }, "../src/other.ts": { - "version": "7719445449-console.log(\"hi\");", - "signature": "5381-" + "version": "11373096570-console.log(\"hi\");\r\nexport { }", + "signature": "-4882119183-export {};\r\n" } }, "options": { diff --git a/tests/baselines/reference/tscWatch/consoleClearing/when-preserveWatchOutput-is-true-in-config-file/createWatchOfConfigFile.js b/tests/baselines/reference/tscWatch/consoleClearing/when-preserveWatchOutput-is-true-in-config-file/createWatchOfConfigFile.js new file mode 100644 index 0000000000000..a8c84a0cb9e9d --- /dev/null +++ b/tests/baselines/reference/tscWatch/consoleClearing/when-preserveWatchOutput-is-true-in-config-file/createWatchOfConfigFile.js @@ -0,0 +1,102 @@ +/a/lib/tsc.js --w -p /tsconfig.json +//// [/f.ts] + + +//// [/tsconfig.json] +{"compilerOptions":{"preserveWatchOutput":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/f.js] + + + +Output:: +>> Screen clear +12:00:13 AM - Starting compilation in watch mode... + + + +12:00:16 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/f.ts","/a/lib/lib.d.ts"] +Program options: {"preserveWatchOutput":true,"configFilePath":"/tsconfig.json"} +Program files:: +/f.ts +/a/lib/lib.d.ts + +Semantic diagnostics in builder refreshed for:: +/f.ts +/a/lib/lib.d.ts + +WatchedFiles:: +/tsconfig.json: + {"pollingInterval":250} +/f.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Comment added to file f + +//// [/f.ts] +// + +//// [/f.js] +// + + + +Output:: + +12:00:19 AM - File change detected. Starting incremental compilation... + + + +12:00:23 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/f.ts","/a/lib/lib.d.ts"] +Program options: {"preserveWatchOutput":true,"configFilePath":"/tsconfig.json"} +Program files:: +/f.ts +/a/lib/lib.d.ts + +Semantic diagnostics in builder refreshed for:: +/f.ts + +WatchedFiles:: +/tsconfig.json: + {"pollingInterval":250} +/f.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/consoleClearing/when-preserveWatchOutput-is-true-in-config-file/when-createWatchProgram-is-invoked-with-configFileParseResult-on-WatchCompilerHostOfConfigFile.js b/tests/baselines/reference/tscWatch/consoleClearing/when-preserveWatchOutput-is-true-in-config-file/when-createWatchProgram-is-invoked-with-configFileParseResult-on-WatchCompilerHostOfConfigFile.js new file mode 100644 index 0000000000000..63a11b26ec46c --- /dev/null +++ b/tests/baselines/reference/tscWatch/consoleClearing/when-preserveWatchOutput-is-true-in-config-file/when-createWatchProgram-is-invoked-with-configFileParseResult-on-WatchCompilerHostOfConfigFile.js @@ -0,0 +1,102 @@ +/a/lib/tsc.js --w -p /tsconfig.json +//// [/f.ts] + + +//// [/tsconfig.json] +{"compilerOptions":{"preserveWatchOutput":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/f.js] + + + +Output:: + +12:00:13 AM - Starting compilation in watch mode... + + + +12:00:16 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/f.ts","/a/lib/lib.d.ts"] +Program options: {"preserveWatchOutput":true,"watch":true,"project":"/tsconfig.json","configFilePath":"/tsconfig.json"} +Program files:: +/f.ts +/a/lib/lib.d.ts + +Semantic diagnostics in builder refreshed for:: +/f.ts +/a/lib/lib.d.ts + +WatchedFiles:: +/tsconfig.json: + {"pollingInterval":250} +/f.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Comment added to file f + +//// [/f.ts] +// + +//// [/f.js] +// + + + +Output:: + +12:00:19 AM - File change detected. Starting incremental compilation... + + + +12:00:23 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/f.ts","/a/lib/lib.d.ts"] +Program options: {"preserveWatchOutput":true,"watch":true,"project":"/tsconfig.json","configFilePath":"/tsconfig.json"} +Program files:: +/f.ts +/a/lib/lib.d.ts + +Semantic diagnostics in builder refreshed for:: +/f.ts + +WatchedFiles:: +/tsconfig.json: + {"pollingInterval":250} +/f.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/consoleClearing/with---diagnostics.js b/tests/baselines/reference/tscWatch/consoleClearing/with---diagnostics.js new file mode 100644 index 0000000000000..dd386d6acea02 --- /dev/null +++ b/tests/baselines/reference/tscWatch/consoleClearing/with---diagnostics.js @@ -0,0 +1,115 @@ +/a/lib/tsc.js --w /f.ts --diagnostics +//// [/f.ts] + + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/f.js] + + + +Output:: + +12:00:11 AM - Starting compilation in watch mode... + + +Current directory: / CaseSensitiveFileNames: false + +Synchronizing program + +CreatingProgramWith:: + + roots: ["/f.ts"] + + options: {"watch":true,"diagnostics":true} + + +12:00:14 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/f.ts"] +Program options: {"watch":true,"diagnostics":true} +Program files:: +/a/lib/lib.d.ts +/f.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/f.ts + +WatchedFiles:: +/f.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Comment added to file f + +//// [/f.ts] +// + +//// [/f.js] +// + + + +Output:: +FileWatcher:: Triggered with /f.ts 1:: WatchInfo: /f.ts 250 undefined Source file + +Scheduling update + +Elapsed:: *ms FileWatcher:: Triggered with /f.ts 1:: WatchInfo: /f.ts 250 undefined Source file + + +12:00:17 AM - File change detected. Starting incremental compilation... + + +Synchronizing program + +CreatingProgramWith:: + + roots: ["/f.ts"] + + options: {"watch":true,"diagnostics":true} + + +12:00:21 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/f.ts"] +Program options: {"watch":true,"diagnostics":true} +Program files:: +/a/lib/lib.d.ts +/f.ts + +Semantic diagnostics in builder refreshed for:: +/f.ts + +WatchedFiles:: +/f.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/consoleClearing/with---extendedDiagnostics.js b/tests/baselines/reference/tscWatch/consoleClearing/with---extendedDiagnostics.js new file mode 100644 index 0000000000000..578a9b7fffcf3 --- /dev/null +++ b/tests/baselines/reference/tscWatch/consoleClearing/with---extendedDiagnostics.js @@ -0,0 +1,119 @@ +/a/lib/tsc.js --w /f.ts --extendedDiagnostics +//// [/f.ts] + + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/f.js] + + + +Output:: + +12:00:11 AM - Starting compilation in watch mode... + + +Current directory: / CaseSensitiveFileNames: false + +Synchronizing program + +CreatingProgramWith:: + + roots: ["/f.ts"] + + options: {"watch":true,"extendedDiagnostics":true} + +FileWatcher:: Added:: WatchInfo: /f.ts 250 undefined Source file + +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 undefined Source file + + +12:00:14 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/f.ts"] +Program options: {"watch":true,"extendedDiagnostics":true} +Program files:: +/a/lib/lib.d.ts +/f.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/f.ts + +WatchedFiles:: +/f.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Comment added to file f + +//// [/f.ts] +// + +//// [/f.js] +// + + + +Output:: +FileWatcher:: Triggered with /f.ts 1:: WatchInfo: /f.ts 250 undefined Source file + +Scheduling update + +Elapsed:: *ms FileWatcher:: Triggered with /f.ts 1:: WatchInfo: /f.ts 250 undefined Source file + + +12:00:17 AM - File change detected. Starting incremental compilation... + + +Synchronizing program + +CreatingProgramWith:: + + roots: ["/f.ts"] + + options: {"watch":true,"extendedDiagnostics":true} + + +12:00:21 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/f.ts"] +Program options: {"watch":true,"extendedDiagnostics":true} +Program files:: +/a/lib/lib.d.ts +/f.ts + +Semantic diagnostics in builder refreshed for:: +/f.ts + +WatchedFiles:: +/f.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/consoleClearing/with---preserveWatchOutput.js b/tests/baselines/reference/tscWatch/consoleClearing/with---preserveWatchOutput.js new file mode 100644 index 0000000000000..bf7bdc4f777cd --- /dev/null +++ b/tests/baselines/reference/tscWatch/consoleClearing/with---preserveWatchOutput.js @@ -0,0 +1,91 @@ +/a/lib/tsc.js --w /f.ts --preserveWatchOutput +//// [/f.ts] + + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/f.js] + + + +Output:: + +12:00:11 AM - Starting compilation in watch mode... + + + +12:00:14 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/f.ts"] +Program options: {"watch":true,"preserveWatchOutput":true} +Program files:: +/a/lib/lib.d.ts +/f.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/f.ts + +WatchedFiles:: +/f.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Comment added to file f + +//// [/f.ts] +// + +//// [/f.js] +// + + + +Output:: + +12:00:17 AM - File change detected. Starting incremental compilation... + + + +12:00:21 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/f.ts"] +Program options: {"watch":true,"preserveWatchOutput":true} +Program files:: +/a/lib/lib.d.ts +/f.ts + +Semantic diagnostics in builder refreshed for:: +/f.ts + +WatchedFiles:: +/f.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/consoleClearing/without---diagnostics-or---extendedDiagnostics.js b/tests/baselines/reference/tscWatch/consoleClearing/without---diagnostics-or---extendedDiagnostics.js new file mode 100644 index 0000000000000..4cb8232c5d269 --- /dev/null +++ b/tests/baselines/reference/tscWatch/consoleClearing/without---diagnostics-or---extendedDiagnostics.js @@ -0,0 +1,91 @@ +/a/lib/tsc.js --w /f.ts +//// [/f.ts] + + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/f.js] + + + +Output:: +>> Screen clear +12:00:11 AM - Starting compilation in watch mode... + + + +12:00:14 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/f.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/f.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/f.ts + +WatchedFiles:: +/f.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Comment added to file f + +//// [/f.ts] +// + +//// [/f.js] +// + + + +Output:: +>> Screen clear +12:00:17 AM - File change detected. Starting incremental compilation... + + + +12:00:21 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/f.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/f.ts + +Semantic diagnostics in builder refreshed for:: +/f.ts + +WatchedFiles:: +/f.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-file-content/elides-const-enums-correctly-in-incremental-compilation.js b/tests/baselines/reference/tscWatch/emit/emit-file-content/elides-const-enums-correctly-in-incremental-compilation.js new file mode 100644 index 0000000000000..2258e83fa4d6b --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-file-content/elides-const-enums-correctly-in-incremental-compilation.js @@ -0,0 +1,127 @@ +/a/lib/tsc.js -w /user/someone/projects/myproject/file3.ts +//// [/user/someone/projects/myproject/file1.ts] +export const enum E1 { V = 1 } + +//// [/user/someone/projects/myproject/file2.ts] +import { E1 } from "./file1"; export const enum E2 { V = E1.V } + +//// [/user/someone/projects/myproject/file3.ts] +import { E2 } from "./file2"; const v: E2 = E2.V; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/someone/projects/myproject/file1.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/someone/projects/myproject/file2.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/someone/projects/myproject/file3.js] +"use strict"; +exports.__esModule = true; +var v = 1 /* V */; + + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + + +12:00:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/someone/projects/myproject/file3.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/user/someone/projects/myproject/file1.ts +/user/someone/projects/myproject/file2.ts +/user/someone/projects/myproject/file3.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/someone/projects/myproject/file1.ts +/user/someone/projects/myproject/file2.ts +/user/someone/projects/myproject/file3.ts + +WatchedFiles:: +/user/someone/projects/myproject/file3.ts: + {"pollingInterval":250} +/user/someone/projects/myproject/file2.ts: + {"pollingInterval":250} +/user/someone/projects/myproject/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Append content to file3 + +//// [/user/someone/projects/myproject/file3.ts] +import { E2 } from "./file2"; const v: E2 = E2.V;function foo2() { return 2; } + +//// [/user/someone/projects/myproject/file3.js] +"use strict"; +exports.__esModule = true; +var v = 1 /* V */; +function foo2() { return 2; } + + + +Output:: +>> Screen clear +12:00:33 AM - File change detected. Starting incremental compilation... + + + +12:00:37 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/someone/projects/myproject/file3.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/user/someone/projects/myproject/file1.ts +/user/someone/projects/myproject/file2.ts +/user/someone/projects/myproject/file3.ts + +Semantic diagnostics in builder refreshed for:: +/user/someone/projects/myproject/file3.ts + +WatchedFiles:: +/user/someone/projects/myproject/file3.ts: + {"pollingInterval":250} +/user/someone/projects/myproject/file2.ts: + {"pollingInterval":250} +/user/someone/projects/myproject/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-file-content/file-is-deleted-and-created-as-part-of-change.js b/tests/baselines/reference/tscWatch/emit/emit-file-content/file-is-deleted-and-created-as-part-of-change.js new file mode 100644 index 0000000000000..9d9197b1bdc59 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-file-content/file-is-deleted-and-created-as-part-of-change.js @@ -0,0 +1,110 @@ +/a/lib/tsc.js -w +//// [/home/username/project/app/file.ts] +var a = 10; + +//// [/home/username/project/tsconfig.json] +{"include":["app/**/*.ts"]} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/home/username/project/app/file.js] +var a = 10; + + + +Output:: +>> Screen clear +12:00:21 AM - Starting compilation in watch mode... + + + +12:00:24 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/home/username/project/app/file.ts"] +Program options: {"watch":true,"configFilePath":"/home/username/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/home/username/project/app/file.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/home/username/project/app/file.ts + +WatchedFiles:: +/home/username/project/tsconfig.json: + {"pollingInterval":250} +/home/username/project/app/file.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/home/username/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/home/username/project/app: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: file is deleted and then created to modify content + +//// [/home/username/project/app/file.js] +var a = 10; +var b = 10; + + +//// [/home/username/project/app/file.ts] +var a = 10; +var b = 10; + + +Output:: +>> Screen clear +12:00:28 AM - File change detected. Starting incremental compilation... + + + +12:00:32 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/home/username/project/app/file.ts"] +Program options: {"watch":true,"configFilePath":"/home/username/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/home/username/project/app/file.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/home/username/project/app/file.ts + +WatchedFiles:: +/home/username/project/tsconfig.json: + {"pollingInterval":250} +/home/username/project/app/file.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/home/username/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/home/username/project/app: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-file-content/handles-new-lines-carriageReturn-lineFeed.js b/tests/baselines/reference/tscWatch/emit/emit-file-content/handles-new-lines-carriageReturn-lineFeed.js new file mode 100644 index 0000000000000..fc5884aafe4a6 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-file-content/handles-new-lines-carriageReturn-lineFeed.js @@ -0,0 +1,99 @@ +/a/lib/tsc.js --w /a/app.ts +//// [/a/app.ts] +var x = 1; +var y = 2; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/app.js] +var x = 1; +var y = 2; + + + +Output:: +>> Screen clear +12:00:11 AM - Starting compilation in watch mode... + + + +12:00:14 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/app.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/app.ts + +WatchedFiles:: +/a/app.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Append a line + +//// [/a/app.ts] +var x = 1; +var y = 2; +var z = 3; + +//// [/a/app.js] +var x = 1; +var y = 2; +var z = 3; + + + +Output:: +>> Screen clear +12:00:17 AM - File change detected. Starting incremental compilation... + + + +12:00:21 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/app.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/app.ts + +WatchedFiles:: +/a/app.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-file-content/handles-new-lines-lineFeed.js b/tests/baselines/reference/tscWatch/emit/emit-file-content/handles-new-lines-lineFeed.js new file mode 100644 index 0000000000000..6e984554dc9bf --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-file-content/handles-new-lines-lineFeed.js @@ -0,0 +1,99 @@ +/a/lib/tsc.js --w /a/app.ts +//// [/a/app.ts] +var x = 1; +var y = 2; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/app.js] +var x = 1; +var y = 2; + + + +Output:: +>> Screen clear +12:00:11 AM - Starting compilation in watch mode... + + + +12:00:14 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/app.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/app.ts + +WatchedFiles:: +/a/app.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Append a line + +//// [/a/app.ts] +var x = 1; +var y = 2; +var z = 3; + +//// [/a/app.js] +var x = 1; +var y = 2; +var z = 3; + + + +Output:: +>> Screen clear +12:00:17 AM - File change detected. Starting incremental compilation... + + + +12:00:21 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/app.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/app.ts + +WatchedFiles:: +/a/app.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-file-content/should-emit-specified-file.js b/tests/baselines/reference/tscWatch/emit/emit-file-content/should-emit-specified-file.js new file mode 100644 index 0000000000000..056b8838a97a7 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-file-content/should-emit-specified-file.js @@ -0,0 +1,151 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/b/f1.ts] +export function Foo() { return 10; } + +//// [/a/b/f2.ts] +import {Foo} from "./f1"; export let y = Foo(); + +//// [/a/b/f3.ts] +import {y} from "./f2"; let x = y; + +//// [/a/b/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/f1.js] +"use strict"; +exports.__esModule = true; +function Foo() { return 10; } +exports.Foo = Foo; + + +//// [/a/b/f2.js] +"use strict"; +exports.__esModule = true; +var f1_1 = require("./f1"); +exports.y = f1_1.Foo(); + + +//// [/a/b/f3.js] +"use strict"; +exports.__esModule = true; +var f2_1 = require("./f2"); +var x = f2_1.y; + + + +Output:: +>> Screen clear +12:00:19 AM - Starting compilation in watch mode... + + + +12:00:26 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/f1.ts","/a/b/f2.ts","/a/b/f3.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/f1.ts +/a/b/f2.ts +/a/b/f3.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/f1.ts +/a/b/f2.ts +/a/b/f3.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/f1.ts: + {"pollingInterval":250} +/a/b/f2.ts: + {"pollingInterval":250} +/a/b/f3.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Append content to f1 + +//// [/a/b/f1.ts] +export function Foo() { return 10; }export function foo2() { return 2; } + +//// [/a/b/f1.js] +"use strict"; +exports.__esModule = true; +function Foo() { return 10; } +exports.Foo = Foo; +function foo2() { return 2; } +exports.foo2 = foo2; + + +//// [/a/b/f2.js] file written with same contents + +Output:: +>> Screen clear +12:00:29 AM - File change detected. Starting incremental compilation... + + + +12:00:36 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/f1.ts","/a/b/f2.ts","/a/b/f3.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/f1.ts +/a/b/f2.ts +/a/b/f3.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/f1.ts +/a/b/f2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/f1.ts: + {"pollingInterval":250} +/a/b/f2.ts: + {"pollingInterval":250} +/a/b/f3.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-always-return-the-file-itself-if-'--isolatedModules'-is-specified.js b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-always-return-the-file-itself-if-'--isolatedModules'-is-specified.js new file mode 100644 index 0000000000000..5ac4cfe21d070 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-always-return-the-file-itself-if-'--isolatedModules'-is-specified.js @@ -0,0 +1,175 @@ +/a/lib/tsc.js --w -p /a/b/tsconfig.json +//// [/a/b/moduleFile1.ts] +export function Foo() { }; + +//// [/a/b/file1Consumer1.ts] +import {Foo} from "./moduleFile1"; export var y = 10; + +//// [/a/b/file1Consumer2.ts] +import {Foo} from "./moduleFile1"; let z = 10; + +//// [/a/b/globalFile3.ts] +interface GlobalFoo { age: number } + +//// [/a/b/moduleFile2.ts] +export var Foo4 = 10; + +//// [/a/b/tsconfig.json] +{"compilerOptions":{"isolatedModules":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +function Foo() { } +exports.Foo = Foo; +; + + +//// [/a/b/file1Consumer1.js] +"use strict"; +exports.__esModule = true; +exports.y = 10; + + +//// [/a/b/file1Consumer2.js] +"use strict"; +exports.__esModule = true; +var z = 10; + + +//// [/a/b/globalFile3.js] + + +//// [/a/b/moduleFile2.js] +"use strict"; +exports.__esModule = true; +exports.Foo4 = 10; + + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + +a/b/globalFile3.ts(1,1): error TS1208: All files must be modules when the '--isolatedModules' flag is provided. + + +12:00:34 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"isolatedModules":true,"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change the content of moduleFile1 to `export var T: number;export function Foo() { };` + +//// [/a/b/moduleFile1.ts] +export var T: number;export function Foo() { }; + +//// [/a/b/moduleFile1.js] file written with same contents + +Output:: +>> Screen clear +12:00:38 AM - File change detected. Starting incremental compilation... + + +a/b/globalFile3.ts(1,1): error TS1208: All files must be modules when the '--isolatedModules' flag is provided. + + +12:00:42 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"isolatedModules":true,"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-always-return-the-file-itself-if-'--out'-or-'--outFile'-is-specified.js b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-always-return-the-file-itself-if-'--out'-or-'--outFile'-is-specified.js new file mode 100644 index 0000000000000..06f539bd12c07 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-always-return-the-file-itself-if-'--out'-or-'--outFile'-is-specified.js @@ -0,0 +1,229 @@ +/a/lib/tsc.js --w -p /a/b/tsconfig.json +//// [/a/b/moduleFile1.ts] +export function Foo() { }; + +//// [/a/b/file1Consumer1.ts] +import {Foo} from "./moduleFile1"; export var y = 10; + +//// [/a/b/file1Consumer2.ts] +import {Foo} from "./moduleFile1"; let z = 10; + +//// [/a/b/globalFile3.ts] +interface GlobalFoo { age: number } + +//// [/a/b/moduleFile2.ts] +export var Foo4 = 10; + +//// [/a/b/tsconfig.json] +{"compilerOptions":{"module":"system","outFile":"/a/b/out.js"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/out.js] +System.register("moduleFile1", [], function (exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + function Foo() { } + exports_1("Foo", Foo); + return { + setters: [], + execute: function () { + ; + } + }; +}); +System.register("file1Consumer1", [], function (exports_2, context_2) { + "use strict"; + var y; + var __moduleName = context_2 && context_2.id; + return { + setters: [], + execute: function () { + exports_2("y", y = 10); + } + }; +}); +System.register("file1Consumer2", [], function (exports_3, context_3) { + "use strict"; + var z; + var __moduleName = context_3 && context_3.id; + return { + setters: [], + execute: function () { + z = 10; + } + }; +}); +System.register("moduleFile2", [], function (exports_4, context_4) { + "use strict"; + var Foo4; + var __moduleName = context_4 && context_4.id; + return { + setters: [], + execute: function () { + exports_4("Foo4", Foo4 = 10); + } + }; +}); + + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + + +12:00:26 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"module":4,"outFile":"/a/b/out.js","watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change the content of moduleFile1 to `export var T: number;export function Foo() { };` + +//// [/a/b/moduleFile1.ts] +export var T: number;export function Foo() { }; + +//// [/a/b/out.js] +System.register("moduleFile1", [], function (exports_1, context_1) { + "use strict"; + var T; + var __moduleName = context_1 && context_1.id; + function Foo() { } + exports_1("Foo", Foo); + return { + setters: [], + execute: function () { + ; + } + }; +}); +System.register("file1Consumer1", [], function (exports_2, context_2) { + "use strict"; + var y; + var __moduleName = context_2 && context_2.id; + return { + setters: [], + execute: function () { + exports_2("y", y = 10); + } + }; +}); +System.register("file1Consumer2", [], function (exports_3, context_3) { + "use strict"; + var z; + var __moduleName = context_3 && context_3.id; + return { + setters: [], + execute: function () { + z = 10; + } + }; +}); +System.register("moduleFile2", [], function (exports_4, context_4) { + "use strict"; + var Foo4; + var __moduleName = context_4 && context_4.id; + return { + setters: [], + execute: function () { + exports_4("Foo4", Foo4 = 10); + } + }; +}); + + + +Output:: +>> Screen clear +12:00:30 AM - File change detected. Starting incremental compilation... + + + +12:00:34 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"module":4,"outFile":"/a/b/out.js","watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-deleted-files.js b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-deleted-files.js new file mode 100644 index 0000000000000..b80e9c8335277 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-deleted-files.js @@ -0,0 +1,169 @@ +/a/lib/tsc.js --w -p /a/b/tsconfig.json +//// [/a/b/moduleFile1.ts] +export function Foo() { }; + +//// [/a/b/file1Consumer1.ts] +import {Foo} from "./moduleFile1"; export var y = 10; + +//// [/a/b/file1Consumer2.ts] +import {Foo} from "./moduleFile1"; let z = 10; + +//// [/a/b/globalFile3.ts] +interface GlobalFoo { age: number } + +//// [/a/b/moduleFile2.ts] +export var Foo4 = 10; + +//// [/a/b/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +function Foo() { } +exports.Foo = Foo; +; + + +//// [/a/b/file1Consumer1.js] +"use strict"; +exports.__esModule = true; +exports.y = 10; + + +//// [/a/b/file1Consumer2.js] +"use strict"; +exports.__esModule = true; +var z = 10; + + +//// [/a/b/globalFile3.js] + + +//// [/a/b/moduleFile2.js] +"use strict"; +exports.__esModule = true; +exports.Foo4 = 10; + + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + + +12:00:34 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: change moduleFile1 shape and delete file1Consumer2 + +//// [/a/b/moduleFile1.ts] +export var T: number;export function Foo() { }; + +//// [/a/b/moduleFile1.js] file written with same contents +//// [/a/b/file1Consumer1.js] file written with same contents +//// [/a/b/file1Consumer2.ts] deleted + +Output:: +>> Screen clear +12:00:39 AM - File change detected. Starting incremental compilation... + + + +12:00:46 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-newly-created-files.js b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-newly-created-files.js new file mode 100644 index 0000000000000..4927b7ae7b496 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-newly-created-files.js @@ -0,0 +1,187 @@ +/a/lib/tsc.js --w -p /a/b/tsconfig.json +//// [/a/b/moduleFile1.ts] +export function Foo() { }; + +//// [/a/b/file1Consumer1.ts] +import {Foo} from "./moduleFile1"; export var y = 10; + +//// [/a/b/file1Consumer2.ts] +import {Foo} from "./moduleFile1"; let z = 10; + +//// [/a/b/globalFile3.ts] +interface GlobalFoo { age: number } + +//// [/a/b/moduleFile2.ts] +export var Foo4 = 10; + +//// [/a/b/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +function Foo() { } +exports.Foo = Foo; +; + + +//// [/a/b/file1Consumer1.js] +"use strict"; +exports.__esModule = true; +exports.y = 10; + + +//// [/a/b/file1Consumer2.js] +"use strict"; +exports.__esModule = true; +var z = 10; + + +//// [/a/b/globalFile3.js] + + +//// [/a/b/moduleFile2.js] +"use strict"; +exports.__esModule = true; +exports.Foo4 = 10; + + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + + +12:00:34 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: change moduleFile1 shape and create file1Consumer3 + +//// [/a/b/moduleFile1.ts] +export var T: number;export function Foo() { }; + +//// [/a/b/moduleFile1.js] file written with same contents +//// [/a/b/file1Consumer1.js] file written with same contents +//// [/a/b/file1Consumer2.js] file written with same contents +//// [/a/b/file1Consumer3.ts] +import {Foo} from "./moduleFile1"; let y = Foo(); + +//// [/a/b/file1Consumer3.js] +"use strict"; +exports.__esModule = true; +var moduleFile1_1 = require("./moduleFile1"); +var y = moduleFile1_1.Foo(); + + + +Output:: +>> Screen clear +12:00:40 AM - File change detected. Starting incremental compilation... + + + +12:00:52 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/file1Consumer3.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/file1Consumer3.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/file1Consumer3.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/file1consumer3.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-the-reference-map-changes.js b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-the-reference-map-changes.js new file mode 100644 index 0000000000000..4eaacd069d829 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-the-reference-map-changes.js @@ -0,0 +1,433 @@ +/a/lib/tsc.js --w -p /a/b/tsconfig.json +//// [/a/b/moduleFile1.ts] +export function Foo() { }; + +//// [/a/b/file1Consumer1.ts] +import {Foo} from "./moduleFile1"; export var y = 10; + +//// [/a/b/file1Consumer2.ts] +import {Foo} from "./moduleFile1"; let z = 10; + +//// [/a/b/globalFile3.ts] +interface GlobalFoo { age: number } + +//// [/a/b/moduleFile2.ts] +export var Foo4 = 10; + +//// [/a/b/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +function Foo() { } +exports.Foo = Foo; +; + + +//// [/a/b/file1Consumer1.js] +"use strict"; +exports.__esModule = true; +exports.y = 10; + + +//// [/a/b/file1Consumer2.js] +"use strict"; +exports.__esModule = true; +var z = 10; + + +//// [/a/b/globalFile3.js] + + +//// [/a/b/moduleFile2.js] +"use strict"; +exports.__esModule = true; +exports.Foo4 = 10; + + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + + +12:00:34 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change file1Consumer1 content to `export let y = Foo();` + +//// [/a/b/file1Consumer1.ts] +export let y = Foo(); + +//// [/a/b/file1Consumer1.js] +"use strict"; +exports.__esModule = true; +exports.y = Foo(); + + + +Output:: +>> Screen clear +12:00:38 AM - File change detected. Starting incremental compilation... + + +a/b/file1Consumer1.ts(1,16): error TS2304: Cannot find name 'Foo'. + + +12:00:42 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/file1Consumer1.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/file1Consumer1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change the content of moduleFile1 to `export var T: number;export function Foo() { };` + +//// [/a/b/moduleFile1.ts] +export var T: number;export function Foo() { }; + +//// [/a/b/moduleFile1.js] file written with same contents +//// [/a/b/file1Consumer2.js] file written with same contents + +Output:: +>> Screen clear +12:00:46 AM - File change detected. Starting incremental compilation... + + +a/b/file1Consumer1.ts(1,16): error TS2304: Cannot find name 'Foo'. + + +12:00:53 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/file1Consumer1.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/moduleFile1.ts +/a/b/file1Consumer2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Add the import statements back to file1Consumer1 + +//// [/a/b/file1Consumer1.ts] +import {Foo} from "./moduleFile1";let y = Foo(); + +//// [/a/b/file1Consumer1.js] +"use strict"; +exports.__esModule = true; +var moduleFile1_1 = require("./moduleFile1"); +var y = moduleFile1_1.Foo(); + + + +Output:: +>> Screen clear +12:00:57 AM - File change detected. Starting incremental compilation... + + + +12:01:01 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/file1Consumer1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change the content of moduleFile1 to `export var T: number;export var T2: string;export function Foo() { };` + +//// [/a/b/moduleFile1.ts] +export let y = Foo(); + +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +exports.y = Foo(); + + +//// [/a/b/file1Consumer1.js] file written with same contents +//// [/a/b/file1Consumer2.js] file written with same contents + +Output:: +>> Screen clear +12:01:05 AM - File change detected. Starting incremental compilation... + + +a/b/file1Consumer1.ts(1,9): error TS2305: Module '"./moduleFile1"' has no exported member 'Foo'. + +a/b/file1Consumer2.ts(1,9): error TS2305: Module '"./moduleFile1"' has no exported member 'Foo'. + +a/b/moduleFile1.ts(1,16): error TS2304: Cannot find name 'Foo'. + + +12:01:15 AM - Found 3 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Multiple file edits in one go + +//// [/a/b/moduleFile1.ts] +export var T: number;export function Foo() { }; + +//// [/a/b/file1Consumer1.ts] file written with same contents +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +function Foo() { } +exports.Foo = Foo; +; + + +//// [/a/b/file1Consumer1.js] file written with same contents +//// [/a/b/file1Consumer2.js] file written with same contents + +Output:: +>> Screen clear +12:01:22 AM - File change detected. Starting incremental compilation... + + + +12:01:32 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-contains-only-itself-if-a-module-file's-shape-didn't-change,-and-all-files-referencing-it-if-its-shape-changed.js b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-contains-only-itself-if-a-module-file's-shape-didn't-change,-and-all-files-referencing-it-if-its-shape-changed.js new file mode 100644 index 0000000000000..6a2d6f3b00347 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-contains-only-itself-if-a-module-file's-shape-didn't-change,-and-all-files-referencing-it-if-its-shape-changed.js @@ -0,0 +1,237 @@ +/a/lib/tsc.js --w -p /a/b/tsconfig.json +//// [/a/b/moduleFile1.ts] +export function Foo() { }; + +//// [/a/b/file1Consumer1.ts] +import {Foo} from "./moduleFile1"; export var y = 10; + +//// [/a/b/file1Consumer2.ts] +import {Foo} from "./moduleFile1"; let z = 10; + +//// [/a/b/globalFile3.ts] +interface GlobalFoo { age: number } + +//// [/a/b/moduleFile2.ts] +export var Foo4 = 10; + +//// [/a/b/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +function Foo() { } +exports.Foo = Foo; +; + + +//// [/a/b/file1Consumer1.js] +"use strict"; +exports.__esModule = true; +exports.y = 10; + + +//// [/a/b/file1Consumer2.js] +"use strict"; +exports.__esModule = true; +var z = 10; + + +//// [/a/b/globalFile3.js] + + +//// [/a/b/moduleFile2.js] +"use strict"; +exports.__esModule = true; +exports.Foo4 = 10; + + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + + +12:00:34 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change the content of moduleFile1 to `export var T: number;export function Foo() { };` + +//// [/a/b/moduleFile1.ts] +export var T: number;export function Foo() { }; + +//// [/a/b/moduleFile1.js] file written with same contents +//// [/a/b/file1Consumer1.js] file written with same contents +//// [/a/b/file1Consumer2.js] file written with same contents + +Output:: +>> Screen clear +12:00:38 AM - File change detected. Starting incremental compilation... + + + +12:00:48 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change the content of moduleFile1 to `export var T: number;export function Foo() { console.log('hi'); };` + +//// [/a/b/moduleFile1.ts] +export var T: number;export function Foo() { console.log('hi'); }; + +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +function Foo() { console.log('hi'); } +exports.Foo = Foo; +; + + + +Output:: +>> Screen clear +12:00:52 AM - File change detected. Starting incremental compilation... + + +a/b/moduleFile1.ts(1,46): error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'. + + +12:00:56 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/moduleFile1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-detect-changes-in-non-root-files.js b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-detect-changes-in-non-root-files.js new file mode 100644 index 0000000000000..e5ca481d15a92 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-detect-changes-in-non-root-files.js @@ -0,0 +1,183 @@ +/a/lib/tsc.js --w -p /a/b/tsconfig.json +//// [/a/b/moduleFile1.ts] +export function Foo() { }; + +//// [/a/b/file1Consumer1.ts] +import {Foo} from "./moduleFile1"; export var y = 10; + +//// [/a/b/file1Consumer2.ts] +import {Foo} from "./moduleFile1"; let z = 10; + +//// [/a/b/globalFile3.ts] +interface GlobalFoo { age: number } + +//// [/a/b/moduleFile2.ts] +export var Foo4 = 10; + +//// [/a/b/tsconfig.json] +{"files":["/a/b/file1Consumer1.ts"]} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +function Foo() { } +exports.Foo = Foo; +; + + +//// [/a/b/file1Consumer1.js] +"use strict"; +exports.__esModule = true; +exports.y = 10; + + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + + +12:00:28 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change the content of moduleFile1 to `export var T: number;export function Foo() { };` + +//// [/a/b/moduleFile1.ts] +export var T: number;export function Foo() { }; + +//// [/a/b/moduleFile1.js] file written with same contents +//// [/a/b/file1Consumer1.js] file written with same contents + +Output:: +>> Screen clear +12:00:32 AM - File change detected. Starting incremental compilation... + + + +12:00:39 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: change file1 internal, and verify only file1 is affected + +//// [/a/b/moduleFile1.ts] +export var T: number;export function Foo() { };var T1: number; + +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +function Foo() { } +exports.Foo = Foo; +; +var T1; + + + +Output:: +>> Screen clear +12:00:42 AM - File change detected. Starting incremental compilation... + + + +12:00:46 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/moduleFile1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-detect-non-existing-code-file.js b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-detect-non-existing-code-file.js new file mode 100644 index 0000000000000..a68bde1d5dc39 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-detect-non-existing-code-file.js @@ -0,0 +1,187 @@ +/a/lib/tsc.js --w -p /a/b/tsconfig.json +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/referenceFile1.ts] +/// +export var x = Foo(); + +//// [/a/b/tsconfig.json] +{} + +//// [/a/b/referenceFile1.js] +"use strict"; +exports.__esModule = true; +/// +exports.x = Foo(); + + + +Output:: +>> Screen clear +12:00:15 AM - Starting compilation in watch mode... + + +a/b/referenceFile1.ts(1,22): error TS6053: File '/a/b/moduleFile2.ts' not found. + +a/b/referenceFile1.ts(2,16): error TS2304: Cannot find name 'Foo'. + + +12:00:18 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/a/b/referenceFile1.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/referenceFile1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/referenceFile1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/referencefile1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: edit refereceFile1 + +//// [/a/b/referenceFile1.ts] +/// +export var x = Foo();export var yy = Foo(); + +//// [/a/b/referenceFile1.js] +"use strict"; +exports.__esModule = true; +/// +exports.x = Foo(); +exports.yy = Foo(); + + + +Output:: +>> Screen clear +12:00:21 AM - File change detected. Starting incremental compilation... + + +a/b/referenceFile1.ts(1,22): error TS6053: File '/a/b/moduleFile2.ts' not found. + +a/b/referenceFile1.ts(2,16): error TS2304: Cannot find name 'Foo'. + +a/b/referenceFile1.ts(2,38): error TS2304: Cannot find name 'Foo'. + + +12:00:25 AM - Found 3 errors. Watching for file changes. + + +Program root files: ["/a/b/referenceFile1.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/referenceFile1.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/referenceFile1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/referencefile1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: create moduleFile2 + +//// [/a/b/referenceFile1.js] file written with same contents +//// [/a/b/moduleFile2.ts] +export var Foo4 = 10; + +//// [/a/b/moduleFile2.js] +"use strict"; +exports.__esModule = true; +exports.Foo4 = 10; + + + +Output:: +>> Screen clear +12:00:28 AM - File change detected. Starting incremental compilation... + + +a/b/referenceFile1.ts(2,16): error TS2304: Cannot find name 'Foo'. + +a/b/referenceFile1.ts(2,38): error TS2304: Cannot find name 'Foo'. + + +12:00:34 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/a/b/moduleFile2.ts","/a/b/referenceFile1.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile2.ts +/a/b/referenceFile1.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/moduleFile2.ts +/a/b/referenceFile1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/referencefile1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-detect-removed-code-file.js b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-detect-removed-code-file.js new file mode 100644 index 0000000000000..ed62ca87d5709 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-detect-removed-code-file.js @@ -0,0 +1,129 @@ +/a/lib/tsc.js --w -p /a/b/tsconfig.json +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/referenceFile1.ts] +/// +export var x = Foo(); + +//// [/a/b/moduleFile1.ts] +export function Foo() { }; + +//// [/a/b/tsconfig.json] +{} + +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +function Foo() { } +exports.Foo = Foo; +; + + +//// [/a/b/referenceFile1.js] +"use strict"; +exports.__esModule = true; +/// +exports.x = Foo(); + + + +Output:: +>> Screen clear +12:00:17 AM - Starting compilation in watch mode... + + +a/b/referenceFile1.ts(2,16): error TS2304: Cannot find name 'Foo'. + + +12:00:22 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a/b/moduleFile1.ts","/a/b/referenceFile1.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/referenceFile1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/referenceFile1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/referencefile1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: delete moduleFile1 + +//// [/a/b/referenceFile1.js] file written with same contents +//// [/a/b/moduleFile1.ts] deleted + +Output:: +>> Screen clear +12:00:24 AM - File change detected. Starting incremental compilation... + + +a/b/referenceFile1.ts(1,22): error TS6053: File '/a/b/moduleFile1.ts' not found. + +a/b/referenceFile1.ts(2,16): error TS2304: Cannot find name 'Foo'. + + +12:00:28 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/a/b/referenceFile1.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/referenceFile1.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/referenceFile1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/referencefile1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-return-all-files-if-a-global-file-changed-shape.js b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-return-all-files-if-a-global-file-changed-shape.js new file mode 100644 index 0000000000000..501a9a3e6f28a --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-return-all-files-if-a-global-file-changed-shape.js @@ -0,0 +1,181 @@ +/a/lib/tsc.js --w -p /a/b/tsconfig.json +//// [/a/b/moduleFile1.ts] +export function Foo() { }; + +//// [/a/b/file1Consumer1.ts] +import {Foo} from "./moduleFile1"; export var y = 10; + +//// [/a/b/file1Consumer2.ts] +import {Foo} from "./moduleFile1"; let z = 10; + +//// [/a/b/globalFile3.ts] +interface GlobalFoo { age: number } + +//// [/a/b/moduleFile2.ts] +export var Foo4 = 10; + +//// [/a/b/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +function Foo() { } +exports.Foo = Foo; +; + + +//// [/a/b/file1Consumer1.js] +"use strict"; +exports.__esModule = true; +exports.y = 10; + + +//// [/a/b/file1Consumer2.js] +"use strict"; +exports.__esModule = true; +var z = 10; + + +//// [/a/b/globalFile3.js] + + +//// [/a/b/moduleFile2.js] +"use strict"; +exports.__esModule = true; +exports.Foo4 = 10; + + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + + +12:00:34 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: change shape of global file + +//// [/a/b/globalFile3.ts] +interface GlobalFoo { age: number }var T2: string; + +//// [/a/b/moduleFile1.js] file written with same contents +//// [/a/b/file1Consumer1.js] file written with same contents +//// [/a/b/file1Consumer2.js] file written with same contents +//// [/a/b/globalFile3.js] +var T2; + + +//// [/a/b/moduleFile2.js] file written with same contents + +Output:: +>> Screen clear +12:00:37 AM - File change detected. Starting incremental compilation... + + + +12:00:53 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-return-cascaded-affected-file-list.js b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-return-cascaded-affected-file-list.js new file mode 100644 index 0000000000000..3903ddc256386 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-return-cascaded-affected-file-list.js @@ -0,0 +1,315 @@ +/a/lib/tsc.js --w -p /a/b/tsconfig.json +//// [/a/b/moduleFile1.ts] +export function Foo() { }; + +//// [/a/b/file1Consumer1.ts] +import {Foo} from "./moduleFile1"; export var y = 10; + +//// [/a/b/file1Consumer2.ts] +import {Foo} from "./moduleFile1"; let z = 10; + +//// [/a/b/globalFile3.ts] +interface GlobalFoo { age: number } + +//// [/a/b/moduleFile2.ts] +export var Foo4 = 10; + +//// [/a/b/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/file1Consumer1Consumer1.ts] +import {y} from "./file1Consumer1"; + +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +function Foo() { } +exports.Foo = Foo; +; + + +//// [/a/b/file1Consumer1.js] +"use strict"; +exports.__esModule = true; +exports.y = 10; + + +//// [/a/b/file1Consumer1Consumer1.js] +"use strict"; +exports.__esModule = true; + + +//// [/a/b/file1Consumer2.js] +"use strict"; +exports.__esModule = true; +var z = 10; + + +//// [/a/b/globalFile3.js] + + +//// [/a/b/moduleFile2.js] +"use strict"; +exports.__esModule = true; +exports.Foo4 = 10; + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:38 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer1consumer1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: change file1Consumer1 + +//// [/a/b/file1Consumer1.ts] +import {Foo} from "./moduleFile1"; export var y = 10;export var T: number; + +//// [/a/b/file1Consumer1.js] file written with same contents +//// [/a/b/file1Consumer1Consumer1.js] file written with same contents + +Output:: +>> Screen clear +12:00:41 AM - File change detected. Starting incremental compilation... + + + +12:00:48 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/file1Consumer1.ts +/a/b/file1Consumer1Consumer1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer1consumer1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change the content of moduleFile1 to `export var T: number;export function Foo() { };` + +//// [/a/b/moduleFile1.ts] +export var T: number;export function Foo() { }; + +//// [/a/b/moduleFile1.js] file written with same contents +//// [/a/b/file1Consumer1.js] file written with same contents +//// [/a/b/file1Consumer2.js] file written with same contents + +Output:: +>> Screen clear +12:00:52 AM - File change detected. Starting incremental compilation... + + + +12:01:02 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer1consumer1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: change file1Consumer1 and moduleFile1 + +//// [/a/b/moduleFile1.ts] +export var T2: number;export function Foo() { }; + +//// [/a/b/file1Consumer1.ts] +import {Foo} from "./moduleFile1"; export var y = 10;export var T: number;export var T2: number; + +//// [/a/b/moduleFile1.js] file written with same contents +//// [/a/b/file1Consumer1.js] file written with same contents +//// [/a/b/file1Consumer1Consumer1.js] file written with same contents +//// [/a/b/file1Consumer2.js] file written with same contents + +Output:: +>> Screen clear +12:01:08 AM - File change detected. Starting incremental compilation... + + + +12:01:21 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1Consumer1.ts","/a/b/file1Consumer1Consumer1.ts","/a/b/file1Consumer2.ts","/a/b/globalFile3.ts","/a/b/moduleFile1.ts","/a/b/moduleFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer1Consumer1.ts +/a/b/file1Consumer2.ts +/a/b/globalFile3.ts +/a/b/moduleFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/moduleFile1.ts +/a/b/file1Consumer1.ts +/a/b/file1Consumer1Consumer1.ts +/a/b/file1Consumer2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1consumer1.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} +/a/b/file1consumer1consumer1.ts: + {"pollingInterval":250} +/a/b/file1consumer2.ts: + {"pollingInterval":250} +/a/b/globalfile3.ts: + {"pollingInterval":250} +/a/b/modulefile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-work-fine-for-files-with-circular-references.js b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-work-fine-for-files-with-circular-references.js new file mode 100644 index 0000000000000..62dde04c3fc2e --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-work-fine-for-files-with-circular-references.js @@ -0,0 +1,136 @@ +/a/lib/tsc.js --w -p /a/b/tsconfig.json +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/file1.ts] +/// +export var t1 = 10; + +//// [/a/b/file2.ts] +/// +export var t2 = 10; + +//// [/a/b/tsconfig.json] +{} + +//// [/a/b/file2.js] +"use strict"; +exports.__esModule = true; +/// +exports.t2 = 10; + + +//// [/a/b/file1.js] +"use strict"; +exports.__esModule = true; +/// +exports.t1 = 10; + + + +Output:: +>> Screen clear +12:00:17 AM - Starting compilation in watch mode... + + + +12:00:22 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1.ts","/a/b/file2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/file2.ts +/a/b/file1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/file2.ts +/a/b/file1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1.ts: + {"pollingInterval":250} +/a/b/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: change file1 + +//// [/a/b/file1.ts] +/// +export var t1 = 10;export var t3 = 10; + +//// [/a/b/file2.js] file written with same contents +//// [/a/b/file1.js] +"use strict"; +exports.__esModule = true; +/// +exports.t1 = 10; +exports.t3 = 10; + + + +Output:: +>> Screen clear +12:00:25 AM - File change detected. Starting incremental compilation... + + + +12:00:32 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1.ts","/a/b/file2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/file2.ts +/a/b/file1.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/file2.ts +/a/b/file1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1.ts: + {"pollingInterval":250} +/a/b/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/config-does-not-have-out-or-outFile.js b/tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/config-does-not-have-out-or-outFile.js new file mode 100644 index 0000000000000..7a712467b9948 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/config-does-not-have-out-or-outFile.js @@ -0,0 +1,121 @@ +/a/lib/tsc.js --w -p /a/tsconfig.json +//// [/a/a.ts] +let x = 1 + +//// [/a/b.ts] +let y = 1 + +//// [/a/tsconfig.json] +{"compilerOptions":{}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/a.js] +var x = 1; + + +//// [/a/b.js] +var y = 1; + + + +Output:: +>> Screen clear +12:00:15 AM - Starting compilation in watch mode... + + + +12:00:20 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/a.ts","/a/b.ts","/a/lib/lib.d.ts"] +Program options: {"watch":true,"project":"/a/tsconfig.json","configFilePath":"/a/tsconfig.json"} +Program files:: +/a/a.ts +/a/b.ts +/a/lib/lib.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/a.ts +/a/b.ts +/a/lib/lib.d.ts + +WatchedFiles:: +/a/tsconfig.json: + {"pollingInterval":250} +/a/a.ts: + {"pollingInterval":250} +/a/b.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Make change in the file + +//// [/a/a.ts] +let x = 11 + +//// [/a/a.js] +var x = 11; + + + +Output:: +>> Screen clear +12:00:24 AM - File change detected. Starting incremental compilation... + + + +12:00:28 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/a.ts","/a/b.ts","/a/lib/lib.d.ts"] +Program options: {"watch":true,"project":"/a/tsconfig.json","configFilePath":"/a/tsconfig.json"} +Program files:: +/a/a.ts +/a/b.ts +/a/lib/lib.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/a.ts + +WatchedFiles:: +/a/tsconfig.json: + {"pollingInterval":250} +/a/a.ts: + {"pollingInterval":250} +/a/b.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/config-has-out.js b/tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/config-has-out.js new file mode 100644 index 0000000000000..552b7c197e40f --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/config-has-out.js @@ -0,0 +1,115 @@ +/a/lib/tsc.js --w -p /a/tsconfig.json +//// [/a/a.ts] +let x = 1 + +//// [/a/b.ts] +let y = 1 + +//// [/a/tsconfig.json] +{"compilerOptions":{"out":"/a/out.js"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/out.js] +var x = 1; +var y = 1; + + + +Output:: +>> Screen clear +12:00:15 AM - Starting compilation in watch mode... + + + +12:00:18 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/a.ts","/a/b.ts","/a/lib/lib.d.ts"] +Program options: {"out":"/a/out.js","watch":true,"project":"/a/tsconfig.json","configFilePath":"/a/tsconfig.json"} +Program files:: +/a/a.ts +/a/b.ts +/a/lib/lib.d.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/a/tsconfig.json: + {"pollingInterval":250} +/a/a.ts: + {"pollingInterval":250} +/a/b.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Make change in the file + +//// [/a/a.ts] +let x = 11 + +//// [/a/out.js] +var x = 11; +var y = 1; + + + +Output:: +>> Screen clear +12:00:22 AM - File change detected. Starting incremental compilation... + + + +12:00:26 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/a.ts","/a/b.ts","/a/lib/lib.d.ts"] +Program options: {"out":"/a/out.js","watch":true,"project":"/a/tsconfig.json","configFilePath":"/a/tsconfig.json"} +Program files:: +/a/a.ts +/a/b.ts +/a/lib/lib.d.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/a/tsconfig.json: + {"pollingInterval":250} +/a/a.ts: + {"pollingInterval":250} +/a/b.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/config-has-outFile.js b/tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/config-has-outFile.js new file mode 100644 index 0000000000000..3f9c8189e4647 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/config-has-outFile.js @@ -0,0 +1,115 @@ +/a/lib/tsc.js --w -p /a/tsconfig.json +//// [/a/a.ts] +let x = 1 + +//// [/a/b.ts] +let y = 1 + +//// [/a/tsconfig.json] +{"compilerOptions":{"outFile":"/a/out.js"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/out.js] +var x = 1; +var y = 1; + + + +Output:: +>> Screen clear +12:00:15 AM - Starting compilation in watch mode... + + + +12:00:18 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/a.ts","/a/b.ts","/a/lib/lib.d.ts"] +Program options: {"outFile":"/a/out.js","watch":true,"project":"/a/tsconfig.json","configFilePath":"/a/tsconfig.json"} +Program files:: +/a/a.ts +/a/b.ts +/a/lib/lib.d.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/a/tsconfig.json: + {"pollingInterval":250} +/a/a.ts: + {"pollingInterval":250} +/a/b.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Make change in the file + +//// [/a/a.ts] +let x = 11 + +//// [/a/out.js] +var x = 11; +var y = 1; + + + +Output:: +>> Screen clear +12:00:22 AM - File change detected. Starting incremental compilation... + + + +12:00:26 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/a.ts","/a/b.ts","/a/lib/lib.d.ts"] +Program options: {"outFile":"/a/out.js","watch":true,"project":"/a/tsconfig.json","configFilePath":"/a/tsconfig.json"} +Program files:: +/a/a.ts +/a/b.ts +/a/lib/lib.d.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/a/tsconfig.json: + {"pollingInterval":250} +/a/a.ts: + {"pollingInterval":250} +/a/b.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/with---outFile-and-multiple-declaration-files-in-the-program.js b/tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/with---outFile-and-multiple-declaration-files-in-the-program.js new file mode 100644 index 0000000000000..b3d73ed09c8a1 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/with---outFile-and-multiple-declaration-files-in-the-program.js @@ -0,0 +1,89 @@ +/a/lib/tsc.js --w -p /a/b/project/tsconfig.json +//// [/a/b/output/AnotherDependency/file1.d.ts] +declare namespace Common.SomeComponent.DynamicMenu { enum Z { Full = 0, Min = 1, Average = 2, } } + +//// [/a/b/dependencies/file2.d.ts] +declare namespace Dependencies.SomeComponent { export class SomeClass { version: string; } } + +//// [/a/b/project/src/main.ts] +namespace Main { export function fooBar() {} } + +//// [/a/b/project/src/main2.ts] +namespace main.file4 { import DynamicMenu = Common.SomeComponent.DynamicMenu; export function foo(a: DynamicMenu.z) { } } + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/project/tsconfig.json] +{"compilerOptions":{"outFile":"../output/common.js","target":"es5"},"files":["/a/b/output/AnotherDependency/file1.d.ts","/a/b/dependencies/file2.d.ts","/a/b/project/src/main.ts","/a/b/project/src/main2.ts"]} + +//// [/a/b/output/common.js] +var Main; +(function (Main) { + function fooBar() { } + Main.fooBar = fooBar; +})(Main || (Main = {})); +var main; +(function (main) { + var file4; + (function (file4) { + function foo(a) { } + file4.foo = foo; + })(file4 = main.file4 || (main.file4 = {})); +})(main || (main = {})); + + + +Output:: +>> Screen clear +12:00:31 AM - Starting compilation in watch mode... + + +a/b/project/src/main2.ts(1,114): error TS2694: Namespace 'Common.SomeComponent.DynamicMenu' has no exported member 'z'. + + +12:00:34 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a/b/output/AnotherDependency/file1.d.ts","/a/b/dependencies/file2.d.ts","/a/b/project/src/main.ts","/a/b/project/src/main2.ts"] +Program options: {"outFile":"/a/b/output/common.js","target":1,"watch":true,"project":"/a/b/project/tsconfig.json","configFilePath":"/a/b/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/output/AnotherDependency/file1.d.ts +/a/b/dependencies/file2.d.ts +/a/b/project/src/main.ts +/a/b/project/src/main2.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/a/b/project/tsconfig.json: + {"pollingInterval":250} +/a/b/output/anotherdependency/file1.d.ts: + {"pollingInterval":250} +/a/b/dependencies/file2.d.ts: + {"pollingInterval":250} +/a/b/project/src/main.ts: + {"pollingInterval":250} +/a/b/project/src/main2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/without---outFile-and-multiple-declaration-files-in-the-program.js b/tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/without---outFile-and-multiple-declaration-files-in-the-program.js new file mode 100644 index 0000000000000..f1c7bd64bcb1a --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/emit-with-outFile-or-out-setting/without---outFile-and-multiple-declaration-files-in-the-program.js @@ -0,0 +1,97 @@ +/a/lib/tsc.js --w -p /a/b/project/tsconfig.json +//// [/a/b/output/AnotherDependency/file1.d.ts] +declare namespace Common.SomeComponent.DynamicMenu { enum Z { Full = 0, Min = 1, Average = 2, } } + +//// [/a/b/dependencies/file2.d.ts] +declare namespace Dependencies.SomeComponent { export class SomeClass { version: string; } } + +//// [/a/b/project/src/main.ts] +namespace Main { export function fooBar() {} } + +//// [/a/b/project/src/main2.ts] +namespace main.file4 { import DynamicMenu = Common.SomeComponent.DynamicMenu; export function foo(a: DynamicMenu.z) { } } + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/project/tsconfig.json] +{"compilerOptions":{"outDir":"../output","target":"es5"},"files":["/a/b/output/AnotherDependency/file1.d.ts","/a/b/dependencies/file2.d.ts","/a/b/project/src/main.ts","/a/b/project/src/main2.ts"]} + +//// [/a/b/output/main.js] +var Main; +(function (Main) { + function fooBar() { } + Main.fooBar = fooBar; +})(Main || (Main = {})); + + +//// [/a/b/output/main2.js] +var main; +(function (main) { + var file4; + (function (file4) { + function foo(a) { } + file4.foo = foo; + })(file4 = main.file4 || (main.file4 = {})); +})(main || (main = {})); + + + +Output:: +>> Screen clear +12:00:31 AM - Starting compilation in watch mode... + + +a/b/project/src/main2.ts(1,114): error TS2694: Namespace 'Common.SomeComponent.DynamicMenu' has no exported member 'z'. + + +12:00:36 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a/b/output/AnotherDependency/file1.d.ts","/a/b/dependencies/file2.d.ts","/a/b/project/src/main.ts","/a/b/project/src/main2.ts"] +Program options: {"outDir":"/a/b/output","target":1,"watch":true,"project":"/a/b/project/tsconfig.json","configFilePath":"/a/b/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/output/AnotherDependency/file1.d.ts +/a/b/dependencies/file2.d.ts +/a/b/project/src/main.ts +/a/b/project/src/main2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/output/AnotherDependency/file1.d.ts +/a/b/dependencies/file2.d.ts +/a/b/project/src/main.ts +/a/b/project/src/main2.ts + +WatchedFiles:: +/a/b/project/tsconfig.json: + {"pollingInterval":250} +/a/b/output/anotherdependency/file1.d.ts: + {"pollingInterval":250} +/a/b/dependencies/file2.d.ts: + {"pollingInterval":250} +/a/b/project/src/main.ts: + {"pollingInterval":250} +/a/b/project/src/main2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emit/when-module-emit-is-specified-as-node/when-instead-of-filechanged-recursive-directory-watcher-is-invoked.js b/tests/baselines/reference/tscWatch/emit/when-module-emit-is-specified-as-node/when-instead-of-filechanged-recursive-directory-watcher-is-invoked.js new file mode 100644 index 0000000000000..c5a3ce67c6824 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emit/when-module-emit-is-specified-as-node/when-instead-of-filechanged-recursive-directory-watcher-is-invoked.js @@ -0,0 +1,124 @@ +/a/lib/tsc.js --w --p /a/rootFolder/project/tsconfig.json +//// [/a/rootFolder/project/tsconfig.json] +{"compilerOptions":{"module":"none","allowJs":true,"outDir":"Static/scripts/"},"include":["Scripts/**/*"]} + +//// [/a/rootFolder/project/Scripts/TypeScript.ts] +var z = 10; + +//// [/a/rootFolder/project/Scripts/Javascript.js] +var zz = 10; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/rootFolder/project/Static/scripts/Javascript.js] +var zz = 10; + + +//// [/a/rootFolder/project/Static/scripts/TypeScript.js] +var z = 10; + + + +Output:: +>> Screen clear +12:00:21 AM - Starting compilation in watch mode... + + + +12:00:31 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/rootFolder/project/Scripts/Javascript.js","/a/rootFolder/project/Scripts/TypeScript.ts"] +Program options: {"module":0,"allowJs":true,"outDir":"/a/rootFolder/project/Static/scripts","watch":true,"project":"/a/rootFolder/project/tsconfig.json","configFilePath":"/a/rootFolder/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/rootFolder/project/Scripts/Javascript.js +/a/rootFolder/project/Scripts/TypeScript.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/rootFolder/project/Scripts/Javascript.js +/a/rootFolder/project/Scripts/TypeScript.ts + +WatchedFiles:: +/a/rootfolder/project/tsconfig.json: + {"pollingInterval":250} +/a/rootfolder/project/scripts/javascript.js: + {"pollingInterval":250} +/a/rootfolder/project/scripts/typescript.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/rootfolder/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/rootfolder/project/scripts: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Modify typescript file + +//// [/a/rootFolder/project/Scripts/TypeScript.ts] +var zz30 = 100; + +//// [/a/rootFolder/project/Static/scripts/Javascript.js] file written with same contents +//// [/a/rootFolder/project/Static/scripts/TypeScript.js] +var zz30 = 100; + + + +Output:: +>> Screen clear +12:00:34 AM - File change detected. Starting incremental compilation... + + + +12:00:41 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/rootFolder/project/Scripts/Javascript.js","/a/rootFolder/project/Scripts/TypeScript.ts"] +Program options: {"module":0,"allowJs":true,"outDir":"/a/rootFolder/project/Static/scripts","watch":true,"project":"/a/rootFolder/project/tsconfig.json","configFilePath":"/a/rootFolder/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/rootFolder/project/Scripts/Javascript.js +/a/rootFolder/project/Scripts/TypeScript.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/rootFolder/project/Scripts/Javascript.js +/a/rootFolder/project/Scripts/TypeScript.ts + +WatchedFiles:: +/a/rootfolder/project/tsconfig.json: + {"pollingInterval":250} +/a/rootfolder/project/scripts/javascript.js: + {"pollingInterval":250} +/a/rootfolder/project/scripts/typescript.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/rootfolder/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/rootfolder/project/scripts: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js new file mode 100644 index 0000000000000..de49e62d1ec0f --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js @@ -0,0 +1,206 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +import {B} from './b'; +declare var console: any; +let b = new B(); +console.log(b.c.d); + +//// [/user/username/projects/myproject/b.ts] +import {C} from './c'; +export class B +{ + c = new C(); +} + +//// [/user/username/projects/myproject/c.ts] +export class C +{ + d = 1; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"isolatedModules":true,"declaration":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +var C = /** @class */ (function () { + function C() { + this.d = 1; + } + return C; +}()); +exports.C = C; + + +//// [/user/username/projects/myproject/c.d.ts] +export declare class C { + d: number; +} + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; +var c_1 = require("./c"); +var B = /** @class */ (function () { + function B() { + this.c = new c_1.C(); + } + return B; +}()); +exports.B = B; + + +//// [/user/username/projects/myproject/b.d.ts] +import { C } from './c'; +export declare class B { + c: C; +} + + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var b = new b_1.B(); +console.log(b.c.d); + + +//// [/user/username/projects/myproject/a.d.ts] +export {}; + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:38 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"isolatedModules":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property d to d2 of class C + +//// [/user/username/projects/myproject/c.ts] +export class C +{ + d2 = 1; +} + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +var C = /** @class */ (function () { + function C() { + this.d2 = 1; + } + return C; +}()); +exports.C = C; + + +//// [/user/username/projects/myproject/c.d.ts] +export declare class C { + d2: number; +} + + +//// [/user/username/projects/myproject/b.d.ts] file written with same contents +//// [/user/username/projects/myproject/a.d.ts] file written with same contents + +Output:: +>> Screen clear +12:00:42 AM - File change detected. Starting incremental compilation... + + +a.ts(4,17): error TS2339: Property 'd' does not exist on type 'C'. + + +12:00:55 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"isolatedModules":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js new file mode 100644 index 0000000000000..bd094e89cbcfe --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js @@ -0,0 +1,153 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +import {B} from './b'; +declare var console: any; +let b = new B(); +console.log(b.c.d); + +//// [/user/username/projects/myproject/b.d.ts] +import {C} from './c'; +export class B +{ + c: C; +} + +//// [/user/username/projects/myproject/c.d.ts] +export class C +{ + d: number; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"isolatedModules":true,"declaration":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var b = new b_1.B(); +console.log(b.c.d); + + +//// [/user/username/projects/myproject/a.d.ts] +export {}; + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] +Program options: {"isolatedModules":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property d to d2 of class C + +//// [/user/username/projects/myproject/c.d.ts] +export class C +{ + d2: number; +} + +//// [/user/username/projects/myproject/a.d.ts] file written with same contents + +Output:: +>> Screen clear +12:00:34 AM - File change detected. Starting incremental compilation... + + +a.ts(4,17): error TS2339: Property 'd' does not exist on type 'C'. + + +12:00:38 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] +Program options: {"isolatedModules":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js new file mode 100644 index 0000000000000..a507c5e46b8be --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js @@ -0,0 +1,257 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x2: number; + y: number; +} + +//// [/user/username/projects/myproject/b.ts] +import { Point } from "./a"; +export interface PointWrapper extends Point { +} + +//// [/user/username/projects/myproject/c.ts] +import { PointWrapper } from "./b"; +export function getPoint(): PointWrapper { + return { + name: "test", + c: { + x: 1, + y: 2 + } + } +}; + +//// [/user/username/projects/myproject/d.ts] +import { getPoint } from "./c"; +getPoint().c.x; + +//// [/user/username/projects/myproject/e.ts] +import "./d"; + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"isolatedModules":true,"declaration":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/a.d.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x2: number; + y: number; +} + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/b.d.ts] +import { Point } from "./a"; +export interface PointWrapper extends Point { +} + + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +function getPoint() { + return { + name: "test", + c: { + x: 1, + y: 2 + } + }; +} +exports.getPoint = getPoint; +; + + +//// [/user/username/projects/myproject/c.d.ts] +import { PointWrapper } from "./b"; +export declare function getPoint(): PointWrapper; + + +//// [/user/username/projects/myproject/d.js] +"use strict"; +exports.__esModule = true; +var c_1 = require("./c"); +c_1.getPoint().c.x; + + +//// [/user/username/projects/myproject/d.d.ts] +export {}; + + +//// [/user/username/projects/myproject/e.js] +"use strict"; +exports.__esModule = true; +require("./d"); + + +//// [/user/username/projects/myproject/e.d.ts] +import "./d"; + + + +Output:: +>> Screen clear +12:00:29 AM - Starting compilation in watch mode... + + +c.ts(6,13): error TS2322: Type '{ x: number; y: number; }' is not assignable to type 'Coords'. + Object literal may only specify known properties, and 'x' does not exist in type 'Coords'. + +d.ts(2,14): error TS2339: Property 'x' does not exist on type 'Coords'. + + +12:00:50 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] +Program options: {"isolatedModules":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/user/username/projects/myproject/d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/e.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property x2 to x of interface Coords + +//// [/user/username/projects/myproject/a.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x: number; + y: number; +} + +//// [/user/username/projects/myproject/a.js] file written with same contents +//// [/user/username/projects/myproject/a.d.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x: number; + y: number; +} + + +//// [/user/username/projects/myproject/b.d.ts] file written with same contents +//// [/user/username/projects/myproject/c.d.ts] file written with same contents +//// [/user/username/projects/myproject/d.d.ts] file written with same contents + +Output:: +>> Screen clear +12:00:54 AM - File change detected. Starting incremental compilation... + + + +12:01:10 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] +Program options: {"isolatedModules":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/user/username/projects/myproject/d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/e.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js new file mode 100644 index 0000000000000..55c2e9a201a57 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js @@ -0,0 +1,310 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title: string; +} + +//// [/user/username/projects/myproject/lib1/tools/public.ts] +export * from "./tools.interface"; + +//// [/user/username/projects/myproject/app.ts] +import { Data } from "lib2/public"; +export class App { + public constructor() { + new Data().test(); + } +} + +//// [/user/username/projects/myproject/lib2/public.ts] +export * from "./data"; + +//// [/user/username/projects/myproject/lib1/public.ts] +export * from "./tools/public"; + +//// [/user/username/projects/myproject/lib2/data.ts] +import { ITest } from "lib1/public"; import { Data2 } from "./data2"; +export class Data { + public dat?: Data2; public test() { + const result: ITest = { + title: "title" + } + return result; + } +} + +//// [/user/username/projects/myproject/lib2/data2.ts] +import { Data } from "./data"; +export class Data2 { + public dat?: Data; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"files":["app.ts"],"compilerOptions":{"baseUrl":".","isolatedModules":true,"declaration":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.d.ts] +export interface ITest { + title: string; +} + + +//// [/user/username/projects/myproject/lib1/tools/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./tools.interface")); + + +//// [/user/username/projects/myproject/lib1/tools/public.d.ts] +export * from "./tools.interface"; + + +//// [/user/username/projects/myproject/lib1/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./tools/public")); + + +//// [/user/username/projects/myproject/lib1/public.d.ts] +export * from "./tools/public"; + + +//// [/user/username/projects/myproject/lib2/data2.js] +"use strict"; +exports.__esModule = true; +var Data2 = /** @class */ (function () { + function Data2() { + } + return Data2; +}()); +exports.Data2 = Data2; + + +//// [/user/username/projects/myproject/lib2/data2.d.ts] +import { Data } from "./data"; +export declare class Data2 { + dat?: Data; +} + + +//// [/user/username/projects/myproject/lib2/data.js] +"use strict"; +exports.__esModule = true; +var Data = /** @class */ (function () { + function Data() { + } + Data.prototype.test = function () { + var result = { + title: "title" + }; + return result; + }; + return Data; +}()); +exports.Data = Data; + + +//// [/user/username/projects/myproject/lib2/data.d.ts] +import { ITest } from "lib1/public"; +import { Data2 } from "./data2"; +export declare class Data { + dat?: Data2; + test(): ITest; +} + + +//// [/user/username/projects/myproject/lib2/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./data")); + + +//// [/user/username/projects/myproject/lib2/public.d.ts] +export * from "./data"; + + +//// [/user/username/projects/myproject/app.js] +"use strict"; +exports.__esModule = true; +var public_1 = require("lib2/public"); +var App = /** @class */ (function () { + function App() { + new public_1.Data().test(); + } + return App; +}()); +exports.App = App; + + +//// [/user/username/projects/myproject/app.d.ts] +export declare class App { + constructor(); +} + + + +Output:: +>> Screen clear +12:00:39 AM - Starting compilation in watch mode... + + + +12:01:08 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","isolatedModules":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property title to title2 of interface ITest + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title2: string; +} + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/tools.interface.d.ts] +export interface ITest { + title2: string; +} + + +//// [/user/username/projects/myproject/lib1/tools/public.d.ts] file written with same contents +//// [/user/username/projects/myproject/lib1/public.d.ts] file written with same contents +//// [/user/username/projects/myproject/lib2/data2.d.ts] file written with same contents +//// [/user/username/projects/myproject/lib2/data.d.ts] file written with same contents +//// [/user/username/projects/myproject/lib2/public.d.ts] file written with same contents +//// [/user/username/projects/myproject/app.d.ts] file written with same contents + +Output:: +>> Screen clear +12:01:12 AM - File change detected. Starting incremental compilation... + + +lib2/data.ts(5,13): error TS2322: Type '{ title: string; }' is not assignable to type 'ITest'. + Object literal may only specify known properties, but 'title' does not exist in type 'ITest'. Did you mean to write 'title2'? + + +12:01:37 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","isolatedModules":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js new file mode 100644 index 0000000000000..b40aaf14401a9 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js @@ -0,0 +1,275 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title: string; +} + +//// [/user/username/projects/myproject/lib1/tools/public.ts] +export * from "./tools.interface"; + +//// [/user/username/projects/myproject/app.ts] +import { Data } from "lib2/public"; +export class App { + public constructor() { + new Data().test(); + } +} + +//// [/user/username/projects/myproject/lib2/public.ts] +export * from "./data"; + +//// [/user/username/projects/myproject/lib1/public.ts] +export * from "./tools/public"; + +//// [/user/username/projects/myproject/lib2/data.ts] +import { ITest } from "lib1/public"; +export class Data { + public test() { + const result: ITest = { + title: "title" + } + return result; + } +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"files":["app.ts"],"compilerOptions":{"baseUrl":".","isolatedModules":true,"declaration":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.d.ts] +export interface ITest { + title: string; +} + + +//// [/user/username/projects/myproject/lib1/tools/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./tools.interface")); + + +//// [/user/username/projects/myproject/lib1/tools/public.d.ts] +export * from "./tools.interface"; + + +//// [/user/username/projects/myproject/lib1/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./tools/public")); + + +//// [/user/username/projects/myproject/lib1/public.d.ts] +export * from "./tools/public"; + + +//// [/user/username/projects/myproject/lib2/data.js] +"use strict"; +exports.__esModule = true; +var Data = /** @class */ (function () { + function Data() { + } + Data.prototype.test = function () { + var result = { + title: "title" + }; + return result; + }; + return Data; +}()); +exports.Data = Data; + + +//// [/user/username/projects/myproject/lib2/data.d.ts] +import { ITest } from "lib1/public"; +export declare class Data { + test(): ITest; +} + + +//// [/user/username/projects/myproject/lib2/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./data")); + + +//// [/user/username/projects/myproject/lib2/public.d.ts] +export * from "./data"; + + +//// [/user/username/projects/myproject/app.js] +"use strict"; +exports.__esModule = true; +var public_1 = require("lib2/public"); +var App = /** @class */ (function () { + function App() { + new public_1.Data().test(); + } + return App; +}()); +exports.App = App; + + +//// [/user/username/projects/myproject/app.d.ts] +export declare class App { + constructor(); +} + + + +Output:: +>> Screen clear +12:00:37 AM - Starting compilation in watch mode... + + + +12:01:02 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","isolatedModules":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property title to title2 of interface ITest + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title2: string; +} + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/tools.interface.d.ts] +export interface ITest { + title2: string; +} + + +//// [/user/username/projects/myproject/lib1/tools/public.d.ts] file written with same contents +//// [/user/username/projects/myproject/lib1/public.d.ts] file written with same contents +//// [/user/username/projects/myproject/lib2/data.d.ts] file written with same contents +//// [/user/username/projects/myproject/lib2/public.d.ts] file written with same contents +//// [/user/username/projects/myproject/app.d.ts] file written with same contents + +Output:: +>> Screen clear +12:01:06 AM - File change detected. Starting incremental compilation... + + +lib2/data.ts(5,13): error TS2322: Type '{ title: string; }' is not assignable to type 'ITest'. + Object literal may only specify known properties, but 'title' does not exist in type 'ITest'. Did you mean to write 'title2'? + + +12:01:28 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","isolatedModules":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/with-noEmitOnError.js new file mode 100644 index 0000000000000..f969e10b19ab5 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules-and---declaration/with-noEmitOnError.js @@ -0,0 +1,165 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/noEmitOnError/shared/types/db.ts] +export interface A { + name: string; +} + +//// [/user/username/projects/noEmitOnError/src/main.ts] +import { A } from "../shared/types/db"; +const a = { + lastName: 'sdsd' +; + +//// [/user/username/projects/noEmitOnError/src/other.ts] +console.log("hi"); +export { } + +//// [/user/username/projects/noEmitOnError/tsconfig.json] +{"compilerOptions":{"outDir":"./dev-build","noEmitOnError":true,"isolatedModules":true,"declaration":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + + +Output:: +>> Screen clear +12:00:31 AM - Starting compilation in watch mode... + + +src/main.ts(4,1): error TS1005: ',' expected. + + +12:00:32 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"isolatedModules":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +WatchedFiles:: +/user/username/projects/noemitonerror/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/noemitonerror/shared/types/db.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/main.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/other.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/noemitonerror/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/noemitonerror: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Fix the error + +//// [/user/username/projects/noEmitOnError/src/main.ts] +import { A } from "../shared/types/db"; +const a = { + lastName: 'sdsd' +}; + +//// [/user/username/projects/noEmitOnError/dev-build/shared/types/db.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/noEmitOnError/dev-build/shared/types/db.d.ts] +export interface A { + name: string; +} + + +//// [/user/username/projects/noEmitOnError/dev-build/src/main.js] +"use strict"; +exports.__esModule = true; +var a = { + lastName: 'sdsd' +}; + + +//// [/user/username/projects/noEmitOnError/dev-build/src/main.d.ts] +export {}; + + +//// [/user/username/projects/noEmitOnError/dev-build/src/other.js] +"use strict"; +exports.__esModule = true; +console.log("hi"); + + +//// [/user/username/projects/noEmitOnError/dev-build/src/other.d.ts] +export {}; + + + +Output:: +>> Screen clear +12:00:36 AM - File change detected. Starting incremental compilation... + + + +12:00:59 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"isolatedModules":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/noEmitOnError/src/main.ts + +WatchedFiles:: +/user/username/projects/noemitonerror/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/noemitonerror/shared/types/db.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/main.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/other.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/noemitonerror/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/noemitonerror: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/deep-import-changes/updates-errors-when-deep-import-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/deep-import-changes/updates-errors-when-deep-import-file-changes.js new file mode 100644 index 0000000000000..cb95ec6df3b84 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/deep-import-changes/updates-errors-when-deep-import-file-changes.js @@ -0,0 +1,181 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +import {B} from './b'; +declare var console: any; +let b = new B(); +console.log(b.c.d); + +//// [/user/username/projects/myproject/b.ts] +import {C} from './c'; +export class B +{ + c = new C(); +} + +//// [/user/username/projects/myproject/c.ts] +export class C +{ + d = 1; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"isolatedModules":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +var C = /** @class */ (function () { + function C() { + this.d = 1; + } + return C; +}()); +exports.C = C; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; +var c_1 = require("./c"); +var B = /** @class */ (function () { + function B() { + this.c = new c_1.C(); + } + return B; +}()); +exports.B = B; + + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var b = new b_1.B(); +console.log(b.c.d); + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:32 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"isolatedModules":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property d to d2 of class C + +//// [/user/username/projects/myproject/c.ts] +export class C +{ + d2 = 1; +} + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +var C = /** @class */ (function () { + function C() { + this.d2 = 1; + } + return C; +}()); +exports.C = C; + + + +Output:: +>> Screen clear +12:00:36 AM - File change detected. Starting incremental compilation... + + +a.ts(4,17): error TS2339: Property 'd' does not exist on type 'C'. + + +12:00:40 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"isolatedModules":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js new file mode 100644 index 0000000000000..f5efcb6a554b4 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js @@ -0,0 +1,148 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +import {B} from './b'; +declare var console: any; +let b = new B(); +console.log(b.c.d); + +//// [/user/username/projects/myproject/b.d.ts] +import {C} from './c'; +export class B +{ + c: C; +} + +//// [/user/username/projects/myproject/c.d.ts] +export class C +{ + d: number; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"isolatedModules":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var b = new b_1.B(); +console.log(b.c.d); + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:28 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] +Program options: {"isolatedModules":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property d to d2 of class C + +//// [/user/username/projects/myproject/c.d.ts] +export class C +{ + d2: number; +} + + +Output:: +>> Screen clear +12:00:32 AM - File change detected. Starting incremental compilation... + + +a.ts(4,17): error TS2339: Property 'd' does not exist on type 'C'. + + +12:00:33 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] +Program options: {"isolatedModules":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js new file mode 100644 index 0000000000000..02df1af92eaa5 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js @@ -0,0 +1,213 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x2: number; + y: number; +} + +//// [/user/username/projects/myproject/b.ts] +import { Point } from "./a"; +export interface PointWrapper extends Point { +} + +//// [/user/username/projects/myproject/c.ts] +import { PointWrapper } from "./b"; +export function getPoint(): PointWrapper { + return { + name: "test", + c: { + x: 1, + y: 2 + } + } +}; + +//// [/user/username/projects/myproject/d.ts] +import { getPoint } from "./c"; +getPoint().c.x; + +//// [/user/username/projects/myproject/e.ts] +import "./d"; + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"isolatedModules":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +function getPoint() { + return { + name: "test", + c: { + x: 1, + y: 2 + } + }; +} +exports.getPoint = getPoint; +; + + +//// [/user/username/projects/myproject/d.js] +"use strict"; +exports.__esModule = true; +var c_1 = require("./c"); +c_1.getPoint().c.x; + + +//// [/user/username/projects/myproject/e.js] +"use strict"; +exports.__esModule = true; +require("./d"); + + + +Output:: +>> Screen clear +12:00:29 AM - Starting compilation in watch mode... + + +c.ts(6,13): error TS2322: Type '{ x: number; y: number; }' is not assignable to type 'Coords'. + Object literal may only specify known properties, and 'x' does not exist in type 'Coords'. + +d.ts(2,14): error TS2339: Property 'x' does not exist on type 'Coords'. + + +12:00:40 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] +Program options: {"isolatedModules":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/user/username/projects/myproject/d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/e.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property x2 to x of interface Coords + +//// [/user/username/projects/myproject/a.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x: number; + y: number; +} + +//// [/user/username/projects/myproject/a.js] file written with same contents + +Output:: +>> Screen clear +12:00:44 AM - File change detected. Starting incremental compilation... + + + +12:00:48 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] +Program options: {"isolatedModules":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/user/username/projects/myproject/d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/e.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js new file mode 100644 index 0000000000000..3afafdf7b60d5 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js @@ -0,0 +1,258 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title: string; +} + +//// [/user/username/projects/myproject/lib1/tools/public.ts] +export * from "./tools.interface"; + +//// [/user/username/projects/myproject/app.ts] +import { Data } from "lib2/public"; +export class App { + public constructor() { + new Data().test(); + } +} + +//// [/user/username/projects/myproject/lib2/public.ts] +export * from "./data"; + +//// [/user/username/projects/myproject/lib1/public.ts] +export * from "./tools/public"; + +//// [/user/username/projects/myproject/lib2/data.ts] +import { ITest } from "lib1/public"; import { Data2 } from "./data2"; +export class Data { + public dat?: Data2; public test() { + const result: ITest = { + title: "title" + } + return result; + } +} + +//// [/user/username/projects/myproject/lib2/data2.ts] +import { Data } from "./data"; +export class Data2 { + public dat?: Data; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"files":["app.ts"],"compilerOptions":{"baseUrl":".","isolatedModules":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./tools.interface")); + + +//// [/user/username/projects/myproject/lib1/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./tools/public")); + + +//// [/user/username/projects/myproject/lib2/data2.js] +"use strict"; +exports.__esModule = true; +var Data2 = /** @class */ (function () { + function Data2() { + } + return Data2; +}()); +exports.Data2 = Data2; + + +//// [/user/username/projects/myproject/lib2/data.js] +"use strict"; +exports.__esModule = true; +var Data = /** @class */ (function () { + function Data() { + } + Data.prototype.test = function () { + var result = { + title: "title" + }; + return result; + }; + return Data; +}()); +exports.Data = Data; + + +//// [/user/username/projects/myproject/lib2/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./data")); + + +//// [/user/username/projects/myproject/app.js] +"use strict"; +exports.__esModule = true; +var public_1 = require("lib2/public"); +var App = /** @class */ (function () { + function App() { + new public_1.Data().test(); + } + return App; +}()); +exports.App = App; + + + +Output:: +>> Screen clear +12:00:39 AM - Starting compilation in watch mode... + + + +12:00:54 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","isolatedModules":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property title to title2 of interface ITest + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title2: string; +} + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] file written with same contents + +Output:: +>> Screen clear +12:00:58 AM - File change detected. Starting incremental compilation... + + +lib2/data.ts(5,13): error TS2322: Type '{ title: string; }' is not assignable to type 'ITest'. + Object literal may only specify known properties, but 'title' does not exist in type 'ITest'. Did you mean to write 'title2'? + + +12:01:02 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","isolatedModules":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js new file mode 100644 index 0000000000000..273b2ec39d5f2 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js @@ -0,0 +1,233 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title: string; +} + +//// [/user/username/projects/myproject/lib1/tools/public.ts] +export * from "./tools.interface"; + +//// [/user/username/projects/myproject/app.ts] +import { Data } from "lib2/public"; +export class App { + public constructor() { + new Data().test(); + } +} + +//// [/user/username/projects/myproject/lib2/public.ts] +export * from "./data"; + +//// [/user/username/projects/myproject/lib1/public.ts] +export * from "./tools/public"; + +//// [/user/username/projects/myproject/lib2/data.ts] +import { ITest } from "lib1/public"; +export class Data { + public test() { + const result: ITest = { + title: "title" + } + return result; + } +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"files":["app.ts"],"compilerOptions":{"baseUrl":".","isolatedModules":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./tools.interface")); + + +//// [/user/username/projects/myproject/lib1/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./tools/public")); + + +//// [/user/username/projects/myproject/lib2/data.js] +"use strict"; +exports.__esModule = true; +var Data = /** @class */ (function () { + function Data() { + } + Data.prototype.test = function () { + var result = { + title: "title" + }; + return result; + }; + return Data; +}()); +exports.Data = Data; + + +//// [/user/username/projects/myproject/lib2/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./data")); + + +//// [/user/username/projects/myproject/app.js] +"use strict"; +exports.__esModule = true; +var public_1 = require("lib2/public"); +var App = /** @class */ (function () { + function App() { + new public_1.Data().test(); + } + return App; +}()); +exports.App = App; + + + +Output:: +>> Screen clear +12:00:37 AM - Starting compilation in watch mode... + + + +12:00:50 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","isolatedModules":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property title to title2 of interface ITest + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title2: string; +} + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] file written with same contents + +Output:: +>> Screen clear +12:00:54 AM - File change detected. Starting incremental compilation... + + +lib2/data.ts(5,13): error TS2322: Type '{ title: string; }' is not assignable to type 'ITest'. + Object literal may only specify known properties, but 'title' does not exist in type 'ITest'. Did you mean to write 'title2'? + + +12:00:58 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","isolatedModules":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/with-noEmitOnError.js new file mode 100644 index 0000000000000..7ef63242fc5fe --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---isolatedModules/with-noEmitOnError.js @@ -0,0 +1,151 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/noEmitOnError/shared/types/db.ts] +export interface A { + name: string; +} + +//// [/user/username/projects/noEmitOnError/src/main.ts] +import { A } from "../shared/types/db"; +const a = { + lastName: 'sdsd' +; + +//// [/user/username/projects/noEmitOnError/src/other.ts] +console.log("hi"); +export { } + +//// [/user/username/projects/noEmitOnError/tsconfig.json] +{"compilerOptions":{"outDir":"./dev-build","noEmitOnError":true,"isolatedModules":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + + +Output:: +>> Screen clear +12:00:31 AM - Starting compilation in watch mode... + + +src/main.ts(4,1): error TS1005: ',' expected. + + +12:00:32 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"isolatedModules":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +WatchedFiles:: +/user/username/projects/noemitonerror/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/noemitonerror/shared/types/db.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/main.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/other.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/noemitonerror/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/noemitonerror: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Fix the error + +//// [/user/username/projects/noEmitOnError/src/main.ts] +import { A } from "../shared/types/db"; +const a = { + lastName: 'sdsd' +}; + +//// [/user/username/projects/noEmitOnError/dev-build/shared/types/db.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/noEmitOnError/dev-build/src/main.js] +"use strict"; +exports.__esModule = true; +var a = { + lastName: 'sdsd' +}; + + +//// [/user/username/projects/noEmitOnError/dev-build/src/other.js] +"use strict"; +exports.__esModule = true; +console.log("hi"); + + + +Output:: +>> Screen clear +12:00:36 AM - File change detected. Starting incremental compilation... + + + +12:00:53 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"isolatedModules":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/noEmitOnError/src/main.ts + +WatchedFiles:: +/user/username/projects/noemitonerror/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/noemitonerror/shared/types/db.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/main.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/other.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/noemitonerror/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/noemitonerror: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js new file mode 100644 index 0000000000000..dee07ade221ef --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js @@ -0,0 +1,207 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +import {B} from './b'; +declare var console: any; +let b = new B(); +console.log(b.c.d); + +//// [/user/username/projects/myproject/b.ts] +import {C} from './c'; +export class B +{ + c = new C(); +} + +//// [/user/username/projects/myproject/c.ts] +export class C +{ + d = 1; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"declaration":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +var C = /** @class */ (function () { + function C() { + this.d = 1; + } + return C; +}()); +exports.C = C; + + +//// [/user/username/projects/myproject/c.d.ts] +export declare class C { + d: number; +} + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; +var c_1 = require("./c"); +var B = /** @class */ (function () { + function B() { + this.c = new c_1.C(); + } + return B; +}()); +exports.B = B; + + +//// [/user/username/projects/myproject/b.d.ts] +import { C } from './c'; +export declare class B { + c: C; +} + + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var b = new b_1.B(); +console.log(b.c.d); + + +//// [/user/username/projects/myproject/a.d.ts] +export {}; + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:38 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property d to d2 of class C + +//// [/user/username/projects/myproject/c.ts] +export class C +{ + d2 = 1; +} + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +var C = /** @class */ (function () { + function C() { + this.d2 = 1; + } + return C; +}()); +exports.C = C; + + +//// [/user/username/projects/myproject/c.d.ts] +export declare class C { + d2: number; +} + + +//// [/user/username/projects/myproject/b.js] file written with same contents +//// [/user/username/projects/myproject/b.d.ts] file written with same contents +//// [/user/username/projects/myproject/a.d.ts] file written with same contents + +Output:: +>> Screen clear +12:00:42 AM - File change detected. Starting incremental compilation... + + +a.ts(4,17): error TS2339: Property 'd' does not exist on type 'C'. + + +12:00:58 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js new file mode 100644 index 0000000000000..42cce174695d7 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js @@ -0,0 +1,153 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +import {B} from './b'; +declare var console: any; +let b = new B(); +console.log(b.c.d); + +//// [/user/username/projects/myproject/b.d.ts] +import {C} from './c'; +export class B +{ + c: C; +} + +//// [/user/username/projects/myproject/c.d.ts] +export class C +{ + d: number; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"declaration":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var b = new b_1.B(); +console.log(b.c.d); + + +//// [/user/username/projects/myproject/a.d.ts] +export {}; + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] +Program options: {"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property d to d2 of class C + +//// [/user/username/projects/myproject/c.d.ts] +export class C +{ + d2: number; +} + +//// [/user/username/projects/myproject/a.d.ts] file written with same contents + +Output:: +>> Screen clear +12:00:34 AM - File change detected. Starting incremental compilation... + + +a.ts(4,17): error TS2339: Property 'd' does not exist on type 'C'. + + +12:00:38 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] +Program options: {"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js new file mode 100644 index 0000000000000..0f5a270c4d2bf --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js @@ -0,0 +1,258 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x2: number; + y: number; +} + +//// [/user/username/projects/myproject/b.ts] +import { Point } from "./a"; +export interface PointWrapper extends Point { +} + +//// [/user/username/projects/myproject/c.ts] +import { PointWrapper } from "./b"; +export function getPoint(): PointWrapper { + return { + name: "test", + c: { + x: 1, + y: 2 + } + } +}; + +//// [/user/username/projects/myproject/d.ts] +import { getPoint } from "./c"; +getPoint().c.x; + +//// [/user/username/projects/myproject/e.ts] +import "./d"; + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"declaration":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/a.d.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x2: number; + y: number; +} + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/b.d.ts] +import { Point } from "./a"; +export interface PointWrapper extends Point { +} + + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +function getPoint() { + return { + name: "test", + c: { + x: 1, + y: 2 + } + }; +} +exports.getPoint = getPoint; +; + + +//// [/user/username/projects/myproject/c.d.ts] +import { PointWrapper } from "./b"; +export declare function getPoint(): PointWrapper; + + +//// [/user/username/projects/myproject/d.js] +"use strict"; +exports.__esModule = true; +var c_1 = require("./c"); +c_1.getPoint().c.x; + + +//// [/user/username/projects/myproject/d.d.ts] +export {}; + + +//// [/user/username/projects/myproject/e.js] +"use strict"; +exports.__esModule = true; +require("./d"); + + +//// [/user/username/projects/myproject/e.d.ts] +import "./d"; + + + +Output:: +>> Screen clear +12:00:29 AM - Starting compilation in watch mode... + + +c.ts(6,13): error TS2322: Type '{ x: number; y: number; }' is not assignable to type 'Coords'. + Object literal may only specify known properties, and 'x' does not exist in type 'Coords'. + +d.ts(2,14): error TS2339: Property 'x' does not exist on type 'Coords'. + + +12:00:50 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] +Program options: {"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/user/username/projects/myproject/d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/e.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property x2 to x of interface Coords + +//// [/user/username/projects/myproject/a.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x: number; + y: number; +} + +//// [/user/username/projects/myproject/a.js] file written with same contents +//// [/user/username/projects/myproject/a.d.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x: number; + y: number; +} + + +//// [/user/username/projects/myproject/b.js] file written with same contents +//// [/user/username/projects/myproject/b.d.ts] file written with same contents +//// [/user/username/projects/myproject/c.d.ts] file written with same contents +//// [/user/username/projects/myproject/d.d.ts] file written with same contents + +Output:: +>> Screen clear +12:00:54 AM - File change detected. Starting incremental compilation... + + + +12:01:13 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] +Program options: {"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/user/username/projects/myproject/d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/e.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js new file mode 100644 index 0000000000000..6f6c17dcd8465 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js @@ -0,0 +1,303 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title: string; +} + +//// [/user/username/projects/myproject/lib1/tools/public.ts] +export * from "./tools.interface"; + +//// [/user/username/projects/myproject/app.ts] +import { Data } from "lib2/public"; +export class App { + public constructor() { + new Data().test(); + } +} + +//// [/user/username/projects/myproject/lib2/public.ts] +export * from "./data"; + +//// [/user/username/projects/myproject/lib1/public.ts] +export * from "./tools/public"; + +//// [/user/username/projects/myproject/lib2/data.ts] +import { ITest } from "lib1/public"; import { Data2 } from "./data2"; +export class Data { + public dat?: Data2; public test() { + const result: ITest = { + title: "title" + } + return result; + } +} + +//// [/user/username/projects/myproject/lib2/data2.ts] +import { Data } from "./data"; +export class Data2 { + public dat?: Data; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"files":["app.ts"],"compilerOptions":{"baseUrl":".","declaration":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.d.ts] +export interface ITest { + title: string; +} + + +//// [/user/username/projects/myproject/lib1/tools/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/public.d.ts] +export * from "./tools.interface"; + + +//// [/user/username/projects/myproject/lib1/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/public.d.ts] +export * from "./tools/public"; + + +//// [/user/username/projects/myproject/lib2/data2.js] +"use strict"; +exports.__esModule = true; +var Data2 = /** @class */ (function () { + function Data2() { + } + return Data2; +}()); +exports.Data2 = Data2; + + +//// [/user/username/projects/myproject/lib2/data2.d.ts] +import { Data } from "./data"; +export declare class Data2 { + dat?: Data; +} + + +//// [/user/username/projects/myproject/lib2/data.js] +"use strict"; +exports.__esModule = true; +var Data = /** @class */ (function () { + function Data() { + } + Data.prototype.test = function () { + var result = { + title: "title" + }; + return result; + }; + return Data; +}()); +exports.Data = Data; + + +//// [/user/username/projects/myproject/lib2/data.d.ts] +import { ITest } from "lib1/public"; +import { Data2 } from "./data2"; +export declare class Data { + dat?: Data2; + test(): ITest; +} + + +//// [/user/username/projects/myproject/lib2/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./data")); + + +//// [/user/username/projects/myproject/lib2/public.d.ts] +export * from "./data"; + + +//// [/user/username/projects/myproject/app.js] +"use strict"; +exports.__esModule = true; +var public_1 = require("lib2/public"); +var App = /** @class */ (function () { + function App() { + new public_1.Data().test(); + } + return App; +}()); +exports.App = App; + + +//// [/user/username/projects/myproject/app.d.ts] +export declare class App { + constructor(); +} + + + +Output:: +>> Screen clear +12:00:39 AM - Starting compilation in watch mode... + + + +12:01:08 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property title to title2 of interface ITest + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title2: string; +} + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/tools.interface.d.ts] +export interface ITest { + title2: string; +} + + +//// [/user/username/projects/myproject/lib1/tools/public.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/public.d.ts] file written with same contents +//// [/user/username/projects/myproject/lib1/public.d.ts] file written with same contents +//// [/user/username/projects/myproject/lib2/data2.d.ts] file written with same contents +//// [/user/username/projects/myproject/lib2/data.d.ts] file written with same contents +//// [/user/username/projects/myproject/lib2/public.d.ts] file written with same contents +//// [/user/username/projects/myproject/app.d.ts] file written with same contents + +Output:: +>> Screen clear +12:01:12 AM - File change detected. Starting incremental compilation... + + +lib2/data.ts(5,13): error TS2322: Type '{ title: string; }' is not assignable to type 'ITest'. + Object literal may only specify known properties, but 'title' does not exist in type 'ITest'. Did you mean to write 'title2'? + + +12:01:40 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js new file mode 100644 index 0000000000000..64e72a39a7306 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js @@ -0,0 +1,268 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title: string; +} + +//// [/user/username/projects/myproject/lib1/tools/public.ts] +export * from "./tools.interface"; + +//// [/user/username/projects/myproject/app.ts] +import { Data } from "lib2/public"; +export class App { + public constructor() { + new Data().test(); + } +} + +//// [/user/username/projects/myproject/lib2/public.ts] +export * from "./data"; + +//// [/user/username/projects/myproject/lib1/public.ts] +export * from "./tools/public"; + +//// [/user/username/projects/myproject/lib2/data.ts] +import { ITest } from "lib1/public"; +export class Data { + public test() { + const result: ITest = { + title: "title" + } + return result; + } +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"files":["app.ts"],"compilerOptions":{"baseUrl":".","declaration":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.d.ts] +export interface ITest { + title: string; +} + + +//// [/user/username/projects/myproject/lib1/tools/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/public.d.ts] +export * from "./tools.interface"; + + +//// [/user/username/projects/myproject/lib1/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/public.d.ts] +export * from "./tools/public"; + + +//// [/user/username/projects/myproject/lib2/data.js] +"use strict"; +exports.__esModule = true; +var Data = /** @class */ (function () { + function Data() { + } + Data.prototype.test = function () { + var result = { + title: "title" + }; + return result; + }; + return Data; +}()); +exports.Data = Data; + + +//// [/user/username/projects/myproject/lib2/data.d.ts] +import { ITest } from "lib1/public"; +export declare class Data { + test(): ITest; +} + + +//// [/user/username/projects/myproject/lib2/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./data")); + + +//// [/user/username/projects/myproject/lib2/public.d.ts] +export * from "./data"; + + +//// [/user/username/projects/myproject/app.js] +"use strict"; +exports.__esModule = true; +var public_1 = require("lib2/public"); +var App = /** @class */ (function () { + function App() { + new public_1.Data().test(); + } + return App; +}()); +exports.App = App; + + +//// [/user/username/projects/myproject/app.d.ts] +export declare class App { + constructor(); +} + + + +Output:: +>> Screen clear +12:00:37 AM - Starting compilation in watch mode... + + + +12:01:02 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property title to title2 of interface ITest + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title2: string; +} + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/tools.interface.d.ts] +export interface ITest { + title2: string; +} + + +//// [/user/username/projects/myproject/lib1/tools/public.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/public.d.ts] file written with same contents +//// [/user/username/projects/myproject/lib1/public.d.ts] file written with same contents +//// [/user/username/projects/myproject/lib2/data.d.ts] file written with same contents +//// [/user/username/projects/myproject/lib2/public.d.ts] file written with same contents +//// [/user/username/projects/myproject/app.d.ts] file written with same contents + +Output:: +>> Screen clear +12:01:06 AM - File change detected. Starting incremental compilation... + + +lib2/data.ts(5,13): error TS2322: Type '{ title: string; }' is not assignable to type 'ITest'. + Object literal may only specify known properties, but 'title' does not exist in type 'ITest'. Did you mean to write 'title2'? + + +12:01:31 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/with-noEmitOnError.js new file mode 100644 index 0000000000000..3494626c5d27a --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config-and---declaration/with-noEmitOnError.js @@ -0,0 +1,165 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/noEmitOnError/shared/types/db.ts] +export interface A { + name: string; +} + +//// [/user/username/projects/noEmitOnError/src/main.ts] +import { A } from "../shared/types/db"; +const a = { + lastName: 'sdsd' +; + +//// [/user/username/projects/noEmitOnError/src/other.ts] +console.log("hi"); +export { } + +//// [/user/username/projects/noEmitOnError/tsconfig.json] +{"compilerOptions":{"outDir":"./dev-build","noEmitOnError":true,"declaration":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + + +Output:: +>> Screen clear +12:00:31 AM - Starting compilation in watch mode... + + +src/main.ts(4,1): error TS1005: ',' expected. + + +12:00:32 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +WatchedFiles:: +/user/username/projects/noemitonerror/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/noemitonerror/shared/types/db.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/main.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/other.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/noemitonerror/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/noemitonerror: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Fix the error + +//// [/user/username/projects/noEmitOnError/src/main.ts] +import { A } from "../shared/types/db"; +const a = { + lastName: 'sdsd' +}; + +//// [/user/username/projects/noEmitOnError/dev-build/shared/types/db.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/noEmitOnError/dev-build/shared/types/db.d.ts] +export interface A { + name: string; +} + + +//// [/user/username/projects/noEmitOnError/dev-build/src/main.js] +"use strict"; +exports.__esModule = true; +var a = { + lastName: 'sdsd' +}; + + +//// [/user/username/projects/noEmitOnError/dev-build/src/main.d.ts] +export {}; + + +//// [/user/username/projects/noEmitOnError/dev-build/src/other.js] +"use strict"; +exports.__esModule = true; +console.log("hi"); + + +//// [/user/username/projects/noEmitOnError/dev-build/src/other.d.ts] +export {}; + + + +Output:: +>> Screen clear +12:00:36 AM - File change detected. Starting incremental compilation... + + + +12:00:59 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/noEmitOnError/src/main.ts + +WatchedFiles:: +/user/username/projects/noemitonerror/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/noemitonerror/shared/types/db.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/main.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/other.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/noemitonerror/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/noemitonerror: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/deep-import-changes/updates-errors-when-deep-import-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/deep-import-changes/updates-errors-when-deep-import-file-changes.js new file mode 100644 index 0000000000000..2f0957c1688e8 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/deep-import-changes/updates-errors-when-deep-import-file-changes.js @@ -0,0 +1,182 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +import {B} from './b'; +declare var console: any; +let b = new B(); +console.log(b.c.d); + +//// [/user/username/projects/myproject/b.ts] +import {C} from './c'; +export class B +{ + c = new C(); +} + +//// [/user/username/projects/myproject/c.ts] +export class C +{ + d = 1; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +var C = /** @class */ (function () { + function C() { + this.d = 1; + } + return C; +}()); +exports.C = C; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; +var c_1 = require("./c"); +var B = /** @class */ (function () { + function B() { + this.c = new c_1.C(); + } + return B; +}()); +exports.B = B; + + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var b = new b_1.B(); +console.log(b.c.d); + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:32 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property d to d2 of class C + +//// [/user/username/projects/myproject/c.ts] +export class C +{ + d2 = 1; +} + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +var C = /** @class */ (function () { + function C() { + this.d2 = 1; + } + return C; +}()); +exports.C = C; + + +//// [/user/username/projects/myproject/b.js] file written with same contents + +Output:: +>> Screen clear +12:00:36 AM - File change detected. Starting incremental compilation... + + +a.ts(4,17): error TS2339: Property 'd' does not exist on type 'C'. + + +12:00:43 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js new file mode 100644 index 0000000000000..b25db78b7bee6 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js @@ -0,0 +1,148 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +import {B} from './b'; +declare var console: any; +let b = new B(); +console.log(b.c.d); + +//// [/user/username/projects/myproject/b.d.ts] +import {C} from './c'; +export class B +{ + c: C; +} + +//// [/user/username/projects/myproject/c.d.ts] +export class C +{ + d: number; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var b = new b_1.B(); +console.log(b.c.d); + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:28 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property d to d2 of class C + +//// [/user/username/projects/myproject/c.d.ts] +export class C +{ + d2: number; +} + + +Output:: +>> Screen clear +12:00:32 AM - File change detected. Starting incremental compilation... + + +a.ts(4,17): error TS2339: Property 'd' does not exist on type 'C'. + + +12:00:33 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js new file mode 100644 index 0000000000000..321ea493c6364 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js @@ -0,0 +1,214 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x2: number; + y: number; +} + +//// [/user/username/projects/myproject/b.ts] +import { Point } from "./a"; +export interface PointWrapper extends Point { +} + +//// [/user/username/projects/myproject/c.ts] +import { PointWrapper } from "./b"; +export function getPoint(): PointWrapper { + return { + name: "test", + c: { + x: 1, + y: 2 + } + } +}; + +//// [/user/username/projects/myproject/d.ts] +import { getPoint } from "./c"; +getPoint().c.x; + +//// [/user/username/projects/myproject/e.ts] +import "./d"; + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +function getPoint() { + return { + name: "test", + c: { + x: 1, + y: 2 + } + }; +} +exports.getPoint = getPoint; +; + + +//// [/user/username/projects/myproject/d.js] +"use strict"; +exports.__esModule = true; +var c_1 = require("./c"); +c_1.getPoint().c.x; + + +//// [/user/username/projects/myproject/e.js] +"use strict"; +exports.__esModule = true; +require("./d"); + + + +Output:: +>> Screen clear +12:00:29 AM - Starting compilation in watch mode... + + +c.ts(6,13): error TS2322: Type '{ x: number; y: number; }' is not assignable to type 'Coords'. + Object literal may only specify known properties, and 'x' does not exist in type 'Coords'. + +d.ts(2,14): error TS2339: Property 'x' does not exist on type 'Coords'. + + +12:00:40 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/user/username/projects/myproject/d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/e.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property x2 to x of interface Coords + +//// [/user/username/projects/myproject/a.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x: number; + y: number; +} + +//// [/user/username/projects/myproject/a.js] file written with same contents +//// [/user/username/projects/myproject/b.js] file written with same contents + +Output:: +>> Screen clear +12:00:44 AM - File change detected. Starting incremental compilation... + + + +12:00:51 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/user/username/projects/myproject/d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/e.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js new file mode 100644 index 0000000000000..914e3c4e6d5f6 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js @@ -0,0 +1,251 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title: string; +} + +//// [/user/username/projects/myproject/lib1/tools/public.ts] +export * from "./tools.interface"; + +//// [/user/username/projects/myproject/app.ts] +import { Data } from "lib2/public"; +export class App { + public constructor() { + new Data().test(); + } +} + +//// [/user/username/projects/myproject/lib2/public.ts] +export * from "./data"; + +//// [/user/username/projects/myproject/lib1/public.ts] +export * from "./tools/public"; + +//// [/user/username/projects/myproject/lib2/data.ts] +import { ITest } from "lib1/public"; import { Data2 } from "./data2"; +export class Data { + public dat?: Data2; public test() { + const result: ITest = { + title: "title" + } + return result; + } +} + +//// [/user/username/projects/myproject/lib2/data2.ts] +import { Data } from "./data"; +export class Data2 { + public dat?: Data; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"files":["app.ts"],"compilerOptions":{"baseUrl":"."}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib2/data2.js] +"use strict"; +exports.__esModule = true; +var Data2 = /** @class */ (function () { + function Data2() { + } + return Data2; +}()); +exports.Data2 = Data2; + + +//// [/user/username/projects/myproject/lib2/data.js] +"use strict"; +exports.__esModule = true; +var Data = /** @class */ (function () { + function Data() { + } + Data.prototype.test = function () { + var result = { + title: "title" + }; + return result; + }; + return Data; +}()); +exports.Data = Data; + + +//// [/user/username/projects/myproject/lib2/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./data")); + + +//// [/user/username/projects/myproject/app.js] +"use strict"; +exports.__esModule = true; +var public_1 = require("lib2/public"); +var App = /** @class */ (function () { + function App() { + new public_1.Data().test(); + } + return App; +}()); +exports.App = App; + + + +Output:: +>> Screen clear +12:00:39 AM - Starting compilation in watch mode... + + + +12:00:54 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property title to title2 of interface ITest + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title2: string; +} + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/public.js] file written with same contents + +Output:: +>> Screen clear +12:00:58 AM - File change detected. Starting incremental compilation... + + +lib2/data.ts(5,13): error TS2322: Type '{ title: string; }' is not assignable to type 'ITest'. + Object literal may only specify known properties, but 'title' does not exist in type 'ITest'. Did you mean to write 'title2'? + + +12:01:05 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js new file mode 100644 index 0000000000000..2560229ebe163 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js @@ -0,0 +1,226 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title: string; +} + +//// [/user/username/projects/myproject/lib1/tools/public.ts] +export * from "./tools.interface"; + +//// [/user/username/projects/myproject/app.ts] +import { Data } from "lib2/public"; +export class App { + public constructor() { + new Data().test(); + } +} + +//// [/user/username/projects/myproject/lib2/public.ts] +export * from "./data"; + +//// [/user/username/projects/myproject/lib1/public.ts] +export * from "./tools/public"; + +//// [/user/username/projects/myproject/lib2/data.ts] +import { ITest } from "lib1/public"; +export class Data { + public test() { + const result: ITest = { + title: "title" + } + return result; + } +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"files":["app.ts"],"compilerOptions":{"baseUrl":"."}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib2/data.js] +"use strict"; +exports.__esModule = true; +var Data = /** @class */ (function () { + function Data() { + } + Data.prototype.test = function () { + var result = { + title: "title" + }; + return result; + }; + return Data; +}()); +exports.Data = Data; + + +//// [/user/username/projects/myproject/lib2/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./data")); + + +//// [/user/username/projects/myproject/app.js] +"use strict"; +exports.__esModule = true; +var public_1 = require("lib2/public"); +var App = /** @class */ (function () { + function App() { + new public_1.Data().test(); + } + return App; +}()); +exports.App = App; + + + +Output:: +>> Screen clear +12:00:37 AM - Starting compilation in watch mode... + + + +12:00:50 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property title to title2 of interface ITest + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title2: string; +} + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/public.js] file written with same contents + +Output:: +>> Screen clear +12:00:54 AM - File change detected. Starting incremental compilation... + + +lib2/data.ts(5,13): error TS2322: Type '{ title: string; }' is not assignable to type 'ITest'. + Object literal may only specify known properties, but 'title' does not exist in type 'ITest'. Did you mean to write 'title2'? + + +12:01:01 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/with-noEmitOnError.js new file mode 100644 index 0000000000000..2f9453a80d4be --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/with-default-config/with-noEmitOnError.js @@ -0,0 +1,157 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/noEmitOnError/shared/types/db.ts] +export interface A { + name: string; +} + +//// [/user/username/projects/noEmitOnError/src/main.ts] +import { A } from "../shared/types/db"; +const a = { + lastName: 'sdsd' +; + +//// [/user/username/projects/noEmitOnError/src/other.ts] +console.log("hi"); +export { } + +//// [/user/username/projects/noEmitOnError/tsconfig.json] +{ + "compilerOptions": { + "outDir": "./dev-build", + "noEmitOnError": true + } +} + + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + + +Output:: +>> Screen clear +12:00:31 AM - Starting compilation in watch mode... + + +src/main.ts(4,1): error TS1005: ',' expected. + + +12:00:32 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +WatchedFiles:: +/user/username/projects/noemitonerror/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/noemitonerror/shared/types/db.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/main.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/other.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/noemitonerror/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/noemitonerror: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Fix the error + +//// [/user/username/projects/noEmitOnError/src/main.ts] +import { A } from "../shared/types/db"; +const a = { + lastName: 'sdsd' +}; + +//// [/user/username/projects/noEmitOnError/dev-build/shared/types/db.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/noEmitOnError/dev-build/src/main.js] +"use strict"; +exports.__esModule = true; +var a = { + lastName: 'sdsd' +}; + + +//// [/user/username/projects/noEmitOnError/dev-build/src/other.js] +"use strict"; +exports.__esModule = true; +console.log("hi"); + + + +Output:: +>> Screen clear +12:00:36 AM - File change detected. Starting incremental compilation... + + + +12:00:53 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/noEmitOnError/src/main.ts + +WatchedFiles:: +/user/username/projects/noemitonerror/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/noemitonerror/shared/types/db.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/main.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/other.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/noemitonerror/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/noemitonerror: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-changing-module-name-with-different-casing.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-changing-module-name-with-different-casing.js new file mode 100644 index 0000000000000..0699a327607da --- /dev/null +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-changing-module-name-with-different-casing.js @@ -0,0 +1,136 @@ +/a/lib/tsc.js --w --p /user/username/projects/myproject/tsconfig.json +//// [/user/username/projects/myproject/logger.ts] +export class logger { } + +//// [/user/username/projects/myproject/another.ts] +import { logger } from "./logger"; new logger(); + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"forceConsistentCasingInFileNames":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/logger.js] +"use strict"; +exports.__esModule = true; +var logger = /** @class */ (function () { + function logger() { + } + return logger; +}()); +exports.logger = logger; + + +//// [/user/username/projects/myproject/another.js] +"use strict"; +exports.__esModule = true; +var logger_1 = require("./logger"); +new logger_1.logger(); + + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + + +12:00:28 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/another.ts","/user/username/projects/myproject/logger.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/logger.ts +/user/username/projects/myproject/another.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/logger.ts +/user/username/projects/myproject/another.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/another.ts: + {"pollingInterval":250} +/user/username/projects/myproject/logger.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change module name from logger to Logger + +//// [/user/username/projects/myproject/another.ts] +import { logger } from "./Logger"; new logger(); + +//// [/user/username/projects/myproject/another.js] +"use strict"; +exports.__esModule = true; +var Logger_1 = require("./Logger"); +new Logger_1.logger(); + + + +Output:: +>> Screen clear +12:00:32 AM - File change detected. Starting incremental compilation... + + +user/username/projects/myproject/another.ts(1,24): error TS1261: Already included file name '/user/username/projects/myproject/Logger.ts' differs from file name '/user/username/projects/myproject/logger.ts' only in casing. + + +12:00:36 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/another.ts","/user/username/projects/myproject/logger.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/Logger.ts +/user/username/projects/myproject/another.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/another.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/another.ts: + {"pollingInterval":250} +/user/username/projects/myproject/logger.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-renaming-file-with-different-casing.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-renaming-file-with-different-casing.js new file mode 100644 index 0000000000000..2ae4f94e04592 --- /dev/null +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-renaming-file-with-different-casing.js @@ -0,0 +1,126 @@ +/a/lib/tsc.js --w --p /user/username/projects/myproject/tsconfig.json +//// [/user/username/projects/myproject/logger.ts] +export class logger { } + +//// [/user/username/projects/myproject/another.ts] +import { logger } from "./logger"; new logger(); + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"forceConsistentCasingInFileNames":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/logger.js] +"use strict"; +exports.__esModule = true; +var logger = /** @class */ (function () { + function logger() { + } + return logger; +}()); +exports.logger = logger; + + +//// [/user/username/projects/myproject/another.js] +"use strict"; +exports.__esModule = true; +var logger_1 = require("./logger"); +new logger_1.logger(); + + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + + +12:00:28 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/another.ts","/user/username/projects/myproject/logger.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/logger.ts +/user/username/projects/myproject/another.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/logger.ts +/user/username/projects/myproject/another.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/another.ts: + {"pollingInterval":250} +/user/username/projects/myproject/logger.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change name of file from logger to Logger + +//// [/user/username/projects/myproject/Logger.ts] file was renamed from file /user/username/projects/myproject/logger.ts + +Output:: +>> Screen clear +12:00:32 AM - File change detected. Starting incremental compilation... + + +user/username/projects/myproject/another.ts(1,24): error TS1149: File name '/user/username/projects/myproject/logger.ts' differs from already included file name '/user/username/projects/myproject/Logger.ts' only in casing. + + +12:00:33 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/Logger.ts","/user/username/projects/myproject/another.ts"] +Program options: {"forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/Logger.ts +/user/username/projects/myproject/another.ts + +Semantic diagnostics in builder refreshed for:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/another.ts: + {"pollingInterval":250} +/user/username/projects/myproject/logger.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/incremental/incremental-with-circular-references-incremental.js b/tests/baselines/reference/tscWatch/incremental/incremental-with-circular-references-incremental.js new file mode 100644 index 0000000000000..8e627672dfc05 --- /dev/null +++ b/tests/baselines/reference/tscWatch/incremental/incremental-with-circular-references-incremental.js @@ -0,0 +1,296 @@ +/a/lib/tsc.js -i +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/users/username/projects/project/a.ts] +import { B } from "./b"; +export interface A { + b: B; +} + + +//// [/users/username/projects/project/b.ts] +import { C } from "./c"; +export interface B { + b: C; +} + + +//// [/users/username/projects/project/c.ts] +import { A } from "./a"; +export interface C { + a: A; +} + + +//// [/users/username/projects/project/index.ts] +export { A } from "./a"; +export { B } from "./b"; +export { C } from "./c"; + + +//// [/users/username/projects/project/tsconfig.json] +{"compilerOptions":{"incremental":true,"target":"es5","module":"commonjs","declaration":true,"emitDeclarationOnly":true}} + +//// [/users/username/projects/project/c.d.ts] +import { A } from "./a"; +export interface C { + a: A; +} + + +//// [/users/username/projects/project/b.d.ts] +import { C } from "./c"; +export interface B { + b: C; +} + + +//// [/users/username/projects/project/a.d.ts] +import { B } from "./b"; +export interface A { + b: B; +} + + +//// [/users/username/projects/project/index.d.ts] +export { A } from "./a"; +export { B } from "./b"; +export { C } from "./c"; + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./c.ts": { + "version": "-3358372745-import { A } from \"./a\";\nexport interface C {\n a: A;\n}\n", + "signature": "-3358372745-import { A } from \"./a\";\nexport interface C {\n a: A;\n}\n" + }, + "./b.ts": { + "version": "2102342013-import { C } from \"./c\";\nexport interface B {\n b: C;\n}\n", + "signature": "2102342013-import { C } from \"./c\";\nexport interface B {\n b: C;\n}\n" + }, + "./a.ts": { + "version": "-9690779495-import { B } from \"./b\";\nexport interface A {\n b: B;\n}\n", + "signature": "-9690779495-import { B } from \"./b\";\nexport interface A {\n b: B;\n}\n" + }, + "./index.ts": { + "version": "1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n", + "signature": "1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n" + } + }, + "options": { + "incremental": true, + "target": 1, + "module": 1, + "declaration": true, + "emitDeclarationOnly": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./a.ts": [ + "./b.ts" + ], + "./b.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./a.ts" + ], + "./index.ts": [ + "./a.ts", + "./b.ts", + "./c.ts" + ] + }, + "exportedModulesMap": { + "./a.ts": [ + "./b.ts" + ], + "./b.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./a.ts" + ], + "./index.ts": [ + "./a.ts", + "./b.ts", + "./c.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +Program root files: ["/users/username/projects/project/a.ts","/users/username/projects/project/b.ts","/users/username/projects/project/c.ts","/users/username/projects/project/index.ts"] +Program options: {"incremental":true,"target":1,"module":1,"declaration":true,"emitDeclarationOnly":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/c.ts +/users/username/projects/project/b.ts +/users/username/projects/project/a.ts +/users/username/projects/project/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/users/username/projects/project/c.ts +/users/username/projects/project/b.ts +/users/username/projects/project/a.ts +/users/username/projects/project/index.ts + +WatchedFiles:: + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.Success + +Change:: + +//// [/users/username/projects/project/a.ts] +import { B } from "./b"; +export interface A { + b: B; + foo: any; +} + + +//// [/users/username/projects/project/c.d.ts] file written with same contents +//// [/users/username/projects/project/b.d.ts] file written with same contents +//// [/users/username/projects/project/a.d.ts] +import { B } from "./b"; +export interface A { + b: B; + foo: any; +} + + +//// [/users/username/projects/project/index.d.ts] file written with same contents +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./c.ts": { + "version": "-3358372745-import { A } from \"./a\";\nexport interface C {\n a: A;\n}\n", + "signature": "-3358372745-import { A } from \"./a\";\nexport interface C {\n a: A;\n}\n" + }, + "./b.ts": { + "version": "2102342013-import { C } from \"./c\";\nexport interface B {\n b: C;\n}\n", + "signature": "2102342013-import { C } from \"./c\";\nexport interface B {\n b: C;\n}\n" + }, + "./a.ts": { + "version": "-7623824316-import { B } from \"./b\";\nexport interface A {\n b: B;\n foo: any;\n}\n", + "signature": "-7623824316-import { B } from \"./b\";\nexport interface A {\n b: B;\n foo: any;\n}\n" + }, + "./index.ts": { + "version": "1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n", + "signature": "1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n" + } + }, + "options": { + "incremental": true, + "target": 1, + "module": 1, + "declaration": true, + "emitDeclarationOnly": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./a.ts": [ + "./b.ts" + ], + "./b.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./a.ts" + ], + "./index.ts": [ + "./a.ts", + "./b.ts", + "./c.ts" + ] + }, + "exportedModulesMap": { + "./a.ts": [ + "./b.ts" + ], + "./b.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./a.ts" + ], + "./index.ts": [ + "./a.ts", + "./b.ts", + "./c.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +Program root files: ["/users/username/projects/project/a.ts","/users/username/projects/project/b.ts","/users/username/projects/project/c.ts","/users/username/projects/project/index.ts"] +Program options: {"incremental":true,"target":1,"module":1,"declaration":true,"emitDeclarationOnly":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/c.ts +/users/username/projects/project/b.ts +/users/username/projects/project/a.ts +/users/username/projects/project/index.ts + +Semantic diagnostics in builder refreshed for:: +/users/username/projects/project/c.ts +/users/username/projects/project/b.ts +/users/username/projects/project/a.ts +/users/username/projects/project/index.ts + +WatchedFiles:: + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.Success diff --git a/tests/baselines/reference/tscWatch/incremental/incremental-with-circular-references-watch.js b/tests/baselines/reference/tscWatch/incremental/incremental-with-circular-references-watch.js new file mode 100644 index 0000000000000..160f65078ec0d --- /dev/null +++ b/tests/baselines/reference/tscWatch/incremental/incremental-with-circular-references-watch.js @@ -0,0 +1,344 @@ +/a/lib/tsc.js -w +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/users/username/projects/project/a.ts] +import { B } from "./b"; +export interface A { + b: B; +} + + +//// [/users/username/projects/project/b.ts] +import { C } from "./c"; +export interface B { + b: C; +} + + +//// [/users/username/projects/project/c.ts] +import { A } from "./a"; +export interface C { + a: A; +} + + +//// [/users/username/projects/project/index.ts] +export { A } from "./a"; +export { B } from "./b"; +export { C } from "./c"; + + +//// [/users/username/projects/project/tsconfig.json] +{"compilerOptions":{"incremental":true,"target":"es5","module":"commonjs","declaration":true,"emitDeclarationOnly":true}} + +//// [/users/username/projects/project/c.d.ts] +import { A } from "./a"; +export interface C { + a: A; +} + + +//// [/users/username/projects/project/b.d.ts] +import { C } from "./c"; +export interface B { + b: C; +} + + +//// [/users/username/projects/project/a.d.ts] +import { B } from "./b"; +export interface A { + b: B; +} + + +//// [/users/username/projects/project/index.d.ts] +export { A } from "./a"; +export { B } from "./b"; +export { C } from "./c"; + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./c.ts": { + "version": "-3358372745-import { A } from \"./a\";\nexport interface C {\n a: A;\n}\n", + "signature": "-3358372745-import { A } from \"./a\";\nexport interface C {\n a: A;\n}\n" + }, + "./b.ts": { + "version": "2102342013-import { C } from \"./c\";\nexport interface B {\n b: C;\n}\n", + "signature": "2102342013-import { C } from \"./c\";\nexport interface B {\n b: C;\n}\n" + }, + "./a.ts": { + "version": "-9690779495-import { B } from \"./b\";\nexport interface A {\n b: B;\n}\n", + "signature": "-9690779495-import { B } from \"./b\";\nexport interface A {\n b: B;\n}\n" + }, + "./index.ts": { + "version": "1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n", + "signature": "1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n" + } + }, + "options": { + "incremental": true, + "target": 1, + "module": 1, + "declaration": true, + "emitDeclarationOnly": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./a.ts": [ + "./b.ts" + ], + "./b.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./a.ts" + ], + "./index.ts": [ + "./a.ts", + "./b.ts", + "./c.ts" + ] + }, + "exportedModulesMap": { + "./a.ts": [ + "./b.ts" + ], + "./b.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./a.ts" + ], + "./index.ts": [ + "./a.ts", + "./b.ts", + "./c.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:27 AM - Starting compilation in watch mode... + + + +12:00:38 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/users/username/projects/project/a.ts","/users/username/projects/project/b.ts","/users/username/projects/project/c.ts","/users/username/projects/project/index.ts"] +Program options: {"incremental":true,"target":1,"module":1,"declaration":true,"emitDeclarationOnly":true,"watch":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/c.ts +/users/username/projects/project/b.ts +/users/username/projects/project/a.ts +/users/username/projects/project/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/users/username/projects/project/c.ts +/users/username/projects/project/b.ts +/users/username/projects/project/a.ts +/users/username/projects/project/index.ts + +WatchedFiles:: +/users/username/projects/project/tsconfig.json: + {"pollingInterval":250} +/users/username/projects/project/a.ts: + {"pollingInterval":250} +/users/username/projects/project/b.ts: + {"pollingInterval":250} +/users/username/projects/project/c.ts: + {"pollingInterval":250} +/users/username/projects/project/index.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/users/username/projects/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/users/username/projects/project: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: + +//// [/users/username/projects/project/a.ts] +import { B } from "./b"; +export interface A { + b: B; + foo: any; +} + + +//// [/users/username/projects/project/c.d.ts] file written with same contents +//// [/users/username/projects/project/b.d.ts] file written with same contents +//// [/users/username/projects/project/a.d.ts] +import { B } from "./b"; +export interface A { + b: B; + foo: any; +} + + +//// [/users/username/projects/project/index.d.ts] file written with same contents +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./c.ts": { + "version": "-3358372745-import { A } from \"./a\";\nexport interface C {\n a: A;\n}\n", + "signature": "-3358372745-import { A } from \"./a\";\nexport interface C {\n a: A;\n}\n" + }, + "./b.ts": { + "version": "2102342013-import { C } from \"./c\";\nexport interface B {\n b: C;\n}\n", + "signature": "2102342013-import { C } from \"./c\";\nexport interface B {\n b: C;\n}\n" + }, + "./a.ts": { + "version": "-7623824316-import { B } from \"./b\";\nexport interface A {\n b: B;\n foo: any;\n}\n", + "signature": "-7623824316-import { B } from \"./b\";\nexport interface A {\n b: B;\n foo: any;\n}\n" + }, + "./index.ts": { + "version": "1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n", + "signature": "1286756397-export { A } from \"./a\";\nexport { B } from \"./b\";\nexport { C } from \"./c\";\n" + } + }, + "options": { + "incremental": true, + "target": 1, + "module": 1, + "declaration": true, + "emitDeclarationOnly": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./a.ts": [ + "./b.ts" + ], + "./b.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./a.ts" + ], + "./index.ts": [ + "./a.ts", + "./b.ts", + "./c.ts" + ] + }, + "exportedModulesMap": { + "./a.ts": [ + "./b.ts" + ], + "./b.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./a.ts" + ], + "./index.ts": [ + "./a.ts", + "./b.ts", + "./c.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./index.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:42 AM - Starting compilation in watch mode... + + + +12:00:58 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/users/username/projects/project/a.ts","/users/username/projects/project/b.ts","/users/username/projects/project/c.ts","/users/username/projects/project/index.ts"] +Program options: {"incremental":true,"target":1,"module":1,"declaration":true,"emitDeclarationOnly":true,"watch":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/c.ts +/users/username/projects/project/b.ts +/users/username/projects/project/a.ts +/users/username/projects/project/index.ts + +Semantic diagnostics in builder refreshed for:: +/users/username/projects/project/c.ts +/users/username/projects/project/b.ts +/users/username/projects/project/a.ts +/users/username/projects/project/index.ts + +WatchedFiles:: +/users/username/projects/project/tsconfig.json: + {"pollingInterval":250} +/users/username/projects/project/a.ts: + {"pollingInterval":250} +/users/username/projects/project/b.ts: + {"pollingInterval":250} +/users/username/projects/project/c.ts: + {"pollingInterval":250} +/users/username/projects/project/index.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/users/username/projects/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/users/username/projects/project: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-with-errors-incremental.js b/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-with-errors-incremental.js new file mode 100644 index 0000000000000..60d3a59b88b31 --- /dev/null +++ b/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-with-errors-incremental.js @@ -0,0 +1,189 @@ +/a/lib/tsc.js -i +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/users/username/projects/project/file1.ts] +export const x = 10; + +//// [/users/username/projects/project/file2.ts] +export const y: string = 20; + +//// [/users/username/projects/project/tsconfig.json] +{"compilerOptions":{"incremental":true,"module":"amd"}} + +//// [/users/username/projects/project/file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.x = 10; +}); + + +//// [/users/username/projects/project/file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.y = 20; +}); + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "-10726455937-export const x = 10;", + "signature": "-6821242887-export declare const x = 10;\n" + }, + "./file2.ts": { + "version": "-13939690350-export const y: string = 20;", + "signature": "-7924398419-export declare const y: string;\n" + } + }, + "options": { + "incremental": true, + "module": 2, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + [ + "./file2.ts", + [ + { + "file": "./file2.ts", + "start": 13, + "length": 1, + "code": 2322, + "category": 1, + "messageText": "Type '20' is not assignable to type 'string'." + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +file2.ts(1,14): error TS2322: Type '20' is not assignable to type 'string'. + + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"module":2,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +WatchedFiles:: + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + +Change:: + +//// [/users/username/projects/project/file1.ts] +export const z = 10; + +//// [/users/username/projects/project/file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.z = 10; +}); + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "-12438487295-export const z = 10;", + "signature": "-7483702853-export declare const z = 10;\n" + }, + "./file2.ts": { + "version": "-13939690350-export const y: string = 20;", + "signature": "-7924398419-export declare const y: string;\n" + } + }, + "options": { + "incremental": true, + "module": 2, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + [ + "./file2.ts", + [ + { + "file": "./file2.ts", + "start": 13, + "length": 1, + "code": 2322, + "category": 1, + "messageText": "Type '20' is not assignable to type 'string'." + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +file2.ts(1,14): error TS2322: Type '20' is not assignable to type 'string'. + + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"module":2,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/users/username/projects/project/file1.ts + +WatchedFiles:: + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated diff --git a/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-with-errors-watch.js b/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-with-errors-watch.js new file mode 100644 index 0000000000000..25ada6b429049 --- /dev/null +++ b/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-with-errors-watch.js @@ -0,0 +1,229 @@ +/a/lib/tsc.js -w +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/users/username/projects/project/file1.ts] +export const x = 10; + +//// [/users/username/projects/project/file2.ts] +export const y: string = 20; + +//// [/users/username/projects/project/tsconfig.json] +{"compilerOptions":{"incremental":true,"module":"amd"}} + +//// [/users/username/projects/project/file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.x = 10; +}); + + +//// [/users/username/projects/project/file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.y = 20; +}); + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "-10726455937-export const x = 10;", + "signature": "-6821242887-export declare const x = 10;\n" + }, + "./file2.ts": { + "version": "-13939690350-export const y: string = 20;", + "signature": "-7924398419-export declare const y: string;\n" + } + }, + "options": { + "incremental": true, + "module": 2, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + [ + "./file2.ts", + [ + { + "file": "./file2.ts", + "start": 13, + "length": 1, + "code": 2322, + "category": 1, + "messageText": "Type '20' is not assignable to type 'string'." + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + +file2.ts(1,14): error TS2322: Type '20' is not assignable to type 'string'. + + +12:00:30 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"module":2,"watch":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +WatchedFiles:: +/users/username/projects/project/tsconfig.json: + {"pollingInterval":250} +/users/username/projects/project/file1.ts: + {"pollingInterval":250} +/users/username/projects/project/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/users/username/projects/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/users/username/projects/project: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: + +//// [/users/username/projects/project/file1.ts] +export const z = 10; + +//// [/users/username/projects/project/file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.z = 10; +}); + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "-12438487295-export const z = 10;", + "signature": "-7483702853-export declare const z = 10;\n" + }, + "./file2.ts": { + "version": "-13939690350-export const y: string = 20;", + "signature": "-7924398419-export declare const y: string;\n" + } + }, + "options": { + "incremental": true, + "module": 2, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + [ + "./file2.ts", + [ + { + "file": "./file2.ts", + "start": 13, + "length": 1, + "code": 2322, + "category": 1, + "messageText": "Type '20' is not assignable to type 'string'." + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:34 AM - Starting compilation in watch mode... + + +file2.ts(1,14): error TS2322: Type '20' is not assignable to type 'string'. + + +12:00:41 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"module":2,"watch":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/users/username/projects/project/file1.ts + +WatchedFiles:: +/users/username/projects/project/tsconfig.json: + {"pollingInterval":250} +/users/username/projects/project/file1.ts: + {"pollingInterval":250} +/users/username/projects/project/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/users/username/projects/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/users/username/projects/project: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-without-errors-incremental.js b/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-without-errors-incremental.js new file mode 100644 index 0000000000000..3d258849a8101 --- /dev/null +++ b/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-without-errors-incremental.js @@ -0,0 +1,161 @@ +/a/lib/tsc.js -i +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/users/username/projects/project/file1.ts] +export const x = 10; + +//// [/users/username/projects/project/file2.ts] +export const y = 20; + +//// [/users/username/projects/project/tsconfig.json] +{"compilerOptions":{"incremental":true,"module":"amd"}} + +//// [/users/username/projects/project/file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.x = 10; +}); + + +//// [/users/username/projects/project/file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.y = 20; +}); + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "-10726455937-export const x = 10;", + "signature": "-6821242887-export declare const x = 10;\n" + }, + "./file2.ts": { + "version": "-13729954175-export const y = 20;", + "signature": "-7152436933-export declare const y = 20;\n" + } + }, + "options": { + "incremental": true, + "module": 2, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + "./file2.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"module":2,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +WatchedFiles:: + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.Success + +Change:: + +//// [/users/username/projects/project/file2.ts] +export const z = 10; + +//// [/users/username/projects/project/file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.z = 10; +}); + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "-10726455937-export const x = 10;", + "signature": "-6821242887-export declare const x = 10;\n" + }, + "./file2.ts": { + "version": "-12438487295-export const z = 10;", + "signature": "-7483702853-export declare const z = 10;\n" + } + }, + "options": { + "incremental": true, + "module": 2, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + "./file2.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"module":2,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/users/username/projects/project/file2.ts + +WatchedFiles:: + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.Success diff --git a/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-without-errors-watch.js b/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-without-errors-watch.js new file mode 100644 index 0000000000000..26693fe859355 --- /dev/null +++ b/tests/baselines/reference/tscWatch/incremental/module-compilation/own-file-emit-without-errors-watch.js @@ -0,0 +1,201 @@ +/a/lib/tsc.js -w +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/users/username/projects/project/file1.ts] +export const x = 10; + +//// [/users/username/projects/project/file2.ts] +export const y = 20; + +//// [/users/username/projects/project/tsconfig.json] +{"compilerOptions":{"incremental":true,"module":"amd"}} + +//// [/users/username/projects/project/file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.x = 10; +}); + + +//// [/users/username/projects/project/file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.y = 20; +}); + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "-10726455937-export const x = 10;", + "signature": "-6821242887-export declare const x = 10;\n" + }, + "./file2.ts": { + "version": "-13729954175-export const y = 20;", + "signature": "-7152436933-export declare const y = 20;\n" + } + }, + "options": { + "incremental": true, + "module": 2, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + "./file2.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + + +12:00:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"module":2,"watch":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +WatchedFiles:: +/users/username/projects/project/tsconfig.json: + {"pollingInterval":250} +/users/username/projects/project/file1.ts: + {"pollingInterval":250} +/users/username/projects/project/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/users/username/projects/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/users/username/projects/project: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: + +//// [/users/username/projects/project/file2.ts] +export const z = 10; + +//// [/users/username/projects/project/file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.z = 10; +}); + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "-10726455937-export const x = 10;", + "signature": "-6821242887-export declare const x = 10;\n" + }, + "./file2.ts": { + "version": "-12438487295-export const z = 10;", + "signature": "-7483702853-export declare const z = 10;\n" + } + }, + "options": { + "incremental": true, + "module": 2, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + "./file2.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:34 AM - Starting compilation in watch mode... + + + +12:00:41 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"module":2,"watch":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/users/username/projects/project/file2.ts + +WatchedFiles:: +/users/username/projects/project/tsconfig.json: + {"pollingInterval":250} +/users/username/projects/project/file1.ts: + {"pollingInterval":250} +/users/username/projects/project/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/users/username/projects/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/users/username/projects/project: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/incremental/module-compilation/with---out-incremental.js b/tests/baselines/reference/tscWatch/incremental/module-compilation/with---out-incremental.js new file mode 100644 index 0000000000000..62269567adcac --- /dev/null +++ b/tests/baselines/reference/tscWatch/incremental/module-compilation/with---out-incremental.js @@ -0,0 +1,94 @@ +/a/lib/tsc.js -i +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/users/username/projects/project/file1.ts] +export const x = 10; + +//// [/users/username/projects/project/file2.ts] +export const y = 20; + +//// [/users/username/projects/project/tsconfig.json] +{"compilerOptions":{"incremental":true,"module":"amd","outFile":"out.js"}} + +//// [/users/username/projects/project/out.js] +define("file1", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.x = 10; +}); +define("file2", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.y = 20; +}); + + +//// [/users/username/projects/project/out.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "./", + "sourceFiles": [ + "./file1.ts", + "./file2.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 286, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/users/username/projects/project/out.tsbuildinfo.baseline.txt] +====================================================================== +File:: /users/username/projects/project/out.js +---------------------------------------------------------------------- +text: (0-286) +define("file1", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.x = 10; +}); +define("file2", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.y = 20; +}); + +====================================================================== + + +Output:: + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"module":2,"outFile":"/users/username/projects/project/out.js","configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.Success diff --git a/tests/baselines/reference/tscWatch/incremental/module-compilation/with---out-watch.js b/tests/baselines/reference/tscWatch/incremental/module-compilation/with---out-watch.js new file mode 100644 index 0000000000000..ced0310c4b1d5 --- /dev/null +++ b/tests/baselines/reference/tscWatch/incremental/module-compilation/with---out-watch.js @@ -0,0 +1,113 @@ +/a/lib/tsc.js -w +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/users/username/projects/project/file1.ts] +export const x = 10; + +//// [/users/username/projects/project/file2.ts] +export const y = 20; + +//// [/users/username/projects/project/tsconfig.json] +{"compilerOptions":{"incremental":true,"module":"amd","outFile":"out.js"}} + +//// [/users/username/projects/project/out.js] +define("file1", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.x = 10; +}); +define("file2", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.y = 20; +}); + + +//// [/users/username/projects/project/out.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "./", + "sourceFiles": [ + "./file1.ts", + "./file2.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 286, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/users/username/projects/project/out.tsbuildinfo.baseline.txt] +====================================================================== +File:: /users/username/projects/project/out.js +---------------------------------------------------------------------- +text: (0-286) +define("file1", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.x = 10; +}); +define("file2", ["require", "exports"], function (require, exports) { + "use strict"; + exports.__esModule = true; + exports.y = 20; +}); + +====================================================================== + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + + +12:00:28 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"module":2,"outFile":"/users/username/projects/project/out.js","watch":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/users/username/projects/project/tsconfig.json: + {"pollingInterval":250} +/users/username/projects/project/file1.ts: + {"pollingInterval":250} +/users/username/projects/project/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/users/username/projects/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/users/username/projects/project: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/incremental/own-file-emit-with-errors-incremental.js b/tests/baselines/reference/tscWatch/incremental/own-file-emit-with-errors-incremental.js new file mode 100644 index 0000000000000..bb050fddb761c --- /dev/null +++ b/tests/baselines/reference/tscWatch/incremental/own-file-emit-with-errors-incremental.js @@ -0,0 +1,178 @@ +/a/lib/tsc.js -i +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/users/username/projects/project/file1.ts] +const x = 10; + +//// [/users/username/projects/project/tsconfig.json] +{"compilerOptions":{"incremental":true}} + +//// [/users/username/projects/project/file2.ts] +const y: string = 20; + +//// [/users/username/projects/project/file1.js] +var x = 10; + + +//// [/users/username/projects/project/file2.js] +var y = 20; + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "5029505981-const x = 10;", + "signature": "-4001438729-declare const x = 10;\n" + }, + "./file2.ts": { + "version": "2414573776-const y: string = 20;", + "signature": "509180395-declare const y: string;\n" + } + }, + "options": { + "incremental": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + [ + "./file2.ts", + [ + { + "file": "./file2.ts", + "start": 6, + "length": 1, + "code": 2322, + "category": 1, + "messageText": "Type '20' is not assignable to type 'string'." + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +file2.ts(1,7): error TS2322: Type '20' is not assignable to type 'string'. + + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +WatchedFiles:: + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + +Change:: + +//// [/users/username/projects/project/file1.ts] +const z = 10; + +//// [/users/username/projects/project/file1.js] +var z = 10; + + +//// [/users/username/projects/project/file2.js] file written with same contents +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "3317474623-const z = 10;", + "signature": "-368931399-declare const z = 10;\n" + }, + "./file2.ts": { + "version": "2414573776-const y: string = 20;", + "signature": "509180395-declare const y: string;\n" + } + }, + "options": { + "incremental": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + [ + "./file2.ts", + [ + { + "file": "./file2.ts", + "start": 6, + "length": 1, + "code": 2322, + "category": 1, + "messageText": "Type '20' is not assignable to type 'string'." + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +file2.ts(1,7): error TS2322: Type '20' is not assignable to type 'string'. + + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +WatchedFiles:: + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated diff --git a/tests/baselines/reference/tscWatch/incremental/own-file-emit-with-errors-watch.js b/tests/baselines/reference/tscWatch/incremental/own-file-emit-with-errors-watch.js new file mode 100644 index 0000000000000..cf0459033c338 --- /dev/null +++ b/tests/baselines/reference/tscWatch/incremental/own-file-emit-with-errors-watch.js @@ -0,0 +1,218 @@ +/a/lib/tsc.js -w +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/users/username/projects/project/file1.ts] +const x = 10; + +//// [/users/username/projects/project/tsconfig.json] +{"compilerOptions":{"incremental":true}} + +//// [/users/username/projects/project/file2.ts] +const y: string = 20; + +//// [/users/username/projects/project/file1.js] +var x = 10; + + +//// [/users/username/projects/project/file2.js] +var y = 20; + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "5029505981-const x = 10;", + "signature": "-4001438729-declare const x = 10;\n" + }, + "./file2.ts": { + "version": "2414573776-const y: string = 20;", + "signature": "509180395-declare const y: string;\n" + } + }, + "options": { + "incremental": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + [ + "./file2.ts", + [ + { + "file": "./file2.ts", + "start": 6, + "length": 1, + "code": 2322, + "category": 1, + "messageText": "Type '20' is not assignable to type 'string'." + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + +file2.ts(1,7): error TS2322: Type '20' is not assignable to type 'string'. + + +12:00:30 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"watch":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +WatchedFiles:: +/users/username/projects/project/tsconfig.json: + {"pollingInterval":250} +/users/username/projects/project/file1.ts: + {"pollingInterval":250} +/users/username/projects/project/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/users/username/projects/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/users/username/projects/project: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: + +//// [/users/username/projects/project/file1.ts] +const z = 10; + +//// [/users/username/projects/project/file1.js] +var z = 10; + + +//// [/users/username/projects/project/file2.js] file written with same contents +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "3317474623-const z = 10;", + "signature": "-368931399-declare const z = 10;\n" + }, + "./file2.ts": { + "version": "2414573776-const y: string = 20;", + "signature": "509180395-declare const y: string;\n" + } + }, + "options": { + "incremental": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + [ + "./file2.ts", + [ + { + "file": "./file2.ts", + "start": 6, + "length": 1, + "code": 2322, + "category": 1, + "messageText": "Type '20' is not assignable to type 'string'." + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:34 AM - Starting compilation in watch mode... + + +file2.ts(1,7): error TS2322: Type '20' is not assignable to type 'string'. + + +12:00:44 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"watch":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +WatchedFiles:: +/users/username/projects/project/tsconfig.json: + {"pollingInterval":250} +/users/username/projects/project/file1.ts: + {"pollingInterval":250} +/users/username/projects/project/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/users/username/projects/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/users/username/projects/project: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/incremental/own-file-emit-without-errors/with-commandline-parameters-that-are-not-relative-incremental.js b/tests/baselines/reference/tscWatch/incremental/own-file-emit-without-errors/with-commandline-parameters-that-are-not-relative-incremental.js new file mode 100644 index 0000000000000..8c1154bcf5855 --- /dev/null +++ b/tests/baselines/reference/tscWatch/incremental/own-file-emit-without-errors/with-commandline-parameters-that-are-not-relative-incremental.js @@ -0,0 +1,152 @@ +/a/lib/tsc.js -i -p tsconfig.json +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/users/username/projects/project/file1.ts] +const x = 10; + +//// [/users/username/projects/project/file2.ts] +const y = 20; + +//// [/users/username/projects/project/tsconfig.json] +{"compilerOptions":{"incremental":true}} + +//// [/users/username/projects/project/file1.js] +var x = 10; + + +//// [/users/username/projects/project/file2.js] +var y = 20; + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "5029505981-const x = 10;", + "signature": "-4001438729-declare const x = 10;\n" + }, + "./file2.ts": { + "version": "2026007743-const y = 20;", + "signature": "-4332632775-declare const y = 20;\n" + } + }, + "options": { + "incremental": true, + "project": "./tsconfig.json", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + "./file2.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"project":"/users/username/projects/project/tsconfig.json","configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +WatchedFiles:: + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.Success + +Change:: + +//// [/users/username/projects/project/file2.ts] +const z = 10; + +//// [/users/username/projects/project/file1.js] file written with same contents +//// [/users/username/projects/project/file2.js] +var z = 10; + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "5029505981-const x = 10;", + "signature": "-4001438729-declare const x = 10;\n" + }, + "./file2.ts": { + "version": "3317474623-const z = 10;", + "signature": "-368931399-declare const z = 10;\n" + } + }, + "options": { + "incremental": true, + "project": "./tsconfig.json", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + "./file2.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"project":"/users/username/projects/project/tsconfig.json","configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +WatchedFiles:: + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.Success diff --git a/tests/baselines/reference/tscWatch/incremental/own-file-emit-without-errors/with-commandline-parameters-that-are-not-relative-watch.js b/tests/baselines/reference/tscWatch/incremental/own-file-emit-without-errors/with-commandline-parameters-that-are-not-relative-watch.js new file mode 100644 index 0000000000000..459e728604f77 --- /dev/null +++ b/tests/baselines/reference/tscWatch/incremental/own-file-emit-without-errors/with-commandline-parameters-that-are-not-relative-watch.js @@ -0,0 +1,192 @@ +/a/lib/tsc.js -w -p tsconfig.json +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/users/username/projects/project/file1.ts] +const x = 10; + +//// [/users/username/projects/project/file2.ts] +const y = 20; + +//// [/users/username/projects/project/tsconfig.json] +{"compilerOptions":{"incremental":true}} + +//// [/users/username/projects/project/file1.js] +var x = 10; + + +//// [/users/username/projects/project/file2.js] +var y = 20; + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "5029505981-const x = 10;", + "signature": "-4001438729-declare const x = 10;\n" + }, + "./file2.ts": { + "version": "2026007743-const y = 20;", + "signature": "-4332632775-declare const y = 20;\n" + } + }, + "options": { + "incremental": true, + "watch": true, + "project": "./tsconfig.json", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + "./file2.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + + +12:00:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"watch":true,"project":"/users/username/projects/project/tsconfig.json","configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +WatchedFiles:: +/users/username/projects/project/tsconfig.json: + {"pollingInterval":250} +/users/username/projects/project/file1.ts: + {"pollingInterval":250} +/users/username/projects/project/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/users/username/projects/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/users/username/projects/project: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: + +//// [/users/username/projects/project/file2.ts] +const z = 10; + +//// [/users/username/projects/project/file1.js] file written with same contents +//// [/users/username/projects/project/file2.js] +var z = 10; + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "5029505981-const x = 10;", + "signature": "-4001438729-declare const x = 10;\n" + }, + "./file2.ts": { + "version": "3317474623-const z = 10;", + "signature": "-368931399-declare const z = 10;\n" + } + }, + "options": { + "incremental": true, + "watch": true, + "project": "./tsconfig.json", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + "./file2.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:34 AM - Starting compilation in watch mode... + + + +12:00:44 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"watch":true,"project":"/users/username/projects/project/tsconfig.json","configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +WatchedFiles:: +/users/username/projects/project/tsconfig.json: + {"pollingInterval":250} +/users/username/projects/project/file1.ts: + {"pollingInterval":250} +/users/username/projects/project/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/users/username/projects/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/users/username/projects/project: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/incremental/own-file-emit-without-errors/without-commandline-options-incremental.js b/tests/baselines/reference/tscWatch/incremental/own-file-emit-without-errors/without-commandline-options-incremental.js new file mode 100644 index 0000000000000..2c5f7f2862c0c --- /dev/null +++ b/tests/baselines/reference/tscWatch/incremental/own-file-emit-without-errors/without-commandline-options-incremental.js @@ -0,0 +1,150 @@ +/a/lib/tsc.js -i +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/users/username/projects/project/file1.ts] +const x = 10; + +//// [/users/username/projects/project/file2.ts] +const y = 20; + +//// [/users/username/projects/project/tsconfig.json] +{"compilerOptions":{"incremental":true}} + +//// [/users/username/projects/project/file1.js] +var x = 10; + + +//// [/users/username/projects/project/file2.js] +var y = 20; + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "5029505981-const x = 10;", + "signature": "-4001438729-declare const x = 10;\n" + }, + "./file2.ts": { + "version": "2026007743-const y = 20;", + "signature": "-4332632775-declare const y = 20;\n" + } + }, + "options": { + "incremental": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + "./file2.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +WatchedFiles:: + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.Success + +Change:: + +//// [/users/username/projects/project/file2.ts] +const z = 10; + +//// [/users/username/projects/project/file1.js] file written with same contents +//// [/users/username/projects/project/file2.js] +var z = 10; + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "5029505981-const x = 10;", + "signature": "-4001438729-declare const x = 10;\n" + }, + "./file2.ts": { + "version": "3317474623-const z = 10;", + "signature": "-368931399-declare const z = 10;\n" + } + }, + "options": { + "incremental": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + "./file2.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +WatchedFiles:: + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.Success diff --git a/tests/baselines/reference/tscWatch/incremental/own-file-emit-without-errors/without-commandline-options-watch.js b/tests/baselines/reference/tscWatch/incremental/own-file-emit-without-errors/without-commandline-options-watch.js new file mode 100644 index 0000000000000..2790f2404c950 --- /dev/null +++ b/tests/baselines/reference/tscWatch/incremental/own-file-emit-without-errors/without-commandline-options-watch.js @@ -0,0 +1,190 @@ +/a/lib/tsc.js -w +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/users/username/projects/project/file1.ts] +const x = 10; + +//// [/users/username/projects/project/file2.ts] +const y = 20; + +//// [/users/username/projects/project/tsconfig.json] +{"compilerOptions":{"incremental":true}} + +//// [/users/username/projects/project/file1.js] +var x = 10; + + +//// [/users/username/projects/project/file2.js] +var y = 20; + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "5029505981-const x = 10;", + "signature": "-4001438729-declare const x = 10;\n" + }, + "./file2.ts": { + "version": "2026007743-const y = 20;", + "signature": "-4332632775-declare const y = 20;\n" + } + }, + "options": { + "incremental": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + "./file2.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + + +12:00:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"watch":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +WatchedFiles:: +/users/username/projects/project/tsconfig.json: + {"pollingInterval":250} +/users/username/projects/project/file1.ts: + {"pollingInterval":250} +/users/username/projects/project/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/users/username/projects/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/users/username/projects/project: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: + +//// [/users/username/projects/project/file2.ts] +const z = 10; + +//// [/users/username/projects/project/file1.js] file written with same contents +//// [/users/username/projects/project/file2.js] +var z = 10; + + +//// [/users/username/projects/project/tsconfig.tsbuildinfo] +{ + "program": { + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + }, + "./file1.ts": { + "version": "5029505981-const x = 10;", + "signature": "-4001438729-declare const x = 10;\n" + }, + "./file2.ts": { + "version": "3317474623-const z = 10;", + "signature": "-368931399-declare const z = 10;\n" + } + }, + "options": { + "incremental": true, + "watch": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./file1.ts", + "./file2.ts" + ] + }, + "version": "FakeTSVersion" +} + + +Output:: +>> Screen clear +12:00:34 AM - Starting compilation in watch mode... + + + +12:00:44 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"watch":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +WatchedFiles:: +/users/username/projects/project/tsconfig.json: + {"pollingInterval":250} +/users/username/projects/project/file1.ts: + {"pollingInterval":250} +/users/username/projects/project/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/users/username/projects/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/users/username/projects/project: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/incremental/with---out-incremental.js b/tests/baselines/reference/tscWatch/incremental/with---out-incremental.js new file mode 100644 index 0000000000000..cf9992f122e28 --- /dev/null +++ b/tests/baselines/reference/tscWatch/incremental/with---out-incremental.js @@ -0,0 +1,78 @@ +/a/lib/tsc.js -i +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/users/username/projects/project/file1.ts] +const x = 10; + +//// [/users/username/projects/project/file2.ts] +const y = 20; + +//// [/users/username/projects/project/tsconfig.json] +{"compilerOptions":{"incremental":true,"outFile":"out.js"}} + +//// [/users/username/projects/project/out.js] +var x = 10; +var y = 20; + + +//// [/users/username/projects/project/out.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "./", + "sourceFiles": [ + "./file1.ts", + "./file2.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 24, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/users/username/projects/project/out.tsbuildinfo.baseline.txt] +====================================================================== +File:: /users/username/projects/project/out.js +---------------------------------------------------------------------- +text: (0-24) +var x = 10; +var y = 20; + +====================================================================== + + +Output:: + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"outFile":"/users/username/projects/project/out.js","configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.Success diff --git a/tests/baselines/reference/tscWatch/incremental/with---out-watch.js b/tests/baselines/reference/tscWatch/incremental/with---out-watch.js new file mode 100644 index 0000000000000..9b619cb7ae950 --- /dev/null +++ b/tests/baselines/reference/tscWatch/incremental/with---out-watch.js @@ -0,0 +1,97 @@ +/a/lib/tsc.js -w +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/users/username/projects/project/file1.ts] +const x = 10; + +//// [/users/username/projects/project/file2.ts] +const y = 20; + +//// [/users/username/projects/project/tsconfig.json] +{"compilerOptions":{"incremental":true,"outFile":"out.js"}} + +//// [/users/username/projects/project/out.js] +var x = 10; +var y = 20; + + +//// [/users/username/projects/project/out.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "./", + "sourceFiles": [ + "./file1.ts", + "./file2.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 24, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/users/username/projects/project/out.tsbuildinfo.baseline.txt] +====================================================================== +File:: /users/username/projects/project/out.js +---------------------------------------------------------------------- +text: (0-24) +var x = 10; +var y = 20; + +====================================================================== + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + + +12:00:28 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/users/username/projects/project/file1.ts","/users/username/projects/project/file2.ts"] +Program options: {"incremental":true,"outFile":"/users/username/projects/project/out.js","watch":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/users/username/projects/project/file1.ts +/users/username/projects/project/file2.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/users/username/projects/project/tsconfig.json: + {"pollingInterval":250} +/users/username/projects/project/file1.ts: + {"pollingInterval":250} +/users/username/projects/project/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/users/username/projects/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/users/username/projects/project: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/Configure-file-diagnostics-events-are-generated-when-the-config-file-has-errors.js b/tests/baselines/reference/tscWatch/programUpdates/Configure-file-diagnostics-events-are-generated-when-the-config-file-has-errors.js new file mode 100644 index 0000000000000..62c9e6baf2761 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/Configure-file-diagnostics-events-are-generated-when-the-config-file-has-errors.js @@ -0,0 +1,70 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/b/app.ts] +let x = 10 + +//// [/a/b/tsconfig.json] +{ + "compilerOptions": { + "foo": "bar", + "allowJS": true + } + } + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/app.js] +var x = 10; + + + +Output:: +>> Screen clear +12:00:15 AM - Starting compilation in watch mode... + + +a/b/tsconfig.json(3,29): error TS5023: Unknown compiler option 'foo'. + +a/b/tsconfig.json(4,29): error TS5025: Unknown compiler option 'allowJS'. Did you mean 'allowJs'? + + +12:00:18 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/a/b/app.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/app.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/app.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/Options-Diagnostic-locations-reported-correctly-with-changes-in-configFile-contents-when-options-change.js b/tests/baselines/reference/tscWatch/programUpdates/Options-Diagnostic-locations-reported-correctly-with-changes-in-configFile-contents-when-options-change.js new file mode 100644 index 0000000000000..4ee038e905ada --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/Options-Diagnostic-locations-reported-correctly-with-changes-in-configFile-contents-when-options-change.js @@ -0,0 +1,126 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/b/app.ts] +let x = 10 + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/tsconfig.json] + +{ + // comment + // More comment + "compilerOptions": { + "inlineSourceMap": true, + "mapRoot": "./" + } +} + +//// [/a/b/app.js] +var x = 10; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiYXBwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLElBQUksQ0FBQyxHQUFHLEVBQUUsQ0FBQSJ9 + + +Output:: +>> Screen clear +12:00:15 AM - Starting compilation in watch mode... + + +a/b/tsconfig.json(6,9): error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'. + +a/b/tsconfig.json(7,9): error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'. + +a/b/tsconfig.json(7,9): error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMap'. + + +12:00:18 AM - Found 3 errors. Watching for file changes. + + +Program root files: ["/a/b/app.ts"] +Program options: {"inlineSourceMap":true,"mapRoot":"./","watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/app.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/app.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Remove the comment from config file + +//// [/a/b/tsconfig.json] + +{ + "compilerOptions": { + "inlineSourceMap": true, + "mapRoot": "./" + } +} + + +Output:: +>> Screen clear +12:00:22 AM - File change detected. Starting incremental compilation... + + +a/b/tsconfig.json(4,9): error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'. + +a/b/tsconfig.json(5,9): error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'. + +a/b/tsconfig.json(5,9): error TS5069: Option 'mapRoot' cannot be specified without specifying option 'sourceMap' or option 'declarationMap'. + + +12:00:23 AM - Found 3 errors. Watching for file changes. + + +Program root files: ["/a/b/app.ts"] +Program options: {"inlineSourceMap":true,"mapRoot":"./","watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/app.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/app.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/Proper-errors-document-is-not-contained-in-project.js b/tests/baselines/reference/tscWatch/programUpdates/Proper-errors-document-is-not-contained-in-project.js new file mode 100644 index 0000000000000..a65d275d7a0e0 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/Proper-errors-document-is-not-contained-in-project.js @@ -0,0 +1,62 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/b/app.ts] + + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/tsconfig.json] +{ + +//// [/a/b/app.js] + + + +Output:: +>> Screen clear +12:00:15 AM - Starting compilation in watch mode... + + +a/b/tsconfig.json(1,2): error TS1005: '}' expected. + + +12:00:18 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a/b/app.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/app.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/app.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/Reports-errors-when-the-config-file-changes.js b/tests/baselines/reference/tscWatch/programUpdates/Reports-errors-when-the-config-file-changes.js new file mode 100644 index 0000000000000..dd5db842864b5 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/Reports-errors-when-the-config-file-changes.js @@ -0,0 +1,152 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/b/app.ts] +let x = 10 + +//// [/a/b/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/app.js] +var x = 10; + + + +Output:: +>> Screen clear +12:00:15 AM - Starting compilation in watch mode... + + + +12:00:18 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/app.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/app.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/app.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: change config file to add error + +//// [/a/b/tsconfig.json] +{ + "compilerOptions": { + "haha": 123 + } + } + + +Output:: +>> Screen clear +12:00:22 AM - File change detected. Starting incremental compilation... + + +a/b/tsconfig.json(3,29): error TS5023: Unknown compiler option 'haha'. + + +12:00:23 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a/b/app.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/app.ts + +Semantic diagnostics in builder refreshed for:: + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/app.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: change config file to remove error + +//// [/a/b/tsconfig.json] +{ + "compilerOptions": { + } + } + + +Output:: +>> Screen clear +12:00:27 AM - File change detected. Starting incremental compilation... + + + +12:00:28 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/app.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/app.ts + +Semantic diagnostics in builder refreshed for:: + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/app.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/Updates-diagnostics-when-'--noUnusedLabels'-changes.js b/tests/baselines/reference/tscWatch/programUpdates/Updates-diagnostics-when-'--noUnusedLabels'-changes.js new file mode 100644 index 0000000000000..1a09339bd8a24 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/Updates-diagnostics-when-'--noUnusedLabels'-changes.js @@ -0,0 +1,143 @@ +/a/lib/tsc.js -w -p /tsconfig.json +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a.ts] +label: while (1) {} + +//// [/tsconfig.json] +{"compilerOptions":{"allowUnusedLabels":true}} + +//// [/a.js] +label: while (1) { } + + + +Output:: +>> Screen clear +12:00:13 AM - Starting compilation in watch mode... + + + +12:00:16 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a.ts","/a/lib/lib.d.ts"] +Program options: {"allowUnusedLabels":true,"watch":true,"project":"/tsconfig.json","configFilePath":"/tsconfig.json"} +Program files:: +/a.ts +/a/lib/lib.d.ts + +Semantic diagnostics in builder refreshed for:: +/a.ts +/a/lib/lib.d.ts + +WatchedFiles:: +/tsconfig.json: + {"pollingInterval":250} +/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Disable allowUnsusedLabels + +//// [/tsconfig.json] +{"compilerOptions":{"allowUnusedLabels":false}} + + +Output:: +>> Screen clear +12:00:19 AM - File change detected. Starting incremental compilation... + + +a.ts(1,1): error TS7028: Unused label. + + +12:00:20 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a.ts","/a/lib/lib.d.ts"] +Program options: {"allowUnusedLabels":false,"watch":true,"project":"/tsconfig.json","configFilePath":"/tsconfig.json"} +Program files:: +/a.ts +/a/lib/lib.d.ts + +Semantic diagnostics in builder refreshed for:: +/a.ts +/a/lib/lib.d.ts + +WatchedFiles:: +/tsconfig.json: + {"pollingInterval":250} +/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Enable allowUnsusedLabels + +//// [/tsconfig.json] +{"compilerOptions":{"allowUnusedLabels":true}} + + +Output:: +>> Screen clear +12:00:23 AM - File change detected. Starting incremental compilation... + + + +12:00:24 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a.ts","/a/lib/lib.d.ts"] +Program options: {"allowUnusedLabels":true,"watch":true,"project":"/tsconfig.json","configFilePath":"/tsconfig.json"} +Program files:: +/a.ts +/a/lib/lib.d.ts + +Semantic diagnostics in builder refreshed for:: +/a.ts +/a/lib/lib.d.ts + +WatchedFiles:: +/tsconfig.json: + {"pollingInterval":250} +/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/add-new-files-to-a-configured-program-without-file-list.js b/tests/baselines/reference/tscWatch/programUpdates/add-new-files-to-a-configured-program-without-file-list.js new file mode 100644 index 0000000000000..66ac1ade73cf3 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/add-new-files-to-a-configured-program-without-file-list.js @@ -0,0 +1,113 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/b/commonFile1.ts] +let x = 1 + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/tsconfig.json] +{} + +//// [/a/b/commonFile1.js] +var x = 1; + + + +Output:: +>> Screen clear +12:00:15 AM - Starting compilation in watch mode... + + + +12:00:18 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/commonFile1.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/commonfile1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Create commonFile2 + +//// [/a/b/commonFile1.js] file written with same contents +//// [/a/b/commonFile2.ts] +let y = 1 + +//// [/a/b/commonFile2.js] +var y = 1; + + + +Output:: +>> Screen clear +12:00:21 AM - File change detected. Starting incremental compilation... + + + +12:00:27 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/commonfile1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/commonfile2.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/add-the-missing-module-file-for-inferred-project-should-remove-the-module-not-found-error.js b/tests/baselines/reference/tscWatch/programUpdates/add-the-missing-module-file-for-inferred-project-should-remove-the-module-not-found-error.js new file mode 100644 index 0000000000000..d41af8a57a3c5 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/add-the-missing-module-file-for-inferred-project-should-remove-the-module-not-found-error.js @@ -0,0 +1,107 @@ +/a/lib/tsc.js -w /a/b/file1.ts +//// [/a/b/file1.ts] +import * as T from "./moduleFile"; T.bar(); + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/file1.js] +"use strict"; +exports.__esModule = true; +var T = require("./moduleFile"); +T.bar(); + + + +Output:: +>> Screen clear +12:00:13 AM - Starting compilation in watch mode... + + +a/b/file1.ts(1,20): error TS2307: Cannot find module './moduleFile'. + + +12:00:16 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a/b/file1.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/b/file1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/file1.ts + +WatchedFiles:: +/a/b/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Create module file + +//// [/a/b/file1.js] file written with same contents +//// [/a/b/moduleFile.ts] +export function bar() { } + +//// [/a/b/moduleFile.js] +"use strict"; +exports.__esModule = true; +function bar() { } +exports.bar = bar; + + + +Output:: +>> Screen clear +12:00:19 AM - File change detected. Starting incremental compilation... + + + +12:00:25 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile.ts +/a/b/file1.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/moduleFile.ts +/a/b/file1.ts + +WatchedFiles:: +/a/b/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/modulefile.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/can-correctly-update-configured-project-when-set-of-root-files-has-changed-(new-file-in-list-of-files).js b/tests/baselines/reference/tscWatch/programUpdates/can-correctly-update-configured-project-when-set-of-root-files-has-changed-(new-file-in-list-of-files).js new file mode 100644 index 0000000000000..8bc3bde15d4d5 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/can-correctly-update-configured-project-when-set-of-root-files-has-changed-(new-file-in-list-of-files).js @@ -0,0 +1,112 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/b/f1.ts] +let x = 1 + +//// [/a/b/f2.ts] +let y = 1 + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/tsconfig.json] +{"compilerOptions":{},"files":["f1.ts"]} + +//// [/a/b/f1.js] +var x = 1; + + + +Output:: +>> Screen clear +12:00:17 AM - Starting compilation in watch mode... + + + +12:00:20 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/f1.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/f1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/f1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/f1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Modify config to make f2 as root too + +//// [/a/b/tsconfig.json] +{"compilerOptions":{},"files":["f1.ts","f2.ts"]} + +//// [/a/b/f1.js] file written with same contents +//// [/a/b/f2.js] +var y = 1; + + + +Output:: +>> Screen clear +12:00:24 AM - File change detected. Starting incremental compilation... + + + +12:00:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/f1.ts","/a/b/f2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/f1.ts +/a/b/f2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/f1.ts +/a/b/f2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/f1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/f2.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/can-correctly-update-configured-project-when-set-of-root-files-has-changed-(new-file-on-disk).js b/tests/baselines/reference/tscWatch/programUpdates/can-correctly-update-configured-project-when-set-of-root-files-has-changed-(new-file-on-disk).js new file mode 100644 index 0000000000000..a2702d90ae3a3 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/can-correctly-update-configured-project-when-set-of-root-files-has-changed-(new-file-on-disk).js @@ -0,0 +1,113 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/b/f1.ts] +let x = 1 + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/tsconfig.json] +{} + +//// [/a/b/f1.js] +var x = 1; + + + +Output:: +>> Screen clear +12:00:15 AM - Starting compilation in watch mode... + + + +12:00:18 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/f1.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/f1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/f1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/f1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Write f2 + +//// [/a/b/f1.js] file written with same contents +//// [/a/b/f2.ts] +let y = 1 + +//// [/a/b/f2.js] +var y = 1; + + + +Output:: +>> Screen clear +12:00:21 AM - File change detected. Starting incremental compilation... + + + +12:00:27 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/f1.ts","/a/b/f2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/f1.ts +/a/b/f2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/f1.ts +/a/b/f2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/f1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/f2.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/can-handle-tsconfig-file-name-with-difference-casing.js b/tests/baselines/reference/tscWatch/programUpdates/can-handle-tsconfig-file-name-with-difference-casing.js new file mode 100644 index 0000000000000..e9fb267e5228d --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/can-handle-tsconfig-file-name-with-difference-casing.js @@ -0,0 +1,59 @@ +/a/lib/tsc.js -w -p /A/B/tsconfig.json +//// [/a/b/app.ts] +let x = 1 + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/tsconfig.json] +{"include":["app.ts"]} + +//// [/A/B/app.js] +var x = 1; + + + +Output:: +>> Screen clear +12:00:15 AM - Starting compilation in watch mode... + + + +12:00:18 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/A/B/app.ts"] +Program options: {"watch":true,"project":"/A/B/tsconfig.json","configFilePath":"/A/B/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/A/B/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/A/B/app.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/app.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/can-update-configured-project-when-set-of-root-files-was-not-changed.js b/tests/baselines/reference/tscWatch/programUpdates/can-update-configured-project-when-set-of-root-files-was-not-changed.js new file mode 100644 index 0000000000000..fbebff82b701b --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/can-update-configured-project-when-set-of-root-files-was-not-changed.js @@ -0,0 +1,117 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/b/f1.ts] +let x = 1 + +//// [/a/b/f2.ts] +let y = 1 + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/tsconfig.json] +{"compilerOptions":{},"files":["f1.ts","f2.ts"]} + +//// [/a/b/f1.js] +var x = 1; + + +//// [/a/b/f2.js] +var y = 1; + + + +Output:: +>> Screen clear +12:00:17 AM - Starting compilation in watch mode... + + + +12:00:22 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/f1.ts","/a/b/f2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/f1.ts +/a/b/f2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/f1.ts +/a/b/f2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/f1.ts: + {"pollingInterval":250} +/a/b/f2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Modify config to set outFile option + +//// [/a/b/tsconfig.json] +{"compilerOptions":{"outFile":"out.js"},"files":["f1.ts","f2.ts"]} + +//// [/a/b/out.js] +var x = 1; +var y = 1; + + + +Output:: +>> Screen clear +12:00:26 AM - File change detected. Starting incremental compilation... + + + +12:00:29 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/f1.ts","/a/b/f2.ts"] +Program options: {"outFile":"/a/b/out.js","watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/f1.ts +/a/b/f2.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/f1.ts: + {"pollingInterval":250} +/a/b/f2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/changes-in-files-are-reflected-in-project-structure.js b/tests/baselines/reference/tscWatch/programUpdates/changes-in-files-are-reflected-in-project-structure.js new file mode 100644 index 0000000000000..eb4697ee36e7c --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/changes-in-files-are-reflected-in-project-structure.js @@ -0,0 +1,133 @@ +/a/lib/tsc.js -w /a/b/f1.ts +//// [/a/b/f1.ts] +export * from "./f2" + +//// [/a/b/f2.ts] +export let x = 1 + +//// [/a/c/f3.ts] +export let y = 1; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/f2.js] +"use strict"; +exports.__esModule = true; +exports.x = 1; + + +//// [/a/b/f1.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./f2")); + + + +Output:: +>> Screen clear +12:00:19 AM - Starting compilation in watch mode... + + + +12:00:24 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/f1.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/b/f2.ts +/a/b/f1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/f2.ts +/a/b/f1.ts + +WatchedFiles:: +/a/b/f1.ts: + {"pollingInterval":250} +/a/b/f2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Modify f2 to include f3 + +//// [/a/b/f2.ts] +export * from "../c/f3" + +//// [/a/b/f2.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("../c/f3")); + + +//// [/a/b/f1.js] file written with same contents +//// [/a/c/f3.js] +"use strict"; +exports.__esModule = true; +exports.y = 1; + + + +Output:: +>> Screen clear +12:00:27 AM - File change detected. Starting incremental compilation... + + + +12:00:36 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/f1.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/c/f3.ts +/a/b/f2.ts +/a/b/f1.ts + +Semantic diagnostics in builder refreshed for:: +/a/c/f3.ts +/a/b/f2.ts +/a/b/f1.ts + +WatchedFiles:: +/a/b/f1.ts: + {"pollingInterval":250} +/a/b/f2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/c/f3.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/config-file-includes-the-file.js b/tests/baselines/reference/tscWatch/programUpdates/config-file-includes-the-file.js new file mode 100644 index 0000000000000..cb101af249dce --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/config-file-includes-the-file.js @@ -0,0 +1,86 @@ +/a/lib/tsc.js -w -p /a/c/tsconfig.json +//// [/a/b/f1.ts] +export let x = 5 + +//// [/a/c/f2.ts] +import {x} from "../b/f1" + +//// [/a/c/f3.ts] +export let y = 1 + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/c/tsconfig.json] +{"compilerOptions":{},"files":["f2.ts","f3.ts"]} + +//// [/a/b/f1.js] +"use strict"; +exports.__esModule = true; +exports.x = 5; + + +//// [/a/c/f2.js] +"use strict"; +exports.__esModule = true; + + +//// [/a/c/f3.js] +"use strict"; +exports.__esModule = true; +exports.y = 1; + + + +Output:: +>> Screen clear +12:00:21 AM - Starting compilation in watch mode... + + + +12:00:28 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/c/f2.ts","/a/c/f3.ts"] +Program options: {"watch":true,"project":"/a/c/tsconfig.json","configFilePath":"/a/c/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/f1.ts +/a/c/f2.ts +/a/c/f3.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/f1.ts +/a/c/f2.ts +/a/c/f3.ts + +WatchedFiles:: +/a/c/tsconfig.json: + {"pollingInterval":250} +/a/c/f2.ts: + {"pollingInterval":250} +/a/b/f1.ts: + {"pollingInterval":250} +/a/c/f3.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/c/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/config-file-is-deleted.js b/tests/baselines/reference/tscWatch/programUpdates/config-file-is-deleted.js new file mode 100644 index 0000000000000..1503851f86279 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/config-file-is-deleted.js @@ -0,0 +1,104 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/b/f1.ts] +let x = 1; + +//// [/a/b/f2.ts] +let y = 2; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/tsconfig.json] +{} + +//// [/a/b/f1.js] +var x = 1; + + +//// [/a/b/f2.js] +var y = 2; + + + +Output:: +>> Screen clear +12:00:17 AM - Starting compilation in watch mode... + + + +12:00:22 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/f1.ts","/a/b/f2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/f1.ts +/a/b/f2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/f1.ts +/a/b/f2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/f1.ts: + {"pollingInterval":250} +/a/b/f2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Delete config file + +//// [/a/b/tsconfig.json] deleted + +Output:: +>> Screen clear +12:00:24 AM - File change detected. Starting incremental compilation... + + +error TS6053: File '/a/b/tsconfig.json' not found. + + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/f1.ts: + {"pollingInterval":250} +/a/b/f2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped diff --git a/tests/baselines/reference/tscWatch/programUpdates/correctly-handles-changes-in-lib-section-of-config-file.js b/tests/baselines/reference/tscWatch/programUpdates/correctly-handles-changes-in-lib-section-of-config-file.js new file mode 100644 index 0000000000000..fa88b66c87863 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/correctly-handles-changes-in-lib-section-of-config-file.js @@ -0,0 +1,115 @@ +/compiler/tsc.js -w -p /src/tsconfig.json +//// [/compiler/lib.es5.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +declare const eval: any + +//// [/compiler/lib.es2015.promise.d.ts] +declare class Promise {} + +//// [/src/app.ts] +var x: Promise; + +//// [/src/tsconfig.json] +{"compilerOptions":{"module":"commonjs","target":"es5","noImplicitAny":true,"sourceMap":false,"lib":["es5"]}} + +//// [/src/app.js] +var x; + + + +Output:: +>> Screen clear +12:00:15 AM - Starting compilation in watch mode... + + +src/app.ts(1,8): error TS2583: Cannot find name 'Promise'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. + + +12:00:18 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/src/app.ts"] +Program options: {"module":1,"target":1,"noImplicitAny":true,"sourceMap":false,"lib":["lib.es5.d.ts"],"watch":true,"project":"/src/tsconfig.json","configFilePath":"/src/tsconfig.json"} +Program files:: +/compiler/lib.es5.d.ts +/src/app.ts + +Semantic diagnostics in builder refreshed for:: +/compiler/lib.es5.d.ts +/src/app.ts + +WatchedFiles:: +/src/tsconfig.json: + {"pollingInterval":250} +/src/app.ts: + {"pollingInterval":250} +/compiler/lib.es5.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/src/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change the lib in config + +//// [/src/tsconfig.json] +{"compilerOptions":{"module":"commonjs","target":"es5","noImplicitAny":true,"sourceMap":false,"lib":["es5","es2015.promise"]}} + +//// [/src/app.js] file written with same contents + +Output:: +>> Screen clear +12:00:22 AM - File change detected. Starting incremental compilation... + + + +12:00:26 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/src/app.ts"] +Program options: {"module":1,"target":1,"noImplicitAny":true,"sourceMap":false,"lib":["lib.es5.d.ts","lib.es2015.promise.d.ts"],"watch":true,"project":"/src/tsconfig.json","configFilePath":"/src/tsconfig.json"} +Program files:: +/compiler/lib.es5.d.ts +/compiler/lib.es2015.promise.d.ts +/src/app.ts + +Semantic diagnostics in builder refreshed for:: +/compiler/lib.es5.d.ts +/compiler/lib.es2015.promise.d.ts +/src/app.ts + +WatchedFiles:: +/src/tsconfig.json: + {"pollingInterval":250} +/src/app.ts: + {"pollingInterval":250} +/compiler/lib.es5.d.ts: + {"pollingInterval":250} +/compiler/lib.es2015.promise.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/src/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/create-configured-project-without-file-list.js b/tests/baselines/reference/tscWatch/programUpdates/create-configured-project-without-file-list.js new file mode 100644 index 0000000000000..77ab66d898bdc --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/create-configured-project-without-file-list.js @@ -0,0 +1,81 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/b/tsconfig.json] + + { + "compilerOptions": {}, + "exclude": [ + "e" + ] + } + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/c/f1.ts] +let x = 1 + +//// [/a/b/d/f2.ts] +let y = 1 + +//// [/a/b/e/f3.ts] +let z = 1 + +//// [/a/b/c/f1.js] +var x = 1; + + +//// [/a/b/d/f2.js] +var y = 1; + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/c/f1.ts","/a/b/d/f2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/c/f1.ts +/a/b/d/f2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/c/f1.ts +/a/b/d/f2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/c/f1.ts: + {"pollingInterval":250} +/a/b/d/f2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/create-watch-without-config-file.js b/tests/baselines/reference/tscWatch/programUpdates/create-watch-without-config-file.js new file mode 100644 index 0000000000000..913feaff5bed9 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/create-watch-without-config-file.js @@ -0,0 +1,71 @@ +/a/lib/tsc.js -w /a/b/c/app.ts +//// [/a/b/c/app.ts] + + import {f} from "./module" + console.log(f) + + +//// [/a/b/c/module.d.ts] +export let x: number + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/c/app.js] +"use strict"; +exports.__esModule = true; +var module_1 = require("./module"); +console.log(module_1.f); + + + +Output:: +>> Screen clear +12:00:17 AM - Starting compilation in watch mode... + + +a/b/c/app.ts(2,25): error TS2305: Module '"./module"' has no exported member 'f'. + +a/b/c/app.ts(3,17): error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'. + + +12:00:20 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/a/b/c/app.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/b/c/module.d.ts +/a/b/c/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/c/module.d.ts +/a/b/c/app.ts + +WatchedFiles:: +/a/b/c/app.ts: + {"pollingInterval":250} +/a/b/c/module.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/deleted-files-affect-project-structure-2.js b/tests/baselines/reference/tscWatch/programUpdates/deleted-files-affect-project-structure-2.js new file mode 100644 index 0000000000000..d6cd96e9b5926 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/deleted-files-affect-project-structure-2.js @@ -0,0 +1,128 @@ +/a/lib/tsc.js -w /a/b/f1.ts /a/c/f3.ts +//// [/a/b/f1.ts] +export * from "./f2" + +//// [/a/b/f2.ts] +export * from "../c/f3" + +//// [/a/c/f3.ts] +export let y = 1; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/c/f3.js] +"use strict"; +exports.__esModule = true; +exports.y = 1; + + +//// [/a/b/f2.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("../c/f3")); + + +//// [/a/b/f1.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./f2")); + + + +Output:: +>> Screen clear +12:00:19 AM - Starting compilation in watch mode... + + + +12:00:26 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/f1.ts","/a/c/f3.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/c/f3.ts +/a/b/f2.ts +/a/b/f1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/c/f3.ts +/a/b/f2.ts +/a/b/f1.ts + +WatchedFiles:: +/a/b/f1.ts: + {"pollingInterval":250} +/a/b/f2.ts: + {"pollingInterval":250} +/a/c/f3.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Delete f2 + +//// [/a/b/f1.js] file written with same contents +//// [/a/b/f2.ts] deleted + +Output:: +>> Screen clear +12:00:28 AM - File change detected. Starting incremental compilation... + + +a/b/f1.ts(1,15): error TS2307: Cannot find module './f2'. + + +12:00:32 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a/b/f1.ts","/a/c/f3.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/b/f1.ts +/a/c/f3.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/f1.ts + +WatchedFiles:: +/a/b/f1.ts: + {"pollingInterval":250} +/a/c/f3.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/f2.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/deleted-files-affect-project-structure.js b/tests/baselines/reference/tscWatch/programUpdates/deleted-files-affect-project-structure.js new file mode 100644 index 0000000000000..a841b0bc0df58 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/deleted-files-affect-project-structure.js @@ -0,0 +1,125 @@ +/a/lib/tsc.js -w /a/b/f1.ts +//// [/a/b/f1.ts] +export * from "./f2" + +//// [/a/b/f2.ts] +export * from "../c/f3" + +//// [/a/c/f3.ts] +export let y = 1; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/c/f3.js] +"use strict"; +exports.__esModule = true; +exports.y = 1; + + +//// [/a/b/f2.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("../c/f3")); + + +//// [/a/b/f1.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./f2")); + + + +Output:: +>> Screen clear +12:00:19 AM - Starting compilation in watch mode... + + + +12:00:26 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/f1.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/c/f3.ts +/a/b/f2.ts +/a/b/f1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/c/f3.ts +/a/b/f2.ts +/a/b/f1.ts + +WatchedFiles:: +/a/b/f1.ts: + {"pollingInterval":250} +/a/b/f2.ts: + {"pollingInterval":250} +/a/c/f3.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Delete f2 + +//// [/a/b/f1.js] file written with same contents +//// [/a/b/f2.ts] deleted + +Output:: +>> Screen clear +12:00:28 AM - File change detected. Starting incremental compilation... + + +a/b/f1.ts(1,15): error TS2307: Cannot find module './f2'. + + +12:00:32 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a/b/f1.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/b/f1.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/f1.ts + +WatchedFiles:: +/a/b/f1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/f2.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/files-explicitly-excluded-in-config-file.js b/tests/baselines/reference/tscWatch/programUpdates/files-explicitly-excluded-in-config-file.js new file mode 100644 index 0000000000000..1c9dcc0954340 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/files-explicitly-excluded-in-config-file.js @@ -0,0 +1,78 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/commonFile1.ts] +let x = 1 + +//// [/a/b/commonFile2.ts] +let y = 1 + +//// [/a/c/excluedFile1.ts] +let t = 1; + +//// [/a/b/tsconfig.json] +{ + "compilerOptions": {}, + "exclude": ["/a/c"] + } + +//// [/a/b/commonFile1.js] +var x = 1; + + +//// [/a/b/commonFile2.js] +var y = 1; + + + +Output:: +>> Screen clear +12:00:21 AM - Starting compilation in watch mode... + + + +12:00:26 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/commonfile1.ts: + {"pollingInterval":250} +/a/b/commonfile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/handle-recreated-files-correctly.js b/tests/baselines/reference/tscWatch/programUpdates/handle-recreated-files-correctly.js new file mode 100644 index 0000000000000..f547bf7d6c707 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/handle-recreated-files-correctly.js @@ -0,0 +1,160 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/commonFile1.ts] +let x = 1 + +//// [/a/b/commonFile2.ts] +let y = 1 + +//// [/a/b/tsconfig.json] +{} + +//// [/a/b/commonFile1.js] +var x = 1; + + +//// [/a/b/commonFile2.js] +var y = 1; + + + +Output:: +>> Screen clear +12:00:17 AM - Starting compilation in watch mode... + + + +12:00:22 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/commonfile1.ts: + {"pollingInterval":250} +/a/b/commonfile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: delete file2 + +//// [/a/b/commonFile2.ts] deleted + +Output:: +>> Screen clear +12:00:24 AM - File change detected. Starting incremental compilation... + + + +12:00:25 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/commonFile1.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts + +Semantic diagnostics in builder refreshed for:: + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/commonfile1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: recreate file2 + +//// [/a/b/commonFile1.js] file written with same contents +//// [/a/b/commonFile2.js] file written with same contents +//// [/a/b/commonFile2.ts] +let y = 1 + + +Output:: +>> Screen clear +12:00:28 AM - File change detected. Starting incremental compilation... + + + +12:00:35 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/commonfile1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/commonfile2.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/handles-the-missing-files---that-were-added-to-program-because-they-were-added-with-tripleSlashRefs.js b/tests/baselines/reference/tscWatch/programUpdates/handles-the-missing-files---that-were-added-to-program-because-they-were-added-with-tripleSlashRefs.js new file mode 100644 index 0000000000000..9859ede4b9294 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/handles-the-missing-files---that-were-added-to-program-because-they-were-added-with-tripleSlashRefs.js @@ -0,0 +1,106 @@ +/a/lib/tsc.js -w /a/b/commonFile1.ts +//// [/a/b/commonFile1.ts] +/// + let x = y + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/commonFile1.js] +/// +var x = y; + + + +Output:: +>> Screen clear +12:00:13 AM - Starting compilation in watch mode... + + +a/b/commonFile1.ts(1,22): error TS6053: File '/a/b/commonFile2.ts' not found. + +a/b/commonFile1.ts(2,29): error TS2304: Cannot find name 'y'. + + +12:00:16 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/a/b/commonFile1.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts + +WatchedFiles:: +/a/b/commonfile1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/commonfile2.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: create file2 + +//// [/a/b/commonFile1.js] file written with same contents +//// [/a/b/commonFile2.ts] +let y = 1 + +//// [/a/b/commonFile2.js] +var y = 1; + + + +Output:: +>> Screen clear +12:00:19 AM - File change detected. Starting incremental compilation... + + + +12:00:25 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/commonFile1.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/b/commonFile2.ts +/a/b/commonFile1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/commonFile2.ts +/a/b/commonFile1.ts + +WatchedFiles:: +/a/b/commonfile1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/commonfile2.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/if-config-file-doesnt-have-errors,-they-are-not-reported.js b/tests/baselines/reference/tscWatch/programUpdates/if-config-file-doesnt-have-errors,-they-are-not-reported.js new file mode 100644 index 0000000000000..2bae0d9afc6a5 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/if-config-file-doesnt-have-errors,-they-are-not-reported.js @@ -0,0 +1,63 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/b/app.ts] +let x = 10 + +//// [/a/b/tsconfig.json] +{ + "compilerOptions": {} + } + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/app.js] +var x = 10; + + + +Output:: +>> Screen clear +12:00:15 AM - Starting compilation in watch mode... + + + +12:00:18 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/app.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/app.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/app.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/non-existing-directories-listed-in-config-file-input-array-should-be-able-to-handle-@types-if-input-file-list-is-empty.js b/tests/baselines/reference/tscWatch/programUpdates/non-existing-directories-listed-in-config-file-input-array-should-be-able-to-handle-@types-if-input-file-list-is-empty.js new file mode 100644 index 0000000000000..b342c0248e221 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/non-existing-directories-listed-in-config-file-input-array-should-be-able-to-handle-@types-if-input-file-list-is-empty.js @@ -0,0 +1,55 @@ +/a/lib/tsc.js -w -p /a/tsconfig.json +//// [/a/app.ts] +let x = 1 + +//// [/a/tsconfig.json] +{"compiler":{},"files":[]} + +//// [/a/node_modules/@types/typings/index.d.ts] +export * from "./lib" + +//// [/a/node_modules/@types/typings/lib.d.ts] +export const x: number + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + +tsconfig.json(1,24): error TS18002: The 'files' list in config file '/a/tsconfig.json' is empty. + + +12:00:24 AM - Found 1 error. Watching for file changes. + + +Program root files: [] +Program options: {"watch":true,"project":"/a/tsconfig.json","configFilePath":"/a/tsconfig.json"} +Program files:: + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/a/tsconfig.json: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/non-existing-directories-listed-in-config-file-input-array-should-be-tolerated-without-crashing-the-server.js b/tests/baselines/reference/tscWatch/programUpdates/non-existing-directories-listed-in-config-file-input-array-should-be-tolerated-without-crashing-the-server.js new file mode 100644 index 0000000000000..4f6e68732df56 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/non-existing-directories-listed-in-config-file-input-array-should-be-tolerated-without-crashing-the-server.js @@ -0,0 +1,58 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/b/file1.ts] +let t = 10; + +//// [/a/b/tsconfig.json] +{ + "compilerOptions": {}, + "include": ["app/*", "test/**/*", "something"] + } + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Output:: +>> Screen clear +12:00:15 AM - Starting compilation in watch mode... + + +error TS18003: No inputs were found in config file '/a/b/tsconfig.json'. Specified 'include' paths were '["app/*","test/**/*","something"]' and 'exclude' paths were '[]'. + + +12:00:16 AM - Found 1 error. Watching for file changes. + + +Program root files: [] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} + +FsWatches:: +/a/b/app: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b/test: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b/something: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/rename-a-module-file-and-rename-back-should-restore-the-states-for-configured-projects.js b/tests/baselines/reference/tscWatch/programUpdates/rename-a-module-file-and-rename-back-should-restore-the-states-for-configured-projects.js new file mode 100644 index 0000000000000..b6830cfbfd5e0 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/rename-a-module-file-and-rename-back-should-restore-the-states-for-configured-projects.js @@ -0,0 +1,198 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/b/moduleFile.ts] +export function bar() { }; + +//// [/a/b/file1.ts] +import * as T from "./moduleFile"; T.bar(); + +//// [/a/b/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/moduleFile.js] +"use strict"; +exports.__esModule = true; +function bar() { } +exports.bar = bar; +; + + +//// [/a/b/file1.js] +"use strict"; +exports.__esModule = true; +var T = require("./moduleFile"); +T.bar(); + + + +Output:: +>> Screen clear +12:00:17 AM - Starting compilation in watch mode... + + + +12:00:22 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1.ts","/a/b/moduleFile.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile.ts +/a/b/file1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/moduleFile.ts +/a/b/file1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1.ts: + {"pollingInterval":250} +/a/b/modulefile.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename moduleFile to moduleFile1 + +//// [/a/b/file1.js] file written with same contents +//// [/a/b/moduleFile1.ts] +export function bar() { }; + +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +function bar() { } +exports.bar = bar; +; + + +//// [/a/b/moduleFile.ts] deleted +//// [/a/b/moduleFile.js] deleted + +Output:: +>> Screen clear +12:00:27 AM - File change detected. Starting incremental compilation... + + +a/b/file1.ts(1,20): error TS2307: Cannot find module './moduleFile'. + + +12:00:33 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a/b/file1.ts","/a/b/moduleFile1.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/file1.ts +/a/b/moduleFile1.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/file1.ts +/a/b/moduleFile1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/modulefile1.ts: + {"pollingInterval":250} + +FsWatches:: +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b/modulefile: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename moduleFile1 back to moduleFile + +//// [/a/b/file1.js] file written with same contents +//// [/a/b/moduleFile.ts] +export function bar() { }; + +//// [/a/b/moduleFile.js] +"use strict"; +exports.__esModule = true; +function bar() { } +exports.bar = bar; +; + + +//// [/a/b/moduleFile1.ts] deleted + +Output:: +>> Screen clear +12:00:37 AM - File change detected. Starting incremental compilation... + + + +12:00:43 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1.ts","/a/b/moduleFile.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile.ts +/a/b/file1.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/moduleFile.ts +/a/b/file1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/modulefile.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/rename-a-module-file-and-rename-back-should-restore-the-states-for-inferred-projects.js b/tests/baselines/reference/tscWatch/programUpdates/rename-a-module-file-and-rename-back-should-restore-the-states-for-inferred-projects.js new file mode 100644 index 0000000000000..e3acfd60e2c0a --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/rename-a-module-file-and-rename-back-should-restore-the-states-for-inferred-projects.js @@ -0,0 +1,163 @@ +/a/lib/tsc.js -w /a/b/file1.ts +//// [/a/b/moduleFile.ts] +export function bar() { }; + +//// [/a/b/file1.ts] +import * as T from "./moduleFile"; T.bar(); + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/moduleFile.js] +"use strict"; +exports.__esModule = true; +function bar() { } +exports.bar = bar; +; + + +//// [/a/b/file1.js] +"use strict"; +exports.__esModule = true; +var T = require("./moduleFile"); +T.bar(); + + + +Output:: +>> Screen clear +12:00:15 AM - Starting compilation in watch mode... + + + +12:00:20 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile.ts +/a/b/file1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/moduleFile.ts +/a/b/file1.ts + +WatchedFiles:: +/a/b/file1.ts: + {"pollingInterval":250} +/a/b/modulefile.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Rename moduleFile to moduleFile1 + +//// [/a/b/file1.js] file written with same contents +//// [/a/b/moduleFile1.ts] +export function bar() { }; + +//// [/a/b/moduleFile.ts] deleted +//// [/a/b/moduleFile.js] deleted + +Output:: +>> Screen clear +12:00:25 AM - File change detected. Starting incremental compilation... + + +a/b/file1.ts(1,20): error TS2307: Cannot find module './moduleFile'. + + +12:00:29 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a/b/file1.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/b/file1.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/file1.ts + +WatchedFiles:: +/a/b/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/modulefile.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Rename moduleFile1 back to moduleFile + +//// [/a/b/file1.js] file written with same contents +//// [/a/b/moduleFile.ts] +export function bar() { }; + +//// [/a/b/moduleFile.js] +"use strict"; +exports.__esModule = true; +function bar() { } +exports.bar = bar; +; + + +//// [/a/b/moduleFile1.ts] deleted + +Output:: +>> Screen clear +12:00:33 AM - File change detected. Starting incremental compilation... + + + +12:00:39 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/b/moduleFile.ts +/a/b/file1.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/moduleFile.ts +/a/b/file1.ts + +WatchedFiles:: +/a/b/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/modulefile.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/reports-errors-correctly-with-file-not-in-rootDir.js b/tests/baselines/reference/tscWatch/programUpdates/reports-errors-correctly-with-file-not-in-rootDir.js new file mode 100644 index 0000000000000..df304098daf75 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/reports-errors-correctly-with-file-not-in-rootDir.js @@ -0,0 +1,127 @@ +/a/lib/tsc.js -w +//// [/user/username/projects/myproject/a.ts] +import { x } from "../b"; + +//// [/user/username/projects/b.ts] +export const x = 10; + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"rootDir":".","outDir":"lib"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/lib/b.js] +"use strict"; +exports.__esModule = true; +exports.x = 10; + + +//// [/user/username/projects/myproject/lib/myproject/a.js] +"use strict"; +exports.__esModule = true; + + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + +a.ts(1,19): error TS6059: File '/user/username/projects/b.ts' is not under 'rootDir' '/user/username/projects/myproject'. 'rootDir' is expected to contain all source files. + + +12:00:34 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"rootDir":"/user/username/projects/myproject","outDir":"/user/username/projects/myproject/lib","watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/b.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/b.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Make changes to file a + +//// [/user/username/projects/myproject/a.ts] + + +import { x } from "../b"; + +//// [/user/username/projects/myproject/lib/myproject/a.js] file written with same contents + +Output:: +>> Screen clear +12:00:38 AM - File change detected. Starting incremental compilation... + + +a.ts(3,19): error TS6059: File '/user/username/projects/b.ts' is not under 'rootDir' '/user/username/projects/myproject'. 'rootDir' is expected to contain all source files. + + +12:00:42 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"rootDir":"/user/username/projects/myproject","outDir":"/user/username/projects/myproject/lib","watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/b.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/reports-errors-correctly-with-isolatedModules.js b/tests/baselines/reference/tscWatch/programUpdates/reports-errors-correctly-with-isolatedModules.js new file mode 100644 index 0000000000000..b645604c671aa --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/reports-errors-correctly-with-isolatedModules.js @@ -0,0 +1,132 @@ +/a/lib/tsc.js -w +//// [/user/username/projects/myproject/a.ts] +export const a: string = ""; + +//// [/user/username/projects/myproject/b.ts] +import { a } from "./a"; +const b: string = a; + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"isolatedModules":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; +exports.a = ""; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; +var a_1 = require("./a"); +var b = a_1.a; + + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + + +12:00:28 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"isolatedModules":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change shape of a + +//// [/user/username/projects/myproject/a.ts] +export const a: number = 1 + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; +exports.a = 1; + + + +Output:: +>> Screen clear +12:00:32 AM - File change detected. Starting incremental compilation... + + +b.ts(2,7): error TS2322: Type 'number' is not assignable to type 'string'. + + +12:00:36 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"isolatedModules":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-handle-non-existing-directories-in-config-file.js b/tests/baselines/reference/tscWatch/programUpdates/should-handle-non-existing-directories-in-config-file.js new file mode 100644 index 0000000000000..c7eb6a8dffb2b --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/should-handle-non-existing-directories-in-config-file.js @@ -0,0 +1,63 @@ +/a/lib/tsc.js -w -p /a/tsconfig.json +//// [/a/src/app.ts] +let x = 1; + +//// [/a/tsconfig.json] +{"compilerOptions":{},"include":["src/**/*","notexistingfolder/*"]} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/src/app.js] +var x = 1; + + + +Output:: +>> Screen clear +12:00:15 AM - Starting compilation in watch mode... + + + +12:00:18 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/src/app.ts"] +Program options: {"watch":true,"project":"/a/tsconfig.json","configFilePath":"/a/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/src/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/src/app.ts + +WatchedFiles:: +/a/tsconfig.json: + {"pollingInterval":250} +/a/src/app.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/a/notexistingfolder: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/a/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-ignore-non-existing-files-specified-in-the-config-file.js b/tests/baselines/reference/tscWatch/programUpdates/should-ignore-non-existing-files-specified-in-the-config-file.js new file mode 100644 index 0000000000000..67c4f8501f127 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/should-ignore-non-existing-files-specified-in-the-config-file.js @@ -0,0 +1,70 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/b/commonFile1.ts] +let x = 1 + +//// [/a/b/commonFile2.ts] +let y = 1 + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/tsconfig.json] +{ + "compilerOptions": {}, + "files": [ + "commonFile1.ts", + "commonFile3.ts" + ] + } + +//// [/a/b/commonFile1.js] +var x = 1; + + + +Output:: +>> Screen clear +12:00:17 AM - Starting compilation in watch mode... + + +error TS6053: File '/a/b/commonFile3.ts' not found. + + +12:00:20 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile3.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/commonfile1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/commonfile3.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js new file mode 100644 index 0000000000000..557505fc40fad --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js @@ -0,0 +1,157 @@ +/a/lib/tsc.js -w -p /user/username/projects/myproject/tsconfig.json +//// [/user/username/projects/myproject/file1.ts] +export const c = 30; + +//// [/user/username/projects/myproject/src/file2.ts] +import {c} from "file1"; export const d = 30; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/tsconfig.json] +{ + "compilerOptions": { + /* Basic Options */ + // "incremental": true, /* Enable incremental compilation */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ + "module": "amd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ + // "lib": [], /* Specify library files to be included in the compilation. */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + + /* Source Map Options */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + + /* Advanced Options */ + "declarationDir": "decls", /* Output directory for generated declaration files. */ + "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + } +} + + +//// [/user/username/projects/myproject/file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.c = 30; +}); + + +//// [/user/username/projects/myproject/decls/file1.d.ts] +export declare const c = 30; + + +//// [/user/username/projects/myproject/src/file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.d = 30; +}); + + +//// [/user/username/projects/myproject/decls/src/file2.d.ts] +export declare const d = 30; + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:40 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/file1.ts","/user/username/projects/myproject/src/file2.ts"] +Program options: {"target":1,"module":2,"declaration":true,"strict":true,"esModuleInterop":true,"declarationDir":"/user/username/projects/myproject/decls","forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/file1.ts +/user/username/projects/myproject/src/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/file1.ts +/user/username/projects/myproject/src/file2.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/file1.ts: + {"pollingInterval":250} +/user/username/projects/myproject/src/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js new file mode 100644 index 0000000000000..9e6974f2dcd2c --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js @@ -0,0 +1,157 @@ +/a/lib/tsc.js -w -p /user/username/projects/myproject/tsconfig.json +//// [/user/username/projects/myproject/file1.ts] +export const c = 30; + +//// [/user/username/projects/myproject/src/file2.ts] +import {c} from "file1"; export const d = 30; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/tsconfig.json] +{ + "compilerOptions": { + /* Basic Options */ + // "incremental": true, /* Enable incremental compilation */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ + "module": "amd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ + // "lib": [], /* Specify library files to be included in the compilation. */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + "outDir": "build", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + + /* Source Map Options */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + + /* Advanced Options */ + "declarationDir": "decls", /* Output directory for generated declaration files. */ + "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + } +} + + +//// [/user/username/projects/myproject/build/file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.c = 30; +}); + + +//// [/user/username/projects/myproject/decls/file1.d.ts] +export declare const c = 30; + + +//// [/user/username/projects/myproject/build/src/file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.d = 30; +}); + + +//// [/user/username/projects/myproject/decls/src/file2.d.ts] +export declare const d = 30; + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:46 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/file1.ts","/user/username/projects/myproject/src/file2.ts"] +Program options: {"target":1,"module":2,"declaration":true,"outDir":"/user/username/projects/myproject/build","strict":true,"esModuleInterop":true,"declarationDir":"/user/username/projects/myproject/decls","forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/file1.ts +/user/username/projects/myproject/src/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/file1.ts +/user/username/projects/myproject/src/file2.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/file1.ts: + {"pollingInterval":250} +/user/username/projects/myproject/src/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js new file mode 100644 index 0000000000000..5ca7256d6dca7 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js @@ -0,0 +1,148 @@ +/a/lib/tsc.js -w -p /user/username/projects/myproject/tsconfig.json +//// [/user/username/projects/myproject/file1.ts] +export const c = 30; + +//// [/user/username/projects/myproject/src/file2.ts] +import {c} from "file1"; export const d = 30; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/tsconfig.json] +{ + "compilerOptions": { + /* Basic Options */ + // "incremental": true, /* Enable incremental compilation */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ + "module": "amd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ + // "lib": [], /* Specify library files to be included in the compilation. */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + "outDir": "build", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + + /* Source Map Options */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + + /* Advanced Options */ + "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + } +} + + +//// [/user/username/projects/myproject/build/file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.c = 30; +}); + + +//// [/user/username/projects/myproject/build/src/file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.d = 30; +}); + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:36 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/file1.ts","/user/username/projects/myproject/src/file2.ts"] +Program options: {"target":1,"module":2,"outDir":"/user/username/projects/myproject/build","strict":true,"esModuleInterop":true,"forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/file1.ts +/user/username/projects/myproject/src/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/file1.ts +/user/username/projects/myproject/src/file2.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/file1.ts: + {"pollingInterval":250} +/user/username/projects/myproject/src/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js new file mode 100644 index 0000000000000..dd556825de4ae --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js @@ -0,0 +1,142 @@ +/a/lib/tsc.js -w -p /user/username/projects/myproject/tsconfig.json +//// [/user/username/projects/myproject/file1.ts] +export const c = 30; + +//// [/user/username/projects/myproject/src/file2.ts] +import {c} from "file1"; export const d = 30; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/tsconfig.json] +{ + "compilerOptions": { + /* Basic Options */ + // "incremental": true, /* Enable incremental compilation */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ + "module": "amd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ + // "lib": [], /* Specify library files to be included in the compilation. */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + "outFile": "build/outFile.js", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + + /* Source Map Options */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + + /* Advanced Options */ + "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + } +} + + +//// [/user/username/projects/myproject/build/outFile.js] +define("file1", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.c = 30; +}); +define("src/file2", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.d = 30; +}); + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:31 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/file1.ts","/user/username/projects/myproject/src/file2.ts"] +Program options: {"target":1,"module":2,"outFile":"/user/username/projects/myproject/build/outFile.js","strict":true,"esModuleInterop":true,"forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/file1.ts +/user/username/projects/myproject/src/file2.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/file1.ts: + {"pollingInterval":250} +/user/username/projects/myproject/src/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js new file mode 100644 index 0000000000000..0d5353320a2aa --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js @@ -0,0 +1,148 @@ +/a/lib/tsc.js -w -p /user/username/projects/myproject/tsconfig.json +//// [/user/username/projects/myproject/file1.ts] +export const c = 30; + +//// [/user/username/projects/myproject/src/file2.ts] +import {c} from "file1"; export const d = 30; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/tsconfig.json] +{ + "compilerOptions": { + /* Basic Options */ + // "incremental": true, /* Enable incremental compilation */ + "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ + "module": "amd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ + // "lib": [], /* Specify library files to be included in the compilation. */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + + /* Source Map Options */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + + /* Advanced Options */ + "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + } +} + + +//// [/user/username/projects/myproject/file1.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.c = 30; +}); + + +//// [/user/username/projects/myproject/src/file2.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.d = 30; +}); + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/file1.ts","/user/username/projects/myproject/src/file2.ts"] +Program options: {"target":1,"module":2,"strict":true,"esModuleInterop":true,"forceConsistentCasingInFileNames":true,"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/file1.ts +/user/username/projects/myproject/src/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/file1.ts +/user/username/projects/myproject/src/file2.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/file1.ts: + {"pollingInterval":250} +/user/username/projects/myproject/src/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-properly-handle-module-resolution-changes-in-config-file.js b/tests/baselines/reference/tscWatch/programUpdates/should-properly-handle-module-resolution-changes-in-config-file.js new file mode 100644 index 0000000000000..45ecb2296b02a --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/should-properly-handle-module-resolution-changes-in-config-file.js @@ -0,0 +1,134 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/file1.ts] +import { T } from "module1"; + +//// [/a/b/node_modules/module1.ts] +export interface T {} + +//// [/a/module1.ts] +export interface T {} + +//// [/a/b/tsconfig.json] +{ + "compilerOptions": { + "moduleResolution": "node" + }, + "files": ["/a/b/file1.ts"] + } + +//// [/a/b/file1.js] +"use strict"; +exports.__esModule = true; + + + +Output:: +>> Screen clear +12:00:21 AM - Starting compilation in watch mode... + + + +12:00:24 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1.ts"] +Program options: {"moduleResolution":2,"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/node_modules/module1.ts +/a/b/file1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/node_modules/module1.ts +/a/b/file1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1.ts: + {"pollingInterval":250} +/a/b/node_modules/module1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change module resolution to classic + +//// [/a/b/tsconfig.json] +{ + "compilerOptions": { + "moduleResolution": "classic" + }, + "files": ["/a/b/file1.ts"] + } + +//// [/a/b/file1.js] file written with same contents +//// [/a/module1.js] +"use strict"; +exports.__esModule = true; + + + +Output:: +>> Screen clear +12:00:28 AM - File change detected. Starting incremental compilation... + + + +12:00:34 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file1.ts"] +Program options: {"moduleResolution":1,"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/module1.ts +/a/b/file1.ts + +Semantic diagnostics in builder refreshed for:: +/a/module1.ts +/a/b/file1.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/module1.ts: + {"pollingInterval":250} + +FsWatches:: +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-reflect-change-in-config-file.js b/tests/baselines/reference/tscWatch/programUpdates/should-reflect-change-in-config-file.js new file mode 100644 index 0000000000000..3986c85627363 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/should-reflect-change-in-config-file.js @@ -0,0 +1,115 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/commonFile1.ts] +let x = 1 + +//// [/a/b/commonFile2.ts] +let y = 1 + +//// [/a/b/tsconfig.json] +{ + "compilerOptions": {}, + "files": ["/a/b/commonFile1.ts", "/a/b/commonFile2.ts"] + } + +//// [/a/b/commonFile1.js] +var x = 1; + + +//// [/a/b/commonFile2.js] +var y = 1; + + + +Output:: +>> Screen clear +12:00:17 AM - Starting compilation in watch mode... + + + +12:00:22 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/commonfile1.ts: + {"pollingInterval":250} +/a/b/commonfile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Change config + +//// [/a/b/tsconfig.json] +{ + "compilerOptions": {}, + "files": ["/a/b/commonFile1.ts"] + } + + +Output:: +>> Screen clear +12:00:26 AM - File change detected. Starting incremental compilation... + + + +12:00:27 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/commonFile1.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts + +Semantic diagnostics in builder refreshed for:: + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/commonfile1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-tolerate-config-file-errors-and-still-try-to-build-a-project.js b/tests/baselines/reference/tscWatch/programUpdates/should-tolerate-config-file-errors-and-still-try-to-build-a-project.js new file mode 100644 index 0000000000000..c9485bc0d24e2 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/should-tolerate-config-file-errors-and-still-try-to-build-a-project.js @@ -0,0 +1,80 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/b/commonFile1.ts] +let x = 1 + +//// [/a/b/commonFile2.ts] +let y = 1 + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/tsconfig.json] +{ + "compilerOptions": { + "module": "none", + "allowAnything": true + }, + "someOtherProperty": {} + } + +//// [/a/b/commonFile1.js] +var x = 1; + + +//// [/a/b/commonFile2.js] +var y = 1; + + + +Output:: +>> Screen clear +12:00:17 AM - Starting compilation in watch mode... + + +a/b/tsconfig.json(4,29): error TS5023: Unknown compiler option 'allowAnything'. + + +12:00:22 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile2.ts"] +Program options: {"module":0,"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/commonfile1.ts: + {"pollingInterval":250} +/a/b/commonfile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/shouldnt-report-error-about-unused-function-incorrectly-when-file-changes-from-global-to-module.js b/tests/baselines/reference/tscWatch/programUpdates/shouldnt-report-error-about-unused-function-incorrectly-when-file-changes-from-global-to-module.js new file mode 100644 index 0000000000000..b8a0b45499938 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/shouldnt-report-error-about-unused-function-incorrectly-when-file-changes-from-global-to-module.js @@ -0,0 +1,115 @@ +/a/lib/tsc.js -w /a/b/file.ts --noUnusedLocals +//// [/a/b/file.ts] +function one() {} +function two() { + return function three() { + one(); + } +} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/file.js] +function one() { } +function two() { + return function three() { + one(); + }; +} + + + +Output:: +>> Screen clear +12:00:13 AM - Starting compilation in watch mode... + + + +12:00:16 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file.ts"] +Program options: {"watch":true,"noUnusedLocals":true} +Program files:: +/a/lib/lib.d.ts +/a/b/file.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/file.ts + +WatchedFiles:: +/a/b/file.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Change file to module + +//// [/a/b/file.ts] +function one() {} +export function two() { + return function three() { + one(); + } +} + +//// [/a/b/file.js] +"use strict"; +exports.__esModule = true; +function one() { } +function two() { + return function three() { + one(); + }; +} +exports.two = two; + + + +Output:: +>> Screen clear +12:00:20 AM - File change detected. Starting incremental compilation... + + + +12:00:24 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/file.ts"] +Program options: {"watch":true,"noUnusedLocals":true} +Program files:: +/a/lib/lib.d.ts +/a/b/file.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/file.ts + +WatchedFiles:: +/a/b/file.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/types-should-load-from-config-file-path-if-config-exists.js b/tests/baselines/reference/tscWatch/programUpdates/types-should-load-from-config-file-path-if-config-exists.js new file mode 100644 index 0000000000000..9ce3b945af0b7 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/types-should-load-from-config-file-path-if-config-exists.js @@ -0,0 +1,68 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/b/app.ts] +let x = 1 + +//// [/a/b/tsconfig.json] +{"compilerOptions":{"types":["node"],"typeRoots":[]}} + +//// [/a/b/node_modules/@types/node/index.d.ts] +declare var process: any + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/app.js] +var x = 1; + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:28 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/app.ts"] +Program options: {"types":["node"],"typeRoots":[],"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/app.ts +/a/b/node_modules/@types/node/index.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/app.ts +/a/b/node_modules/@types/node/index.d.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/app.ts: + {"pollingInterval":250} +/a/b/node_modules/@types/node/index.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/updates-errors-correctly-when-declaration-emit-is-disabled-in-compiler-options.js b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-correctly-when-declaration-emit-is-disabled-in-compiler-options.js new file mode 100644 index 0000000000000..b818f62280c16 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-correctly-when-declaration-emit-is-disabled-in-compiler-options.js @@ -0,0 +1,270 @@ +/a/lib/tsc.js -w +//// [/user/username/projects/myproject/a.ts] +import test from './b'; +test(4, 5); + +//// [/user/username/projects/myproject/b.ts] +function test(x: number, y: number) { + return x + y / 5; +} +export default test; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"module":"commonjs","noEmit":true,"strict":true}} + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + + +12:00:24 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"module":1,"noEmit":true,"strict":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Changed x type to string + +//// [/user/username/projects/myproject/b.ts] +function test(x: string, y: number) { + return x + y / 5; +} +export default test; + + +Output:: +>> Screen clear +12:00:28 AM - File change detected. Starting incremental compilation... + + +a.ts(2,6): error TS2345: Argument of type '4' is not assignable to parameter of type 'string'. + + +12:00:29 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"module":1,"noEmit":true,"strict":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Changed x type to number + +//// [/user/username/projects/myproject/b.ts] +function test(x: number, y: number) { + return x + y / 5; +} +export default test; + + +Output:: +>> Screen clear +12:00:33 AM - File change detected. Starting incremental compilation... + + + +12:00:34 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"module":1,"noEmit":true,"strict":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Changed y type to string + +//// [/user/username/projects/myproject/b.ts] +function test(x: number, y: string) { + return x + y / 5; +} +export default test; + + +Output:: +>> Screen clear +12:00:38 AM - File change detected. Starting incremental compilation... + + +a.ts(2,9): error TS2345: Argument of type '5' is not assignable to parameter of type 'string'. + +b.ts(2,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. + + +12:00:39 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"module":1,"noEmit":true,"strict":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Changed y type to number + +//// [/user/username/projects/myproject/b.ts] +function test(x: number, y: number) { + return x + y / 5; +} +export default test; + + +Output:: +>> Screen clear +12:00:43 AM - File change detected. Starting incremental compilation... + + + +12:00:44 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"module":1,"noEmit":true,"strict":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-module-file-with-global-definitions-changes/with-default-options.js b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-module-file-with-global-definitions-changes/with-default-options.js new file mode 100644 index 0000000000000..2207b02abf560 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-module-file-with-global-definitions-changes/with-default-options.js @@ -0,0 +1,162 @@ +/a/lib/tsc.js -w /user/username/projects/myproject/a.ts +//// [/user/username/projects/myproject/a.ts] +export {} +declare global { +interface Document { + fullscreen: boolean; +} +var y: number; +} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface Document { + readonly fullscreen: boolean; +} + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; + + + +Output:: +>> Screen clear +12:00:19 AM - Starting compilation in watch mode... + + +../../../../a/lib/lib.d.ts(13,14): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + +a.ts(4,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + + +12:00:22 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Remove document declaration from file + +//// [/user/username/projects/myproject/a.ts] +export {} +declare global { +var x: string; +var y: number; +} + +//// [/user/username/projects/myproject/a.js] file written with same contents + +Output:: +>> Screen clear +12:00:26 AM - File change detected. Starting incremental compilation... + + + +12:00:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rever the file to contain document declaration + +//// [/user/username/projects/myproject/a.ts] +export {} +declare global { +interface Document { + fullscreen: boolean; +} +var y: number; +} + +//// [/user/username/projects/myproject/a.js] file written with same contents + +Output:: +>> Screen clear +12:00:34 AM - File change detected. Starting incremental compilation... + + +../../../../a/lib/lib.d.ts(13,14): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + +a.ts(4,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + + +12:00:38 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-module-file-with-global-definitions-changes/with-skipDefaultLibCheck.js b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-module-file-with-global-definitions-changes/with-skipDefaultLibCheck.js new file mode 100644 index 0000000000000..1ccb60c790ca3 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-module-file-with-global-definitions-changes/with-skipDefaultLibCheck.js @@ -0,0 +1,156 @@ +/a/lib/tsc.js -w /user/username/projects/myproject/a.ts --skipDefaultLibCheck +//// [/user/username/projects/myproject/a.ts] +export {} +declare global { +interface Document { + fullscreen: boolean; +} +var y: number; +} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface Document { + readonly fullscreen: boolean; +} + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; + + + +Output:: +>> Screen clear +12:00:19 AM - Starting compilation in watch mode... + + +a.ts(4,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + + +12:00:22 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true,"skipDefaultLibCheck":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Remove document declaration from file + +//// [/user/username/projects/myproject/a.ts] +export {} +declare global { +var x: string; +var y: number; +} + +//// [/user/username/projects/myproject/a.js] file written with same contents + +Output:: +>> Screen clear +12:00:26 AM - File change detected. Starting incremental compilation... + + + +12:00:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true,"skipDefaultLibCheck":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rever the file to contain document declaration + +//// [/user/username/projects/myproject/a.ts] +export {} +declare global { +interface Document { + fullscreen: boolean; +} +var y: number; +} + +//// [/user/username/projects/myproject/a.js] file written with same contents + +Output:: +>> Screen clear +12:00:34 AM - File change detected. Starting incremental compilation... + + +a.ts(4,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + + +12:00:38 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true,"skipDefaultLibCheck":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-module-file-with-global-definitions-changes/with-skipLibCheck.js b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-module-file-with-global-definitions-changes/with-skipLibCheck.js new file mode 100644 index 0000000000000..56df1558af3e9 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-module-file-with-global-definitions-changes/with-skipLibCheck.js @@ -0,0 +1,156 @@ +/a/lib/tsc.js -w /user/username/projects/myproject/a.ts --skipLibCheck +//// [/user/username/projects/myproject/a.ts] +export {} +declare global { +interface Document { + fullscreen: boolean; +} +var y: number; +} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface Document { + readonly fullscreen: boolean; +} + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; + + + +Output:: +>> Screen clear +12:00:19 AM - Starting compilation in watch mode... + + +a.ts(4,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + + +12:00:22 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true,"skipLibCheck":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Remove document declaration from file + +//// [/user/username/projects/myproject/a.ts] +export {} +declare global { +var x: string; +var y: number; +} + +//// [/user/username/projects/myproject/a.js] file written with same contents + +Output:: +>> Screen clear +12:00:26 AM - File change detected. Starting incremental compilation... + + + +12:00:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true,"skipLibCheck":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rever the file to contain document declaration + +//// [/user/username/projects/myproject/a.ts] +export {} +declare global { +interface Document { + fullscreen: boolean; +} +var y: number; +} + +//// [/user/username/projects/myproject/a.js] file written with same contents + +Output:: +>> Screen clear +12:00:34 AM - File change detected. Starting incremental compilation... + + +a.ts(4,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + + +12:00:38 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true,"skipLibCheck":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-non-module-file-changes/with-default-options.js b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-non-module-file-changes/with-default-options.js new file mode 100644 index 0000000000000..3ad150772e17f --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-non-module-file-changes/with-default-options.js @@ -0,0 +1,159 @@ +/a/lib/tsc.js -w /user/username/projects/myproject/a.ts +//// [/user/username/projects/myproject/a.ts] +interface Document { + fullscreen: boolean; +} +var y: number; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface Document { + readonly fullscreen: boolean; +} + +//// [/user/username/projects/myproject/a.js] +var y; + + + +Output:: +>> Screen clear +12:00:19 AM - Starting compilation in watch mode... + + +../../../../a/lib/lib.d.ts(13,14): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + +a.ts(2,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + + +12:00:22 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Remove document declaration from file + +//// [/user/username/projects/myproject/a.ts] +var x: string; +var y: number; + +//// [/user/username/projects/myproject/a.js] +var x; +var y; + + + +Output:: +>> Screen clear +12:00:26 AM - File change detected. Starting incremental compilation... + + + +12:00:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rever the file to contain document declaration + +//// [/user/username/projects/myproject/a.ts] +interface Document { + fullscreen: boolean; +} +var y: number; + +//// [/user/username/projects/myproject/a.js] +var y; + + + +Output:: +>> Screen clear +12:00:34 AM - File change detected. Starting incremental compilation... + + +../../../../a/lib/lib.d.ts(13,14): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + +a.ts(2,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + + +12:00:38 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-non-module-file-changes/with-skipDefaultLibCheck.js b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-non-module-file-changes/with-skipDefaultLibCheck.js new file mode 100644 index 0000000000000..e2c69174598a8 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-non-module-file-changes/with-skipDefaultLibCheck.js @@ -0,0 +1,153 @@ +/a/lib/tsc.js -w /user/username/projects/myproject/a.ts --skipDefaultLibCheck +//// [/user/username/projects/myproject/a.ts] +interface Document { + fullscreen: boolean; +} +var y: number; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface Document { + readonly fullscreen: boolean; +} + +//// [/user/username/projects/myproject/a.js] +var y; + + + +Output:: +>> Screen clear +12:00:19 AM - Starting compilation in watch mode... + + +a.ts(2,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + + +12:00:22 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true,"skipDefaultLibCheck":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Remove document declaration from file + +//// [/user/username/projects/myproject/a.ts] +var x: string; +var y: number; + +//// [/user/username/projects/myproject/a.js] +var x; +var y; + + + +Output:: +>> Screen clear +12:00:26 AM - File change detected. Starting incremental compilation... + + + +12:00:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true,"skipDefaultLibCheck":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rever the file to contain document declaration + +//// [/user/username/projects/myproject/a.ts] +interface Document { + fullscreen: boolean; +} +var y: number; + +//// [/user/username/projects/myproject/a.js] +var y; + + + +Output:: +>> Screen clear +12:00:34 AM - File change detected. Starting incremental compilation... + + +a.ts(2,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + + +12:00:38 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true,"skipDefaultLibCheck":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-non-module-file-changes/with-skipLibCheck.js b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-non-module-file-changes/with-skipLibCheck.js new file mode 100644 index 0000000000000..6e0dc94052e80 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-in-lib-file/when-non-module-file-changes/with-skipLibCheck.js @@ -0,0 +1,153 @@ +/a/lib/tsc.js -w /user/username/projects/myproject/a.ts --skipLibCheck +//// [/user/username/projects/myproject/a.ts] +interface Document { + fullscreen: boolean; +} +var y: number; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface Document { + readonly fullscreen: boolean; +} + +//// [/user/username/projects/myproject/a.js] +var y; + + + +Output:: +>> Screen clear +12:00:19 AM - Starting compilation in watch mode... + + +a.ts(2,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + + +12:00:22 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true,"skipLibCheck":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Remove document declaration from file + +//// [/user/username/projects/myproject/a.ts] +var x: string; +var y: number; + +//// [/user/username/projects/myproject/a.js] +var x; +var y; + + + +Output:: +>> Screen clear +12:00:26 AM - File change detected. Starting incremental compilation... + + + +12:00:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true,"skipLibCheck":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rever the file to contain document declaration + +//// [/user/username/projects/myproject/a.ts] +interface Document { + fullscreen: boolean; +} +var y: number; + +//// [/user/username/projects/myproject/a.js] +var y; + + + +Output:: +>> Screen clear +12:00:34 AM - File change detected. Starting incremental compilation... + + +a.ts(2,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + + +12:00:38 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true,"skipLibCheck":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/updates-errors-when-ambient-modules-of-program-changes.js b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-when-ambient-modules-of-program-changes.js new file mode 100644 index 0000000000000..10c14d872e1b8 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-when-ambient-modules-of-program-changes.js @@ -0,0 +1,161 @@ +/a/lib/tsc.js -w +//// [/user/username/projects/myproject/a.ts] +declare module 'a' { + type foo = number; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/a.js] + + + +Output:: +>> Screen clear +12:00:21 AM - Starting compilation in watch mode... + + + +12:00:24 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Create b.ts with same content + +//// [/user/username/projects/myproject/a.js] file written with same contents +//// [/user/username/projects/myproject/b.ts] +declare module 'a' { + type foo = number; +} + +//// [/user/username/projects/myproject/b.js] + + + +Output:: +>> Screen clear +12:00:27 AM - File change detected. Starting incremental compilation... + + +a.ts(2,8): error TS2300: Duplicate identifier 'foo'. + +b.ts(2,8): error TS2300: Duplicate identifier 'foo'. + + +12:00:33 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Delete b.ts + +//// [/user/username/projects/myproject/a.js] file written with same contents +//// [/user/username/projects/myproject/b.ts] deleted + +Output:: +>> Screen clear +12:00:35 AM - File change detected. Starting incremental compilation... + + + +12:00:39 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/updates-errors-when-strictNullChecks-changes.js b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-when-strictNullChecks-changes.js new file mode 100644 index 0000000000000..d5754b3899e17 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/updates-errors-when-strictNullChecks-changes.js @@ -0,0 +1,195 @@ +/a/lib/tsc.js -w +//// [/user/username/projects/myproject/a.ts] +declare function foo(): null | { hello: any }; +foo().hello + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/a.js] +foo().hello; + + + +Output:: +>> Screen clear +12:00:21 AM - Starting compilation in watch mode... + + + +12:00:24 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Enable strict null checks + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"strictNullChecks":true}} + + +Output:: +>> Screen clear +12:00:28 AM - File change detected. Starting incremental compilation... + + +a.ts(2,1): error TS2531: Object is possibly 'null'. + + +12:00:29 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"strictNullChecks":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Set always strict false + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"strict":true,"alwaysStrict":false}} + + +Output:: +>> Screen clear +12:00:33 AM - File change detected. Starting incremental compilation... + + +a.ts(2,1): error TS2531: Object is possibly 'null'. + + +12:00:34 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"strict":true,"alwaysStrict":false,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Disable strict + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{}} + + +Output:: +>> Screen clear +12:00:38 AM - File change detected. Starting incremental compilation... + + + +12:00:39 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/watched-files-when-file-is-deleted-and-new-file-is-added-as-part-of-change.js b/tests/baselines/reference/tscWatch/programUpdates/watched-files-when-file-is-deleted-and-new-file-is-added-as-part-of-change.js new file mode 100644 index 0000000000000..08a989b780031 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/watched-files-when-file-is-deleted-and-new-file-is-added-as-part-of-change.js @@ -0,0 +1,109 @@ +/a/lib/tsc.js -w -p /home/username/project/tsconfig.json +//// [/home/username/project/src/file1.ts] +var a = 10; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/home/username/project/tsconfig.json] +{} + +//// [/home/username/project/src/file1.js] +var a = 10; + + + +Output:: +>> Screen clear +12:00:21 AM - Starting compilation in watch mode... + + + +12:00:24 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/home/username/project/src/file1.ts"] +Program options: {"watch":true,"project":"/home/username/project/tsconfig.json","configFilePath":"/home/username/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/home/username/project/src/file1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/home/username/project/src/file1.ts + +WatchedFiles:: +/home/username/project/tsconfig.json: + {"pollingInterval":250} +/home/username/project/src/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/home/username/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/home/username/project: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename file1 to file2 + +//// [/home/username/project/src/file2.ts] +var a = 10; + +//// [/home/username/project/src/file2.js] +var a = 10; + + +//// [/home/username/project/src/file1.ts] deleted + +Output:: +>> Screen clear +12:00:28 AM - File change detected. Starting incremental compilation... + + + +12:00:31 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/home/username/project/src/file2.ts"] +Program options: {"watch":true,"project":"/home/username/project/tsconfig.json","configFilePath":"/home/username/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/home/username/project/src/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/home/username/project/src/file2.ts + +WatchedFiles:: +/home/username/project/tsconfig.json: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/home/username/project/src/file2.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/home/username/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/home/username/project: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/when-skipLibCheck-and-skipDefaultLibCheck-changes.js b/tests/baselines/reference/tscWatch/programUpdates/when-skipLibCheck-and-skipDefaultLibCheck-changes.js new file mode 100644 index 0000000000000..6c8194a30849f --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/when-skipLibCheck-and-skipDefaultLibCheck-changes.js @@ -0,0 +1,378 @@ +/a/lib/tsc.js -w +//// [/user/username/projects/myproject/a.ts] +interface Document { + fullscreen: boolean; +} + +//// [/user/username/projects/myproject/b.d.ts] +interface Document { + fullscreen: boolean; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface Document { + readonly fullscreen: boolean; +} + +//// [/user/username/projects/myproject/a.js] + + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + +../../../../a/lib/lib.d.ts(13,14): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + +a.ts(2,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + +b.d.ts(2,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + + +12:00:26 AM - Found 3 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.d.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Changing config to {"compilerOptions":{"skipLibCheck":true}} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"skipLibCheck":true}} + + +Output:: +>> Screen clear +12:00:30 AM - File change detected. Starting incremental compilation... + + +a.ts(2,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + + +12:00:31 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts"] +Program options: {"skipLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/b.d.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Changing config to {"compilerOptions":{"skipDefaultLibCheck":true}} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"skipDefaultLibCheck":true}} + + +Output:: +>> Screen clear +12:00:35 AM - File change detected. Starting incremental compilation... + + +a.ts(2,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + +b.d.ts(2,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + + +12:00:36 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts"] +Program options: {"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/b.d.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Changing config to {"compilerOptions":{}} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{}} + + +Output:: +>> Screen clear +12:00:40 AM - File change detected. Starting incremental compilation... + + +../../../../a/lib/lib.d.ts(13,14): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + +a.ts(2,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + +b.d.ts(2,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + + +12:00:41 AM - Found 3 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Changing config to {"compilerOptions":{"skipDefaultLibCheck":true}} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"skipDefaultLibCheck":true}} + + +Output:: +>> Screen clear +12:00:45 AM - File change detected. Starting incremental compilation... + + +a.ts(2,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + +b.d.ts(2,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + + +12:00:46 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts"] +Program options: {"skipDefaultLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Changing config to {"compilerOptions":{"skipLibCheck":true}} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"skipLibCheck":true}} + + +Output:: +>> Screen clear +12:00:50 AM - File change detected. Starting incremental compilation... + + +a.ts(2,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + + +12:00:51 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts"] +Program options: {"skipLibCheck":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/b.d.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Changing config to {"compilerOptions":{}} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{}} + + +Output:: +>> Screen clear +12:00:55 AM - File change detected. Starting incremental compilation... + + +../../../../a/lib/lib.d.ts(13,14): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + +a.ts(2,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + +b.d.ts(2,5): error TS2687: All declarations of 'fullscreen' must have identical modifiers. + + +12:00:56 AM - Found 3 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts"] +Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/b.d.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/programUpdates/works-correctly-when-config-file-is-changed-but-its-content-havent.js b/tests/baselines/reference/tscWatch/programUpdates/works-correctly-when-config-file-is-changed-but-its-content-havent.js new file mode 100644 index 0000000000000..e251cf09b1753 --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/works-correctly-when-config-file-is-changed-but-its-content-havent.js @@ -0,0 +1,113 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/commonFile1.ts] +let x = 1 + +//// [/a/b/commonFile2.ts] +let y = 1 + +//// [/a/b/tsconfig.json] +{ + "compilerOptions": {}, + "files": ["/a/b/commonFile1.ts", "/a/b/commonFile2.ts"] + } + +//// [/a/b/commonFile1.js] +var x = 1; + + +//// [/a/b/commonFile2.js] +var y = 1; + + + +Output:: +>> Screen clear +12:00:17 AM - Starting compilation in watch mode... + + + +12:00:22 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/commonfile1.ts: + {"pollingInterval":250} +/a/b/commonfile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Modify config without changing content + +//// [/a/b/tsconfig.json] file changed its modified time + +Output:: +>> Screen clear +12:00:25 AM - File change detected. Starting incremental compilation... + + + +12:00:26 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +Semantic diagnostics in builder refreshed for:: + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/commonfile1.ts: + {"pollingInterval":250} +/a/b/commonfile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/resolutionCache/ignores-changes-in-node_modules-that-start-with-dot/watch-with-configFile.js b/tests/baselines/reference/tscWatch/resolutionCache/ignores-changes-in-node_modules-that-start-with-dot/watch-with-configFile.js new file mode 100644 index 0000000000000..37b3565a8e2fb --- /dev/null +++ b/tests/baselines/reference/tscWatch/resolutionCache/ignores-changes-in-node_modules-that-start-with-dot/watch-with-configFile.js @@ -0,0 +1,101 @@ +/a/lib/tsc.js --w -p /user/username/projects/myproject/tsconfig.json +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/test.ts] +import { x } from "somemodule"; + +//// [/user/username/projects/myproject/node_modules/somemodule/index.d.ts] +export const x = 10; + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/user/username/projects/myproject/test.js] +"use strict"; +exports.__esModule = true; + + + +Output:: +>> Screen clear +12:00:27 AM - Starting compilation in watch mode... + + + +12:00:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/test.ts"] +Program options: {"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/node_modules/somemodule/index.d.ts +/user/username/projects/myproject/test.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/node_modules/somemodule/index.d.ts +/user/username/projects/myproject/test.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/test.ts: + {"pollingInterval":250} +/user/username/projects/myproject/node_modules/somemodule/index.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: npm install file and folder that start with '.' + +//// [/user/username/projects/myproject/node_modules/.cache/babel-loader/89c02171edab901b9926470ba6d5677e.ts] +{"something":10} + + +Output:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/test.ts: + {"pollingInterval":250} +/user/username/projects/myproject/node_modules/somemodule/index.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/resolutionCache/ignores-changes-in-node_modules-that-start-with-dot/watch-without-configFile.js b/tests/baselines/reference/tscWatch/resolutionCache/ignores-changes-in-node_modules-that-start-with-dot/watch-without-configFile.js new file mode 100644 index 0000000000000..a9b304a95af2d --- /dev/null +++ b/tests/baselines/reference/tscWatch/resolutionCache/ignores-changes-in-node_modules-that-start-with-dot/watch-without-configFile.js @@ -0,0 +1,89 @@ +/a/lib/tsc.js --w /user/username/projects/myproject/test.ts +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/test.ts] +import { x } from "somemodule"; + +//// [/user/username/projects/myproject/node_modules/somemodule/index.d.ts] +export const x = 10; + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/user/username/projects/myproject/test.js] +"use strict"; +exports.__esModule = true; + + + +Output:: +>> Screen clear +12:00:27 AM - Starting compilation in watch mode... + + + +12:00:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/test.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/node_modules/somemodule/index.d.ts +/user/username/projects/myproject/test.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/node_modules/somemodule/index.d.ts +/user/username/projects/myproject/test.ts + +WatchedFiles:: +/user/username/projects/myproject/test.ts: + {"pollingInterval":250} +/user/username/projects/myproject/node_modules/somemodule/index.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: npm install file and folder that start with '.' + +//// [/user/username/projects/myproject/node_modules/.cache/babel-loader/89c02171edab901b9926470ba6d5677e.ts] +{"something":10} + + +Output:: + +WatchedFiles:: +/user/username/projects/myproject/test.ts: + {"pollingInterval":250} +/user/username/projects/myproject/node_modules/somemodule/index.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/resolutionCache/when-types-in-compiler-option-are-global-and-installed-at-later-point.js b/tests/baselines/reference/tscWatch/resolutionCache/when-types-in-compiler-option-are-global-and-installed-at-later-point.js new file mode 100644 index 0000000000000..ec64fa379d0ca --- /dev/null +++ b/tests/baselines/reference/tscWatch/resolutionCache/when-types-in-compiler-option-are-global-and-installed-at-later-point.js @@ -0,0 +1,115 @@ +/a/lib/tsc.js --w -p /user/username/projects/myproject/tsconfig.json +//// [/user/username/projects/myproject/lib/app.ts] +myapp.component("hello"); + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"module":"none","types":["@myapp/ts-types"]}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/lib/app.js] +myapp.component("hello"); + + + +Output:: +>> Screen clear +12:00:23 AM - Starting compilation in watch mode... + + +error TS2688: Cannot find type definition file for '@myapp/ts-types'. + + +12:00:26 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/lib/app.ts"] +Program options: {"module":0,"types":["@myapp/ts-types"],"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib/app.ts + +No cached semantic diagnostics in the builder:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/lib/app.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: npm install ts-types + +//// [/user/username/projects/myproject/lib/app.js] file written with same contents +//// [/user/username/projects/myproject/node_modules/@myapp/ts-types/package.json] +{"version":"1.65.1","types":"types/somefile.define.d.ts"} + +//// [/user/username/projects/myproject/node_modules/@myapp/ts-types/types/somefile.define.d.ts] + +declare namespace myapp { + function component(str: string): number; +} + + +Output:: +>> Screen clear +12:00:39 AM - File change detected. Starting incremental compilation... + + + +12:00:43 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/lib/app.ts"] +Program options: {"module":0,"types":["@myapp/ts-types"],"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib/app.ts +/user/username/projects/myproject/node_modules/@myapp/ts-types/types/somefile.define.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib/app.ts +/user/username/projects/myproject/node_modules/@myapp/ts-types/types/somefile.define.d.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/lib/app.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/node_modules/@myapp/ts-types/types/somefile.define.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/resolutionCache/with-modules-linked-to-sibling-folder.js b/tests/baselines/reference/tscWatch/resolutionCache/with-modules-linked-to-sibling-folder.js new file mode 100644 index 0000000000000..57cb1fca9fdfb --- /dev/null +++ b/tests/baselines/reference/tscWatch/resolutionCache/with-modules-linked-to-sibling-folder.js @@ -0,0 +1,86 @@ +/a/lib/tsc.js -w +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/main/index.ts] +import { Foo } from '@scoped/linked-package' + +//// [/user/username/projects/myproject/main/tsconfig.json] +{"compilerOptions":{"module":"commonjs","moduleResolution":"node","baseUrl":".","rootDir":"."},"files":["index.ts"]} + +//// [/user/username/projects/myproject/main/node_modules/@scoped/linked-package] symlink(/user/username/projects/myproject/linked-package) +//// [/user/username/projects/myproject/linked-package/package.json] +{"name":"@scoped/linked-package","version":"0.0.1","types":"dist/index.d.ts","main":"dist/index.js"} + +//// [/user/username/projects/myproject/linked-package/dist/index.d.ts] +export * from './other'; + +//// [/user/username/projects/myproject/linked-package/dist/other.d.ts] +export declare const Foo = "BAR"; + +//// [/user/username/projects/myproject/main/index.js] +"use strict"; +exports.__esModule = true; + + + +Output:: +>> Screen clear +12:00:39 AM - Starting compilation in watch mode... + + + +12:00:42 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/main/index.ts"] +Program options: {"module":1,"moduleResolution":2,"baseUrl":"/user/username/projects/myproject/main","rootDir":"/user/username/projects/myproject/main","watch":true,"configFilePath":"/user/username/projects/myproject/main/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/linked-package/dist/other.d.ts +/user/username/projects/myproject/linked-package/dist/index.d.ts +/user/username/projects/myproject/main/index.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/linked-package/dist/other.d.ts +/user/username/projects/myproject/linked-package/dist/index.d.ts +/user/username/projects/myproject/main/index.ts + +WatchedFiles:: +/user/username/projects/myproject/main/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/main/index.ts: + {"pollingInterval":250} +/user/username/projects/myproject/linked-package/dist/index.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/linked-package/dist/other.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/linked-package: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/main/@scoped: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/main/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/main/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/resolutionCache/works-when-included-file-with-ambient-module-changes.js b/tests/baselines/reference/tscWatch/resolutionCache/works-when-included-file-with-ambient-module-changes.js new file mode 100644 index 0000000000000..2a5db1a5b6bd4 --- /dev/null +++ b/tests/baselines/reference/tscWatch/resolutionCache/works-when-included-file-with-ambient-module-changes.js @@ -0,0 +1,132 @@ +/a/lib/tsc.js --w /a/b/foo.ts /a/b/bar.d.ts +//// [/a/b/foo.ts] + +import * as fs from "fs"; +import * as u from "url"; + + +//// [/a/b/bar.d.ts] + +declare module "url" { + export interface Url { + href?: string; + } +} + + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/foo.js] +"use strict"; +exports.__esModule = true; + + + +Output:: +>> Screen clear +12:00:15 AM - Starting compilation in watch mode... + + +foo.ts(2,21): error TS2307: Cannot find module 'fs'. + + +12:00:18 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a/b/foo.ts","/a/b/bar.d.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/b/foo.ts +/a/b/bar.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/foo.ts +/a/b/bar.d.ts + +WatchedFiles:: +/a/b/foo.ts: + {"pollingInterval":250} +/a/b/bar.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Add fs definition + +//// [/a/b/bar.d.ts] + +declare module "url" { + export interface Url { + href?: string; + } +} + +declare module "fs" { + export interface Stats { + isFile(): boolean; + } +} + + +//// [/a/b/foo.js] file written with same contents + +Output:: +>> Screen clear +12:00:21 AM - File change detected. Starting incremental compilation... + + + +12:00:25 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/foo.ts","/a/b/bar.d.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/b/foo.ts +/a/b/bar.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/foo.ts +/a/b/bar.d.ts + +WatchedFiles:: +/a/b/foo.ts: + {"pollingInterval":250} +/a/b/bar.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/resolutionCache/works-when-module-resolution-changes-to-ambient-module.js b/tests/baselines/reference/tscWatch/resolutionCache/works-when-module-resolution-changes-to-ambient-module.js new file mode 100644 index 0000000000000..0eda4b706cc5e --- /dev/null +++ b/tests/baselines/reference/tscWatch/resolutionCache/works-when-module-resolution-changes-to-ambient-module.js @@ -0,0 +1,114 @@ +/a/lib/tsc.js -w /a/b/foo.ts +//// [/a/b/foo.ts] +import * as fs from "fs"; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/foo.js] +"use strict"; +exports.__esModule = true; + + + +Output:: +>> Screen clear +12:00:13 AM - Starting compilation in watch mode... + + +foo.ts(1,21): error TS2307: Cannot find module 'fs'. + + +12:00:16 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/a/b/foo.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/b/foo.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/foo.ts + +WatchedFiles:: +/a/b/foo.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: npm install node types + +//// [/a/b/foo.js] file written with same contents +//// [/a/b/node_modules/@types/node/package.json] + +{ + "main": "" +} + + +//// [/a/b/node_modules/@types/node/index.d.ts] + +declare module "fs" { + export interface Stats { + isFile(): boolean; + } +} + + +Output:: +>> Screen clear +12:00:27 AM - File change detected. Starting incremental compilation... + + + +12:00:31 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/foo.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/b/foo.ts +/a/b/node_modules/@types/node/index.d.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/foo.ts +/a/b/node_modules/@types/node/index.d.ts + +WatchedFiles:: +/a/b/foo.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/node_modules/@types/node/index.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/resolutionCache/works-when-renaming-node_modules-folder-that-already-contains-@types-folder.js b/tests/baselines/reference/tscWatch/resolutionCache/works-when-renaming-node_modules-folder-that-already-contains-@types-folder.js new file mode 100644 index 0000000000000..8d91441427fce --- /dev/null +++ b/tests/baselines/reference/tscWatch/resolutionCache/works-when-renaming-node_modules-folder-that-already-contains-@types-folder.js @@ -0,0 +1,108 @@ +/a/lib/tsc.js --w /user/username/projects/myproject/a.ts +//// [/user/username/projects/myproject/a.ts] +import * as q from "qqq"; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/node_modules2/@types/qqq/index.d.ts] +export {} + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; + + + +Output:: +>> Screen clear +12:00:27 AM - Starting compilation in watch mode... + + +a.ts(1,20): error TS2307: Cannot find module 'qqq'. + + +12:00:30 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: npm install + +//// [/user/username/projects/myproject/a.js] file written with same contents +//// [/user/username/projects/myproject/node_modules/@types/qqq/index.d.ts] +export {} + +//// [/user/username/projects/myproject/node_modules2/@types/qqq/index.d.ts] deleted + +Output:: +>> Screen clear +12:00:34 AM - File change detected. Starting incremental compilation... + + + +12:00:38 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/node_modules/@types/qqq/index.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/node_modules/@types/qqq/index.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/node_modules/@types/qqq/index.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/resolutionCache/works-when-reusing-program-with-files-from-external-library.js b/tests/baselines/reference/tscWatch/resolutionCache/works-when-reusing-program-with-files-from-external-library.js new file mode 100644 index 0000000000000..39e49c5305715 --- /dev/null +++ b/tests/baselines/reference/tscWatch/resolutionCache/works-when-reusing-program-with-files-from-external-library.js @@ -0,0 +1,157 @@ +/a/lib/tsc.js --w -p /a/b/projects/myProject/src +//// [/a/b/projects/myProject/src/file1.ts] +import module1 = require("module1"); +module1("hello"); + +//// [/a/b/projects/myProject/src/file2.ts] +import module11 = require("module1"); +module11("hello"); + +//// [/a/b/projects/myProject/node_modules/module1/index.js] +module.exports = options => { return options.toString(); } + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/projects/myProject/src/tsconfig.json] +{"compilerOptions":{"allowJs":true,"rootDir":".","outDir":"../dist","moduleResolution":"node","maxNodeModuleJsDepth":1}} + +//// [/a/b/projects/myProject/dist/file1.js] +"use strict"; +exports.__esModule = true; +var module1 = require("module1"); +module1("hello"); + + +//// [/a/b/projects/myProject/dist/file2.js] +"use strict"; +exports.__esModule = true; +var module11 = require("module1"); +module11("hello"); + + + +Output:: +>> Screen clear +12:00:29 AM - Starting compilation in watch mode... + + + +12:00:37 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/projects/myProject/src/file1.ts","/a/b/projects/myProject/src/file2.ts"] +Program options: {"allowJs":true,"rootDir":"/a/b/projects/myProject/src","outDir":"/a/b/projects/myProject/dist","moduleResolution":2,"maxNodeModuleJsDepth":1,"watch":true,"project":"/a/b/projects/myProject/src","configFilePath":"/a/b/projects/myProject/src/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/projects/myProject/node_modules/module1/index.js +/a/b/projects/myProject/src/file1.ts +/a/b/projects/myProject/src/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/projects/myProject/node_modules/module1/index.js +/a/b/projects/myProject/src/file1.ts +/a/b/projects/myProject/src/file2.ts + +WatchedFiles:: +/a/b/projects/myproject/src/tsconfig.json: + {"pollingInterval":250} +/a/b/projects/myproject/src/file1.ts: + {"pollingInterval":250} +/a/b/projects/myproject/node_modules/module1/index.js: + {"pollingInterval":250} +/a/b/projects/myproject/src/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/projects/myproject/src/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b/projects/myproject/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b/projects/myproject/src/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b/projects/myproject/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Add new line to file1 + +//// [/a/b/projects/myProject/src/file1.ts] +import module1 = require("module1"); +module1("hello"); +; + +//// [/a/b/projects/myProject/dist/file1.js] +"use strict"; +exports.__esModule = true; +var module1 = require("module1"); +module1("hello"); +; + + + +Output:: +>> Screen clear +12:00:40 AM - File change detected. Starting incremental compilation... + + + +12:00:44 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/projects/myProject/src/file1.ts","/a/b/projects/myProject/src/file2.ts"] +Program options: {"allowJs":true,"rootDir":"/a/b/projects/myProject/src","outDir":"/a/b/projects/myProject/dist","moduleResolution":2,"maxNodeModuleJsDepth":1,"watch":true,"project":"/a/b/projects/myProject/src","configFilePath":"/a/b/projects/myProject/src/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/projects/myProject/node_modules/module1/index.js +/a/b/projects/myProject/src/file1.ts +/a/b/projects/myProject/src/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/b/projects/myProject/src/file1.ts + +WatchedFiles:: +/a/b/projects/myproject/src/tsconfig.json: + {"pollingInterval":250} +/a/b/projects/myproject/src/file1.ts: + {"pollingInterval":250} +/a/b/projects/myproject/node_modules/module1/index.js: + {"pollingInterval":250} +/a/b/projects/myproject/src/file2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/a/b/projects/myproject/src/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b/projects/myproject/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b/projects/myproject/src/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b/projects/myproject/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/uses-non-recursive-dynamic-polling-when-renaming-file-in-subfolder.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/uses-non-recursive-dynamic-polling-when-renaming-file-in-subfolder.js new file mode 100644 index 0000000000000..095c5adccf89c --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/uses-non-recursive-dynamic-polling-when-renaming-file-in-subfolder.js @@ -0,0 +1,98 @@ +/a/lib/tsc.js --w -p /a/username/project/tsconfig.json +//// [/a/username/project/src/file1.ts] + + +//// [/a/username/project/tsconfig.json] +{"watchOptions":{"synchronousWatchDirectory":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/username/project/src/file1.js] + + + +Output:: +>> Screen clear +12:00:19 AM - Starting compilation in watch mode... + + + +12:00:22 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/username/project/src/file1.ts"] +Program options: {"watch":true,"project":"/a/username/project/tsconfig.json","configFilePath":"/a/username/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/username/project/src/file1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/username/project/src/file1.ts + +WatchedFiles:: +/a/username/project/tsconfig.json: + {"pollingInterval":250} +/a/username/project/src/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Rename file1 to file2 + +//// [/a/username/project/src/file2.ts] + + +//// [/a/username/project/src/file2.js] + + +//// [/a/username/project/src/file1.ts] deleted + +Output:: +>> Screen clear +12:00:26 AM - File change detected. Starting incremental compilation... + + + +12:00:29 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/username/project/src/file2.ts"] +Program options: {"watch":true,"project":"/a/username/project/tsconfig.json","configFilePath":"/a/username/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/username/project/src/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/username/project/src/file2.ts + +WatchedFiles:: +/a/username/project/tsconfig.json: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/username/project/src/file2.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/uses-non-recursive-watchDirectory-when-renaming-file-in-subfolder.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/uses-non-recursive-watchDirectory-when-renaming-file-in-subfolder.js new file mode 100644 index 0000000000000..76ae5a5d2e681 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/uses-non-recursive-watchDirectory-when-renaming-file-in-subfolder.js @@ -0,0 +1,110 @@ +/a/lib/tsc.js --w -p /a/username/project/tsconfig.json +//// [/a/username/project/src/file1.ts] + + +//// [/a/username/project/tsconfig.json] +{"watchOptions":{"synchronousWatchDirectory":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/username/project/src/file1.js] + + + +Output:: +>> Screen clear +12:00:19 AM - Starting compilation in watch mode... + + + +12:00:22 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/username/project/src/file1.ts"] +Program options: {"watch":true,"project":"/a/username/project/tsconfig.json","configFilePath":"/a/username/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/username/project/src/file1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/username/project/src/file1.ts + +WatchedFiles:: +/a/username/project/tsconfig.json: + {"pollingInterval":250} +/a/username/project/src/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/a/username/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/username/project: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/username/project/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Rename file1 to file2 + +//// [/a/username/project/src/file2.ts] + + +//// [/a/username/project/src/file2.js] + + +//// [/a/username/project/src/file1.ts] deleted + +Output:: +>> Screen clear +12:00:26 AM - File change detected. Starting incremental compilation... + + + +12:00:29 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/username/project/src/file2.ts"] +Program options: {"watch":true,"project":"/a/username/project/tsconfig.json","configFilePath":"/a/username/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/username/project/src/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/username/project/src/file2.ts + +WatchedFiles:: +/a/username/project/tsconfig.json: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/username/project/src/file2.ts: + {"pollingInterval":250} + +FsWatches:: +/a/username/project/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/username/project: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/username/project/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/uses-watchFile-when-renaming-file-in-subfolder.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/uses-watchFile-when-renaming-file-in-subfolder.js new file mode 100644 index 0000000000000..e786008be326c --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/uses-watchFile-when-renaming-file-in-subfolder.js @@ -0,0 +1,110 @@ +/a/lib/tsc.js --w -p /a/username/project/tsconfig.json +//// [/a/username/project/src/file1.ts] + + +//// [/a/username/project/tsconfig.json] +{"watchOptions":{"synchronousWatchDirectory":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/username/project/src/file1.js] + + + +Output:: +>> Screen clear +12:00:19 AM - Starting compilation in watch mode... + + + +12:00:22 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/username/project/src/file1.ts"] +Program options: {"watch":true,"project":"/a/username/project/tsconfig.json","configFilePath":"/a/username/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/username/project/src/file1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/username/project/src/file1.ts + +WatchedFiles:: +/a/username/project/tsconfig.json: + {"pollingInterval":250} +/a/username/project/src/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/username/project/node_modules/@types: + {"pollingInterval":500} +/a/username/project: + {"pollingInterval":500} +/a/username/project/src: + {"pollingInterval":500} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Rename file1 to file2 + +//// [/a/username/project/src/file2.ts] + + +//// [/a/username/project/src/file2.js] + + +//// [/a/username/project/src/file1.ts] deleted + +Output:: +>> Screen clear +12:00:26 AM - File change detected. Starting incremental compilation... + + + +12:00:29 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/username/project/src/file2.ts"] +Program options: {"watch":true,"project":"/a/username/project/tsconfig.json","configFilePath":"/a/username/project/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/username/project/src/file2.ts + +Semantic diagnostics in builder refreshed for:: +/a/username/project/src/file2.ts + +WatchedFiles:: +/a/username/project/tsconfig.json: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/username/project/node_modules/@types: + {"pollingInterval":500} +/a/username/project: + {"pollingInterval":500} +/a/username/project/src: + {"pollingInterval":500} +/a/username/project/src/file2.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/when-there-are-symlinks-to-folders-in-recursive-folders.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/when-there-are-symlinks-to-folders-in-recursive-folders.js new file mode 100644 index 0000000000000..9708b683a1847 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/when-there-are-symlinks-to-folders-in-recursive-folders.js @@ -0,0 +1,148 @@ +/a/lib/tsc.js --w +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/home/user/projects/myproject/src/file.ts] +import * as a from "a" + +//// [/home/user/projects/myproject/tsconfig.json] +{ "compilerOptions": { "extendedDiagnostics": true, "traceResolution": true }} + +//// [/home/user/projects/myproject/node_modules/reala/index.d.ts] +export {} + +//// [/home/user/projects/myproject/node_modules/realb/index.d.ts] +export {} + +//// [/home/user/projects/myproject/node_modules/a] symlink(/home/user/projects/myproject/node_modules/reala) +//// [/home/user/projects/myproject/node_modules/b] symlink(/home/user/projects/myproject/node_modules/realb) +//// [/home/user/projects/myproject/node_modules/reala/node_modules/b] symlink(/home/user/projects/myproject/node_modules/b) +//// [/home/user/projects/myproject/node_modules/realb/node_modules/a] symlink(/home/user/projects/myproject/node_modules/a) +//// [/home/user/projects/myproject/src/file.js] +"use strict"; +exports.__esModule = true; + + + +Output:: + +12:00:45 AM - Starting compilation in watch mode... + + +Current directory: /home/user/projects/myproject CaseSensitiveFileNames: false + +FileWatcher:: Added:: WatchInfo: /home/user/projects/myproject/tsconfig.json 2000 undefined Config file + +Synchronizing program + +CreatingProgramWith:: + + roots: ["/home/user/projects/myproject/src/file.ts"] + + options: {"extendedDiagnostics":true,"traceResolution":true,"watch":true,"configFilePath":"/home/user/projects/myproject/tsconfig.json"} + +FileWatcher:: Added:: WatchInfo: /home/user/projects/myproject/src/file.ts 250 undefined Source file + +======== Resolving module 'a' from '/home/user/projects/myproject/src/file.ts'. ======== + +Module resolution kind is not specified, using 'NodeJs'. + +Loading module 'a' from 'node_modules' folder, target file type 'TypeScript'. + +Directory '/home/user/projects/myproject/src/node_modules' does not exist, skipping all lookups in it. + +File '/home/user/projects/myproject/node_modules/a/package.json' does not exist. + +File '/home/user/projects/myproject/node_modules/a.ts' does not exist. + +File '/home/user/projects/myproject/node_modules/a.tsx' does not exist. + +File '/home/user/projects/myproject/node_modules/a.d.ts' does not exist. + +File '/home/user/projects/myproject/node_modules/a/index.ts' does not exist. + +File '/home/user/projects/myproject/node_modules/a/index.tsx' does not exist. + +File '/home/user/projects/myproject/node_modules/a/index.d.ts' exist - use it as a name resolution result. + +Resolving real path for '/home/user/projects/myproject/node_modules/a/index.d.ts', result '/home/user/projects/myproject/node_modules/reala/index.d.ts'. + +======== Module name 'a' was successfully resolved to '/home/user/projects/myproject/node_modules/reala/index.d.ts'. ======== + +FileWatcher:: Added:: WatchInfo: /home/user/projects/myproject/node_modules/reala/index.d.ts 250 undefined Source file + +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 undefined Source file + +DirectoryWatcher:: Added:: WatchInfo: /home/user/projects/myproject/src 1 undefined Failed Lookup Locations + +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /home/user/projects/myproject/src 1 undefined Failed Lookup Locations + +DirectoryWatcher:: Added:: WatchInfo: /home/user/projects/myproject/node_modules 1 undefined Failed Lookup Locations + +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /home/user/projects/myproject/node_modules 1 undefined Failed Lookup Locations + +DirectoryWatcher:: Added:: WatchInfo: /home/user/projects/myproject/node_modules/@types 1 undefined Type roots + +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /home/user/projects/myproject/node_modules/@types 1 undefined Type roots + + +12:00:48 AM - Found 0 errors. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /home/user/projects/myproject 1 undefined Wild card directory + +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /home/user/projects/myproject 1 undefined Wild card directory + + +Program root files: ["/home/user/projects/myproject/src/file.ts"] +Program options: {"extendedDiagnostics":true,"traceResolution":true,"watch":true,"configFilePath":"/home/user/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/home/user/projects/myproject/node_modules/reala/index.d.ts +/home/user/projects/myproject/src/file.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/home/user/projects/myproject/node_modules/reala/index.d.ts +/home/user/projects/myproject/src/file.ts + +WatchedFiles:: +/home/user/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/home/user/projects/myproject/src/file.ts: + {"pollingInterval":250} +/home/user/projects/myproject/node_modules/reala/index.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/home/user/projects/myproject/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/home/user/projects/myproject/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/home/user/projects/myproject/node_modules/reala: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/home/user/projects/myproject/node_modules/reala/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/home/user/projects/myproject/node_modules/realb: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/home/user/projects/myproject/node_modules/realb/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/home/user/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/home/user/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/with-non-synchronous-watch-directory.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/with-non-synchronous-watch-directory.js new file mode 100644 index 0000000000000..04430feb625c6 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchDirectories/with-non-synchronous-watch-directory.js @@ -0,0 +1,376 @@ +/a/lib/tsc.js --w -p /user/username/projects/myproject/tsconfig.json +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/src/file1.ts] +import { x } from "file2"; + +//// [/user/username/projects/myproject/node_modules/file2/index.d.ts] +export const x = 10; + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/user/username/projects/myproject/src/file1.js] +"use strict"; +exports.__esModule = true; + + + +Output:: +>> Screen clear +12:00:29 AM - Starting compilation in watch mode... + + + +12:00:32 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/src/file1.ts"] +Program options: {"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/node_modules/file2/index.d.ts +/user/username/projects/myproject/src/file1.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/node_modules/file2/index.d.ts +/user/username/projects/myproject/src/file1.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/src/file1.ts: + {"pollingInterval":250} +/user/username/projects/myproject/node_modules/file2/index.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/file2: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Pending updates because of file1.js creation + + +Output:: +>> Screen clear +12:00:33 AM - File change detected. Starting incremental compilation... + + + +12:00:34 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/src/file1.ts"] +Program options: {"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/node_modules/file2/index.d.ts +/user/username/projects/myproject/src/file1.ts + +Semantic diagnostics in builder refreshed for:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/src/file1.ts: + {"pollingInterval":250} +/user/username/projects/myproject/node_modules/file2/index.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/file2: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Remove directory node_modules + +//// [/user/username/projects/myproject/src/file1.js] file written with same contents +//// [/user/username/projects/myproject/node_modules/file2/index.d.ts] deleted + +Output:: +>> Screen clear +12:00:38 AM - File change detected. Starting incremental compilation... + + +user/username/projects/myproject/src/file1.ts(1,19): error TS2307: Cannot find module 'file2'. + + +12:00:42 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/src/file1.ts"] +Program options: {"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/src/file1.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/src/file1.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/src/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Pending directory watchers and program update + + +Output:: +>> Screen clear +12:00:43 AM - File change detected. Starting incremental compilation... + + +user/username/projects/myproject/src/file1.ts(1,19): error TS2307: Cannot find module 'file2'. + + +12:00:44 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/src/file1.ts"] +Program options: {"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/src/file1.ts + +Semantic diagnostics in builder refreshed for:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/src/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Start npm install + + +Output:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/src/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: npm install folder creation of file2 + + +Output:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/src/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: npm install index file in file2 + +//// [/user/username/projects/myproject/node_modules/file2/index.d.ts] +export const x = 10; + + +Output:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/src/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Updates the program + + +Output:: + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/src/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/file2: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Pending updates + +//// [/user/username/projects/myproject/src/file1.js] file written with same contents + +Output:: +>> Screen clear +12:00:51 AM - File change detected. Starting incremental compilation... + + + +12:00:55 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/src/file1.ts"] +Program options: {"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/node_modules/file2/index.d.ts +/user/username/projects/myproject/src/file1.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/node_modules/file2/index.d.ts +/user/username/projects/myproject/src/file1.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/src/file1.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/node_modules/file2/index.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject/src: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject/node_modules/file2: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFile/using-dynamic-priority-polling.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFile/using-dynamic-priority-polling.js new file mode 100644 index 0000000000000..61398bf7f3b9f --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFile/using-dynamic-priority-polling.js @@ -0,0 +1,124 @@ +/a/lib/tsc.js --w /a/username/project/typescript.ts +//// [/a/username/project/typescript.ts] +var z = 10; + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/username/project/typescript.js] +var z = 10; + + + +Output:: +>> Screen clear +12:00:15 AM - Starting compilation in watch mode... + + + +12:00:18 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/username/project/typescript.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/username/project/typescript.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/username/project/typescript.ts + +WatchedFiles:: + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Time spent to Transition libFile and file1 to low priority queue + + +Output:: + +WatchedFiles:: + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Make change to file + +//// [/a/username/project/typescript.ts] +var zz30 = 100; + + +Output:: + +WatchedFiles:: + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Callbacks: medium priority + high priority queue and scheduled program update + +//// [/a/username/project/typescript.js] +var zz30 = 100; + + + +Output:: +>> Screen clear +12:00:22 AM - File change detected. Starting incremental compilation... + + + +12:00:26 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/username/project/typescript.ts"] +Program options: {"watch":true} +Program files:: +/a/lib/lib.d.ts +/a/username/project/typescript.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/username/project/typescript.ts + +WatchedFiles:: + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined + +Change:: Polling queues polled and everything is in the high polling queue + + +Output:: + +WatchedFiles:: + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchOptions/with-fallbackPolling-option.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchOptions/with-fallbackPolling-option.js new file mode 100644 index 0000000000000..a31bba01f8953 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchOptions/with-fallbackPolling-option.js @@ -0,0 +1,72 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/commonFile1.ts] +let x = 1 + +//// [/a/b/commonFile2.ts] +let y = 1 + +//// [/a/b/tsconfig.json] +{"watchOptions":{"fallbackPolling":"PriorityInterval"}} + +//// [/a/b/commonFile1.js] +var x = 1; + + +//// [/a/b/commonFile2.js] +var y = 1; + + + +Output:: +>> Screen clear +12:00:17 AM - Starting compilation in watch mode... + + + +12:00:22 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/commonfile1.ts: + {"pollingInterval":250} +/a/b/commonfile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} +/a/b/node_modules/@types: + {"pollingInterval":500} +/a/b: + {"pollingInterval":500} + +FsWatches:: + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchOptions/with-watchDirectory-option.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchOptions/with-watchDirectory-option.js new file mode 100644 index 0000000000000..0b8356b99de9b --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchOptions/with-watchDirectory-option.js @@ -0,0 +1,72 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/commonFile1.ts] +let x = 1 + +//// [/a/b/commonFile2.ts] +let y = 1 + +//// [/a/b/tsconfig.json] +{"watchOptions":{"watchDirectory":"UseFsEvents"}} + +//// [/a/b/commonFile1.js] +var x = 1; + + +//// [/a/b/commonFile2.js] +var y = 1; + + + +Output:: +>> Screen clear +12:00:17 AM - Starting compilation in watch mode... + + + +12:00:22 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +WatchedFiles:: +/a/b/tsconfig.json: + {"pollingInterval":250} +/a/b/commonfile1.ts: + {"pollingInterval":250} +/a/b/commonfile2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchOptions/with-watchFile-as-watch-options-to-extend.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchOptions/with-watchFile-as-watch-options-to-extend.js new file mode 100644 index 0000000000000..e3bece821f353 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchOptions/with-watchFile-as-watch-options-to-extend.js @@ -0,0 +1,72 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json --watchFile UseFsEvents +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/commonFile1.ts] +let x = 1 + +//// [/a/b/commonFile2.ts] +let y = 1 + +//// [/a/b/tsconfig.json] +{} + +//// [/a/b/commonFile1.js] +var x = 1; + + +//// [/a/b/commonFile2.js] +var y = 1; + + + +Output:: +>> Screen clear +12:00:17 AM - Starting compilation in watch mode... + + + +12:00:22 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +WatchedFiles:: + +FsWatches:: +/a/b/tsconfig.json: + {"fallbackPollingInterval":2000,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b/commonfile1.ts: + {"fallbackPollingInterval":250,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b/commonfile2.ts: + {"fallbackPollingInterval":250,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/lib/lib.d.ts: + {"fallbackPollingInterval":250,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchOptions/with-watchFile-option.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchOptions/with-watchFile-option.js new file mode 100644 index 0000000000000..3abde2f8e2fff --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchOptions/with-watchFile-option.js @@ -0,0 +1,72 @@ +/a/lib/tsc.js -w -p /a/b/tsconfig.json +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/a/b/commonFile1.ts] +let x = 1 + +//// [/a/b/commonFile2.ts] +let y = 1 + +//// [/a/b/tsconfig.json] +{"watchOptions":{"watchFile":"UseFsEvents"}} + +//// [/a/b/commonFile1.js] +var x = 1; + + +//// [/a/b/commonFile2.js] +var y = 1; + + + +Output:: +>> Screen clear +12:00:17 AM - Starting compilation in watch mode... + + + +12:00:22 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/a/b/commonFile1.ts","/a/b/commonFile2.ts"] +Program options: {"watch":true,"project":"/a/b/tsconfig.json","configFilePath":"/a/b/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/a/b/commonFile1.ts +/a/b/commonFile2.ts + +WatchedFiles:: + +FsWatches:: +/a/b/tsconfig.json: + {"fallbackPollingInterval":2000,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b/commonfile1.ts: + {"fallbackPollingInterval":250,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b/commonfile2.ts: + {"fallbackPollingInterval":250,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/lib/lib.d.ts: + {"fallbackPollingInterval":250,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/a/b/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/a/b: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/projects/noEmitOnError/src/other.ts b/tests/projects/noEmitOnError/src/other.ts index ecfb2d2ad39fb..a39fdb0a2789b 100644 --- a/tests/projects/noEmitOnError/src/other.ts +++ b/tests/projects/noEmitOnError/src/other.ts @@ -1 +1,2 @@ -console.log("hi"); \ No newline at end of file +console.log("hi"); +export { } \ No newline at end of file From 6ae17e7740dc18da44475c137572f48cf01c36a9 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 10 Dec 2019 14:55:43 -0800 Subject: [PATCH 2/4] Add noIndirectImports as a option to skip checking and generating .d.ts files for files indirectly importing affected file Fixes #33329 --- src/compiler/builder.ts | 4 +- src/compiler/commandLineParser.ts | 8 + src/compiler/diagnosticMessages.json | 4 + src/compiler/tsbuildPublic.ts | 1 + src/compiler/types.ts | 1 + .../unittests/tscWatch/emitAndErrorUpdates.ts | 12 + .../reference/api/tsserverlibrary.d.ts | 2 + tests/baselines/reference/api/typescript.d.ts | 2 + .../noIndirectImports/tsconfig.json | 5 + ...es-errors-when-deep-import-file-changes.js | 203 ++++++++++++ ...import-through-declaration-file-changes.js | 149 +++++++++ ...g-a-deep-multilevel-import-that-changes.js | 259 ++++++++++++++++ ...n-there-are-circular-import-and-exports.js | 290 ++++++++++++++++++ ...here-are-no-circular-import-and-exports.js | 257 ++++++++++++++++ .../with-noEmitOnError.js | 165 ++++++++++ ...es-errors-when-deep-import-file-changes.js | 179 +++++++++++ ...import-through-declaration-file-changes.js | 145 +++++++++ ...g-a-deep-multilevel-import-that-changes.js | 217 +++++++++++++ ...n-there-are-circular-import-and-exports.js | 243 +++++++++++++++ ...here-are-no-circular-import-and-exports.js | 219 +++++++++++++ .../with-noEmitOnError.js | 151 +++++++++ 21 files changed, 2515 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/showConfig/Shows tsconfig for single option/noIndirectImports/tsconfig.json create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/with-noEmitOnError.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/deep-import-changes/updates-errors-when-deep-import-file-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js create mode 100644 tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/with-noEmitOnError.js diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index ce4a4e6645384..60972f2eb3808 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -433,7 +433,9 @@ namespace ts { return; } - forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, (state, path) => handleDtsMayChangeOf(state, path, cancellationToken, computeHash)); + if (!state.compilerOptions.noIndirectImports) { + forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, (state, path) => handleDtsMayChangeOf(state, path, cancellationToken, computeHash)); + } } /** diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 8bf71d7301d8a..058dbbfe34cf5 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -200,6 +200,14 @@ namespace ts { description: Diagnostics.Enable_incremental_compilation, transpileOptionValue: undefined }, + { + name: "noIndirectImports", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsEmit: true, + category: Diagnostics.Advanced_Options, + description: Diagnostics.Skip_checking_and_generating_d_ts_files_for_files_indirectly_importing_affected_file + }, { name: "locale", type: "string", diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 890e88f05eb08..c923f976cb6f1 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4358,6 +4358,10 @@ "category": "Message", "code": 6383 }, + "Skip checking and generating .d.ts files for files indirectly importing affected file": { + "category": "Message", + "code": 6384 + }, "The expected type comes from property '{0}' which is declared here on type '{1}'": { "category": "Message", diff --git a/src/compiler/tsbuildPublic.ts b/src/compiler/tsbuildPublic.ts index c2760a1265615..7ceba2981a36f 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -16,6 +16,7 @@ namespace ts { /*@internal*/ listFiles?: boolean; /*@internal*/ pretty?: boolean; incremental?: boolean; + noIndirectImports?: boolean; traceResolution?: boolean; /* @internal */ diagnostics?: boolean; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 1e0e32bcc45f0..6ebb9cb811f87 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5015,6 +5015,7 @@ namespace ts { noUnusedLocals?: boolean; noUnusedParameters?: boolean; noImplicitUseStrict?: boolean; + noIndirectImports?: boolean; noLib?: boolean; noResolve?: boolean; out?: string; diff --git a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts index 620be52e3eec9..bd4992a9a6742 100644 --- a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts +++ b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts @@ -66,6 +66,18 @@ namespace ts.tscWatch { subScenario: `config with --isolatedModules and --declaration/${input.subScenario}`, configFile: () => changeCompilerOptions(input, { isolatedModules: true, declaration: true }) }); + + verifyEmitAndErrorUpdatesWorker({ + ...input, + subScenario: `config with --noIndirectImports/${input.subScenario}`, + configFile: () => changeCompilerOptions(input, { noIndirectImports: true }) + }); + + verifyEmitAndErrorUpdatesWorker({ + ...input, + subScenario: `config with --noIndirectImports and --declaration/${input.subScenario}`, + configFile: () => changeCompilerOptions(input, { noIndirectImports: true, declaration: true }) + }); } describe("deep import changes", () => { diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 00890b067f855..1912f9374c5e2 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -2641,6 +2641,7 @@ declare namespace ts { noUnusedLocals?: boolean; noUnusedParameters?: boolean; noImplicitUseStrict?: boolean; + noIndirectImports?: boolean; noLib?: boolean; noResolve?: boolean; out?: string; @@ -4726,6 +4727,7 @@ declare namespace ts { force?: boolean; verbose?: boolean; incremental?: boolean; + noIndirectImports?: boolean; traceResolution?: boolean; [option: string]: CompilerOptionsValue | undefined; } diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 89f8bb0543dea..6d641dd0f323b 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2641,6 +2641,7 @@ declare namespace ts { noUnusedLocals?: boolean; noUnusedParameters?: boolean; noImplicitUseStrict?: boolean; + noIndirectImports?: boolean; noLib?: boolean; noResolve?: boolean; out?: string; @@ -4726,6 +4727,7 @@ declare namespace ts { force?: boolean; verbose?: boolean; incremental?: boolean; + noIndirectImports?: boolean; traceResolution?: boolean; [option: string]: CompilerOptionsValue | undefined; } diff --git a/tests/baselines/reference/showConfig/Shows tsconfig for single option/noIndirectImports/tsconfig.json b/tests/baselines/reference/showConfig/Shows tsconfig for single option/noIndirectImports/tsconfig.json new file mode 100644 index 0000000000000..65abfafbc84e6 --- /dev/null +++ b/tests/baselines/reference/showConfig/Shows tsconfig for single option/noIndirectImports/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "noIndirectImports": true + } +} diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js new file mode 100644 index 0000000000000..2b13048577392 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js @@ -0,0 +1,203 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +import {B} from './b'; +declare var console: any; +let b = new B(); +console.log(b.c.d); + +//// [/user/username/projects/myproject/b.ts] +import {C} from './c'; +export class B +{ + c = new C(); +} + +//// [/user/username/projects/myproject/c.ts] +export class C +{ + d = 1; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"noIndirectImports":true,"declaration":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +var C = /** @class */ (function () { + function C() { + this.d = 1; + } + return C; +}()); +exports.C = C; + + +//// [/user/username/projects/myproject/c.d.ts] +export declare class C { + d: number; +} + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; +var c_1 = require("./c"); +var B = /** @class */ (function () { + function B() { + this.c = new c_1.C(); + } + return B; +}()); +exports.B = B; + + +//// [/user/username/projects/myproject/b.d.ts] +import { C } from './c'; +export declare class B { + c: C; +} + + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var b = new b_1.B(); +console.log(b.c.d); + + +//// [/user/username/projects/myproject/a.d.ts] +export {}; + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:38 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property d to d2 of class C + +//// [/user/username/projects/myproject/c.ts] +export class C +{ + d2 = 1; +} + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +var C = /** @class */ (function () { + function C() { + this.d2 = 1; + } + return C; +}()); +exports.C = C; + + +//// [/user/username/projects/myproject/c.d.ts] +export declare class C { + d2: number; +} + + +//// [/user/username/projects/myproject/b.js] file written with same contents +//// [/user/username/projects/myproject/b.d.ts] file written with same contents + +Output:: +>> Screen clear +12:00:42 AM - File change detected. Starting incremental compilation... + + + +12:00:55 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js new file mode 100644 index 0000000000000..8d6383ef24cea --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js @@ -0,0 +1,149 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +import {B} from './b'; +declare var console: any; +let b = new B(); +console.log(b.c.d); + +//// [/user/username/projects/myproject/b.d.ts] +import {C} from './c'; +export class B +{ + c: C; +} + +//// [/user/username/projects/myproject/c.d.ts] +export class C +{ + d: number; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"noIndirectImports":true,"declaration":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var b = new b_1.B(); +console.log(b.c.d); + + +//// [/user/username/projects/myproject/a.d.ts] +export {}; + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:30 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] +Program options: {"noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property d to d2 of class C + +//// [/user/username/projects/myproject/c.d.ts] +export class C +{ + d2: number; +} + + +Output:: +>> Screen clear +12:00:34 AM - File change detected. Starting incremental compilation... + + + +12:00:35 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] +Program options: {"noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js new file mode 100644 index 0000000000000..d809b97a7f98c --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js @@ -0,0 +1,259 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x2: number; + y: number; +} + +//// [/user/username/projects/myproject/b.ts] +import { Point } from "./a"; +export interface PointWrapper extends Point { +} + +//// [/user/username/projects/myproject/c.ts] +import { PointWrapper } from "./b"; +export function getPoint(): PointWrapper { + return { + name: "test", + c: { + x: 1, + y: 2 + } + } +}; + +//// [/user/username/projects/myproject/d.ts] +import { getPoint } from "./c"; +getPoint().c.x; + +//// [/user/username/projects/myproject/e.ts] +import "./d"; + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"noIndirectImports":true,"declaration":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/a.d.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x2: number; + y: number; +} + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/b.d.ts] +import { Point } from "./a"; +export interface PointWrapper extends Point { +} + + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +function getPoint() { + return { + name: "test", + c: { + x: 1, + y: 2 + } + }; +} +exports.getPoint = getPoint; +; + + +//// [/user/username/projects/myproject/c.d.ts] +import { PointWrapper } from "./b"; +export declare function getPoint(): PointWrapper; + + +//// [/user/username/projects/myproject/d.js] +"use strict"; +exports.__esModule = true; +var c_1 = require("./c"); +c_1.getPoint().c.x; + + +//// [/user/username/projects/myproject/d.d.ts] +export {}; + + +//// [/user/username/projects/myproject/e.js] +"use strict"; +exports.__esModule = true; +require("./d"); + + +//// [/user/username/projects/myproject/e.d.ts] +import "./d"; + + + +Output:: +>> Screen clear +12:00:29 AM - Starting compilation in watch mode... + + +c.ts(6,13): error TS2322: Type '{ x: number; y: number; }' is not assignable to type 'Coords'. + Object literal may only specify known properties, and 'x' does not exist in type 'Coords'. + +d.ts(2,14): error TS2339: Property 'x' does not exist on type 'Coords'. + + +12:00:50 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] +Program options: {"noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/user/username/projects/myproject/d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/e.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property x2 to x of interface Coords + +//// [/user/username/projects/myproject/a.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x: number; + y: number; +} + +//// [/user/username/projects/myproject/a.js] file written with same contents +//// [/user/username/projects/myproject/a.d.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x: number; + y: number; +} + + +//// [/user/username/projects/myproject/b.js] file written with same contents +//// [/user/username/projects/myproject/b.d.ts] file written with same contents + +Output:: +>> Screen clear +12:00:54 AM - File change detected. Starting incremental compilation... + + +c.ts(6,13): error TS2322: Type '{ x: number; y: number; }' is not assignable to type 'Coords'. + Object literal may only specify known properties, and 'x' does not exist in type 'Coords'. + +d.ts(2,14): error TS2339: Property 'x' does not exist on type 'Coords'. + + +12:01:07 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] +Program options: {"noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/user/username/projects/myproject/d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/e.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js new file mode 100644 index 0000000000000..c8a6e11fc1fa8 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js @@ -0,0 +1,290 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title: string; +} + +//// [/user/username/projects/myproject/lib1/tools/public.ts] +export * from "./tools.interface"; + +//// [/user/username/projects/myproject/app.ts] +import { Data } from "lib2/public"; +export class App { + public constructor() { + new Data().test(); + } +} + +//// [/user/username/projects/myproject/lib2/public.ts] +export * from "./data"; + +//// [/user/username/projects/myproject/lib1/public.ts] +export * from "./tools/public"; + +//// [/user/username/projects/myproject/lib2/data.ts] +import { ITest } from "lib1/public"; import { Data2 } from "./data2"; +export class Data { + public dat?: Data2; public test() { + const result: ITest = { + title: "title" + } + return result; + } +} + +//// [/user/username/projects/myproject/lib2/data2.ts] +import { Data } from "./data"; +export class Data2 { + public dat?: Data; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"files":["app.ts"],"compilerOptions":{"baseUrl":".","noIndirectImports":true,"declaration":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.d.ts] +export interface ITest { + title: string; +} + + +//// [/user/username/projects/myproject/lib1/tools/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/public.d.ts] +export * from "./tools.interface"; + + +//// [/user/username/projects/myproject/lib1/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/public.d.ts] +export * from "./tools/public"; + + +//// [/user/username/projects/myproject/lib2/data2.js] +"use strict"; +exports.__esModule = true; +var Data2 = /** @class */ (function () { + function Data2() { + } + return Data2; +}()); +exports.Data2 = Data2; + + +//// [/user/username/projects/myproject/lib2/data2.d.ts] +import { Data } from "./data"; +export declare class Data2 { + dat?: Data; +} + + +//// [/user/username/projects/myproject/lib2/data.js] +"use strict"; +exports.__esModule = true; +var Data = /** @class */ (function () { + function Data() { + } + Data.prototype.test = function () { + var result = { + title: "title" + }; + return result; + }; + return Data; +}()); +exports.Data = Data; + + +//// [/user/username/projects/myproject/lib2/data.d.ts] +import { ITest } from "lib1/public"; +import { Data2 } from "./data2"; +export declare class Data { + dat?: Data2; + test(): ITest; +} + + +//// [/user/username/projects/myproject/lib2/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./data")); + + +//// [/user/username/projects/myproject/lib2/public.d.ts] +export * from "./data"; + + +//// [/user/username/projects/myproject/app.js] +"use strict"; +exports.__esModule = true; +var public_1 = require("lib2/public"); +var App = /** @class */ (function () { + function App() { + new public_1.Data().test(); + } + return App; +}()); +exports.App = App; + + +//// [/user/username/projects/myproject/app.d.ts] +export declare class App { + constructor(); +} + + + +Output:: +>> Screen clear +12:00:39 AM - Starting compilation in watch mode... + + + +12:01:08 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property title to title2 of interface ITest + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title2: string; +} + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/tools.interface.d.ts] +export interface ITest { + title2: string; +} + + +//// [/user/username/projects/myproject/lib1/tools/public.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/public.d.ts] file written with same contents + +Output:: +>> Screen clear +12:01:12 AM - File change detected. Starting incremental compilation... + + + +12:01:25 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js new file mode 100644 index 0000000000000..39020281c7bf6 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js @@ -0,0 +1,257 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title: string; +} + +//// [/user/username/projects/myproject/lib1/tools/public.ts] +export * from "./tools.interface"; + +//// [/user/username/projects/myproject/app.ts] +import { Data } from "lib2/public"; +export class App { + public constructor() { + new Data().test(); + } +} + +//// [/user/username/projects/myproject/lib2/public.ts] +export * from "./data"; + +//// [/user/username/projects/myproject/lib1/public.ts] +export * from "./tools/public"; + +//// [/user/username/projects/myproject/lib2/data.ts] +import { ITest } from "lib1/public"; +export class Data { + public test() { + const result: ITest = { + title: "title" + } + return result; + } +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"files":["app.ts"],"compilerOptions":{"baseUrl":".","noIndirectImports":true,"declaration":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.d.ts] +export interface ITest { + title: string; +} + + +//// [/user/username/projects/myproject/lib1/tools/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/public.d.ts] +export * from "./tools.interface"; + + +//// [/user/username/projects/myproject/lib1/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/public.d.ts] +export * from "./tools/public"; + + +//// [/user/username/projects/myproject/lib2/data.js] +"use strict"; +exports.__esModule = true; +var Data = /** @class */ (function () { + function Data() { + } + Data.prototype.test = function () { + var result = { + title: "title" + }; + return result; + }; + return Data; +}()); +exports.Data = Data; + + +//// [/user/username/projects/myproject/lib2/data.d.ts] +import { ITest } from "lib1/public"; +export declare class Data { + test(): ITest; +} + + +//// [/user/username/projects/myproject/lib2/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./data")); + + +//// [/user/username/projects/myproject/lib2/public.d.ts] +export * from "./data"; + + +//// [/user/username/projects/myproject/app.js] +"use strict"; +exports.__esModule = true; +var public_1 = require("lib2/public"); +var App = /** @class */ (function () { + function App() { + new public_1.Data().test(); + } + return App; +}()); +exports.App = App; + + +//// [/user/username/projects/myproject/app.d.ts] +export declare class App { + constructor(); +} + + + +Output:: +>> Screen clear +12:00:37 AM - Starting compilation in watch mode... + + + +12:01:02 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property title to title2 of interface ITest + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title2: string; +} + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/tools.interface.d.ts] +export interface ITest { + title2: string; +} + + +//// [/user/username/projects/myproject/lib1/tools/public.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/public.d.ts] file written with same contents + +Output:: +>> Screen clear +12:01:06 AM - File change detected. Starting incremental compilation... + + + +12:01:19 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/with-noEmitOnError.js new file mode 100644 index 0000000000000..f4d4412813265 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/with-noEmitOnError.js @@ -0,0 +1,165 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/noEmitOnError/shared/types/db.ts] +export interface A { + name: string; +} + +//// [/user/username/projects/noEmitOnError/src/main.ts] +import { A } from "../shared/types/db"; +const a = { + lastName: 'sdsd' +; + +//// [/user/username/projects/noEmitOnError/src/other.ts] +console.log("hi"); +export { } + +//// [/user/username/projects/noEmitOnError/tsconfig.json] +{"compilerOptions":{"outDir":"./dev-build","noEmitOnError":true,"noIndirectImports":true,"declaration":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + + +Output:: +>> Screen clear +12:00:31 AM - Starting compilation in watch mode... + + +src/main.ts(4,1): error TS1005: ',' expected. + + +12:00:32 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +WatchedFiles:: +/user/username/projects/noemitonerror/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/noemitonerror/shared/types/db.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/main.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/other.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/noemitonerror/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/noemitonerror: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Fix the error + +//// [/user/username/projects/noEmitOnError/src/main.ts] +import { A } from "../shared/types/db"; +const a = { + lastName: 'sdsd' +}; + +//// [/user/username/projects/noEmitOnError/dev-build/shared/types/db.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/noEmitOnError/dev-build/shared/types/db.d.ts] +export interface A { + name: string; +} + + +//// [/user/username/projects/noEmitOnError/dev-build/src/main.js] +"use strict"; +exports.__esModule = true; +var a = { + lastName: 'sdsd' +}; + + +//// [/user/username/projects/noEmitOnError/dev-build/src/main.d.ts] +export {}; + + +//// [/user/username/projects/noEmitOnError/dev-build/src/other.js] +"use strict"; +exports.__esModule = true; +console.log("hi"); + + +//// [/user/username/projects/noEmitOnError/dev-build/src/other.d.ts] +export {}; + + + +Output:: +>> Screen clear +12:00:36 AM - File change detected. Starting incremental compilation... + + + +12:00:59 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/noEmitOnError/src/main.ts + +WatchedFiles:: +/user/username/projects/noemitonerror/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/noemitonerror/shared/types/db.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/main.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/other.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/noemitonerror/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/noemitonerror: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/deep-import-changes/updates-errors-when-deep-import-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/deep-import-changes/updates-errors-when-deep-import-file-changes.js new file mode 100644 index 0000000000000..89522948aa7c6 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/deep-import-changes/updates-errors-when-deep-import-file-changes.js @@ -0,0 +1,179 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +import {B} from './b'; +declare var console: any; +let b = new B(); +console.log(b.c.d); + +//// [/user/username/projects/myproject/b.ts] +import {C} from './c'; +export class B +{ + c = new C(); +} + +//// [/user/username/projects/myproject/c.ts] +export class C +{ + d = 1; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"noIndirectImports":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +var C = /** @class */ (function () { + function C() { + this.d = 1; + } + return C; +}()); +exports.C = C; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; +var c_1 = require("./c"); +var B = /** @class */ (function () { + function B() { + this.c = new c_1.C(); + } + return B; +}()); +exports.B = B; + + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var b = new b_1.B(); +console.log(b.c.d); + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:32 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property d to d2 of class C + +//// [/user/username/projects/myproject/c.ts] +export class C +{ + d2 = 1; +} + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +var C = /** @class */ (function () { + function C() { + this.d2 = 1; + } + return C; +}()); +exports.C = C; + + +//// [/user/username/projects/myproject/b.js] file written with same contents + +Output:: +>> Screen clear +12:00:36 AM - File change detected. Starting incremental compilation... + + + +12:00:43 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/b.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js new file mode 100644 index 0000000000000..d08d8d8e53956 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js @@ -0,0 +1,145 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +import {B} from './b'; +declare var console: any; +let b = new B(); +console.log(b.c.d); + +//// [/user/username/projects/myproject/b.d.ts] +import {C} from './c'; +export class B +{ + c: C; +} + +//// [/user/username/projects/myproject/c.d.ts] +export class C +{ + d: number; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"noIndirectImports":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; +var b_1 = require("./b"); +var b = new b_1.B(); +console.log(b.c.d); + + + +Output:: +>> Screen clear +12:00:25 AM - Starting compilation in watch mode... + + + +12:00:28 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] +Program options: {"noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property d to d2 of class C + +//// [/user/username/projects/myproject/c.d.ts] +export class C +{ + d2: number; +} + + +Output:: +>> Screen clear +12:00:32 AM - File change detected. Starting incremental compilation... + + + +12:00:33 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] +Program options: {"noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts +/user/username/projects/myproject/a.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.d.ts +/user/username/projects/myproject/b.d.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.d.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js new file mode 100644 index 0000000000000..405d786347f7d --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js @@ -0,0 +1,217 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/a.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x2: number; + y: number; +} + +//// [/user/username/projects/myproject/b.ts] +import { Point } from "./a"; +export interface PointWrapper extends Point { +} + +//// [/user/username/projects/myproject/c.ts] +import { PointWrapper } from "./b"; +export function getPoint(): PointWrapper { + return { + name: "test", + c: { + x: 1, + y: 2 + } + } +}; + +//// [/user/username/projects/myproject/d.ts] +import { getPoint } from "./c"; +getPoint().c.x; + +//// [/user/username/projects/myproject/e.ts] +import "./d"; + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"noIndirectImports":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/a.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/c.js] +"use strict"; +exports.__esModule = true; +function getPoint() { + return { + name: "test", + c: { + x: 1, + y: 2 + } + }; +} +exports.getPoint = getPoint; +; + + +//// [/user/username/projects/myproject/d.js] +"use strict"; +exports.__esModule = true; +var c_1 = require("./c"); +c_1.getPoint().c.x; + + +//// [/user/username/projects/myproject/e.js] +"use strict"; +exports.__esModule = true; +require("./d"); + + + +Output:: +>> Screen clear +12:00:29 AM - Starting compilation in watch mode... + + +c.ts(6,13): error TS2322: Type '{ x: number; y: number; }' is not assignable to type 'Coords'. + Object literal may only specify known properties, and 'x' does not exist in type 'Coords'. + +d.ts(2,14): error TS2339: Property 'x' does not exist on type 'Coords'. + + +12:00:40 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] +Program options: {"noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/user/username/projects/myproject/d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/e.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property x2 to x of interface Coords + +//// [/user/username/projects/myproject/a.ts] +export interface Point { + name: string; + c: Coords; +} +export interface Coords { + x: number; + y: number; +} + +//// [/user/username/projects/myproject/a.js] file written with same contents +//// [/user/username/projects/myproject/b.js] file written with same contents + +Output:: +>> Screen clear +12:00:44 AM - File change detected. Starting incremental compilation... + + +c.ts(6,13): error TS2322: Type '{ x: number; y: number; }' is not assignable to type 'Coords'. + Object literal may only specify known properties, and 'x' does not exist in type 'Coords'. + +d.ts(2,14): error TS2339: Property 'x' does not exist on type 'Coords'. + + +12:00:51 AM - Found 2 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] +Program options: {"noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts +/user/username/projects/myproject/d.ts +/user/username/projects/myproject/e.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/a.ts: + {"pollingInterval":250} +/user/username/projects/myproject/b.ts: + {"pollingInterval":250} +/user/username/projects/myproject/c.ts: + {"pollingInterval":250} +/user/username/projects/myproject/d.ts: + {"pollingInterval":250} +/user/username/projects/myproject/e.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js new file mode 100644 index 0000000000000..730dd840ec42a --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js @@ -0,0 +1,243 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title: string; +} + +//// [/user/username/projects/myproject/lib1/tools/public.ts] +export * from "./tools.interface"; + +//// [/user/username/projects/myproject/app.ts] +import { Data } from "lib2/public"; +export class App { + public constructor() { + new Data().test(); + } +} + +//// [/user/username/projects/myproject/lib2/public.ts] +export * from "./data"; + +//// [/user/username/projects/myproject/lib1/public.ts] +export * from "./tools/public"; + +//// [/user/username/projects/myproject/lib2/data.ts] +import { ITest } from "lib1/public"; import { Data2 } from "./data2"; +export class Data { + public dat?: Data2; public test() { + const result: ITest = { + title: "title" + } + return result; + } +} + +//// [/user/username/projects/myproject/lib2/data2.ts] +import { Data } from "./data"; +export class Data2 { + public dat?: Data; +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"files":["app.ts"],"compilerOptions":{"baseUrl":".","noIndirectImports":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib2/data2.js] +"use strict"; +exports.__esModule = true; +var Data2 = /** @class */ (function () { + function Data2() { + } + return Data2; +}()); +exports.Data2 = Data2; + + +//// [/user/username/projects/myproject/lib2/data.js] +"use strict"; +exports.__esModule = true; +var Data = /** @class */ (function () { + function Data() { + } + Data.prototype.test = function () { + var result = { + title: "title" + }; + return result; + }; + return Data; +}()); +exports.Data = Data; + + +//// [/user/username/projects/myproject/lib2/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./data")); + + +//// [/user/username/projects/myproject/app.js] +"use strict"; +exports.__esModule = true; +var public_1 = require("lib2/public"); +var App = /** @class */ (function () { + function App() { + new public_1.Data().test(); + } + return App; +}()); +exports.App = App; + + + +Output:: +>> Screen clear +12:00:39 AM - Starting compilation in watch mode... + + + +12:00:54 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property title to title2 of interface ITest + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title2: string; +} + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/public.js] file written with same contents + +Output:: +>> Screen clear +12:00:58 AM - File change detected. Starting incremental compilation... + + + +12:01:05 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data2.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data2.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js new file mode 100644 index 0000000000000..d98a21c31a633 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js @@ -0,0 +1,219 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title: string; +} + +//// [/user/username/projects/myproject/lib1/tools/public.ts] +export * from "./tools.interface"; + +//// [/user/username/projects/myproject/app.ts] +import { Data } from "lib2/public"; +export class App { + public constructor() { + new Data().test(); + } +} + +//// [/user/username/projects/myproject/lib2/public.ts] +export * from "./data"; + +//// [/user/username/projects/myproject/lib1/public.ts] +export * from "./tools/public"; + +//// [/user/username/projects/myproject/lib2/data.ts] +import { ITest } from "lib1/public"; +export class Data { + public test() { + const result: ITest = { + title: "title" + } + return result; + } +} + +//// [/user/username/projects/myproject/tsconfig.json] +{"files":["app.ts"],"compilerOptions":{"baseUrl":".","noIndirectImports":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/tools/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib1/public.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/myproject/lib2/data.js] +"use strict"; +exports.__esModule = true; +var Data = /** @class */ (function () { + function Data() { + } + Data.prototype.test = function () { + var result = { + title: "title" + }; + return result; + }; + return Data; +}()); +exports.Data = Data; + + +//// [/user/username/projects/myproject/lib2/public.js] +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("./data")); + + +//// [/user/username/projects/myproject/app.js] +"use strict"; +exports.__esModule = true; +var public_1 = require("lib2/public"); +var App = /** @class */ (function () { + function App() { + new public_1.Data().test(); + } + return App; +}()); +exports.App = App; + + + +Output:: +>> Screen clear +12:00:37 AM - Starting compilation in watch mode... + + + +12:00:50 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Rename property title to title2 of interface ITest + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.ts] +export interface ITest { + title2: string; +} + +//// [/user/username/projects/myproject/lib1/tools/tools.interface.js] file written with same contents +//// [/user/username/projects/myproject/lib1/tools/public.js] file written with same contents + +Output:: +>> Screen clear +12:00:54 AM - File change detected. Starting incremental compilation... + + + +12:01:01 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/myproject/app.ts"] +Program options: {"baseUrl":"/user/username/projects/myproject","noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts +/user/username/projects/myproject/lib1/public.ts +/user/username/projects/myproject/lib2/data.ts +/user/username/projects/myproject/lib2/public.ts +/user/username/projects/myproject/app.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/lib1/tools/tools.interface.ts +/user/username/projects/myproject/lib1/tools/public.ts + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/myproject/app.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib2/data.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/public.ts: + {"pollingInterval":250} +/user/username/projects/myproject/lib1/tools/tools.interface.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/with-noEmitOnError.js new file mode 100644 index 0000000000000..0e4a49c1c6c64 --- /dev/null +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/with-noEmitOnError.js @@ -0,0 +1,151 @@ +/a/lib/tsc.js --w +//// [/user/username/projects/noEmitOnError/shared/types/db.ts] +export interface A { + name: string; +} + +//// [/user/username/projects/noEmitOnError/src/main.ts] +import { A } from "../shared/types/db"; +const a = { + lastName: 'sdsd' +; + +//// [/user/username/projects/noEmitOnError/src/other.ts] +console.log("hi"); +export { } + +//// [/user/username/projects/noEmitOnError/tsconfig.json] +{"compilerOptions":{"outDir":"./dev-build","noEmitOnError":true,"noIndirectImports":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + + +Output:: +>> Screen clear +12:00:31 AM - Starting compilation in watch mode... + + +src/main.ts(4,1): error TS1005: ',' expected. + + +12:00:32 AM - Found 1 error. Watching for file changes. + + +Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +WatchedFiles:: +/user/username/projects/noemitonerror/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/noemitonerror/shared/types/db.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/main.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/other.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/noemitonerror/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/noemitonerror: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +Change:: Fix the error + +//// [/user/username/projects/noEmitOnError/src/main.ts] +import { A } from "../shared/types/db"; +const a = { + lastName: 'sdsd' +}; + +//// [/user/username/projects/noEmitOnError/dev-build/shared/types/db.js] +"use strict"; +exports.__esModule = true; + + +//// [/user/username/projects/noEmitOnError/dev-build/src/main.js] +"use strict"; +exports.__esModule = true; +var a = { + lastName: 'sdsd' +}; + + +//// [/user/username/projects/noEmitOnError/dev-build/src/other.js] +"use strict"; +exports.__esModule = true; +console.log("hi"); + + + +Output:: +>> Screen clear +12:00:36 AM - File change detected. Starting incremental compilation... + + + +12:00:53 AM - Found 0 errors. Watching for file changes. + + +Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program files:: +/a/lib/lib.d.ts +/user/username/projects/noEmitOnError/shared/types/db.ts +/user/username/projects/noEmitOnError/src/main.ts +/user/username/projects/noEmitOnError/src/other.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/noEmitOnError/src/main.ts + +WatchedFiles:: +/user/username/projects/noemitonerror/tsconfig.json: + {"pollingInterval":250} +/user/username/projects/noemitonerror/shared/types/db.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/main.ts: + {"pollingInterval":250} +/user/username/projects/noemitonerror/src/other.ts: + {"pollingInterval":250} +/a/lib/lib.d.ts: + {"pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/noemitonerror/node_modules/@types: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/noemitonerror: + {"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined From e99d2023ff1c08130374da1acfb937dd07a77447 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 2 Jan 2020 14:07:09 -0800 Subject: [PATCH 3/4] Rename option to assumeChangesOnlyAffectDirectDependencies --- src/compiler/builder.ts | 2 +- src/compiler/commandLineParser.ts | 4 ++-- src/compiler/diagnosticMessages.json | 2 +- src/compiler/tsbuildPublic.ts | 2 +- src/compiler/types.ts | 2 +- src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts | 8 ++++---- tests/baselines/reference/api/tsserverlibrary.d.ts | 4 ++-- tests/baselines/reference/api/typescript.d.ts | 4 ++-- .../tsconfig.json | 5 +++++ .../noIndirectImports/tsconfig.json | 5 ----- .../updates-errors-when-deep-import-file-changes.js | 6 +++--- ...s-when-deep-import-through-declaration-file-changes.js | 6 +++--- ...not-exporting-a-deep-multilevel-import-that-changes.js | 6 +++--- .../when-there-are-circular-import-and-exports.js | 6 +++--- .../when-there-are-no-circular-import-and-exports.js | 6 +++--- .../with-noEmitOnError.js | 6 +++--- .../updates-errors-when-deep-import-file-changes.js | 6 +++--- ...s-when-deep-import-through-declaration-file-changes.js | 6 +++--- ...not-exporting-a-deep-multilevel-import-that-changes.js | 6 +++--- .../when-there-are-circular-import-and-exports.js | 6 +++--- .../when-there-are-no-circular-import-and-exports.js | 6 +++--- .../with-noEmitOnError.js | 6 +++--- 22 files changed, 55 insertions(+), 55 deletions(-) create mode 100644 tests/baselines/reference/showConfig/Shows tsconfig for single option/assumeChangesOnlyAffectDirectDependencies/tsconfig.json delete mode 100644 tests/baselines/reference/showConfig/Shows tsconfig for single option/noIndirectImports/tsconfig.json rename tests/baselines/reference/tscWatch/emitAndErrorUpdates/{config-with---noIndirectImports-and---declaration => config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration}/deep-import-changes/updates-errors-when-deep-import-file-changes.js (89%) rename tests/baselines/reference/tscWatch/emitAndErrorUpdates/{config-with---noIndirectImports-and---declaration => config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration}/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js (87%) rename tests/baselines/reference/tscWatch/emitAndErrorUpdates/{config-with---noIndirectImports-and---declaration => config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration}/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js (91%) rename tests/baselines/reference/tscWatch/emitAndErrorUpdates/{config-with---noIndirectImports-and---declaration => config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration}/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js (92%) rename tests/baselines/reference/tscWatch/emitAndErrorUpdates/{config-with---noIndirectImports-and---declaration => config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration}/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js (92%) rename tests/baselines/reference/tscWatch/emitAndErrorUpdates/{config-with---noIndirectImports-and---declaration => config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration}/with-noEmitOnError.js (89%) rename tests/baselines/reference/tscWatch/emitAndErrorUpdates/{config-with---noIndirectImports => config-with---assumeChangesOnlyAffectDirectDependencies}/deep-import-changes/updates-errors-when-deep-import-file-changes.js (89%) rename tests/baselines/reference/tscWatch/emitAndErrorUpdates/{config-with---noIndirectImports => config-with---assumeChangesOnlyAffectDirectDependencies}/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js (89%) rename tests/baselines/reference/tscWatch/emitAndErrorUpdates/{config-with---noIndirectImports => config-with---assumeChangesOnlyAffectDirectDependencies}/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js (92%) rename tests/baselines/reference/tscWatch/emitAndErrorUpdates/{config-with---noIndirectImports => config-with---assumeChangesOnlyAffectDirectDependencies}/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js (92%) rename tests/baselines/reference/tscWatch/emitAndErrorUpdates/{config-with---noIndirectImports => config-with---assumeChangesOnlyAffectDirectDependencies}/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js (92%) rename tests/baselines/reference/tscWatch/emitAndErrorUpdates/{config-with---noIndirectImports => config-with---assumeChangesOnlyAffectDirectDependencies}/with-noEmitOnError.js (89%) diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index 60972f2eb3808..51f529f6c6dbc 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -433,7 +433,7 @@ namespace ts { return; } - if (!state.compilerOptions.noIndirectImports) { + if (!state.compilerOptions.assumeChangesOnlyAffectDirectDependencies) { forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, (state, path) => handleDtsMayChangeOf(state, path, cancellationToken, computeHash)); } } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 058dbbfe34cf5..e8b25a06d418d 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -201,12 +201,12 @@ namespace ts { transpileOptionValue: undefined }, { - name: "noIndirectImports", + name: "assumeChangesOnlyAffectDirectDependencies", type: "boolean", affectsSemanticDiagnostics: true, affectsEmit: true, category: Diagnostics.Advanced_Options, - description: Diagnostics.Skip_checking_and_generating_d_ts_files_for_files_indirectly_importing_affected_file + description: Diagnostics.Assumes_that_changes_in_any_change_in_a_file_will_only_affect_the_files_directly_depending_on_it }, { name: "locale", diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index c923f976cb6f1..f5508c6ac1fae 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4358,7 +4358,7 @@ "category": "Message", "code": 6383 }, - "Skip checking and generating .d.ts files for files indirectly importing affected file": { + "Assumes that changes in any change in a file will only affect the files directly depending on it.": { "category": "Message", "code": 6384 }, diff --git a/src/compiler/tsbuildPublic.ts b/src/compiler/tsbuildPublic.ts index 8a316b39a0883..a7cadbf3bcb6d 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -16,7 +16,7 @@ namespace ts { /*@internal*/ listFiles?: boolean; /*@internal*/ pretty?: boolean; incremental?: boolean; - noIndirectImports?: boolean; + assumeChangesOnlyAffectDirectDependencies?: boolean; traceResolution?: boolean; /* @internal */ diagnostics?: boolean; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 6ebb9cb811f87..40e5a97f05d3f 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5015,7 +5015,7 @@ namespace ts { noUnusedLocals?: boolean; noUnusedParameters?: boolean; noImplicitUseStrict?: boolean; - noIndirectImports?: boolean; + assumeChangesOnlyAffectDirectDependencies?: boolean; noLib?: boolean; noResolve?: boolean; out?: string; diff --git a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts index bd4992a9a6742..ca57ad939b73d 100644 --- a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts +++ b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts @@ -69,14 +69,14 @@ namespace ts.tscWatch { verifyEmitAndErrorUpdatesWorker({ ...input, - subScenario: `config with --noIndirectImports/${input.subScenario}`, - configFile: () => changeCompilerOptions(input, { noIndirectImports: true }) + subScenario: `config with --assumeChangesOnlyAffectDirectDependencies/${input.subScenario}`, + configFile: () => changeCompilerOptions(input, { assumeChangesOnlyAffectDirectDependencies: true }) }); verifyEmitAndErrorUpdatesWorker({ ...input, - subScenario: `config with --noIndirectImports and --declaration/${input.subScenario}`, - configFile: () => changeCompilerOptions(input, { noIndirectImports: true, declaration: true }) + subScenario: `config with --assumeChangesOnlyAffectDirectDependencies and --declaration/${input.subScenario}`, + configFile: () => changeCompilerOptions(input, { assumeChangesOnlyAffectDirectDependencies: true, declaration: true }) }); } diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 05fcabf8e99bf..4159bf1bc20c7 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -2641,7 +2641,7 @@ declare namespace ts { noUnusedLocals?: boolean; noUnusedParameters?: boolean; noImplicitUseStrict?: boolean; - noIndirectImports?: boolean; + assumeChangesOnlyAffectDirectDependencies?: boolean; noLib?: boolean; noResolve?: boolean; out?: string; @@ -4728,7 +4728,7 @@ declare namespace ts { force?: boolean; verbose?: boolean; incremental?: boolean; - noIndirectImports?: boolean; + assumeChangesOnlyAffectDirectDependencies?: boolean; traceResolution?: boolean; [option: string]: CompilerOptionsValue | undefined; } diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 4266d2bbfe637..bf0bacb8e29b2 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2641,7 +2641,7 @@ declare namespace ts { noUnusedLocals?: boolean; noUnusedParameters?: boolean; noImplicitUseStrict?: boolean; - noIndirectImports?: boolean; + assumeChangesOnlyAffectDirectDependencies?: boolean; noLib?: boolean; noResolve?: boolean; out?: string; @@ -4728,7 +4728,7 @@ declare namespace ts { force?: boolean; verbose?: boolean; incremental?: boolean; - noIndirectImports?: boolean; + assumeChangesOnlyAffectDirectDependencies?: boolean; traceResolution?: boolean; [option: string]: CompilerOptionsValue | undefined; } diff --git a/tests/baselines/reference/showConfig/Shows tsconfig for single option/assumeChangesOnlyAffectDirectDependencies/tsconfig.json b/tests/baselines/reference/showConfig/Shows tsconfig for single option/assumeChangesOnlyAffectDirectDependencies/tsconfig.json new file mode 100644 index 0000000000000..1f5155fb8f0be --- /dev/null +++ b/tests/baselines/reference/showConfig/Shows tsconfig for single option/assumeChangesOnlyAffectDirectDependencies/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "assumeChangesOnlyAffectDirectDependencies": true + } +} diff --git a/tests/baselines/reference/showConfig/Shows tsconfig for single option/noIndirectImports/tsconfig.json b/tests/baselines/reference/showConfig/Shows tsconfig for single option/noIndirectImports/tsconfig.json deleted file mode 100644 index 65abfafbc84e6..0000000000000 --- a/tests/baselines/reference/showConfig/Shows tsconfig for single option/noIndirectImports/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compilerOptions": { - "noIndirectImports": true - } -} diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js similarity index 89% rename from tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js rename to tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js index 2b13048577392..9f46249791d48 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/deep-import-changes/updates-errors-when-deep-import-file-changes.js @@ -19,7 +19,7 @@ export class C } //// [/user/username/projects/myproject/tsconfig.json] -{"compilerOptions":{"noIndirectImports":true,"declaration":true}} +{"compilerOptions":{"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true}} //// [/a/lib/lib.d.ts] /// @@ -95,7 +95,7 @@ Output:: Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] -Program options: {"noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/c.ts @@ -169,7 +169,7 @@ Output:: Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] -Program options: {"noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/c.ts diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js similarity index 87% rename from tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js rename to tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js index 8d6383ef24cea..64f5a555675a4 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js @@ -19,7 +19,7 @@ export class C } //// [/user/username/projects/myproject/tsconfig.json] -{"compilerOptions":{"noIndirectImports":true,"declaration":true}} +{"compilerOptions":{"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true}} //// [/a/lib/lib.d.ts] /// @@ -57,7 +57,7 @@ Output:: Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] -Program options: {"noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/c.d.ts @@ -113,7 +113,7 @@ Output:: Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] -Program options: {"noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/c.d.ts diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js similarity index 91% rename from tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js rename to tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js index d809b97a7f98c..8dddd3fff925b 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js @@ -34,7 +34,7 @@ getPoint().c.x; import "./d"; //// [/user/username/projects/myproject/tsconfig.json] -{"compilerOptions":{"noIndirectImports":true,"declaration":true}} +{"compilerOptions":{"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true}} //// [/a/lib/lib.d.ts] /// @@ -134,7 +134,7 @@ d.ts(2,14): error TS2339: Property 'x' does not exist on type 'Coords'. Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] -Program options: {"noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/a.ts @@ -219,7 +219,7 @@ d.ts(2,14): error TS2339: Property 'x' does not exist on type 'Coords'. Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] -Program options: {"noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/a.ts diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js similarity index 92% rename from tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js rename to tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js index c8a6e11fc1fa8..b554a69a372c6 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js @@ -39,7 +39,7 @@ export class Data2 { } //// [/user/username/projects/myproject/tsconfig.json] -{"files":["app.ts"],"compilerOptions":{"baseUrl":".","noIndirectImports":true,"declaration":true}} +{"files":["app.ts"],"compilerOptions":{"baseUrl":".","assumeChangesOnlyAffectDirectDependencies":true,"declaration":true}} //// [/a/lib/lib.d.ts] /// @@ -170,7 +170,7 @@ Output:: Program root files: ["/user/username/projects/myproject/app.ts"] -Program options: {"baseUrl":"/user/username/projects/myproject","noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"baseUrl":"/user/username/projects/myproject","assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/lib1/tools/tools.interface.ts @@ -246,7 +246,7 @@ Output:: Program root files: ["/user/username/projects/myproject/app.ts"] -Program options: {"baseUrl":"/user/username/projects/myproject","noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"baseUrl":"/user/username/projects/myproject","assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/lib1/tools/tools.interface.ts diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js similarity index 92% rename from tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js rename to tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js index 39020281c7bf6..a9b7299030e55 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js @@ -33,7 +33,7 @@ export class Data { } //// [/user/username/projects/myproject/tsconfig.json] -{"files":["app.ts"],"compilerOptions":{"baseUrl":".","noIndirectImports":true,"declaration":true}} +{"files":["app.ts"],"compilerOptions":{"baseUrl":".","assumeChangesOnlyAffectDirectDependencies":true,"declaration":true}} //// [/a/lib/lib.d.ts] /// @@ -144,7 +144,7 @@ Output:: Program root files: ["/user/username/projects/myproject/app.ts"] -Program options: {"baseUrl":"/user/username/projects/myproject","noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"baseUrl":"/user/username/projects/myproject","assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/lib1/tools/tools.interface.ts @@ -216,7 +216,7 @@ Output:: Program root files: ["/user/username/projects/myproject/app.ts"] -Program options: {"baseUrl":"/user/username/projects/myproject","noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"baseUrl":"/user/username/projects/myproject","assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/lib1/tools/tools.interface.ts diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/with-noEmitOnError.js similarity index 89% rename from tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/with-noEmitOnError.js rename to tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/with-noEmitOnError.js index f4d4412813265..0d8f7659fcaa9 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports-and---declaration/with-noEmitOnError.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies-and---declaration/with-noEmitOnError.js @@ -15,7 +15,7 @@ console.log("hi"); export { } //// [/user/username/projects/noEmitOnError/tsconfig.json] -{"compilerOptions":{"outDir":"./dev-build","noEmitOnError":true,"noIndirectImports":true,"declaration":true}} +{"compilerOptions":{"outDir":"./dev-build","noEmitOnError":true,"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true}} //// [/a/lib/lib.d.ts] /// @@ -45,7 +45,7 @@ src/main.ts(4,1): error TS1005: ',' expected. Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] -Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/noEmitOnError/shared/types/db.ts @@ -132,7 +132,7 @@ Output:: Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] -Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"noIndirectImports":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"assumeChangesOnlyAffectDirectDependencies":true,"declaration":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/noEmitOnError/shared/types/db.ts diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/deep-import-changes/updates-errors-when-deep-import-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/deep-import-changes/updates-errors-when-deep-import-file-changes.js similarity index 89% rename from tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/deep-import-changes/updates-errors-when-deep-import-file-changes.js rename to tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/deep-import-changes/updates-errors-when-deep-import-file-changes.js index 89522948aa7c6..3c4b536c87422 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/deep-import-changes/updates-errors-when-deep-import-file-changes.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/deep-import-changes/updates-errors-when-deep-import-file-changes.js @@ -19,7 +19,7 @@ export class C } //// [/user/username/projects/myproject/tsconfig.json] -{"compilerOptions":{"noIndirectImports":true}} +{"compilerOptions":{"assumeChangesOnlyAffectDirectDependencies":true}} //// [/a/lib/lib.d.ts] /// @@ -78,7 +78,7 @@ Output:: Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] -Program options: {"noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/c.ts @@ -145,7 +145,7 @@ Output:: Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] -Program options: {"noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/c.ts diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js similarity index 89% rename from tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js rename to tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js index d08d8d8e53956..bce8664eae658 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/deep-import-changes/updates-errors-when-deep-import-through-declaration-file-changes.js @@ -19,7 +19,7 @@ export class C } //// [/user/username/projects/myproject/tsconfig.json] -{"compilerOptions":{"noIndirectImports":true}} +{"compilerOptions":{"assumeChangesOnlyAffectDirectDependencies":true}} //// [/a/lib/lib.d.ts] /// @@ -53,7 +53,7 @@ Output:: Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] -Program options: {"noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/c.d.ts @@ -109,7 +109,7 @@ Output:: Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.d.ts","/user/username/projects/myproject/c.d.ts"] -Program options: {"noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/c.d.ts diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js similarity index 92% rename from tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js rename to tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js index 405d786347f7d..b8c39b6484a9d 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-in-file-not-exporting-a-deep-multilevel-import-that-changes.js @@ -34,7 +34,7 @@ getPoint().c.x; import "./d"; //// [/user/username/projects/myproject/tsconfig.json] -{"compilerOptions":{"noIndirectImports":true}} +{"compilerOptions":{"assumeChangesOnlyAffectDirectDependencies":true}} //// [/a/lib/lib.d.ts] /// @@ -104,7 +104,7 @@ d.ts(2,14): error TS2339: Property 'x' does not exist on type 'Coords'. Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] -Program options: {"noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/a.ts @@ -177,7 +177,7 @@ d.ts(2,14): error TS2339: Property 'x' does not exist on type 'Coords'. Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts","/user/username/projects/myproject/d.ts","/user/username/projects/myproject/e.ts"] -Program options: {"noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/a.ts diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js similarity index 92% rename from tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js rename to tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js index 730dd840ec42a..19a4fe780eb01 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-circular-import-and-exports.js @@ -39,7 +39,7 @@ export class Data2 { } //// [/user/username/projects/myproject/tsconfig.json] -{"files":["app.ts"],"compilerOptions":{"baseUrl":".","noIndirectImports":true}} +{"files":["app.ts"],"compilerOptions":{"baseUrl":".","assumeChangesOnlyAffectDirectDependencies":true}} //// [/a/lib/lib.d.ts] /// @@ -130,7 +130,7 @@ Output:: Program root files: ["/user/username/projects/myproject/app.ts"] -Program options: {"baseUrl":"/user/username/projects/myproject","noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"baseUrl":"/user/username/projects/myproject","assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/lib1/tools/tools.interface.ts @@ -199,7 +199,7 @@ Output:: Program root files: ["/user/username/projects/myproject/app.ts"] -Program options: {"baseUrl":"/user/username/projects/myproject","noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"baseUrl":"/user/username/projects/myproject","assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/lib1/tools/tools.interface.ts diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js similarity index 92% rename from tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js rename to tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js index d98a21c31a633..b0d915d80867c 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/updates-errors-when-file-transitively-exported-file-changes/when-there-are-no-circular-import-and-exports.js @@ -33,7 +33,7 @@ export class Data { } //// [/user/username/projects/myproject/tsconfig.json] -{"files":["app.ts"],"compilerOptions":{"baseUrl":".","noIndirectImports":true}} +{"files":["app.ts"],"compilerOptions":{"baseUrl":".","assumeChangesOnlyAffectDirectDependencies":true}} //// [/a/lib/lib.d.ts] /// @@ -113,7 +113,7 @@ Output:: Program root files: ["/user/username/projects/myproject/app.ts"] -Program options: {"baseUrl":"/user/username/projects/myproject","noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"baseUrl":"/user/username/projects/myproject","assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/lib1/tools/tools.interface.ts @@ -178,7 +178,7 @@ Output:: Program root files: ["/user/username/projects/myproject/app.ts"] -Program options: {"baseUrl":"/user/username/projects/myproject","noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"baseUrl":"/user/username/projects/myproject","assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/lib1/tools/tools.interface.ts diff --git a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/with-noEmitOnError.js b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError.js similarity index 89% rename from tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/with-noEmitOnError.js rename to tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError.js index 0e4a49c1c6c64..f2aa1e833bf1a 100644 --- a/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---noIndirectImports/with-noEmitOnError.js +++ b/tests/baselines/reference/tscWatch/emitAndErrorUpdates/config-with---assumeChangesOnlyAffectDirectDependencies/with-noEmitOnError.js @@ -15,7 +15,7 @@ console.log("hi"); export { } //// [/user/username/projects/noEmitOnError/tsconfig.json] -{"compilerOptions":{"outDir":"./dev-build","noEmitOnError":true,"noIndirectImports":true}} +{"compilerOptions":{"outDir":"./dev-build","noEmitOnError":true,"assumeChangesOnlyAffectDirectDependencies":true}} //// [/a/lib/lib.d.ts] /// @@ -45,7 +45,7 @@ src/main.ts(4,1): error TS1005: ',' expected. Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] -Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/noEmitOnError/shared/types/db.ts @@ -118,7 +118,7 @@ Output:: Program root files: ["/user/username/projects/noEmitOnError/shared/types/db.ts","/user/username/projects/noEmitOnError/src/main.ts","/user/username/projects/noEmitOnError/src/other.ts"] -Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"noIndirectImports":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} +Program options: {"outDir":"/user/username/projects/noEmitOnError/dev-build","noEmitOnError":true,"assumeChangesOnlyAffectDirectDependencies":true,"watch":true,"configFilePath":"/user/username/projects/noEmitOnError/tsconfig.json"} Program files:: /a/lib/lib.d.ts /user/username/projects/noEmitOnError/shared/types/db.ts From 4cab8ae8d53d121308084b33bfa5f0d65dd08c12 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 2 Jan 2020 14:46:56 -0800 Subject: [PATCH 4/4] Description change as per feedback --- src/compiler/commandLineParser.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 97e0f2412be9a..60a475095ce28 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -207,7 +207,7 @@ namespace ts { affectsSemanticDiagnostics: true, affectsEmit: true, category: Diagnostics.Advanced_Options, - description: Diagnostics.Assumes_that_changes_in_any_change_in_a_file_will_only_affect_the_files_directly_depending_on_it + description: Diagnostics.Have_recompiles_in_incremental_and_watch_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it }, { name: "locale", diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index aba253ae219be..45d192e20ac7a 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4366,7 +4366,7 @@ "category": "Message", "code": 6383 }, - "Assumes that changes in any change in a file will only affect the files directly depending on it.": { + "Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it.": { "category": "Message", "code": 6384 },