More baselining for timeouts that make furture changes easier (#53579)

This commit is contained in:
Sheetal Nandi
2023-03-30 09:48:34 -07:00
committed by GitHub
parent 5586727193
commit 0ee51b96dc
594 changed files with 6957 additions and 2345 deletions
+6 -6
View File
@@ -286,7 +286,7 @@ function createDynamicPriorityPollingWatchFile(host: {
return queue;
}
function pollPollingIntervalQueue(queue: PollingIntervalQueue) {
function pollPollingIntervalQueue(_timeoutType: string, queue: PollingIntervalQueue) {
queue.pollIndex = pollQueue(queue, queue.pollingInterval, queue.pollIndex, pollingChunkSize[queue.pollingInterval]);
// Set the next polling index and timeout
if (queue.length) {
@@ -298,12 +298,12 @@ function createDynamicPriorityPollingWatchFile(host: {
}
}
function pollLowPollingIntervalQueue(queue: PollingIntervalQueue) {
function pollLowPollingIntervalQueue(_timeoutType: string, queue: PollingIntervalQueue) {
// Always poll complete list of changedFilesInLastPoll
pollQueue(changedFilesInLastPoll, PollingInterval.Low, /*pollIndex*/ 0, changedFilesInLastPoll.length);
// Finally do the actual polling of the queue
pollPollingIntervalQueue(queue);
pollPollingIntervalQueue(_timeoutType, queue);
// Schedule poll if there are files in changedFilesInLastPoll but no files in the actual queue
// as pollPollingIntervalQueue wont schedule for next poll
if (!queue.pollScheduled && changedFilesInLastPoll.length) {
@@ -374,7 +374,7 @@ function createDynamicPriorityPollingWatchFile(host: {
}
function scheduleNextPoll(pollingInterval: PollingInterval) {
pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval));
pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === PollingInterval.Low ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval));
}
}
@@ -465,7 +465,7 @@ function createFixedChunkSizePollingWatchFile(host: {
function scheduleNextPoll() {
if (!watchedFiles.length || pollScheduled) return;
pollScheduled = host.setTimeout(pollQueue, PollingInterval.High);
pollScheduled = host.setTimeout(pollQueue, PollingInterval.High, "pollQueue");
}
}
@@ -713,7 +713,7 @@ function createDirectoryWatcherSupportingRecursive({
clearTimeout(timerToUpdateChildWatches);
timerToUpdateChildWatches = undefined;
}
timerToUpdateChildWatches = setTimeout(onTimerToUpdateChildWatches, 1000);
timerToUpdateChildWatches = setTimeout(onTimerToUpdateChildWatches, 1000, "timerToUpdateChildWatches");
}
function onTimerToUpdateChildWatches() {
+2 -2
View File
@@ -2258,10 +2258,10 @@ function scheduleBuildInvalidatedProject<T extends BuilderProgram>(state: Soluti
if (state.timerToBuildInvalidatedProject) {
hostWithWatch.clearTimeout(state.timerToBuildInvalidatedProject);
}
state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, "timerToBuildInvalidatedProject", state, changeDetected);
}
function buildNextInvalidatedProject<T extends BuilderProgram>(state: SolutionBuilderState<T>, changeDetected: boolean) {
function buildNextInvalidatedProject<T extends BuilderProgram>(_timeoutType: string, state: SolutionBuilderState<T>, changeDetected: boolean) {
performance.mark("SolutionBuilder::beforeBuild");
const buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
performance.mark("SolutionBuilder::afterBuild");
+2 -2
View File
@@ -803,7 +803,7 @@ export function createWatchProgram<T extends BuilderProgram>(host: WatchCompiler
}
const pending = clearInvalidateResolutionsOfFailedLookupLocations();
writeLog(`Scheduling invalidateFailedLookup${pending ? ", Cancelled earlier one" : ""}`);
timerToInvalidateFailedLookupResolutions = host.setTimeout(invalidateResolutionsOfFailedLookup, 250);
timerToInvalidateFailedLookupResolutions = host.setTimeout(invalidateResolutionsOfFailedLookup, 250, "timerToInvalidateFailedLookupResolutions");
}
function invalidateResolutionsOfFailedLookup() {
@@ -825,7 +825,7 @@ export function createWatchProgram<T extends BuilderProgram>(host: WatchCompiler
host.clearTimeout(timerToUpdateProgram);
}
writeLog("Scheduling update");
timerToUpdateProgram = host.setTimeout(updateProgramWithWatchStatus, 250);
timerToUpdateProgram = host.setTimeout(updateProgramWithWatchStatus, 250, "timerToUpdateProgram");
}
function scheduleProgramReload() {
+10 -10
View File
@@ -329,8 +329,8 @@ export function formatMessage<T extends protocol.Message>(msg: T, logger: Logger
* Allows to schedule next step in multistep operation
*/
interface NextStep {
immediate(action: () => void): void;
delay(ms: number, action: () => void): void;
immediate(actionType: string, action: () => void): void;
delay(actionType: string, ms: number, action: () => void): void;
}
/**
@@ -371,22 +371,22 @@ class MultistepOperation implements NextStep {
this.setImmediateId(undefined);
}
public immediate(action: () => void) {
public immediate(actionType: string, action: () => void) {
const requestId = this.requestId!;
Debug.assert(requestId === this.operationHost.getCurrentRequestId(), "immediate: incorrect request id");
this.setImmediateId(this.operationHost.getServerHost().setImmediate(() => {
this.immediateId = undefined;
this.operationHost.executeWithRequestId(requestId, () => this.executeAction(action));
}));
}, actionType));
}
public delay(ms: number, action: () => void) {
public delay(actionType: string, ms: number, action: () => void) {
const requestId = this.requestId!;
Debug.assert(requestId === this.operationHost.getCurrentRequestId(), "delay: incorrect request id");
this.setTimerHandle(this.operationHost.getServerHost().setTimeout(() => {
this.timerHandle = undefined;
this.operationHost.executeWithRequestId(requestId, () => this.executeAction(action));
}, ms));
}, ms, actionType));
}
private executeAction(action: (next: NextStep) => void) {
@@ -1271,7 +1271,7 @@ export class Session<TMessage = string> implements EventSender {
const goNext = () => {
index++;
if (checkList.length > index) {
next.delay(followMs, checkOne);
next.delay("checkOne", followMs, checkOne);
}
};
const checkOne = () => {
@@ -1308,7 +1308,7 @@ export class Session<TMessage = string> implements EventSender {
goNext();
return;
}
next.immediate(() => {
next.immediate("semanticCheck", () => {
this.semanticCheck(fileName, project);
if (this.changeSeq !== seq) {
return;
@@ -1318,7 +1318,7 @@ export class Session<TMessage = string> implements EventSender {
goNext();
return;
}
next.immediate(() => {
next.immediate("suggestionCheck", () => {
this.suggestionCheck(fileName, project);
goNext();
});
@@ -1326,7 +1326,7 @@ export class Session<TMessage = string> implements EventSender {
};
if (checkList.length > index && this.changeSeq === seq) {
next.delay(ms, checkOne);
next.delay("checkOne", ms, checkOne);
}
}
+2 -2
View File
@@ -34,7 +34,7 @@ export class ThrottledOperations {
this.host.clearTimeout(pendingTimeout);
}
// schedule new operation, pass arguments
this.pendingTimeouts.set(operationId, this.host.setTimeout(ThrottledOperations.run, delay, this, operationId, cb));
this.pendingTimeouts.set(operationId, this.host.setTimeout(ThrottledOperations.run, delay, operationId, this, cb));
if (this.logger) {
this.logger.info(`Scheduled: ${operationId}${pendingTimeout ? ", Cancelled earlier one" : ""}`);
}
@@ -47,7 +47,7 @@ export class ThrottledOperations {
return this.pendingTimeouts.delete(operationId);
}
private static run(self: ThrottledOperations, operationId: string, cb: () => void) {
private static run(operationId: string, self: ThrottledOperations, cb: () => void) {
perfLogger?.logStartScheduledOperation(operationId);
self.pendingTimeouts.delete(operationId);
if (self.logger) {
@@ -3,14 +3,9 @@ import { verifyTscWatch } from "../tscWatch/helpers";
import {
createWatchedSystem,
libFile,
TestServerHost,
} from "../virtualFileSystemWithWatch";
describe("unittests:: tsbuildWatch:: watchMode:: configFileErrors:: reports syntax errors in config file", () => {
function build(sys: TestServerHost) {
sys.checkTimeoutQueueLengthAndRun(1); // build the project
sys.checkTimeoutQueueLength(0);
}
verifyTscWatch({
scenario: "configFileErrors",
subScenario: "reports syntax errors in config file",
@@ -41,17 +36,17 @@ describe("unittests:: tsbuildWatch:: watchMode:: configFileErrors:: reports synt
caption: "reports syntax errors after change to config file",
edit: sys => sys.replaceFileText(`/user/username/projects/myproject/tsconfig.json`, ",", `,
"declaration": true,`),
timeouts: build,
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // build the project
},
{
caption: "reports syntax errors after change to ts file",
edit: sys => sys.replaceFileText(`/user/username/projects/myproject/a.ts`, "foo", "fooBar"),
timeouts: build,
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // build the project
},
{
caption: "reports error when there is no change to tsconfig file",
edit: sys => sys.replaceFileText(`/user/username/projects/myproject/tsconfig.json`, "", ""),
timeouts: build,
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // build the project
},
{
caption: "builds after fixing config file errors",
@@ -59,7 +54,7 @@ describe("unittests:: tsbuildWatch:: watchMode:: configFileErrors:: reports synt
compilerOptions: { composite: true, declaration: true },
files: ["a.ts", "b.ts"]
})),
timeouts: build,
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // build the project
}
]
});
@@ -55,9 +55,8 @@ describe("unittests:: tsbuildWatch:: watchMode:: with demo project", () => {
caption: "Fix error",
edit: sys => sys.writeFile(coreFiles[0].path, coreFiles[0].content),
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1); // build core
sys.checkTimeoutQueueLengthAndRun(1); // build animals, zoo and solution
sys.checkTimeoutQueueLength(0);
sys.runQueuedTimeoutCallbacks(); // build core
sys.runQueuedTimeoutCallbacks(); // build animals, zoo and solution
},
}
]
@@ -80,10 +79,7 @@ ${coreFiles[1].content}`);
import * as A from '../animals';
${coreFiles[1].content}`),
// build core
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -50,10 +50,7 @@ describe("unittests:: tsbuildWatch:: watchMode:: moduleResolution", () => {
{
caption: "Append text",
edit: sys => sys.appendFile(`/user/username/projects/myproject/project1/index.ts`, "const bar = 10;"),
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1); // build project1 and solution
sys.checkTimeoutQueueLength(0);
}
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // build project1 and solution
},
]
});
@@ -24,19 +24,13 @@ describe("unittests:: tsbuildWatch:: watchMode:: with noEmit", () => {
caption: "No change",
edit: sys => sys.writeFile(`/user/username/projects/myproject/a.js`, sys.readFile(`/user/username/projects/myproject/a.js`)!),
// build project
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "change",
edit: sys => sys.writeFile(`/user/username/projects/myproject/a.js`, "const x = 10;"),
// build project
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
],
baselineIncremental: true
@@ -15,10 +15,7 @@ describe("unittests:: tsbuildWatch:: watchMode:: with noEmitOnError", () => {
caption,
edit: sys => sys.writeFile(`/user/username/projects/noEmitOnError/src/main.ts`, content),
// build project
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
};
}
@@ -26,10 +23,7 @@ describe("unittests:: tsbuildWatch:: watchMode:: with noEmitOnError", () => {
caption: "No change",
edit: sys => sys.writeFile(`/user/username/projects/noEmitOnError/src/main.ts`, sys.readFile(`/user/username/projects/noEmitOnError/src/main.ts`)!),
// build project
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
};
verifyTscWatch({
scenario: "noEmitOnError",
@@ -15,7 +15,6 @@ import {
getTsBuildProjectFile,
getTsBuildProjectFilePath,
libFile,
TestServerHost,
} from "../virtualFileSystemWithWatch";
describe("unittests:: tsbuildWatch:: watchMode:: program updates", () => {
@@ -51,7 +50,7 @@ describe("unittests:: tsbuildWatch:: watchMode:: program updates", () => {
return {
caption,
edit: sys => sys.writeFile(ts.isString(fileName) ? fileName : fileName(), ts.isString(content) ? content : content()),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1), // Builds core
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Builds core
};
}
@@ -116,10 +115,7 @@ describe("unittests:: tsbuildWatch:: watchMode:: program updates", () => {
const buildLogicAndTests: TscWatchCompileChange = {
caption: "Build logic and tests",
edit: ts.noop,
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
};
verifyTscWatch({
@@ -148,7 +144,7 @@ export class someClass { }`;
sys.writeFile(core[1].path, `${change1}
export class someClass2 { }`);
},
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1), // Builds core
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Builds core
},
buildLogicAndTests,
]
@@ -226,16 +222,13 @@ export class someClass2 { }`),
{
caption: "Write logic tsconfig and build logic",
edit: sys => sys.writeFile(logic[0].path, logic[0].content),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1), // Builds logic
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Builds logic
},
{
caption: "Build Tests",
edit: ts.noop,
// Build tests
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -255,10 +248,7 @@ export class someClass2 { }`),
caption: "Build logic",
edit: ts.noop,
// Builds logic
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
};
verifyTscWatch({
scenario: "programUpdates",
@@ -341,8 +331,8 @@ createSomeObject().message;`
// Change message in library to message2
edit: sys => sys.writeFile(libraryTs.path, libraryTs.content.replace(/message/g, "message2")),
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1); // Build library
sys.checkTimeoutQueueLengthAndRun(1); // Build App
sys.runQueuedTimeoutCallbacks(); // Build library
sys.runQueuedTimeoutCallbacks(); // Build App
},
},
{
@@ -350,8 +340,8 @@ createSomeObject().message;`
// Revert library changes
edit: sys => sys.writeFile(libraryTs.path, libraryTs.content),
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1); // Build library
sys.checkTimeoutQueueLengthAndRun(1); // Build App
sys.runQueuedTimeoutCallbacks(); // Build library
sys.runQueuedTimeoutCallbacks(); // Build App
},
},
]
@@ -372,20 +362,14 @@ createSomeObject().message;`
edit: sys => sys.writeFile(logic[1].path, `${logic[1].content}
let y: string = 10;`),
// Builds logic
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "change core",
edit: sys => sys.writeFile(core[1].path, `${core[1].content}
let x: string = 10;`),
// Builds core
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -417,22 +401,17 @@ let x: string = 10;`),
content: JSON.stringify({ compilerOptions: { composite: true } })
};
function incrementalBuild(sys: TestServerHost) {
sys.checkTimeoutQueueLengthAndRun(1); // Build the app
sys.checkTimeoutQueueLength(0);
}
const fixError: TscWatchCompileChange = {
caption: "Fix error in fileWithError",
// Fix error
edit: sys => sys.writeFile(fileWithError.path, fileWithFixedError.content),
timeouts: incrementalBuild
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
};
const changeFileWithoutError: TscWatchCompileChange = {
caption: "Change fileWithoutError",
edit: sys => sys.writeFile(fileWithoutError.path, fileWithoutError.content.replace(/myClass/g, "myClass2")),
timeouts: incrementalBuild
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
};
verifyTscWatch({
@@ -465,7 +444,7 @@ let x: string = 10;`),
const introduceError: TscWatchCompileChange = {
caption: "Introduce error",
edit: sys => sys.writeFile(fileWithError.path, fileWithError.content),
timeouts: incrementalBuild,
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
};
verifyTscWatch({
@@ -509,18 +488,15 @@ let x: string = 10;`),
caption: "Make non dts change",
edit: sys => sys.writeFile(logic[1].path, `${logic[1].content}
function someFn() { }`),
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1); // build logic and updates tests
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // build logic and updates tests
},
{
caption: "Make dts change",
edit: sys => sys.writeFile(logic[1].path, `${logic[1].content}
export function someFn() { }`),
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1); // build logic
sys.checkTimeoutQueueLengthAndRun(1); // build tests
sys.runQueuedTimeoutCallbacks(); // build logic
sys.runQueuedTimeoutCallbacks(); // build tests
},
}
],
@@ -568,7 +544,7 @@ export function someFn() { }`),
{
caption: "Add new file",
edit: sys => sys.writeFile(`sample1/${SubProject.core}/file3.ts`, `export const y = 10;`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
noopChange,
]
@@ -588,7 +564,7 @@ export function someFn() { }`),
{
caption: "Add new file",
edit: sys => sys.writeFile(`sample1/${SubProject.core}/file3.ts`, `export const y = 10;`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
noopChange
]
@@ -684,15 +660,12 @@ export function someFn() { }`),
edit: sys => sys.writeFile("/a/b/alpha.tsconfig.json", JSON.stringify({
compilerOptions: { strict: true }
})),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1) // Build project1
timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build project1
},
{
caption: "Build project 2",
edit: ts.noop,
timeouts: sys => { // Build project2
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build project2
},
{
caption: "change bravo config",
@@ -700,43 +673,31 @@ export function someFn() { }`),
extends: "./alpha.tsconfig.json",
compilerOptions: { strict: false }
})),
timeouts: sys => { // Build project2
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build project2
},
{
caption: "project 2 extends alpha",
edit: sys => sys.writeFile("/a/b/project2.tsconfig.json", JSON.stringify({
extends: "./alpha.tsconfig.json",
})),
timeouts: sys => { // Build project2
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build project2
},
{
caption: "update aplha config",
edit: sys => sys.writeFile("/a/b/alpha.tsconfig.json", "{}"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1), // build project1
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // build project1
},
{
caption: "Build project 2",
edit: ts.noop,
timeouts: sys => { // Build project2
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build project3
},
{
caption: "Modify extendsConfigFile2",
edit: sys => sys.writeFile("/a/b/extendsConfig2.tsconfig.json", JSON.stringify({
compilerOptions: { strictNullChecks: true }
})),
timeouts: sys => { // Build project3
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build project3
},
{
caption: "Modify project 3",
@@ -745,18 +706,12 @@ export function someFn() { }`),
compilerOptions: { composite: false },
files: ["/a/b/other2.ts"]
})),
timeouts: sys => { // Build project3
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build project3
},
{
caption: "Delete extendedConfigFile2 and report error",
edit: sys => sys.deleteFile("./extendsConfig2.tsconfig.json"),
timeouts: sys => { // Build project3
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build project3
}
],
});
@@ -837,10 +792,7 @@ export function someFn() { }`),
],
files: [],
})),
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -51,7 +51,7 @@ describe("unittests:: tsbuildWatch:: watchMode:: projectsBuilding", () => {
return {
caption: `build ${pkgs(index => `pkg${index}`, count, startIndex).join(",")}`,
edit: ts.noop,
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
};
}
verifyTscWatch({
@@ -66,13 +66,13 @@ describe("unittests:: tsbuildWatch:: watchMode:: projectsBuilding", () => {
{
caption: "dts doesn't change",
edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `const someConst2 = 10;`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1), // Build pkg0 and update timestamps
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build pkg0 and update timestamps
},
noopChange,
{
caption: "dts change",
edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `export const someConst = 10;`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1) // Build pkg0
timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build pkg0
},
checkBuildPkg(1, 2),
noopChange,
@@ -90,13 +90,13 @@ describe("unittests:: tsbuildWatch:: watchMode:: projectsBuilding", () => {
{
caption: "dts doesn't change",
edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `const someConst2 = 10;`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1), // Build pkg0 and update timestamps
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build pkg0 and update timestamps
},
noopChange,
{
caption: "dts change",
edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `export const someConst = 10;`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1) // Build pkg0
timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build pkg0
},
checkBuildPkg(1, 4),
noopChange,
@@ -114,13 +114,13 @@ describe("unittests:: tsbuildWatch:: watchMode:: projectsBuilding", () => {
{
caption: "dts doesn't change",
edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `const someConst2 = 10;`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1), // Build pkg0 and update timestamps
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build pkg0 and update timestamps
},
noopChange,
{
caption: "dts change",
edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `export const someConst = 10;`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1) // Build pkg0
timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build pkg0
},
checkBuildPkg(1, 5),
checkBuildPkg(6, 2),
@@ -128,13 +128,13 @@ describe("unittests:: tsbuildWatch:: watchMode:: projectsBuilding", () => {
{
caption: "dts change2",
edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `export const someConst3 = 10;`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1) // Build pkg0
timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build pkg0
},
checkBuildPkg(1, 5),
{
caption: "change while building",
edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `const someConst4 = 10;`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1) // Build pkg0
timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build pkg0
},
checkBuildPkg(6, 2),
noopChange,
@@ -152,13 +152,13 @@ describe("unittests:: tsbuildWatch:: watchMode:: projectsBuilding", () => {
{
caption: "dts doesn't change",
edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `const someConst2 = 10;`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1), // Build pkg0 and update timestamps
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Build pkg0 and update timestamps
},
noopChange,
{
caption: "dts change",
edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `export const someConst = 10;`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1) // Build pkg0
timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build pkg0
},
checkBuildPkg(1, 5),
checkBuildPkg(6, 5),
@@ -169,20 +169,20 @@ describe("unittests:: tsbuildWatch:: watchMode:: projectsBuilding", () => {
{
caption: "dts change2",
edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `export const someConst3 = 10;`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1) // Build pkg0
timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build pkg0
},
checkBuildPkg(1, 5),
checkBuildPkg(6, 5),
{
caption: "change while building",
edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `const someConst4 = 10;`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1) // Build pkg0
timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build pkg0
},
checkBuildPkg(11, 5),
{
caption: "change while building: dts changes",
edit: sys => sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `export const someConst5 = 10;`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1) // Build pkg0
timeouts: sys => sys.runQueuedTimeoutCallbacks() // Build pkg0
},
checkBuildPkg(1, 5),
checkBuildPkg(6, 5),
@@ -69,9 +69,8 @@ export function f22() { } // trailing`
caption: "change to shared",
edit: sys => sys.prependFile(sharedIndex.path, "export function fooBar() {}"),
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1); // Shared
sys.checkTimeoutQueueLengthAndRun(1); // webpack and solution
sys.checkTimeoutQueueLength(0);
sys.runQueuedTimeoutCallbacks(); // Shared
sys.runQueuedTimeoutCallbacks(); // webpack and solution
}
}
],
@@ -28,18 +28,16 @@ describe("unittests:: tsbuildWatch:: watchMode:: with reexport when referenced p
caption: "Introduce error",
edit: sys => sys.replaceFileText(`/user/username/projects/reexport/src/pure/session.ts`, "// ", ""),
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1); // build src/pure
sys.checkTimeoutQueueLengthAndRun(1); // build src/main and src
sys.checkTimeoutQueueLength(0);
sys.runQueuedTimeoutCallbacks(); // build src/pure
sys.runQueuedTimeoutCallbacks(); // build src/main and src
},
},
{
caption: "Fix error",
edit: sys => sys.replaceFileText(`/user/username/projects/reexport/src/pure/session.ts`, "bar: ", "// bar: "),
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1); // build src/pure
sys.checkTimeoutQueueLengthAndRun(1); // build src/main and src
sys.checkTimeoutQueueLength(0);
sys.runQueuedTimeoutCallbacks(); // build src/pure
sys.runQueuedTimeoutCallbacks(); // build src/main and src
},
}
]
@@ -41,9 +41,8 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi
caption: "modify typing file",
edit: sys => sys.writeFile(typing.path, `${typing.content}export const typing1 = 10;`),
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
sys.runQueuedTimeoutCallbacks();
sys.runQueuedTimeoutCallbacks();
}
},
{
@@ -53,15 +52,14 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi
maxPkgs--;
writePkgReferences(sys);
},
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "modify typing file",
edit: sys => sys.writeFile(typing.path, typing.content),
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLengthAndRun(1);
sys.checkTimeoutQueueLength(0);
sys.runQueuedTimeoutCallbacks();
sys.runQueuedTimeoutCallbacks();
}
},
{
@@ -71,12 +69,12 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi
maxPkgs = 0;
writePkgReferences(sys);
},
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "modify typing file",
edit: sys => sys.writeFile(typing.path, `${typing.content}export const typing1 = 10;`),
timeouts: sys => sys.checkTimeoutQueueLength(0),
timeouts: sys => sys.logTimeoutQueueLength(),
},
],
watchOrSolution: solutionBuilder
+21 -21
View File
@@ -154,7 +154,7 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => {
const changeModuleFile1Shape: TscWatchCompileChange = {
caption: "Change the content of moduleFile1 to `export var T: number;export function Foo() { };`",
edit: modifyModuleFile1Shape,
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
};
verifyTscWatchEmit({
@@ -164,7 +164,7 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => {
{
caption: "Change the content of moduleFile1 to `export var T: number;export function Foo() { console.log('hi'); };`",
edit: sys => sys.writeFile(moduleFile1Path, `export var T: number;export function Foo() { console.log('hi'); };`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -175,18 +175,18 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => {
{
caption: "Change file1Consumer1 content to `export let y = Foo();`",
edit: sys => sys.writeFile(file1Consumer1Path, `export let y = Foo();`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
changeModuleFile1Shape,
{
caption: "Add the import statements back to file1Consumer1",
edit: sys => sys.writeFile(file1Consumer1Path, `import {Foo} from "./moduleFile1";let y = Foo();`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Change the content of moduleFile1 to `export var T: number;export var T2: string;export function Foo() { };`",
edit: sys => sys.writeFile(moduleFile1Path, `export let y = Foo();`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Multiple file edits in one go",
@@ -196,7 +196,7 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => {
sys.writeFile(file1Consumer1Path, `import {Foo} from "./moduleFile1";let y = Foo();`);
modifyModuleFile1Shape(sys);
},
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -210,7 +210,7 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => {
modifyModuleFile1Shape(sys);
sys.deleteFile(file1Consumer2Path);
},
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -224,7 +224,7 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => {
sys.writeFile("/a/b/file1Consumer3.ts", `import {Foo} from "./moduleFile1"; let y = Foo();`);
modifyModuleFile1Shape(sys);
},
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -237,7 +237,7 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => {
{
caption: "change file1 internal, and verify only file1 is affected",
edit: sys => sys.appendFile(moduleFile1Path, "var T1: number;"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -248,7 +248,7 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => {
{
caption: "change shape of global file",
edit: sys => sys.appendFile(globalFilePath, "var T2: string;"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -279,7 +279,7 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => {
{
caption: "change file1Consumer1",
edit: sys => sys.appendFile(file1Consumer1Path, "export var T: number;"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
changeModuleFile1Shape,
{
@@ -288,7 +288,7 @@ describe("unittests:: tsc-watch:: emit for configured projects", () => {
sys.appendFile(file1Consumer1Path, "export var T2: number;");
sys.writeFile(moduleFile1Path, `export var T2: number;export function Foo() { };`);
},
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -312,7 +312,7 @@ export var t2 = 10;`
{
caption: "change file1",
edit: sys => sys.appendFile("/a/b/file1.ts", "export var t3 = 10;"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -329,7 +329,7 @@ export var x = Foo();`
{
caption: "delete moduleFile1",
edit: sys => sys.deleteFile(moduleFile1Path),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -346,12 +346,12 @@ export var x = Foo();`
{
caption: "edit refereceFile1",
edit: sys => sys.appendFile("/a/b/referenceFile1.ts", "export var yy = Foo();"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "create moduleFile2",
edit: sys => sys.writeFile(moduleFile2Path, "export var Foo4 = 10;"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -377,7 +377,7 @@ describe("unittests:: tsc-watch:: emit file content", () => {
{
caption: "Append a line",
edit: sys => sys.appendFile("/a/app.ts", newLine + "var z = 3;"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
],
});
@@ -415,12 +415,12 @@ describe("unittests:: tsc-watch:: emit file content", () => {
{
caption: "Append content to f1",
edit: sys => sys.appendFile("/a/b/f1.ts", "export function foo2() { return 2; }"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Again Append content to f1",
edit: sys => sys.appendFile("/a/b/f1.ts", "export function fooN() { return 2; }"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
],
});
@@ -449,7 +449,7 @@ describe("unittests:: tsc-watch:: emit file content", () => {
{
caption: "Append content to file3",
edit: sys => sys.appendFile("/user/someone/projects/myproject/file3.ts", "function foo2() { return 2; }"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
],
});
@@ -479,7 +479,7 @@ describe("unittests:: tsc-watch:: emit file content", () => {
{
caption: "file is deleted and then created to modify content",
edit: sys => sys.appendFile("/home/username/project/app/file.ts", "\nvar b = 10;", { invokeFileDeleteCreateAsPartInsteadOfChange: true }),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -350,14 +350,14 @@ export class Data2 {
caption,
edit: sys => sys.writeFile(`/user/username/projects/noEmitOnError/src/main.ts`, content),
// build project
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
};
}
const noChange: TscWatchCompileChange = {
caption: "No change",
edit: sys => sys.writeFile(`/user/username/projects/noEmitOnError/src/main.ts`, sys.readFile(`/user/username/projects/noEmitOnError/src/main.ts`)!),
// build project
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
};
verifyEmitAndErrorUpdates({
subScenario: "with noEmitOnError",
+40 -6
View File
@@ -32,9 +32,9 @@ export const commonFile2: File = {
export type WatchOrSolution<T extends ts.BuilderProgram> = void | ts.SolutionBuilder<T> | ts.WatchOfConfigFile<T> | ts.WatchOfFilesAndCompilerOptions<T>;
export interface TscWatchCompileChange<T extends ts.BuilderProgram = ts.EmitAndSemanticDiagnosticsBuilderProgram> {
caption: string;
edit: (sys: TestServerHostTrackingWrittenFiles) => void;
edit: (sys: TscWatchSystem) => void;
timeouts: (
sys: TestServerHostTrackingWrittenFiles,
sys: TscWatchSystem,
programs: readonly CommandLineProgram[],
watchOrSolution: WatchOrSolution<T>
) => void;
@@ -56,7 +56,7 @@ export interface TscWatchCompile extends TscWatchCompileBase {
export const noopChange: TscWatchCompileChange = {
caption: "No change",
edit: ts.noop,
timeouts: sys => sys.checkTimeoutQueueLength(0),
timeouts: sys => sys.logTimeoutQueueLength(),
};
export type SystemSnap = ReturnType<TestServerHost["snap"]>;
@@ -92,9 +92,43 @@ function tscWatchCompile(input: TscWatchCompile) {
});
}
export interface TestServerHostWithTimeoutLogging {
logTimeoutQueueLength(): void;
}
export type TscWatchSystem = TestServerHostTrackingWrittenFiles & TestServerHostWithTimeoutLogging;
function changeToTestServerHostWithTimeoutLogging(inputHost: TestServerHostTrackingWrittenFiles, baseline: string[]): TscWatchSystem {
const host = inputHost as TscWatchSystem;
const originalRunQueuedTimeoutCallbacks = host.runQueuedTimeoutCallbacks;
const originalRunQueuedImmediateCallbacks = host.runQueuedImmediateCallbacks;
host.runQueuedTimeoutCallbacks = runQueuedTimeoutCallbacks;
host.runQueuedImmediateCallbacks = runQueuedImmediateCallbacks;
host.logTimeoutQueueLength = logTimeoutQueueLength;
return host;
function logTimeoutQueueLength() {
baseline.push(host.timeoutCallbacks.log());
baseline.push(host.immediateCallbacks.log());
}
function runQueuedTimeoutCallbacks(timeoutId?: number) {
baseline.push(`Before running ${host.timeoutCallbacks.log()}`);
if (timeoutId !== undefined) baseline.push(`Invoking ${host.timeoutCallbacks.callbackType} callback:: timeoutId:: ${timeoutId}:: ${host.timeoutCallbacks.map[timeoutId].args[0]}`);
originalRunQueuedTimeoutCallbacks.call(host, timeoutId);
baseline.push(`After running ${host.timeoutCallbacks.log()}`);
}
function runQueuedImmediateCallbacks() {
baseline.push(`Before running ${host.immediateCallbacks.log()}`);
originalRunQueuedImmediateCallbacks.call(host);
baseline.push(`After running ${host.immediateCallbacks.log()}`);
}
}
export interface BaselineBase {
baseline: string[];
sys: TestServerHostTrackingWrittenFiles;
sys: TscWatchSystem;
oldSnap: SystemSnap;
}
@@ -105,8 +139,8 @@ export function createBaseline(system: TestServerHost, modifySystem?: (sys: Test
const originalRead = system.readFile;
const initialSys = patchHostForBuildInfoReadWrite(system);
modifySystem?.(initialSys, originalRead);
const sys = changeToHostTrackingWrittenFiles(initialSys);
const baseline: string[] = [];
const sys = changeToTestServerHostWithTimeoutLogging(changeToHostTrackingWrittenFiles(initialSys), baseline);
baseline.push(`currentDirectory:: ${sys.getCurrentDirectory()} useCaseSensitiveFileNames: ${sys.useCaseSensitiveFileNames}`);
baseline.push("Input::");
sys.diff(baseline);
@@ -179,7 +213,7 @@ export function applyEdit(sys: BaselineBase["sys"], baseline: BaselineBase["base
}
export interface RunWatchBaseline<T extends ts.BuilderProgram> extends BaselineBase, TscWatchCompileBase<T> {
sys: TestServerHostTrackingWrittenFiles;
sys: TscWatchSystem;
getPrograms: () => readonly CommandLineProgram[];
watchOrSolution: WatchOrSolution<T>;
}
@@ -110,7 +110,7 @@ describe("unittests:: tsc-watch:: program updates", () => {
{
caption: "Create commonFile2",
edit: sys => sys.writeFile(commonFile2.path, commonFile2.content),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -145,17 +145,17 @@ describe("unittests:: tsc-watch:: program updates", () => {
{
caption: "change file to ensure signatures are updated",
edit: sys => sys.appendFile(commonFile2.path, ";let xy = 10;"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "delete file2",
edit: sys => sys.deleteFile(commonFile2.path),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "recreate file2",
edit: sys => sys.writeFile(commonFile2.path, commonFile2.content),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -176,7 +176,7 @@ describe("unittests:: tsc-watch:: program updates", () => {
{
caption: "create file2",
edit: sys => sys.writeFile(commonFile2.path, commonFile2.content),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -199,7 +199,7 @@ describe("unittests:: tsc-watch:: program updates", () => {
{
caption: "change file to ensure signatures are updated",
edit: sys => sys.appendFile(commonFile2.path, ";let xy = 10;"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Change config",
@@ -207,7 +207,7 @@ describe("unittests:: tsc-watch:: program updates", () => {
"compilerOptions": {},
"files": ["${commonFile1.path}"]
}`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -233,7 +233,7 @@ describe("unittests:: tsc-watch:: program updates", () => {
"compilerOptions": {},
"files": ["${commonFile1.path}", "${commonFile2.path}"]
}`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -261,14 +261,14 @@ describe("unittests:: tsc-watch:: program updates", () => {
edit: sys => sys.modifyFile("/tsconfig.json", JSON.stringify({
compilerOptions: { allowUnusedLabels: false }
})),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "Enable allowUnsusedLabels",
edit: sys => sys.modifyFile("/tsconfig.json", JSON.stringify({
compilerOptions: { allowUnusedLabels: true }
})),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -302,7 +302,7 @@ describe("unittests:: tsc-watch:: program updates", () => {
compilerOptions: { allowArbitraryExtensions: false },
files: ["/a.ts"],
})),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "Enable allowArbitraryExtensions",
@@ -310,7 +310,7 @@ describe("unittests:: tsc-watch:: program updates", () => {
compilerOptions: { allowArbitraryExtensions: true },
files: ["/a.ts"],
})),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -346,7 +346,7 @@ export class A {
edit: sys => sys.modifyFile("/tsconfig.json", JSON.stringify({
compilerOptions: { target: "es6", importsNotUsedAsValues: "error", experimentalDecorators: true }
})),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
@@ -354,7 +354,7 @@ export class A {
edit: sys => sys.modifyFile("/tsconfig.json", JSON.stringify({
compilerOptions: { target: "es6", importsNotUsedAsValues: "error", experimentalDecorators: true, emitDecoratorMetadata: true }
})),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -416,7 +416,7 @@ export class A {
},
"files": ["/a/b/file1.ts"]
}`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -464,7 +464,7 @@ export class A {
caption: "Modify f2 to include f3",
// now inferred project should inclule file3
edit: sys => sys.modifyFile("/a/b/f2.ts", `export * from "../c/f3"`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -492,7 +492,7 @@ export class A {
{
caption: "Delete f2",
edit: sys => sys.deleteFile("/a/b/f2.ts"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -520,7 +520,7 @@ export class A {
{
caption: "Delete f2",
edit: sys => sys.deleteFile("/a/b/f2.ts"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -563,7 +563,7 @@ export class A {
},
edits: [{
caption: "change `module` to 'none'",
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
edit: sys => {
sys.writeFile(configFilePath, JSON.stringify({ compilerOptions: { module: "none" } }));
}
@@ -621,7 +621,7 @@ export class A {
oldSnap: oldSnap2,
});
sys.checkTimeoutQueueLength(0);
sys.logTimeoutQueueLength();
baseline.push(`First program is not updated:: ${getPrograms() === ts.emptyArray}`);
baseline.push(`Second program is not updated:: ${getPrograms2() === ts.emptyArray}`);
Harness.Baseline.runBaseline(`tscWatch/${scenario}/two-watch-programs-are-not-affected-by-each-other.js`, baseline.join("\r\n"));
@@ -642,7 +642,7 @@ export class A {
{
caption: "Write f2",
edit: sys => sys.writeFile("/a/b/f2.ts", "let y = 1"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -670,7 +670,7 @@ export class A {
{
caption: "Modify config to make f2 as root too",
edit: sys => sys.writeFile(configFilePath, JSON.stringify({ compilerOptions: {}, files: ["f1.ts", "f2.ts"] })),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -698,12 +698,12 @@ export class A {
{
caption: "Add new file",
edit: sys => sys.writeFile(`/user/username/projects/myproject/new-file.ts`, "export const z = 1;"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Import new file",
edit: sys => sys.prependFile(`/user/username/projects/myproject/f1.ts`, `import { z } from "./new-file";`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -727,7 +727,7 @@ export class A {
{
caption: "Write file2",
edit: sys => sys.writeFile(`/user/username/projects/myproject/Project/file2.ts`, "export const y = 10;"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
}
]
});
@@ -755,7 +755,7 @@ export class A {
{
caption: "Modify config to set outFile option",
edit: sys => sys.writeFile(configFilePath, JSON.stringify({ compilerOptions: { outFile: "out.js" }, files: ["f1.ts", "f2.ts"] })),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -783,7 +783,7 @@ export class A {
{
caption: "Delete f2",
edit: sys => sys.deleteFile("/a/b/f2.ts"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -807,7 +807,7 @@ export class A {
{
caption: "Delete config file",
edit: sys => sys.deleteFile(configFilePath),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -881,7 +881,7 @@ declare const eval: any`
}
})
),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}
]
});
@@ -1234,7 +1234,7 @@ declare const eval: any`
{
caption: "Add new file",
edit: sys => sys.writeFile(`/user/username/projects/myproject/src/file3.ts`, `export const y = 10;`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2), // To update program and failed lookups
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // To update program and failed lookups
},
noopChange,
]
@@ -1843,7 +1843,7 @@ import { x } from "../b";`),
compilerOptions: {},
files: [commonFile1.path, commonFile2.path]
})),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Change first extended config",
@@ -1852,7 +1852,7 @@ import { x } from "../b";`),
strict: false,
}
})),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Change second extended config",
@@ -1862,7 +1862,7 @@ import { x } from "../b";`),
strictNullChecks: true,
}
})),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Change config to stop extending another config",
@@ -1870,7 +1870,7 @@ import { x } from "../b";`),
compilerOptions: {},
files: [commonFile1.path, commonFile2.path]
})),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
]
});
@@ -1908,7 +1908,7 @@ import { x } from "../b";`),
{
caption: "Add module3 to folder2",
edit: sys => sys.writeFile(`/user/username/projects/myproject/client/linktofolder2/module3.ts`, `import * as M from "folder1/module1";`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
]
});
@@ -1959,27 +1959,27 @@ import { x } from "../b";`),
{
caption: "Add class3 to project1",
edit: sys => sys.writeFile(`/user/username/projects/myproject/projects/project1/class3.ts`, `class class3 {}`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Add output of class3",
edit: sys => sys.writeFile(`/user/username/projects/myproject/projects/project1/class3.d.ts`, `declare class class3 {}`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Add excluded file to project1",
edit: sys => sys.ensureFileOrFolder({ path: `/user/username/projects/myproject/projects/project1/temp/file.d.ts`, content: `declare class file {}` }),
timeouts: sys => sys.checkTimeoutQueueLength(0),
timeouts: sys => sys.logTimeoutQueueLength(),
},
{
caption: "Delete output of class3",
edit: sys => sys.deleteFile(`/user/username/projects/myproject/projects/project1/class3.d.ts`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Add output of class3",
edit: sys => sys.writeFile(`/user/username/projects/myproject/projects/project1/class3.d.ts`, `declare class class3 {}`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
]
});
@@ -2003,7 +2003,7 @@ import { x } from "../b";`),
{
caption: "Create foo in project root",
edit: sys => sys.writeFile(`/user/username/projects/myproject/foo`, ``),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
]
});
@@ -2041,7 +2041,7 @@ import { x } from "../b";`),
allowImportingTsExtensions: true
}
})),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
]
});
@@ -40,7 +40,7 @@ describe("unittests:: tsc-watch:: projects with references: invoking when refere
},
// not ideal, but currently because of d.ts but no new file is written
// There will be timeout queued even though file contents are same
timeouts: sys => sys.checkTimeoutQueueLength(0),
timeouts: sys => sys.logTimeoutQueueLength(),
},
{
caption: "non local edit in logic ts, and build logic",
@@ -49,7 +49,7 @@ describe("unittests:: tsc-watch:: projects with references: invoking when refere
const solutionBuilder = createSolutionBuilder(sys, ["logic"]);
solutionBuilder.build();
},
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "change in project reference config file builds correctly",
@@ -61,7 +61,7 @@ describe("unittests:: tsc-watch:: projects with references: invoking when refere
const solutionBuilder = createSolutionBuilder(sys, ["logic"]);
solutionBuilder.build();
},
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
],
baselineDependencies: true
@@ -99,7 +99,7 @@ describe("unittests:: tsc-watch:: projects with references: invoking when refere
const solutionBuilder = createSolutionBuilder(sys, ["tsconfig.b.json"]);
solutionBuilder.build();
},
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "edit on config file",
@@ -110,42 +110,42 @@ describe("unittests:: tsc-watch:: projects with references: invoking when refere
});
changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "tsconfig.c.json"), { "@ref/*": ["./nrefs/*"] });
},
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "Revert config file edit",
edit: sys => changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "tsconfig.c.json"), { "@ref/*": ["./refs/*"] }),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "edit in referenced config file",
edit: sys => changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json"), { "@ref/*": ["./nrefs/*"] }),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "Revert referenced config file edit",
edit: sys => changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json"), { "@ref/*": ["./refs/*"] }),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "deleting referenced config file",
edit: sys => sys.deleteFile(getTsBuildProjectFilePath("transitiveReferences", "tsconfig.b.json")),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "Revert deleting referenced config file",
edit: sys => sys.ensureFileOrFolder(getTsBuildProjectFile("transitiveReferences", "tsconfig.b.json")),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "deleting transitively referenced config file",
edit: sys => sys.deleteFile(getTsBuildProjectFilePath("transitiveReferences", "tsconfig.a.json")),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "Revert deleting transitively referenced config file",
edit: sys => sys.ensureFileOrFolder(getTsBuildProjectFile("transitiveReferences", "tsconfig.a.json")),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
],
baselineDependencies: true,
@@ -241,7 +241,7 @@ X;`,
const solutionBuilder = createSolutionBuilder(sys, ["b"]);
solutionBuilder.build();
},
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "edit on config file",
@@ -252,27 +252,27 @@ X;`,
});
changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../nrefs/*"] });
},
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "Revert config file edit",
edit: sys => changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../refs/*"] }),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "edit in referenced config file",
edit: sys => changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "Revert referenced config file edit",
edit: sys => changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../refs/*"] }),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "deleting referenced config file",
edit: sys => sys.deleteFile(getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json")),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "Revert deleting referenced config file",
@@ -284,12 +284,12 @@ X;`,
references: [{ path: `../a` }]
})
),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "deleting transitively referenced config file",
edit: sys => sys.deleteFile(getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json")),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "Revert deleting transitively referenced config file",
@@ -300,7 +300,7 @@ X;`,
files: ["index.ts"]
}),
),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
],
baselineDependencies: true,
@@ -360,7 +360,7 @@ X;`,
const solutionBuilder = createSolutionBuilder(sys, ["b"]);
solutionBuilder.build();
},
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "edit on config file",
@@ -371,27 +371,27 @@ X;`,
});
changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../nrefs/*"] });
},
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "Revert config file edit",
edit: sys => changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "c/tsconfig.json"), { "@ref/*": ["../refs/*"] }),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "edit in referenced config file",
edit: sys => changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../nrefs/*"] }),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "Revert referenced config file edit",
edit: sys => changeCompilerOpitonsPaths(sys, getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json"), { "@ref/*": ["../refs/*"] }),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "deleting referenced config file",
edit: sys => sys.deleteFile(getTsBuildProjectFilePath("transitiveReferences", "b/tsconfig.json")),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "Revert deleting referenced config file",
@@ -402,12 +402,12 @@ X;`,
references: [{ path: `../a` }]
})
),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "deleting transitively referenced config file",
edit: sys => sys.deleteFile(getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json")),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
{
caption: "Revert deleting transitively referenced config file",
@@ -415,7 +415,7 @@ X;`,
getTsBuildProjectFilePath("transitiveReferences", "a/tsconfig.json"),
JSON.stringify({ compilerOptions: { composite: true } }),
),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2)
timeouts: sys => sys.runQueuedTimeoutCallbacks()
},
],
baselineDependencies: true,
@@ -446,7 +446,7 @@ X;`,
const solutionBuilder = createSolutionBuilder(sys, ["core"]);
solutionBuilder.build();
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(0),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
],
baselineDependencies: true
@@ -214,8 +214,8 @@ describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch module resolution
sys.writeFile(imported.path, imported.content);
},
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1); // Scheduled invalidation of resolutions
sys.checkTimeoutQueueLengthAndRun(1); // Actual update
sys.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions
sys.runQueuedTimeoutCallbacks(); // Actual update
assert.isTrue(fileExistsCalledForBar, "'fileExists' should be called.");
},
},
@@ -392,7 +392,7 @@ declare module "fs" {
path: `/user/username/projects/myproject/node_modules/.cache/babel-loader/89c02171edab901b9926470ba6d5677e.ts`,
content: JSON.stringify({ something: 10 })
}),
timeouts: sys => sys.checkTimeoutQueueLength(0),
timeouts: sys => sys.logTimeoutQueueLength(),
}
]
});
@@ -441,15 +441,15 @@ declare namespace myapp {
});
},
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(2); // Scheduled invalidation of resolutions, update that gets cancelled and rescheduled by actual invalidation of resolution
sys.checkTimeoutQueueLengthAndRun(1); // Actual update
sys.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions, update that gets cancelled and rescheduled by actual invalidation of resolution
sys.runQueuedTimeoutCallbacks(); // Actual update
},
},
{
caption: "No change, just check program",
edit: ts.noop,
timeouts: (sys, [[oldProgram, oldBuilderProgram]], watchorSolution) => {
sys.checkTimeoutQueueLength(0);
sys.logTimeoutQueueLength();
const newProgram = (watchorSolution as ts.WatchOfConfigFile<ts.EmitAndSemanticDiagnosticsBuilderProgram>).getProgram();
assert.strictEqual(newProgram, oldBuilderProgram, "No change so builder program should be same");
assert.strictEqual(newProgram.getProgram(), oldProgram, "No change so program should be same");
+22 -22
View File
@@ -6,7 +6,6 @@ import {
createWatchedSystem,
File,
libFile,
TestServerHostTrackingWrittenFiles,
} from "../virtualFileSystemWithWatch";
import {
applyEdit,
@@ -14,6 +13,7 @@ import {
createWatchCompilerHostOfConfigFileForBaseline,
createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline,
runWatchBaseline,
TscWatchSystem,
watchBaseline,
} from "./helpers";
@@ -200,7 +200,7 @@ describe("unittests:: tsc-watch:: watchAPI:: when watchHost does not implement s
caption: "Write a file",
edit: sys => sys.writeFile(`/user/username/projects/myproject/bar.ts`, "const y =10;"),
timeouts: sys => {
sys.checkTimeoutQueueLength(0);
sys.logTimeoutQueueLength();
watch.getProgram();
}
}],
@@ -245,7 +245,7 @@ describe("unittests:: tsc-watch:: watchAPI:: when watchHost can add extraFileExt
edits: [{
caption: "Write a file",
edit: sys => sys.writeFile(`/user/username/projects/myproject/other2.vue`, otherFile.content),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
}],
watchOrSolution: watch
});
@@ -277,7 +277,7 @@ describe("unittests:: tsc-watch:: watchAPI:: when watchHost uses createSemanticD
function createWatch<T extends ts.BuilderProgram>(
baseline: string[],
config: File,
sys: TestServerHostTrackingWrittenFiles,
sys: TscWatchSystem,
createProgram: ts.CreateProgram<T>,
optionsToExtend?: ts.CompilerOptions,
) {
@@ -319,9 +319,9 @@ describe("unittests:: tsc-watch:: watchAPI:: when watchHost uses createSemanticD
function applyChangeForBuilderTest(
baseline: string[],
emitBaseline: string[],
sys: TestServerHostTrackingWrittenFiles,
emitSys: TestServerHostTrackingWrittenFiles,
change: (sys: TestServerHostTrackingWrittenFiles) => void,
sys: TscWatchSystem,
emitSys: TscWatchSystem,
change: (sys: TscWatchSystem) => void,
caption: string
) {
// Change file
@@ -333,8 +333,8 @@ describe("unittests:: tsc-watch:: watchAPI:: when watchHost uses createSemanticD
baseline: string[],
emitBaseline: string[],
config: File,
sys: TestServerHostTrackingWrittenFiles,
emitSys: TestServerHostTrackingWrittenFiles,
sys: TscWatchSystem,
emitSys: TscWatchSystem,
createProgram: ts.CreateProgram<T>,
optionsToExtend?: ts.CompilerOptions) {
createWatch(baseline, config, sys, createProgram, optionsToExtend);
@@ -569,17 +569,17 @@ describe("unittests:: tsc-watch:: watchAPI:: when getParsedCommandLine is implem
calledGetParsedCommandLine.clear();
sys.writeFile(`/user/username/projects/myproject/projects/project1/class3.ts`, `class class3 {}`);
},
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Add excluded file to project1",
edit: sys => sys.ensureFileOrFolder({ path: `/user/username/projects/myproject/projects/project1/temp/file.d.ts`, content: `declare class file {}` }),
timeouts: sys => sys.checkTimeoutQueueLength(0),
timeouts: sys => sys.logTimeoutQueueLength(),
},
{
caption: "Add output of class3",
edit: sys => sys.writeFile(`/user/username/projects/myproject/projects/project1/class3.d.ts`, `declare class class3 {}`),
timeouts: sys => sys.checkTimeoutQueueLength(0),
timeouts: sys => sys.logTimeoutQueueLength(),
},
],
watchOrSolution: watch
@@ -600,27 +600,27 @@ describe("unittests:: tsc-watch:: watchAPI:: when getParsedCommandLine is implem
calledGetParsedCommandLine.clear();
sys.writeFile(`/user/username/projects/myproject/projects/project1/class3.ts`, `class class3 {}`);
},
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Add class3 output to project1",
edit: sys => sys.writeFile(`/user/username/projects/myproject/projects/project1/class3.d.ts`, `declare class class3 {}`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Add excluded file to project1",
edit: sys => sys.ensureFileOrFolder({ path: `/user/username/projects/myproject/projects/project1/temp/file.d.ts`, content: `declare class file {}` }),
timeouts: sys => sys.checkTimeoutQueueLength(0),
timeouts: sys => sys.logTimeoutQueueLength(),
},
{
caption: "Delete output of class3",
edit: sys => sys.deleteFile(`/user/username/projects/myproject/projects/project1/class3.d.ts`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Add output of class3",
edit: sys => sys.writeFile(`/user/username/projects/myproject/projects/project1/class3.d.ts`, `declare class class3 {}`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
],
watchOrSolution: watch
@@ -663,7 +663,7 @@ describe("unittests:: tsc-watch:: watchAPI:: when builder emit occurs with emitO
sys.writeFile(`/user/username/projects/myproject/b.ts`, `export const y = 10;`);
callFullEmit = false;
},
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Emit with emitOnlyDts shouldnt emit anything",
@@ -672,7 +672,7 @@ describe("unittests:: tsc-watch:: watchAPI:: when builder emit occurs with emitO
program.emit(/*targetSourceFile*/ undefined, /*writeFile*/ undefined, /*cancellationToken*/ undefined, /*emitOnlyDtsFiles*/ true);
baseline.cb(program);
},
timeouts: sys => sys.checkTimeoutQueueLength(0),
timeouts: sys => sys.logTimeoutQueueLength(),
},
{
caption: "Emit all files",
@@ -681,7 +681,7 @@ describe("unittests:: tsc-watch:: watchAPI:: when builder emit occurs with emitO
program.emit();
baseline.cb(program);
},
timeouts: sys => sys.checkTimeoutQueueLength(0),
timeouts: sys => sys.logTimeoutQueueLength(),
},
{
caption: "Emit with emitOnlyDts shouldnt emit anything",
@@ -690,7 +690,7 @@ describe("unittests:: tsc-watch:: watchAPI:: when builder emit occurs with emitO
program.emit(/*targetSourceFile*/ undefined, /*writeFile*/ undefined, /*cancellationToken*/ undefined, /*emitOnlyDtsFiles*/ true);
baseline.cb(program);
},
timeouts: sys => sys.checkTimeoutQueueLength(0),
timeouts: sys => sys.logTimeoutQueueLength(),
},
{
caption: "Emit full should not emit anything",
@@ -699,7 +699,7 @@ describe("unittests:: tsc-watch:: watchAPI:: when builder emit occurs with emitO
program.emit();
baseline.cb(program);
},
timeouts: sys => sys.checkTimeoutQueueLength(0),
timeouts: sys => sys.logTimeoutQueueLength(),
},
],
watchOrSolution: watch
@@ -40,7 +40,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po
const mediumPollingIntervalThreshold = ts.unchangedPollThresholds[ts.PollingInterval.Medium];
for (let index = 0; index < mediumPollingIntervalThreshold; index++) {
// Transition libFile and file1 to low priority queue
sys.checkTimeoutQueueLengthAndRun(1);
sys.runQueuedTimeoutCallbacks();
assert.deepEqual(programs[0][0], initialProgram);
}
return;
@@ -51,14 +51,14 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po
// Make a change to file
edit: sys => sys.writeFile("/a/username/project/typescript.ts", "var zz30 = 100;"),
// During this timeout the file would be detected as unchanged
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Callbacks: medium priority + high priority queue and scheduled program update",
edit: ts.noop,
// Callbacks: medium priority + high priority queue and scheduled program update
// This should detect change in the file
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(3),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Polling queues polled and everything is in the high polling queue",
@@ -69,12 +69,12 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po
const newThreshold = ts.unchangedPollThresholds[ts.PollingInterval.Low] + mediumPollingIntervalThreshold;
for (let fileUnchangeDetected = 1; fileUnchangeDetected < newThreshold; fileUnchangeDetected++) {
// For high + Medium/low polling interval
sys.checkTimeoutQueueLengthAndRun(2);
sys.runQueuedTimeoutCallbacks();
assert.deepEqual(programs[0][0], initialProgram);
}
// Everything goes in high polling interval queue
sys.checkTimeoutQueueLengthAndRun(1);
sys.runQueuedTimeoutCallbacks();
return;
},
}
@@ -105,7 +105,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po
// On each timeout file does not change
const initialProgram = programs[0][0];
for (let index = 0; index < 4; index++) {
sys.checkTimeoutQueueLengthAndRun(1);
sys.runQueuedTimeoutCallbacks();
assert.deepEqual(programs[0][0], initialProgram);
}
},
@@ -114,13 +114,13 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po
caption: "Make change to file but should detect as changed and schedule program update",
// Make a change to file
edit: sys => sys.writeFile(commonFile1.path, "var zz30 = 100;"),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Callbacks: queue and scheduled program update",
edit: ts.noop,
// Callbacks: scheduled program update and queue for the polling
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "The timeout is to check the status of all files",
@@ -128,7 +128,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po
timeouts: (sys, programs) => {
// On each timeout file does not change
const initialProgram = programs[0][0];
sys.checkTimeoutQueueLengthAndRun(1);
sys.runQueuedTimeoutCallbacks();
assert.deepEqual(programs[0][0], initialProgram);
},
},
@@ -256,68 +256,55 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po
caption: "Directory watch updates because of file1.js creation",
edit: ts.noop,
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1); // To update directory callbacks for file1.js output
sys.checkTimeoutQueueLength(0);
sys.runQueuedTimeoutCallbacks(); // To update directory callbacks for file1.js output
},
},
{
caption: "Remove directory node_modules",
// Remove directory node_modules
edit: sys => sys.deleteFolder(`/user/username/projects/myproject/node_modules`, /*recursive*/ true),
timeouts: sys => {
sys.checkTimeoutQueueLength(3); // 1. Failed lookup invalidation 2. For updating program and 3. for updating child watches
sys.runQueuedTimeoutCallbacks(sys.getNextTimeoutId() - 2); // Update program
},
// 1. Failed lookup invalidation 2. For updating program and 3. for updating child watches
timeouts: sys => sys.runQueuedTimeoutCallbacks(sys.getNextTimeoutId() - 2), // Update program,
},
{
caption: "Pending directory watchers and program update",
edit: ts.noop,
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1); // To update directory watchers
sys.checkTimeoutQueueLengthAndRun(2); // To Update program and failed lookup update
sys.checkTimeoutQueueLengthAndRun(1); // Actual program update
sys.checkTimeoutQueueLength(0);
sys.runQueuedTimeoutCallbacks(); // To update directory watchers
sys.runQueuedTimeoutCallbacks(); // To Update program and failed lookup update
sys.runQueuedTimeoutCallbacks(); // Actual program update
},
},
{
caption: "Start npm install",
// npm install
edit: sys => sys.createDirectory(`/user/username/projects/myproject/node_modules`),
timeouts: sys => sys.checkTimeoutQueueLength(1), // To update folder structure
timeouts: sys => sys.logTimeoutQueueLength(), // To update folder structure
},
{
caption: "npm install folder creation of file2",
edit: sys => sys.createDirectory(`/user/username/projects/myproject/node_modules/file2`),
timeouts: sys => sys.checkTimeoutQueueLength(1), // To update folder structure
timeouts: sys => sys.logTimeoutQueueLength(), // To update folder structure
},
{
caption: "npm install index file in file2",
edit: sys => sys.writeFile(`/user/username/projects/myproject/node_modules/file2/index.d.ts`, `export const x = 10;`),
timeouts: sys => sys.checkTimeoutQueueLength(1), // To update folder structure
timeouts: sys => sys.logTimeoutQueueLength(), // To update folder structure
},
{
caption: "Updates the program",
edit: ts.noop,
timeouts: sys => {
sys.runQueuedTimeoutCallbacks();
sys.checkTimeoutQueueLength(2); // To Update program and failed lookup update
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // To Update program and failed lookup update
},
{
caption: "Invalidates module resolution cache",
edit: ts.noop,
timeouts: sys => {
sys.runQueuedTimeoutCallbacks();
sys.checkTimeoutQueueLength(1); // To Update program
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // To Update program
},
{
caption: "Pending updates",
edit: ts.noop,
timeouts: sys => {
sys.runQueuedTimeoutCallbacks();
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
],
});
@@ -347,17 +334,17 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po
{
caption: "Add new file, should schedule and run timeout to update directory watcher",
edit: sys => sys.writeFile(`/user/username/projects/myproject/src/file3.ts`, `export const y = 10;`),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1), // Update the child watch
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Update the child watch
},
{
caption: "Actual program update to include new file",
edit: ts.noop,
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2), // Scheduling failed lookup update and program update
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Scheduling failed lookup update and program update
},
{
caption: "After program emit with new file, should schedule and run timeout to update directory watcher",
edit: ts.noop,
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1), // Update the child watch
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // Update the child watch
},
noopChange,
],
@@ -388,19 +375,16 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po
{
caption: "rename the file",
edit: sys => sys.renameFile(`/user/username/projects/myproject/src/file2.ts`, `/user/username/projects/myproject/src/renamed.ts`),
timeouts: sys => {
sys.checkTimeoutQueueLength(2); // 1. For updating program and 2. for updating child watches
sys.runQueuedTimeoutCallbacks(1); // Update program
},
// 1. For updating program and 2. for updating child watches
timeouts: sys => sys.runQueuedTimeoutCallbacks(1), // Update program
},
{
caption: "Pending directory watchers and program update",
edit: ts.noop,
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1); // To update directory watchers
sys.checkTimeoutQueueLengthAndRun(2); // To Update program and failed lookup update
sys.checkTimeoutQueueLengthAndRun(1); // Actual program update
sys.checkTimeoutQueueLength(0);
sys.runQueuedTimeoutCallbacks(); // To update directory watchers
sys.runQueuedTimeoutCallbacks(); // To Update program and failed lookup update
sys.runQueuedTimeoutCallbacks(); // Actual program update
},
},
],
@@ -516,7 +500,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po
{
caption: "Change foo",
edit: sys => sys.replaceFileText(`/user/username/projects/myproject/node_modules/bar/foo.d.ts`, "foo", "fooBar"),
timeouts: sys => sys.checkTimeoutQueueLength(0),
timeouts: sys => sys.logTimeoutQueueLength(),
}
]
});
@@ -530,7 +514,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po
{
caption: "delete fooBar",
edit: sys => sys.deleteFile(`/user/username/projects/myproject/node_modules/bar/fooBar.d.ts`),
timeouts: sys => sys.checkTimeoutQueueLength(0), }
timeouts: sys => sys.logTimeoutQueueLength(), }
]
});
@@ -543,15 +527,12 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po
{
caption: "Directory watch updates because of main.js creation",
edit: ts.noop,
timeouts: sys => {
sys.checkTimeoutQueueLengthAndRun(1); // To update directory callbacks for main.js output
sys.checkTimeoutQueueLength(0);
},
timeouts: sys => sys.runQueuedTimeoutCallbacks(), // To update directory callbacks for main.js output
},
{
caption: "add new folder to temp",
edit: sys => sys.ensureFileOrFolder({ path: `/user/username/projects/myproject/node_modules/bar/temp/fooBar/index.d.ts`, content: "export function temp(): string;" }),
timeouts: sys => sys.checkTimeoutQueueLength(0),
timeouts: sys => sys.logTimeoutQueueLength(),
}
]
});
@@ -587,12 +568,12 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po
invokeFileDeleteCreateAsPartInsteadOfChange: true,
ignoreDelete: true,
}),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Replace file with rename event that fixes error",
edit: sys => sys.modifyFile(`/user/username/projects/myproject/foo.ts`, `export declare function foo(): string;`, { invokeFileDeleteCreateAsPartInsteadOfChange: true, }),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
]
});
@@ -618,12 +599,12 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po
{
caption: "Replace file with rename event that introduces error",
edit: sys => sys.modifyFile(`/user/username/projects/myproject/foo.d.ts`, `export function foo2(): string;`, { invokeFileDeleteCreateAsPartInsteadOfChange: true }),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Replace file with rename event that fixes error",
edit: sys => sys.modifyFile(`/user/username/projects/myproject/foo.d.ts`, `export function foo(): string;`, { invokeFileDeleteCreateAsPartInsteadOfChange: true }),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
]
});
@@ -648,12 +629,12 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po
{
caption: "Replace file with rename event that introduces error",
edit: sys => sys.modifyFile(`/user/username/projects/myproject/foo.d.ts`, `export function foo2(): string;`, { invokeFileDeleteCreateAsPartInsteadOfChange: true, useTildeAsSuffixInRenameEventFileName: true }),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Replace file with rename event that fixes error",
edit: sys => sys.modifyFile(`/user/username/projects/myproject/foo.d.ts`, `export function foo(): string;`, { invokeFileDeleteCreateAsPartInsteadOfChange: true, useTildeAsSuffixInRenameEventFileName: true }),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(2),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
]
});
@@ -687,12 +668,12 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po
ignoreDelete: true,
skipInodeCheckOnCreate: true
}),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
{
caption: "Replace file with rename event that fixes error",
edit: sys => sys.modifyFile(`/user/username/projects/myproject/foo.ts`, `export declare function foo(): string;`, { invokeFileDeleteCreateAsPartInsteadOfChange: true, }),
timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1),
timeouts: sys => sys.runQueuedTimeoutCallbacks(),
},
]
});
File diff suppressed because one or more lines are too long
@@ -87,7 +87,7 @@ describe("unittests:: tsserver:: cancellationToken", () => {
arguments: { files: ["/a/missing"], delay: 0 }
});
// Queued files
host.checkTimeoutQueueLengthAndRun(1);
host.runQueuedTimeoutCallbacks();
// Completed event since file is missing
}
{
@@ -133,7 +133,7 @@ describe("unittests:: tsserver:: cancellationToken", () => {
host.runQueuedTimeoutCallbacks();
// the semanticDiag message
host.runQueuedImmediateCallbacks();
host.runQueuedImmediateCallbacks(1);
host.runQueuedImmediateCallbacks();
cancellationToken.resetToken();
}
{
@@ -112,11 +112,11 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => {
// Add a tsconfig file
host.writeFile(configFile.path, configFile.content);
host.checkTimeoutQueueLengthAndRun(2); // load configured project from disk + ensureProjectsForOpenFiles
host.runQueuedTimeoutCallbacks(); // load configured project from disk + ensureProjectsForOpenFiles
// remove the tsconfig file
host.deleteFile(configFile.path);
host.checkTimeoutQueueLengthAndRun(1); // Refresh inferred projects
host.runQueuedTimeoutCallbacks(); // Refresh inferred projects
baselineTsserverLogs("configuredProjects", "add and then remove a config file in a folder with loose files", projectService);
});
@@ -132,7 +132,7 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => {
// add a new ts file
host.writeFile(commonFile2.path, commonFile2.content);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("configuredProjects", "add new files to a configured project without file list", projectService);
});
@@ -165,11 +165,11 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => {
// delete commonFile2
host.deleteFile(commonFile2.path);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
// re-add commonFile2
host.writeFile(commonFile2.path, commonFile2.content);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("configuredProjects", "handle recreated files correctly", projectService);
});
@@ -234,7 +234,7 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => {
},
"files": ["${file1.path}"]
}`);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
// will not remove project 1
logInferredProjectsOrphanStatus(projectService);
@@ -371,7 +371,7 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => {
projectService.openClientFile(file3.path);
host.writeFile(configFile.path, configFile.content);
host.checkTimeoutQueueLengthAndRun(2); // load configured project from disk + ensureProjectsForOpenFiles
host.runQueuedTimeoutCallbacks(); // load configured project from disk + ensureProjectsForOpenFiles
logInferredProjectsOrphanStatus(projectService);
baselineTsserverLogs("configuredProjects", "open file become a part of configured project if it is referenced from root file", projectService);
});
@@ -397,7 +397,7 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => {
host.writeFile(file2.path, file2.content);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("configuredProjects", "can correctly update configured project when set of root files has changed (new file on disk)", projectService);
});
@@ -423,7 +423,7 @@ describe("unittests:: tsserver:: ConfiguredProjects", () => {
host.writeFile(configFile.path, JSON.stringify({ compilerOptions: {}, files: ["f1.ts", "f2.ts"] }));
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("configuredProjects", "can correctly update configured project when set of root files has changed (new file in list of files)", projectService);
});
@@ -697,7 +697,7 @@ declare var console: {
const host = createServerHost([barConfig, barIndex, fooConfig, fooIndex, barSymLink, lib2017, libDom]);
const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) });
openFilesForSession([fooIndex, barIndex], session);
verifyGetErrRequest({ session, host, files: [barIndex, fooIndex] });
verifyGetErrRequest({ session, files: [barIndex, fooIndex] });
baselineTsserverLogs("configuredProjects", "when multiple projects are open detects correct default project", session);
});
@@ -780,11 +780,10 @@ declare var console: {
}
verifyGetErrRequest({
session,
host,
files: errorOnNewFileBeforeOldFile ?
[fooBar, foo] :
[foo, fooBar],
existingTimeouts: withExclude ? 0 : 2
existingTimeouts: !withExclude
});
baselineTsserverLogs("configuredProjects", `creating new file and then open it ${openFileBeforeCreating ? "before" : "after"} watcher is invoked, ask errors on it ${errorOnNewFileBeforeOldFile ? "before" : "after"} old one${withExclude ? " without file being in config" : ""}`, session);
}
@@ -929,7 +928,7 @@ foo();`
strict: true
}
}));
host.checkTimeoutQueueLengthAndRun(3);
host.runQueuedTimeoutCallbacks();
host.writeFile(bravoExtendedConfig.path, JSON.stringify({
extends: "./alpha.tsconfig.json",
@@ -937,15 +936,15 @@ foo();`
strict: false
}
}));
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
host.writeFile(bConfig.path, JSON.stringify({
extends: "../extended/alpha.tsconfig.json",
}));
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
host.writeFile(alphaExtendedConfig.path, "{}");
host.checkTimeoutQueueLengthAndRun(3);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("configuredProjects", "should watch the extended configs of multiple projects", projectService);
});
@@ -81,7 +81,7 @@ describe("unittests:: tsserver:: dynamicFiles:: Untitled files", () => {
content: "const x = 10;"
};
host.writeFile(untitled.path, untitled.content);
host.checkTimeoutQueueLength(0);
service.testhost.logTimeoutQueueLength();
service.openClientFile(untitled.path, untitled.content, /*scriptKind*/ undefined, "/user/username/projects/myproject");
service.closeClientFile(untitledFile);
@@ -40,7 +40,7 @@ describe("unittests:: tsserver:: events:: ProjectLanguageServiceStateEvent", ()
session.logger.log(`Language service enabled: ${session.getProjectService().configuredProjects.get(config.path)!.languageServiceEnabled}`);
host.writeFile(configWithExclude.path, configWithExclude.content);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
session.logger.log(`Language service enabled: ${session.getProjectService().configuredProjects.get(config.path)!.languageServiceEnabled}`);
baselineTsserverLogs("events/projectLanguageServiceState", "language service disabled events are triggered", session);
});
@@ -54,7 +54,7 @@ describe("unittests:: tsserver:: events:: ProjectLoadingStart and ProjectLoading
openFilesForSession([aTs], session);
host.writeFile(configA.path, configA.content);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("events/projectLoading", `change is detected in the config file ${sessionType}`, session);
});
@@ -74,7 +74,7 @@ describe("unittests:: tsserver:: events:: ProjectLoadingStart and ProjectLoading
openFilesForSession([bTs], session);
host.writeFile(configA.path, configA.content);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("events/projectLoading", `change is detected in an extended config file ${sessionType}`, session);
});
@@ -379,7 +379,7 @@ describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => {
file3.content += "export class d {}";
host.writeFile(file3.path, file3.content);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
host.writeFile(file2.path, file2.content);
host.runQueuedTimeoutCallbacks(); // For invalidation
@@ -634,7 +634,7 @@ describe("unittests:: tsserver:: externalProjects", () => {
projectService.openClientFile(app.path);
host.writeFile(config2.path, config2.content);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("externalProjects", "correctly handles changes in lib section of config file", projectService);
});
@@ -77,7 +77,7 @@ describe("unittests:: tsserver:: forceConsistentCasingInFileNames", () => {
const host = createServerHost([loggerFile, anotherFile, tsconfig, libFile, tsconfig]);
const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) });
openFilesForSession([{ file: loggerFile, projectRootPath: "/user/username/projects/myproject" }], session);
verifyGetErrRequest({ session, host, files: [loggerFile] });
verifyGetErrRequest({ session, files: [loggerFile] });
const newLoggerPath = loggerFile.path.toLowerCase();
host.renameFile(loggerFile.path, newLoggerPath);
@@ -103,7 +103,7 @@ describe("unittests:: tsserver:: forceConsistentCasingInFileNames", () => {
});
// Check errors in both files
verifyGetErrRequest({ session, host, files: [newLoggerPath, anotherFile] });
verifyGetErrRequest({ session, files: [newLoggerPath, anotherFile] });
baselineTsserverLogs("forceConsistentCasingInFileNames", "works when renaming file with different casing", session);
});
@@ -126,7 +126,7 @@ describe("unittests:: tsserver:: forceConsistentCasingInFileNames", () => {
const host = createServerHost([loggerFile, anotherFile, tsconfig, libFile, tsconfig]);
const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) });
openFilesForSession([{ file: anotherFile, projectRootPath: "/user/username/projects/myproject" }], session);
verifyGetErrRequest({ session, host, files: [anotherFile] });
verifyGetErrRequest({ session, files: [anotherFile] });
session.executeCommandSeq<ts.server.protocol.UpdateOpenRequest>({
command: ts.server.protocol.CommandTypes.UpdateOpen,
@@ -145,7 +145,7 @@ describe("unittests:: tsserver:: forceConsistentCasingInFileNames", () => {
});
// Check errors in both files
verifyGetErrRequest({ host, session, files: [anotherFile] });
verifyGetErrRequest({ session, files: [anotherFile] });
baselineTsserverLogs("forceConsistentCasingInFileNames", "when changing module name with different casing", session);
});
});
+30 -39
View File
@@ -384,6 +384,7 @@ export function toExternalFiles(fileNames: string[]) {
export type TestSessionAndServiceHost = TestServerHostTrackingWrittenFiles & {
patched: boolean;
baselineHost(title: string): void;
logTimeoutQueueLength(): void;
};
function patchHostTimeouts(
inputHost: TestServerHostTrackingWrittenFiles,
@@ -391,50 +392,47 @@ function patchHostTimeouts(
) {
const host = inputHost as TestSessionAndServiceHost;
if (host.patched) return host;
const originalCheckTimeoutQueueLength = host.checkTimeoutQueueLength;
host.patched = true;
if (!logger.hasLevel(ts.server.LogLevel.verbose)) {
host.logTimeoutQueueLength = ts.notImplemented;
host.baselineHost = ts.notImplemented;
return host;
}
const originalRunQueuedTimeoutCallbacks = host.runQueuedTimeoutCallbacks;
const originalRunQueuedImmediateCallbacks = host.runQueuedImmediateCallbacks;
let hostDiff: ReturnType<TestServerHost["snap"]> | undefined;
host.checkTimeoutQueueLengthAndRun = checkTimeoutQueueLengthAndRun;
host.checkTimeoutQueueLength = checkTimeoutQueueLength;
host.runQueuedTimeoutCallbacks = runQueuedTimeoutCallbacks;
host.runQueuedImmediateCallbacks = runQueuedImmediateCallbacks;
host.logTimeoutQueueLength = logTimeoutQueueLength;
host.baselineHost = baselineHost;
host.patched = true;
return host;
function checkTimeoutQueueLengthAndRun(expected: number) {
host.baselineHost(`Before checking timeout queue length (${expected}) and running`);
originalCheckTimeoutQueueLength.call(host, expected);
originalRunQueuedTimeoutCallbacks.call(host);
host.baselineHost(`After checking timeout queue length (${expected}) and running`);
}
function checkTimeoutQueueLength(expected: number) {
host.baselineHost(`Checking timeout queue length: ${expected}`);
originalCheckTimeoutQueueLength.call(host, expected);
function logTimeoutQueueLength() {
logger.log(host.timeoutCallbacks.log());
host.baselineHost(host.immediateCallbacks.log());
}
function runQueuedTimeoutCallbacks(timeoutId?: number) {
host.baselineHost(`Before running timeout callback${timeoutId === undefined ? "s" : timeoutId}`);
host.baselineHost(`Before running ${host.timeoutCallbacks.log()}`);
if (timeoutId !== undefined) logger.log(`Invoking ${host.timeoutCallbacks.callbackType} callback:: timeoutId:: ${timeoutId}:: ${host.timeoutCallbacks.map[timeoutId].args[0]}`);
originalRunQueuedTimeoutCallbacks.call(host, timeoutId);
host.baselineHost(`After running timeout callback${timeoutId === undefined ? "s" : timeoutId}`);
host.baselineHost(`After running ${host.timeoutCallbacks.log()}`);
}
function runQueuedImmediateCallbacks(checkCount?: number) {
host.baselineHost(`Before running immediate callbacks${checkCount === undefined ? "" : ` and checking length (${checkCount})`}`);
originalRunQueuedImmediateCallbacks.call(host, checkCount);
host.baselineHost(`After running immediate callbacks${checkCount === undefined ? "" : ` and checking length (${checkCount})`}`);
function runQueuedImmediateCallbacks() {
host.baselineHost(`Before running ${host.immediateCallbacks.log()}`);
originalRunQueuedImmediateCallbacks.call(host);
host.baselineHost(`After running ${host.immediateCallbacks.log()}`);
}
function baselineHost(title: string) {
if (!logger.hasLevel(ts.server.LogLevel.verbose)) return;
logger.log(title);
const logs = logger.logs || [];
host.diff(logs, hostDiff);
host.serializeWatches(logs);
if (!logger.logs) logs.forEach(log => logger.log(log));
ts.Debug.assertIsDefined(logger.logs);
host.diff(logger.logs, hostDiff);
host.serializeWatches(logger.logs);
hostDiff = host.snap();
host.writtenFiles.clear();
}
@@ -574,7 +572,7 @@ export class TestProjectService extends ts.server.ProjectService {
changeToHostTrackingWrittenFiles(this.host as TestServerHost),
this.logger
);
this.testhost.baselineHost("Creating project service");
if (logger.hasLevel(ts.server.LogLevel.verbose)) this.testhost.baselineHost("Creating project service");
}
}
@@ -739,8 +737,7 @@ export function logDiagnostics(sessionOrService: TestSession | TestProjectServic
}
export interface VerifyGetErrRequestBase {
session: TestSession;
host: TestServerHost;
existingTimeouts?: number;
existingTimeouts?: boolean;
}
export interface VerifyGetErrRequest extends VerifyGetErrRequestBase {
files: readonly (string | File)[];
@@ -760,18 +757,12 @@ export interface CheckAllErrors extends VerifyGetErrRequestBase {
files: readonly any[];
skip?: readonly (SkipErrors | undefined)[];
}
function checkAllErrors({ session, host, existingTimeouts, files, skip }: CheckAllErrors) {
function checkAllErrors({ session, existingTimeouts, files, skip }: CheckAllErrors) {
ts.Debug.assert(session.logger.logs?.length);
for (let i = 0; i < files.length; i++) {
if (existingTimeouts !== undefined) {
host.checkTimeoutQueueLength(existingTimeouts + 1);
host.runQueuedTimeoutCallbacks(host.getNextTimeoutId() - 1);
}
else {
host.checkTimeoutQueueLengthAndRun(1);
}
if (!skip?.[i]?.semantic) host.runQueuedImmediateCallbacks(1);
if (!skip?.[i]?.suggestion) host.runQueuedImmediateCallbacks(1);
session.testhost.runQueuedTimeoutCallbacks(existingTimeouts ? session.testhost.getNextTimeoutId() - 1 : undefined);
if (!skip?.[i]?.semantic) session.testhost.runQueuedImmediateCallbacks();
if (!skip?.[i]?.suggestion) session.testhost.runQueuedImmediateCallbacks();
}
}
@@ -785,7 +776,7 @@ function verifyErrorsUsingGeterr({scenario, subScenario, allFiles, openFiles, ge
const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) });
openFilesForSession(openFiles(), session);
verifyGetErrRequest({ session, host, files: getErrRequest() });
verifyGetErrRequest({ session, files: getErrRequest() });
baselineTsserverLogs(scenario, `${subScenario} getErr`, session);
});
}
@@ -801,7 +792,7 @@ function verifyErrorsUsingGeterrForProject({ scenario, subScenario, allFiles, op
command: ts.server.protocol.CommandTypes.GeterrForProject,
arguments: { delay: 0, file: filePath(expected.project) }
});
checkAllErrors({ session, host, files: expected.files });
checkAllErrors({ session, files: expected.files });
}
baselineTsserverLogs(scenario, `${subScenario} geterrForProject`, session);
});
@@ -35,7 +35,7 @@ describe("unittests:: tsserver:: inconsistentErrorInEditor", () => {
format: "2020"
}
});
verifyGetErrRequest({ session, host, files: ["^/untitled/ts-nul-authority/Untitled-1"] });
verifyGetErrRequest({ session, files: ["^/untitled/ts-nul-authority/Untitled-1"] });
baselineTsserverLogs("inconsistentErrorInEditor", "should not error", session);
});
});
@@ -67,7 +67,7 @@ describe("unittests:: tsserver:: inconsistentErrorInEditor2", () => {
format: "2020"
}
});
verifyGetErrRequest({ session, host, files: ["^/untitled/ts-nul-authority/Untitled-1"] });
verifyGetErrRequest({ session, files: ["^/untitled/ts-nul-authority/Untitled-1"] });
baselineTsserverLogs("inconsistentErrorInEditor2", "should not error", session);
});
});
@@ -67,7 +67,7 @@ describe("unittests:: tsserver:: inferredProjects", () => {
projectService.openClientFile(file3.path);
host.writeFile(configFile.path, configFile.content);
host.checkTimeoutQueueLengthAndRun(2); // load configured project from disk + ensureProjectsForOpenFiles
host.runQueuedTimeoutCallbacks(); // load configured project from disk + ensureProjectsForOpenFiles
baselineTsserverLogs("inferredProjects", "should use only one inferred project if useOneInferredProject is set", projectService);
});
@@ -101,7 +101,7 @@ describe("unittests:: tsserver:: inferredProjects", () => {
projectService.openClientFile(file1.path);
projectService.openClientFile(modFile.path);
projectService.setCompilerOptionsForInferredProjects({ moduleResolution: ts.ModuleResolutionKind.Classic });
host.checkTimeoutQueueLengthAndRun(3);
host.runQueuedTimeoutCallbacks();
logInferredProjectsOrphanStatus(projectService);
baselineTsserverLogs("inferredProjects", "project settings for inferred projects", projectService);
});
@@ -286,7 +286,7 @@ describe("unittests:: tsserver:: inferredProjects", () => {
allowJs: true,
target: ts.ScriptTarget.ES2015
}, session);
host.checkTimeoutQueueLength(0);
session.testhost.logTimeoutQueueLength();
baselineTsserverLogs("inferredProjects", "Setting compiler options for inferred projects when there are no open files should not schedule any refresh", session);
});
});
@@ -49,7 +49,7 @@ describe("unittests:: tsserver:: moduleResolution", () => {
openFilesForSession([fileA], session);
return {
host, session, packageFile,
verifyErr: () => verifyGetErrRequest({ files: [fileA], session, host }),
verifyErr: () => verifyGetErrRequest({ files: [fileA], session }),
};
}
it("package json file is edited", () => {
@@ -153,7 +153,7 @@ bar();`
const host = createServerHost([file, libFile]);
const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) });
openFilesForSession([file], session);
verifyGetErrRequest({ session, host, files: [file] });
verifyGetErrRequest({ session, files: [file] });
// Remove first ts-ignore and check only first error is reported
const tsIgnoreComment = `// @ts-ignore`;
@@ -170,7 +170,7 @@ bar();`
}]
}
});
verifyGetErrRequest({ session, host, files: [file] });
verifyGetErrRequest({ session, files: [file] });
// Revert the change and no errors should be reported
session.executeCommandSeq<ts.server.protocol.UpdateOpenRequest>({
command: ts.server.protocol.CommandTypes.UpdateOpen,
@@ -184,7 +184,7 @@ bar();`
}]
}
});
verifyGetErrRequest({ session, host, files: [file] });
verifyGetErrRequest({ session, files: [file] });
baselineTsserverLogs("openfile", "when file makes edits to add/remove comment directives, they are handled correcrly", session);
});
@@ -127,7 +127,7 @@ import { something } from "something";
assert.isTrue(diagnostics.length === 1);
assert.equal(diagnostics[0].messageText, expectedErrorMessage);
verifyGetErrRequest({ session, host, files: [file1], skip: [{ semantic: true, suggestion: true }] });
verifyGetErrRequest({ session, files: [file1], skip: [{ semantic: true, suggestion: true }] });
baselineTsserverLogs("partialSemanticServer", "syntactic diagnostics are returned with no error", session);
});
@@ -243,8 +243,7 @@ describe("unittests:: tsserver:: projectErrors:: are reported as appropriate", (
appendAllScriptInfos(session);
// Since this is not js project so no typings are queued
host.checkTimeoutQueueLength(0);
verifyGetErrRequest({ session, host, files: [untitledFile] });
verifyGetErrRequest({ session, files: [untitledFile] });
baselineTsserverLogs("projectErrors", `when opening new file that doesnt exist on disk yet ${useProjectRoot ? "with projectRoot" : "without projectRoot"}`, session);
}
@@ -278,12 +277,12 @@ describe("unittests:: tsserver:: projectErrors:: are reported as appropriate", (
command: ts.server.protocol.CommandTypes.Open,
arguments: { file: app.path, }
});
verifyGetErrRequest({ session, host, files: [app] });
verifyGetErrRequest({ session, files: [app] });
host.renameFolder(`${projectDir}/foo`, `${projectDir}/foo2`);
host.runQueuedTimeoutCallbacks();
host.runQueuedTimeoutCallbacks();
verifyGetErrRequest({ session, host, files: [app] });
verifyGetErrRequest({ session, files: [app] });
baselineTsserverLogs("projectErrors", `folder rename updates project structure and reports no errors`, session);
});
@@ -302,7 +301,7 @@ describe("unittests:: tsserver:: projectErrors:: are reported as appropriate", (
}
});
host.checkTimeoutQueueLengthAndRun(1);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("projectErrors", "getting errors before opening file", session);
});
@@ -324,10 +323,10 @@ describe("unittests:: tsserver:: projectErrors:: are reported as appropriate", (
const session = createSession(host, { useInferredProjectPerProjectRoot: true, canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) });
openFilesForSession([{ file: app, projectRootPath: "/user/username/projects/myproject" }], session);
openFilesForSession([{ file: backendTest, projectRootPath: "/user/username/projects/myproject" }], session);
verifyGetErrRequest({ session, host, files: [backendTest.path, app.path] });
verifyGetErrRequest({ session, files: [backendTest.path, app.path] });
closeFilesForSession([backendTest], session);
openFilesForSession([{ file: serverUtilities.path, projectRootPath: "/user/username/projects/myproject" }], session);
verifyGetErrRequest({ session, host, files: [serverUtilities.path, app.path] });
verifyGetErrRequest({ session, files: [serverUtilities.path, app.path] });
baselineTsserverLogs("projectErrors", `reports errors correctly when file referenced by inferred project root, is opened right after closing the root file`, session);
});
@@ -362,7 +361,7 @@ declare module '@custom/plugin' {
const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) });
openFilesForSession([aFile], session);
checkErrors();
verifyGetErrRequest({ session, files: [aFile] });
session.executeCommandSeq<ts.server.protocol.ChangeRequest>({
command: ts.server.protocol.CommandTypes.Change,
@@ -375,13 +374,8 @@ declare module '@custom/plugin' {
insertString: "o"
}
});
checkErrors();
verifyGetErrRequest({ session, files: [aFile] });
baselineTsserverLogs("projectErrors", `correct errors when resolution resolves to file that has same ambient module and is also module`, session);
function checkErrors() {
host.checkTimeoutQueueLength(0);
verifyGetErrRequest({ session, host, files: [aFile] });
}
});
describe("when semantic error returns includes global error", () => {
@@ -728,18 +722,18 @@ console.log(blabla);`
}
it("should not report incorrect error when json is root file found by tsconfig", () => {
const { host, session, test } = createSessionForTest({
const { session, test } = createSessionForTest({
include: ["./src/*.ts", "./src/*.json"]
});
verifyGetErrRequest({ session, host, files: [test] });
verifyGetErrRequest({ session, files: [test] });
baselineTsserverLogs("projectErrors", `should not report incorrect error when json is root file found by tsconfig`, session);
});
it("should report error when json is not root file found by tsconfig", () => {
const { host, session, test } = createSessionForTest({
const { session, test } = createSessionForTest({
include: ["./src/*.ts"]
});
verifyGetErrRequest({ session, host, files: [test] });
verifyGetErrRequest({ session, files: [test] });
baselineTsserverLogs("projectErrors", `should report error when json is not root file found by tsconfig`, session);
});
});
@@ -763,7 +757,7 @@ describe("unittests:: tsserver:: projectErrors:: with npm install when", () => {
const host = createServerHost(projectFiles);
const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) });
openFilesForSession([{ file: main, projectRootPath: "/user/username/projects/myproject" }], session);
verifyGetErrRequest({ session, host, files: [main] });
verifyGetErrRequest({ session, files: [main] });
let npmInstallComplete = false;
@@ -775,7 +769,7 @@ describe("unittests:: tsserver:: projectErrors:: with npm install when", () => {
{ path: `/user/username/projects/myproject/node_modules/.staging/@babel/helper-plugin-utils-a06c629f` },
{ path: `/user/username/projects/myproject/node_modules/.staging/core-js-db53158d` },
];
verifyWhileNpmInstall(3);
verifyWhileNpmInstall();
filesAndFoldersToAdd = [
{ path: `/user/username/projects/myproject/node_modules/.staging/@angular/platform-browser-dynamic-5efaaa1a` },
@@ -783,34 +777,32 @@ describe("unittests:: tsserver:: projectErrors:: with npm install when", () => {
{ path: `/user/username/projects/myproject/node_modules/.staging/@angular/core-0963aebf/index.d.ts`, content: `export const y = 10;` },
];
// Since we added/removed in .staging no timeout
verifyWhileNpmInstall(0);
verifyWhileNpmInstall();
filesAndFoldersToAdd = [];
host.ensureFileOrFolder(moduleFile, /*ignoreWatchInvokedWithTriggerAsFileCreate*/ true, /*ignoreParentWatch*/ true);
// Since we added/removed in .staging no timeout
verifyWhileNpmInstall(0);
verifyWhileNpmInstall();
// Remove staging folder to remove errors
host.deleteFolder(`/user/username/projects/myproject/node_modules/.staging`, /*recursive*/ true);
npmInstallComplete = true;
projectFiles.push(moduleFile);
// Additional watch for watching script infos from node_modules
verifyWhileNpmInstall(3);
verifyWhileNpmInstall();
baselineTsserverLogs("projectErrors", `npm install when timeout occurs ${timeoutDuringPartialInstallation ? "inbetween" : "after"} installation`, session);
function verifyWhileNpmInstall(timeouts: number) {
function verifyWhileNpmInstall() {
filesAndFoldersToAdd.forEach(f => host.ensureFileOrFolder(f));
if (npmInstallComplete || timeoutDuringPartialInstallation) {
host.checkTimeoutQueueLengthAndRun(timeouts); // Invalidation of failed lookups
if (timeouts) {
host.checkTimeoutQueueLengthAndRun(timeouts - 1); // Actual update
}
host.runQueuedTimeoutCallbacks(); // Invalidation of failed lookups
host.runQueuedTimeoutCallbacks(); // Actual update
}
else {
host.checkTimeoutQueueLength(timeouts ? 3 : 2);
session.testhost.logTimeoutQueueLength();
}
verifyGetErrRequest({ session, host, files: [main], existingTimeouts: !npmInstallComplete && !timeoutDuringPartialInstallation ? timeouts ? 3 : 2 : undefined });
verifyGetErrRequest({ session, files: [main], existingTimeouts: !npmInstallComplete && !timeoutDuringPartialInstallation });
}
}
@@ -309,7 +309,7 @@ function foo() {
// Create symlink in node module
const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) });
openFilesForSession([aTest], session);
verifyGetErrRequest({ session, host, files: [aTest] });
verifyGetErrRequest({ session, files: [aTest] });
session.executeCommandSeq<ts.server.protocol.UpdateOpenRequest>({
command: ts.server.protocol.CommandTypes.UpdateOpen,
arguments: {
@@ -323,7 +323,7 @@ function foo() {
}]
}
});
verifyGetErrRequest({ session, host, files: [aTest] });
verifyGetErrRequest({ session, files: [aTest] });
baselineTsserverLogs("projectReferences", `monorepo like with symlinks ${scenario} and solution is ${alreadyBuilt ? "built" : "not built"}${extraOptions.preserveSymlinks ? " with preserveSymlinks" : ""}`, session);
}
@@ -460,7 +460,7 @@ testCompositeFunction('why hello there', 42);`
const host = createServerHost([libFile, compositeConfig, compositePackageJson, compositeIndex, compositeTestModule, consumerConfig, consumerIndex, symlink], { useCaseSensitiveFileNames: true });
const session = createSession(host, { canUseEvents: true, logger: createLoggerWithInMemoryLogs(host) });
openFilesForSession([consumerIndex], session);
verifyGetErrRequest({ host, session, files: [consumerIndex] });
verifyGetErrRequest({ session, files: [consumerIndex] });
baselineTsserverLogs("projectReferences", `when the referenced projects have allowJs and emitDeclarationOnly`, session);
});
@@ -942,7 +942,7 @@ export function bar() {}`
}
function verifySolutionScenario(input: Setup) {
const { session, service, host } = setup(input);
const { session, service } = setup(input);
const info = service.getScriptInfoForPath(main.path as ts.Path)!;
session.logger.startGroup();
@@ -951,7 +951,7 @@ export function bar() {}`
session.logger.endGroup();
// Verify errors
verifyGetErrRequest({ session, host, files: [main] });
verifyGetErrRequest({ session, files: [main] });
// Verify collection of script infos
service.openClientFile(dummyFilePath);
@@ -1223,16 +1223,16 @@ bar;`
// Add new class to referenced project
const class3 = `/user/username/projects/myproject/projects/project1/class3.ts`;
host.writeFile(class3, `class class3 {}`);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
// Add excluded file to referenced project
host.ensureFileOrFolder({ path: `/user/username/projects/myproject/projects/project1/temp/file.d.ts`, content: `declare class file {}` });
host.checkTimeoutQueueLengthAndRun(0);
host.runQueuedTimeoutCallbacks();
// Add output from new class to referenced project
const class3Dts = `/user/username/projects/myproject/projects/project1/class3.d.ts`;
host.writeFile(class3Dts, `declare class class3 {}`);
host.checkTimeoutQueueLengthAndRun(0);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("projectReferences", `new file is added to the referenced project when referenced project is not open`, session);
});
@@ -1243,14 +1243,14 @@ bar;`
// Add new class to referenced project
const class3 = `/user/username/projects/myproject/projects/project1/class3.ts`;
host.writeFile(class3, `class class3 {}`);
host.checkTimeoutQueueLengthAndRun(3);
host.runQueuedTimeoutCallbacks();
// Add excluded file to referenced project
host.ensureFileOrFolder({ path: `/user/username/projects/myproject/projects/project1/temp/file.d.ts`, content: `declare class file {}` });
host.checkTimeoutQueueLengthAndRun(0);
host.runQueuedTimeoutCallbacks();
// Add output from new class to referenced project
const class3Dts = `/user/username/projects/myproject/projects/project1/class3.d.ts`;
host.writeFile(class3Dts, `declare class class3 {}`);
host.checkTimeoutQueueLengthAndRun(0);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("projectReferences", `new file is added to the referenced project when referenced project is open`, session);
});
@@ -1260,20 +1260,20 @@ bar;`
// Add new class to referenced project
const class3 = `/user/username/projects/myproject/projects/project1/class3.ts`;
host.writeFile(class3, `class class3 {}`);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
// Add output of new class to referenced project
const class3Dts = `/user/username/projects/myproject/projects/project1/class3.d.ts`;
host.writeFile(class3Dts, `declare class class3 {}`);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
// Add excluded file to referenced project
host.ensureFileOrFolder({ path: `/user/username/projects/myproject/projects/project1/temp/file.d.ts`, content: `declare class file {}` });
host.checkTimeoutQueueLengthAndRun(0);
host.runQueuedTimeoutCallbacks();
// Delete output from new class to referenced project
host.deleteFile(class3Dts);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
// Write back output of new class to referenced project
host.writeFile(class3Dts, `declare class class3 {}`);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("projectReferences", `new file is added to the referenced project when referenced project is not open with disableSourceOfProjectReferenceRedirect`, session);
});
@@ -1284,20 +1284,20 @@ bar;`
// Add new class to referenced project
const class3 = `/user/username/projects/myproject/projects/project1/class3.ts`;
host.writeFile(class3, `class class3 {}`);
host.checkTimeoutQueueLengthAndRun(3);
host.runQueuedTimeoutCallbacks();
// Add output of new class to referenced project
const class3Dts = `/user/username/projects/myproject/projects/project1/class3.d.ts`;
host.writeFile(class3Dts, `declare class class3 {}`);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
// Add excluded file to referenced project
host.ensureFileOrFolder({ path: `/user/username/projects/myproject/projects/project1/temp/file.d.ts`, content: `declare class file {}` });
host.checkTimeoutQueueLengthAndRun(0);
host.runQueuedTimeoutCallbacks();
// Delete output from new class to referenced project
host.deleteFile(class3Dts);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
// Write back output of new class to referenced project
host.writeFile(class3Dts, `declare class class3 {}`);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("projectReferences", `new file is added to the referenced project when referenced project is open with disableSourceOfProjectReferenceRedirect`, session);
});
});
+14 -14
View File
@@ -72,7 +72,7 @@ describe("unittests:: tsserver:: projects::", () => {
}`;
host.writeFile(configFile.path, configFile.content);
host.checkTimeoutQueueLengthAndRun(2); // Update the configured project + refresh inferred projects
host.runQueuedTimeoutCallbacks(); // Update the configured project + refresh inferred projects
openFilesForSession([commonFile2], session);
baselineTsserverLogs("projects", "should create new inferred projects for files excluded from a configured project", session);
@@ -282,7 +282,7 @@ describe("unittests:: tsserver:: projects::", () => {
projectService.openClientFile(file3.path);
host.writeFile(file2.path, `export * from "../c/f3"`); // now inferred project should inclule file3
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
logInferredProjectsOrphanStatus(projectService);
baselineTsserverLogs("projects", "changes in closed files are reflected in project structure", projectService);
});
@@ -307,7 +307,7 @@ describe("unittests:: tsserver:: projects::", () => {
projectService.openClientFile(file3.path);
host.deleteFile(file2.path);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("projects", "deleted files affect project structure", projectService);
});
@@ -384,7 +384,7 @@ describe("unittests:: tsserver:: projects::", () => {
unresolvedImports: response.unresolvedImports,
});
host.checkTimeoutQueueLength(0);
projectService.testhost.logTimeoutQueueLength();
assert.isUndefined(request);
baselineTsserverLogs("projects", "file with name constructor.js doesnt cause issue with typeAcquisition when safe type list", projectService);
});
@@ -553,7 +553,7 @@ describe("unittests:: tsserver:: projects::", () => {
projectService.openClientFile(file2.path);
host.deleteFile(config.path);
host.checkTimeoutQueueLengthAndRun(1);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("projects", "config file is deleted", projectService);
});
@@ -1155,7 +1155,7 @@ describe("unittests:: tsserver:: projects::", () => {
service.openClientFile(file1.path);
host.modifyFile(file1.path, file1.content, { invokeFileDeleteCreateAsPartInsteadOfChange: true });
host.checkTimeoutQueueLength(0);
service.testhost.logTimeoutQueueLength();
baselineTsserverLogs("projects", "no project structure update on directory watch invoke on open file save", service);
});
@@ -1326,43 +1326,43 @@ describe("unittests:: tsserver:: projects::", () => {
openFile(fileB);
openFile(fileSubA);
host.checkTimeoutQueueLengthAndRun(0);
host.runQueuedTimeoutCallbacks();
// This should schedule 2 timeouts for ensuring project structure and ensuring projects for open file
host.deleteFile(fileSubA.path);
host.deleteFolder(ts.getDirectoryPath(fileSubA.path));
host.writeFile(fileA.path, fileA.content);
host.checkTimeoutQueueLength(2);
session.testhost.logTimeoutQueueLength();
closeFilesForSession([fileSubA], session);
// This should cancel existing updates and schedule new ones
host.checkTimeoutQueueLength(2);
session.testhost.logTimeoutQueueLength();
// Open the fileA (as if rename)
// config project is updated to check if fileA is present in it
openFile(fileA);
// Run the timeout for updating configured project and ensuring projects for open file
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
// file is deleted but watches are not yet invoked
const originalFileExists = host.fileExists;
host.fileExists = s => s === fileA.path ? false : originalFileExists.call(host, s);
closeFilesForSession([fileA], session);
host.checkTimeoutQueueLength(2); // Update configured project and projects for open file
session.testhost.logTimeoutQueueLength(); // Update configured project and projects for open file
// This should create inferred project since fileSubA not on the disk
openFile(fileSubA);
host.checkTimeoutQueueLengthAndRun(2); // Update configured project and projects for open file
host.runQueuedTimeoutCallbacks(); // Update configured project and projects for open file
host.fileExists = originalFileExists;
// Actually trigger the file move
host.deleteFile(fileA.path);
host.ensureFileOrFolder(fileSubA);
host.checkTimeoutQueueLength(2);
session.testhost.logTimeoutQueueLength();
verifyGetErrRequest({ session, host, files: [fileB, fileSubA], existingTimeouts: 2 });
verifyGetErrRequest({ session, files: [fileB, fileSubA], existingTimeouts: true });
baselineTsserverLogs("projects", "handles delayed directory watch invoke on file creation", session);
function openFile(file: File) {
@@ -27,18 +27,18 @@ describe("unittests:: tsserver:: projects with references: invoking when referen
// local edit in ts file
host.appendFile(logicIndex.path, `function foo() {}`);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
// non local edit in ts file
host.appendFile(logicIndex.path, `export function gfoo() {}`);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
// change in project reference config file
host.writeFile(logicConfig.path, JSON.stringify({
compilerOptions: { composite: true, declaration: true, declarationDir: "decls" },
references: [{ path: "../core" }]
}));
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("projectsWithReferences", "sample project", service);
});
@@ -99,7 +99,7 @@ export class A {}`
// non local edit
host.appendFile(bTs.path, `export function gFoo() { }`);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("projectsWithReferences", "transitive references with non local edit", service);
});
@@ -113,11 +113,11 @@ export class A {}`
host.ensureFileOrFolder(nRefsTs);
cTsConfigJson.compilerOptions.paths = { "@ref/*": ["../nrefs/*"] };
host.writeFile(cConfig.path, JSON.stringify(cTsConfigJson));
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
// revert the edit on config file
host.writeFile(cConfig.path, cConfig.content);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("projectsWithReferences", "transitive references with edit on config file", service);
});
@@ -131,33 +131,33 @@ export class A {}`
host.ensureFileOrFolder(nRefsTs);
bTsConfigJson.compilerOptions.paths = { "@ref/*": ["../nrefs/*"] };
host.writeFile(bConfig.path, JSON.stringify(bTsConfigJson));
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
// revert the edit on config file
host.writeFile(bConfig.path, bConfig.content);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("projectsWithReferences", "transitive references with edit in referenced config file", service);
});
it("deleting referenced config file", () => {
const { host, service, bConfig } = createService();
host.deleteFile(bConfig.path);
host.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation
host.runQueuedTimeoutCallbacks(); // Schedules failed lookup invalidation
// revert
host.writeFile(bConfig.path, bConfig.content);
host.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation
host.runQueuedTimeoutCallbacks(); // Schedules failed lookup invalidation
baselineTsserverLogs("projectsWithReferences", "transitive references with deleting referenced config file", service);
});
it("deleting transitively referenced config file", () => {
const { host, service, aConfig } = createService();
host.deleteFile(aConfig.path);
host.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation
host.runQueuedTimeoutCallbacks(); // Schedules failed lookup invalidation
// revert
host.writeFile(aConfig.path, aConfig.content);
host.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation
host.runQueuedTimeoutCallbacks(); // Schedules failed lookup invalidation
baselineTsserverLogs("projectsWithReferences", "transitive references with deleting transitively referenced config file", service);
});
});
@@ -214,7 +214,7 @@ export class A {}`
// non local edit
host.appendFile(bTs.path, `export function gFoo() { }`);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("projectsWithReferences", "trasitive references without files with non local edit", service);
});
@@ -228,11 +228,11 @@ export class A {}`
host.ensureFileOrFolder(nRefsTs);
cTsConfigJson.compilerOptions.paths = { "@ref/*": ["../nrefs/*"] };
host.writeFile(cConfig.path, JSON.stringify(cTsConfigJson));
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
// revert the edit on config file
host.writeFile(cConfig.path, cConfig.content);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("projectsWithReferences", "trasitive references without files with edit on config file", service);
});
@@ -246,33 +246,33 @@ export class A {}`
host.ensureFileOrFolder(nRefsTs);
bTsConfigJson.compilerOptions.paths = { "@ref/*": ["../nrefs/*"] };
host.writeFile(bConfig.path, JSON.stringify(bTsConfigJson));
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
// revert the edit on config file
host.writeFile(bConfig.path, bConfig.content);
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("projectsWithReferences", "trasitive references without files with edit in referenced config file", service);
});
it("deleting referenced config file", () => {
const { host, service, bConfig } = createService();
host.deleteFile(bConfig.path);
host.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation
host.runQueuedTimeoutCallbacks(); // Schedules failed lookup invalidation
// revert
host.writeFile(bConfig.path, bConfig.content);
host.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation
host.runQueuedTimeoutCallbacks(); // Schedules failed lookup invalidation
baselineTsserverLogs("projectsWithReferences", "trasitive references without files with deleting referenced config file", service);
});
it("deleting transitively referenced config file", () => {
const { host, service, aConfig } = createService();
host.deleteFile(aConfig.path);
host.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation
host.runQueuedTimeoutCallbacks(); // Schedules failed lookup invalidation
// revert
host.writeFile(aConfig.path, aConfig.content);
host.checkTimeoutQueueLengthAndRun(3); // Schedules failed lookup invalidation
host.runQueuedTimeoutCallbacks(); // Schedules failed lookup invalidation
baselineTsserverLogs("projectsWithReferences", "trasitive references without files with deleting transitively referenced config file", service);
});
});
@@ -43,14 +43,14 @@ describe("unittests:: tsserver:: reloadProjects", () => {
const updatedText = `${file2.content}
bar();`;
host.writeFile(file2.path, updatedText);
host.checkTimeoutQueueLength(0);
session.testhost.logTimeoutQueueLength();
session.executeCommandSeq({
command: ts.server.protocol.CommandTypes.ReloadProjects
});
// delete file
host.deleteFile(file2.path);
host.checkTimeoutQueueLength(0);
session.testhost.logTimeoutQueueLength();
session.executeCommandSeq({
command: ts.server.protocol.CommandTypes.ReloadProjects
});
@@ -67,7 +67,7 @@ describe("unittests:: tsserver:: reloadProjects", () => {
// Install module1
host.ensureFileOrFolder(moduleFile);
host.checkTimeoutQueueLength(0);
session.testhost.logTimeoutQueueLength();
session.executeCommandSeq({
command: ts.server.protocol.CommandTypes.ReloadProjects
@@ -94,7 +94,7 @@ describe("unittests:: tsserver:: reloadProjects", () => {
// Install module1
host.ensureFileOrFolder(moduleFile);
host.checkTimeoutQueueLength(0);
session.testhost.logTimeoutQueueLength();
session.executeCommandSeq({
command: ts.server.protocol.CommandTypes.ReloadProjects
@@ -120,7 +120,7 @@ describe("unittests:: tsserver:: reloadProjects", () => {
// Install module1
host.ensureFileOrFolder(moduleFile);
host.checkTimeoutQueueLength(0);
session.testhost.logTimeoutQueueLength();
session.executeCommandSeq({
command: ts.server.protocol.CommandTypes.ReloadProjects
@@ -146,7 +146,7 @@ describe("unittests:: tsserver:: reloadProjects", () => {
// Install module1
host.ensureFileOrFolder(moduleFile);
host.checkTimeoutQueueLength(0);
session.testhost.logTimeoutQueueLength();
session.executeCommandSeq({
command: ts.server.protocol.CommandTypes.ReloadProjects
@@ -138,7 +138,7 @@ describe("unittests:: tsserver:: resolutionCache:: tsserverProjectSystem add the
}
});
verifyGetErrRequest({ session, host, files: [file1] });
verifyGetErrRequest({ session, files: [file1] });
const padIndex: File = {
path: `${folderPath}/node_modules/@types/pad/index.d.ts`,
@@ -166,8 +166,7 @@ describe("unittests:: tsserver:: resolutionCache:: tsserverProjectSystem add the
arguments: { file: file.path, fileContent: file.content },
});
host.checkTimeoutQueueLength(0);
verifyGetErrRequest({ session, host, files: [file] });
verifyGetErrRequest({ session, files: [file] });
baselineTsserverLogs("resolutionCache", `suggestion diagnostics`, session);
});
@@ -192,8 +191,7 @@ describe("unittests:: tsserver:: resolutionCache:: tsserverProjectSystem add the
},
});
host.checkTimeoutQueueLength(0);
verifyGetErrRequest({ session, host, files: [file], skip: [{ suggestion: true }] });
verifyGetErrRequest({ session, files: [file], skip: [{ suggestion: true }] });
baselineTsserverLogs("resolutionCache", `disable suggestion diagnostics`, session);
});
@@ -211,7 +209,7 @@ describe("unittests:: tsserver:: resolutionCache:: tsserverProjectSystem add the
arguments: { file: file.path, fileContent: file.content },
});
host.checkTimeoutQueueLength(0);
session.testhost.logTimeoutQueueLength();
session.executeCommandSeq<ts.server.protocol.GeterrRequest>({
command: ts.server.protocol.CommandTypes.Geterr,
arguments: {
@@ -220,7 +218,7 @@ describe("unittests:: tsserver:: resolutionCache:: tsserverProjectSystem add the
}
});
host.checkTimeoutQueueLength(0);
session.testhost.logTimeoutQueueLength();
session.executeCommandSeq<ts.server.protocol.GeterrForProjectRequest>({
command: ts.server.protocol.CommandTypes.GeterrForProject,
arguments: {
@@ -229,7 +227,7 @@ describe("unittests:: tsserver:: resolutionCache:: tsserverProjectSystem add the
}
});
host.checkTimeoutQueueLength(0);
session.testhost.logTimeoutQueueLength();
baselineTsserverLogs("resolutionCache", "suppressed diagnostic events", session);
});
});
@@ -585,10 +583,10 @@ export const x = 10;`
const host = createServerHost(files);
const service = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) });
service.openClientFile(file1.path);
host.checkTimeoutQueueLength(0);
service.testhost.logTimeoutQueueLength();
host.ensureFileOrFolder(npmCacheFile);
host.checkTimeoutQueueLength(0);
service.testhost.logTimeoutQueueLength();
baselineTsserverLogs("resolutionCache", "when watching node_modules in inferred project for failed lookup/closed script infos", service);
});
it("when watching node_modules as part of wild card directories in config project", () => {
@@ -600,10 +598,10 @@ export const x = 10;`
const host = createServerHost(files);
const service = createProjectService(host, { logger: createLoggerWithInMemoryLogs(host) });
service.openClientFile(file1.path);
host.checkTimeoutQueueLength(0);
service.testhost.logTimeoutQueueLength();
host.ensureFileOrFolder(npmCacheFile);
host.checkTimeoutQueueLength(0);
service.testhost.logTimeoutQueueLength();
baselineTsserverLogs("resolutionCache", "when watching node_modules as part of wild card directories in config project", service);
});
});
@@ -623,7 +621,7 @@ export const x = 10;`
// invoke callback to simulate saving
host.modifyFile(file1.path, file1.content, { invokeFileDeleteCreateAsPartInsteadOfChange: true });
host.checkTimeoutQueueLengthAndRun(0);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("resolutionCache", "avoid unnecessary lookup invalidation on save", service);
});
});
@@ -141,14 +141,14 @@ new C();`
it("when project compiles from sources", () => {
const host = createServerHost(filesWithSources);
const session = createSessionAndOpenFile(host);
verifyGetErrRequest({ session, host, files: [recognizersDateTimeSrcFile] });
verifyGetErrRequest({ session, files: [recognizersDateTimeSrcFile] });
host.ensureFileOrFolder(nodeModulesRecorgnizersText);
host.writeFile(recongnizerTextDistTypingFile.path, recongnizerTextDistTypingFile.content);
host.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions
host.runQueuedTimeoutCallbacks(); // Actual update
verifyGetErrRequest({ session, host, files: [recognizersDateTimeSrcFile] });
verifyGetErrRequest({ session, files: [recognizersDateTimeSrcFile] });
// Change config file's module resolution affecting option
const config = JSON.parse(host.readFile(recognizerDateTimeTsconfigPath)!);
@@ -165,13 +165,13 @@ new C();`
it("when project has node_modules setup but doesnt have modules in typings folder and then recompiles", () => {
const host = createServerHost([...filesWithSources, nodeModulesRecorgnizersText]);
const session = createSessionAndOpenFile(host);
verifyGetErrRequest({ session, host, files: [recognizersDateTimeSrcFile] });
verifyGetErrRequest({ session, files: [recognizersDateTimeSrcFile] });
host.writeFile(recongnizerTextDistTypingFile.path, recongnizerTextDistTypingFile.content);
host.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions
host.runQueuedTimeoutCallbacks(); // Actual update
verifyGetErrRequest({ session, host, files: [recognizersDateTimeSrcFile] });
verifyGetErrRequest({ session, files: [recognizersDateTimeSrcFile] });
baselineTsserverLogs("symLinks", `module resolution${withPathMapping ? " with path mapping" : ""} when project has node_modules setup but doesnt have modules in typings folder and then recompiles`, session);
});
@@ -179,19 +179,19 @@ new C();`
const host = createServerHost([...filesWithSources, nodeModulesRecorgnizersText, recongnizerTextDistTypingFile]);
const session = createSessionAndOpenFile(host);
verifyGetErrRequest({ session, host, files: [recognizersDateTimeSrcFile] });
verifyGetErrRequest({ session, files: [recognizersDateTimeSrcFile] });
host.deleteFolder(recognizersTextDist, /*recursive*/ true);
host.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions
host.runQueuedTimeoutCallbacks(); // Actual update
verifyGetErrRequest({ session, host, files: [recognizersDateTimeSrcFile] });
verifyGetErrRequest({ session, files: [recognizersDateTimeSrcFile] });
host.ensureFileOrFolder(recongnizerTextDistTypingFile);
host.runQueuedTimeoutCallbacks(); // Scheduled invalidation of resolutions
host.runQueuedTimeoutCallbacks(); // Actual update
verifyGetErrRequest({ session, host, files: [recognizersDateTimeSrcFile] });
verifyGetErrRequest({ session, files: [recognizersDateTimeSrcFile] });
baselineTsserverLogs("symLinks", `module resolution${withPathMapping ? " with path mapping" : ""} when project recompiles after deleting generated folders`, session);
});
});
@@ -51,13 +51,13 @@ describe("Test Suite 1", () => {
arguments: { file: unitTest1.path }
});
host.deleteFile(unitTest1.path);
host.checkTimeoutQueueLengthAndRun(0);
host.runQueuedTimeoutCallbacks();
session.executeCommandSeq<ts.server.protocol.CloseRequest>({
command: ts.server.protocol.CommandTypes.Close,
arguments: { file: unitTest1.path }
});
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
const unitTest1WithChangedContent: File = {
path: unitTest1.path,
@@ -61,7 +61,7 @@ declare class TestLib {
const session = createSession(host, { logger: createLoggerWithInMemoryLogs(host) });
openFilesForSession([testFile], session);
host.writeFile(appLib.path, appLib.content.replace("test()", "test2()"));
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("typeReferenceDirectives", "when typeReferenceDirective contains UpperCasePackage", session);
});
@@ -184,7 +184,7 @@ describe("unittests:: tsserver:: typingsInstaller:: General functionality", () =
projectService.openClientFile(file1.path);
typingsInstaller.installer.executePendingCommands();
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("typingsInstaller", "configured projects", projectService);
});
@@ -220,7 +220,7 @@ describe("unittests:: tsserver:: typingsInstaller:: General functionality", () =
projectService.openClientFile(file1.path);
typingsInstaller.installer.executePendingCommands();
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("typingsInstaller", "inferred projects", projectService);
});
@@ -251,7 +251,7 @@ describe("unittests:: tsserver:: typingsInstaller:: General functionality", () =
projectService.openClientFile(jqueryJs.path);
typingsInstaller.installer.executePendingCommands();
host.checkTimeoutQueueLength(0);
projectService.testhost.logTimeoutQueueLength();
// files should not be removed from project if ATA is skipped
baselineTsserverLogs("typingsInstaller", "inferred projects with disableFilenameBasedTypeAcquisition", projectService);
@@ -425,7 +425,7 @@ describe("unittests:: tsserver:: typingsInstaller:: General functionality", () =
typingsInstaller.installer.executePendingCommands();
host.checkTimeoutQueueLengthAndRun(1);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("typingsInstaller", "external projects no type acquisition", projectService);
});
@@ -586,7 +586,7 @@ describe("unittests:: tsserver:: typingsInstaller:: General functionality", () =
typingsInstaller.installer.executePendingCommands();
host.checkTimeoutQueueLengthAndRun(1);
host.runQueuedTimeoutCallbacks();
// Commander: Existed as a JS file
// JQuery: Specified in 'include'
// Moment: Specified in 'include'
@@ -659,7 +659,7 @@ describe("unittests:: tsserver:: typingsInstaller:: General functionality", () =
});
typingsInstaller.installer.executePendingCommands();
host.checkTimeoutQueueLengthAndRun(1);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("typingsInstaller", "throttle delayed typings to install", projectService);
});
@@ -754,7 +754,7 @@ describe("unittests:: tsserver:: typingsInstaller:: General functionality", () =
assert.equal(typingsInstaller.installer.pendingRunRequests.length, 0, "expected no throttled requests");
typingsInstaller.installer.executePendingCommands();
host.checkTimeoutQueueLengthAndRun(2); // for 2 projects
host.runQueuedTimeoutCallbacks(); // for 2 projects
baselineTsserverLogs("typingsInstaller", "throttle delayed run install requests", projectService);
});
@@ -812,7 +812,7 @@ describe("unittests:: tsserver:: typingsInstaller:: General functionality", () =
typingsInstaller.installer.executePendingCommands();
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("typingsInstaller", "scoped name discovery", projectService);
});
@@ -943,7 +943,7 @@ describe("unittests:: tsserver:: typingsInstaller:: General functionality", () =
typingsInstaller.installer.executePendingCommands();
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("typingsInstaller", "configured projects discover from bower_components", projectService);
});
@@ -982,7 +982,7 @@ describe("unittests:: tsserver:: typingsInstaller:: General functionality", () =
typingsInstaller.installer.executePendingCommands();
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("typingsInstaller", "discover from bower", projectService);
});
@@ -1016,10 +1016,10 @@ describe("unittests:: tsserver:: typingsInstaller:: General functionality", () =
service.openClientFile(f.path);
host.writeFile(fixedPackageJson.path, fixedPackageJson.content);
host.checkTimeoutQueueLength(0);
service.testhost.logTimeoutQueueLength();
// expected install request
typingsInstaller.installer.executePendingCommands();
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("typingsInstaller", "malformed packagejson", service);
});
@@ -1058,7 +1058,7 @@ describe("unittests:: tsserver:: typingsInstaller:: General functionality", () =
typingsInstaller.installer.executePendingCommands();
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("typingsInstaller", "install typings for unresolved imports", service);
});
@@ -1091,7 +1091,7 @@ describe("unittests:: tsserver:: typingsInstaller:: General functionality", () =
service.openClientFile(file.path);
typingsInstaller.installer.executePendingCommands();
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("typingsInstaller", "redo resolutions pointing to js on typing install", service);
});
@@ -1167,7 +1167,7 @@ describe("unittests:: tsserver:: typingsInstaller:: General functionality", () =
}
};
session.executeCommandSeq(changeRequest);
host.checkTimeoutQueueLength(0);
session.testhost.logTimeoutQueueLength();
proj.updateGraph();
const version2 = proj.lastCachedUnresolvedImportsList;
assert.strictEqual(version1, version2, "set of unresolved imports should change");
@@ -1226,7 +1226,7 @@ describe("unittests:: tsserver:: typingsInstaller:: General functionality", () =
projectService.openClientFile(file1.path);
typingsInstaller.installer.executePendingCommands();
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("typingsInstaller", "expired cache entry", projectService);
});
@@ -1625,7 +1625,7 @@ describe("unittests:: tsserver:: typingsInstaller:: telemetry events", () => {
projectService.openClientFile(f1.path);
typingsInstaller.installer.executePendingCommands();
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("typingsInstaller", "telemetry events", projectService);
});
});
@@ -1667,7 +1667,7 @@ describe("unittests:: tsserver:: typingsInstaller:: progress notifications", ()
projectService.openClientFile(f1.path);
typingsInstaller.installer.executePendingCommands();
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
baselineTsserverLogs("typingsInstaller", "progress notification", projectService);
});
@@ -1762,7 +1762,7 @@ describe("unittests:: tsserver:: typingsInstaller:: recomputing resolutions of u
const foooResolution1 = verifyResolvedModuleOfFooo(proj);
typingsInstaller.installer.executePendingCommands();
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
const foooResolution2 = verifyResolvedModuleOfFooo(proj);
assert.strictEqual(foooResolution1, foooResolution2);
projectService.applyChangesInOpenFiles(/*openFiles*/ undefined, [{
@@ -1774,7 +1774,7 @@ describe("unittests:: tsserver:: typingsInstaller:: recomputing resolutions of u
}]);
host.runQueuedTimeoutCallbacks(); // Update the graph
// Update the typing
host.checkTimeoutQueueLength(0);
projectService.testhost.logTimeoutQueueLength();
assert.isFalse(proj.resolutionCache.isFileWithInvalidatedNonRelativeUnresolvedImports(app.path as ts.Path));
baselineTsserverLogs("typingsInstaller", scenario, projectService);
}
@@ -1842,7 +1842,7 @@ declare module "stream" {
const proj = projectService.inferredProjects[0];
typingsInstaller.installer.executePendingCommands();
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
projectService.applyChangesInOpenFiles(
/*openFiles*/ undefined,
[{
@@ -1859,10 +1859,10 @@ declare module "stream" {
);
// Below timeout Updates the typings to empty array because of "s tream" as unsresolved import
// and schedules the update graph because of this.
host.checkTimeoutQueueLengthAndRun(2);
host.runQueuedTimeoutCallbacks();
// Here, since typings dont change, there is no timeout scheduled
host.checkTimeoutQueueLength(0);
projectService.testhost.logTimeoutQueueLength();
projectService.applyChangesInOpenFiles(/*openFiles*/ undefined, [{
fileName: file.path,
changes: [{
@@ -1872,7 +1872,7 @@ declare module "stream" {
}]);
proj.updateGraph(); // Update the graph
// Update the typing
host.checkTimeoutQueueLength(0);
projectService.testhost.logTimeoutQueueLength();
assert.isFalse(proj.resolutionCache.isFileWithInvalidatedNonRelativeUnresolvedImports(file.path as ts.Path));
baselineTsserverLogs("typingsInstaller", "should handle node core modules", projectService);
});
@@ -172,7 +172,7 @@ it(`unittests:: tsserver:: watchEnvironment:: tsserverProjectSystem recursive wa
emacsIgnoredFileFromIgnoreDirectory
].forEach(ignoredEntity => {
host.ensureFileOrFolder(ignoredEntity);
host.checkTimeoutQueueLength(0);
session.testhost.logTimeoutQueueLength();
});
baselineTsserverLogs("watchEnvironment", `recursive directory does not watch files starting with dot in node_modules`, session);
@@ -167,10 +167,10 @@ interface CallbackData {
time: number;
}
class Callbacks {
private map: { cb: TimeOutCallback; args: any[]; ms: number | undefined; time: number; }[] = [];
readonly map: CallbackData[] = [];
private nextId = 1;
constructor(private host: TestServerHost) {
constructor(private host: TestServerHost, readonly callbackType: string) {
}
getNextId() {
@@ -190,15 +190,17 @@ class Callbacks {
}
}
count() {
let n = 0;
for (const _ in this.map) {
n++;
log() {
const details: string[] = [];
for (const timeoutId in this.map) {
const { args } = this.map[Number(timeoutId)];
details.push(`${timeoutId}: ${args[0]}`);
}
return n;
return `${this.callbackType} callback:: count: ${details.length}` + (details.length ? "\r\n" + details.join("\r\n") : "");
}
private invokeCallback({ cb, args, ms, time }: CallbackData) {
private invokeCallback(timeoutId: number) {
const { cb, args, ms, time } = this.map[timeoutId];
if (ms !== undefined) {
const newTime = ms + time;
if (this.host.getTime() < newTime) {
@@ -206,21 +208,17 @@ class Callbacks {
}
}
cb(...args);
delete this.map[timeoutId];
}
invoke(invokeKey?: number) {
if (invokeKey) {
this.invokeCallback(this.map[invokeKey]);
delete this.map[invokeKey];
return;
}
if (invokeKey) return this.invokeCallback(invokeKey);
// Note: invoking a callback may result in new callbacks been queued,
// so do not clear the entire callback list regardless. Only remove the
// ones we have invoked.
for (const key in this.map) {
this.invokeCallback(this.map[key]);
delete this.map[key];
this.invokeCallback(Number(key));
}
}
}
@@ -280,8 +278,8 @@ export class TestServerHost implements server.ServerHost, FormatDiagnosticsHost,
private time = timeIncrements;
getCanonicalFileName: (s: string) => string;
private toPath: (f: string) => Path;
private timeoutCallbacks = new Callbacks(this);
private immediateCallbacks = new Callbacks(this);
readonly timeoutCallbacks = new Callbacks(this, "Timeout");
readonly immediateCallbacks = new Callbacks(this, "Immedidate");
readonly screenClears: number[] = [];
readonly watchedFiles = createMultiMap<Path, TestFileWatcher>();
@@ -869,16 +867,6 @@ export class TestServerHost implements server.ServerHost, FormatDiagnosticsHost,
this.screenClears.push(this.output.length);
}
checkTimeoutQueueLengthAndRun(expected: number) {
this.checkTimeoutQueueLength(expected);
this.runQueuedTimeoutCallbacks();
}
checkTimeoutQueueLength(expected: number) {
const callbacksCount = this.timeoutCallbacks.count();
assert.equal(callbacksCount, expected, `expected ${expected} timeout callbacks queued but found ${callbacksCount}.`);
}
runQueuedTimeoutCallbacks(timeoutId?: number) {
try {
this.timeoutCallbacks.invoke(timeoutId);
@@ -891,10 +879,7 @@ export class TestServerHost implements server.ServerHost, FormatDiagnosticsHost,
}
}
runQueuedImmediateCallbacks(checkCount?: number) {
if (checkCount !== undefined) {
assert.equal(this.immediateCallbacks.count(), checkCount);
}
runQueuedImmediateCallbacks() {
this.immediateCallbacks.invoke();
}
@@ -145,6 +145,9 @@ Input::
}
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:33 AM] File change detected. Starting incremental compilation...
@@ -180,6 +183,9 @@ Input::
export function fooBar() { }
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:38 AM] File change detected. Starting incremental compilation...
@@ -275,6 +281,9 @@ Change:: reports error when there is no change to tsconfig file
Input::
//// [/user/username/projects/myproject/tsconfig.json] file written with same contents
Before running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:50 AM] File change detected. Starting incremental compilation...
@@ -310,6 +319,9 @@ Input::
{"compilerOptions":{"composite":true,"declaration":true},"files":["a.ts","b.ts"]}
Before running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:56 AM] File change detected. Starting incremental compilation...
@@ -449,6 +449,9 @@ export function lastElementOf<T>(arr: T[]): T | undefined {
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:08 AM] File change detected. Starting incremental compilation...
@@ -214,6 +214,13 @@ Input::
}
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:52 AM] File change detected. Starting incremental compilation...
@@ -297,6 +297,9 @@ Input::
{"name":"pkg2","version":"1.0.0","main":"build/other.js"}
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:19 AM] File change detected. Starting incremental compilation...
@@ -362,6 +365,9 @@ Input::
{"name":"pkg2","version":"1.0.0","main":"build/index.js"}
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:26 AM] File change detected. Starting incremental compilation...
@@ -292,6 +292,9 @@ Input::
{"name":"pkg1","version":"1.0.0","main":"build/index.js","type":"commonjs"}
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:13 AM] File change detected. Starting incremental compilation...
@@ -374,6 +377,9 @@ Input::
{"name":"pkg1","version":"1.0.0","main":"build/index.js","type":"module"}
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:20 AM] File change detected. Starting incremental compilation...
@@ -448,6 +454,9 @@ Input::
{"name":"pkg1","version":"1.0.0","main":"build/index.js","type":"commonjs"}
Before running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:31 AM] File change detected. Starting incremental compilation...
@@ -534,6 +543,13 @@ export type { TheNum } from './const.cjs';
//// [/user/username/projects/myproject/packages/pkg2/index.ts] deleted
Before running Timeout callback:: count: 1
8: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
9: timerToBuildInvalidatedProject
Before running Timeout callback:: count: 1
9: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:42 AM] File change detected. Starting incremental compilation...
@@ -304,6 +304,9 @@ Input::
import { foo } from "file";const bar = 10;
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:18 AM] File change detected. Starting incremental compilation...
@@ -141,6 +141,9 @@ Change:: No change
Input::
//// [/user/username/projects/myproject/a.js] file written with same contents
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:36 AM] File change detected. Starting incremental compilation...
@@ -161,6 +164,9 @@ Input::
const x = 10;
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:42 AM] File change detected. Starting incremental compilation...
@@ -79,6 +79,9 @@ Change:: No change
Input::
//// [/user/username/projects/myproject/a.js] file written with same contents
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:31 AM] File change detected. Starting incremental compilation...
@@ -113,6 +116,9 @@ Input::
const x = 10;
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:38 AM] File change detected. Starting incremental compilation...
@@ -179,6 +179,9 @@ Change:: No change
Input::
//// [/user/username/projects/noEmitOnError/src/main.ts] file written with same contents
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:47 AM] File change detected. Starting incremental compilation...
@@ -222,6 +225,9 @@ const a = {
};
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:54 AM] File change detected. Starting incremental compilation...
@@ -371,6 +377,9 @@ import { A } from "../shared/types/db";
const a: string = 10;
Before running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:22 AM] File change detected. Starting incremental compilation...
@@ -515,6 +524,9 @@ Change:: No change
Input::
//// [/user/username/projects/noEmitOnError/src/main.ts] file written with same contents
Before running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:37 AM] File change detected. Starting incremental compilation...
@@ -556,6 +568,9 @@ import { A } from "../shared/types/db";
const a: string = "hello";
Before running Timeout callback:: count: 1
5: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:44 AM] File change detected. Starting incremental compilation...
@@ -683,6 +698,9 @@ Change:: No change
Input::
//// [/user/username/projects/noEmitOnError/src/main.ts] file written with same contents
Before running Timeout callback:: count: 1
6: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:02:01 AM] File change detected. Starting incremental compilation...
@@ -96,6 +96,9 @@ Change:: No change
Input::
//// [/user/username/projects/noEmitOnError/src/main.ts] file written with same contents
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:39 AM] File change detected. Starting incremental compilation...
@@ -139,6 +142,9 @@ const a = {
};
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:46 AM] File change detected. Starting incremental compilation...
@@ -202,6 +208,9 @@ import { A } from "../shared/types/db";
const a: string = 10;
Before running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:10 AM] File change detected. Starting incremental compilation...
@@ -242,6 +251,9 @@ Change:: No change
Input::
//// [/user/username/projects/noEmitOnError/src/main.ts] file written with same contents
Before running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:18 AM] File change detected. Starting incremental compilation...
@@ -283,6 +295,9 @@ import { A } from "../shared/types/db";
const a: string = "hello";
Before running Timeout callback:: count: 1
5: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:25 AM] File change detected. Starting incremental compilation...
@@ -328,6 +343,9 @@ Change:: No change
Input::
//// [/user/username/projects/noEmitOnError/src/main.ts] file written with same contents
Before running Timeout callback:: count: 1
6: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:38 AM] File change detected. Starting incremental compilation...
@@ -550,6 +550,9 @@ export const m = mod;
function someFn() { }
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:34 AM] File change detected. Starting incremental compilation...
@@ -699,6 +702,13 @@ export const m = mod;
export function someFn() { }
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
Before running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:57 AM] File change detected. Starting incremental compilation...
@@ -179,6 +179,9 @@ export var myClassWithError = class {
};
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:43 AM] File change detected. Starting incremental compilation...
@@ -216,6 +219,9 @@ Input::
export class myClass2 { }
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:48 AM] File change detected. Starting incremental compilation...
@@ -179,6 +179,9 @@ export var myClassWithError = class {
};
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:43 AM] File change detected. Starting incremental compilation...
@@ -219,6 +222,9 @@ export var myClassWithError = class {
};
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:48 AM] File change detected. Starting incremental compilation...
@@ -80,6 +80,9 @@ Input::
export class myClass2 { }
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:30 AM] File change detected. Starting incremental compilation...
@@ -83,6 +83,9 @@ export var myClassWithError = class {
};
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:30 AM] File change detected. Starting incremental compilation...
@@ -533,6 +533,9 @@ export const m = mod;
let y: string = 10;
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:27 AM] File change detected. Starting incremental compilation...
@@ -676,6 +679,9 @@ export function multiply(a: number, b: number) { return a * b; }
let x: string = 10;
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:39 AM] File change detected. Starting incremental compilation...
@@ -532,6 +532,9 @@ export const m = mod;
let y: string = 10;
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:01:27 AM] File change detected. Starting incremental compilation...
@@ -674,6 +677,9 @@ export function multiply(a: number, b: number) { return a * b; }
let x: string = 10;
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:01:39 AM] File change detected. Starting incremental compilation...
@@ -173,6 +173,8 @@ Change:: No change
Input::
Timeout callback:: count: 0
Immedidate callback:: count: 0
Output::
exitCode:: ExitStatus.undefined
@@ -185,6 +187,9 @@ Input::
export const y = 10;
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:50 AM] File change detected. Starting incremental compilation...
@@ -322,6 +327,8 @@ Change:: No change
Input::
Timeout callback:: count: 0
Immedidate callback:: count: 0
Output::
exitCode:: ExitStatus.undefined
@@ -188,6 +188,8 @@ Change:: No change
Input::
Timeout callback:: count: 0
Immedidate callback:: count: 0
Output::
exitCode:: ExitStatus.undefined
@@ -200,6 +202,9 @@ Input::
export const y = 10;
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:51 AM] File change detected. Starting incremental compilation...
@@ -342,6 +347,8 @@ Change:: No change
Input::
Timeout callback:: count: 0
Immedidate callback:: count: 0
Output::
exitCode:: ExitStatus.undefined
@@ -263,6 +263,10 @@ FsWatchesRecursive::
/user/username/projects/sample1/core:
{}
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
Output::
sysLog:: /user/username/projects/sample1/logic/tsconfig.json:: Changing watcher to PresentFileSystemEntryWatcher
@@ -426,6 +430,9 @@ Change:: Build Tests
Input::
Before running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:01:19 AM] Found 0 errors. Watching for file changes.
@@ -194,6 +194,13 @@ export function createSomeObject(): SomeObject
}
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:46 AM] File change detected. Starting incremental compilation...
@@ -332,6 +339,13 @@ export function createSomeObject(): SomeObject
}
Before running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
Before running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:04 AM] File change detected. Starting incremental compilation...
@@ -293,6 +293,10 @@ function foo() { return 10; }
function myFunc() { return 10; }
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:00:56 AM] File change detected. Starting incremental compilation...
@@ -403,6 +407,9 @@ Change:: Build logic
Input::
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:01:29 AM] Found 0 errors. Watching for file changes.
@@ -561,6 +568,10 @@ function foo() { return 10; }
function myFunc() { return 100; }
Before running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:01:33 AM] File change detected. Starting incremental compilation...
@@ -666,6 +677,9 @@ Change:: Build logic
Input::
Before running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:02:00 AM] Found 0 errors. Watching for file changes.
@@ -492,6 +492,10 @@ Input::
export const newFileConst = 30;
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:01:16 AM] File change detected. Starting incremental compilation...
@@ -633,6 +637,9 @@ Change:: Build logic and tests
Input::
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:01:30 AM] Found 0 errors. Watching for file changes.
@@ -678,6 +685,10 @@ export const newFileConst = 30;
export class someClass2 { }
Before running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:01:34 AM] File change detected. Starting incremental compilation...
@@ -803,6 +814,9 @@ Change:: Build logic and tests
Input::
Before running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:01:50 AM] Found 0 errors. Watching for file changes.
@@ -496,6 +496,10 @@ export function multiply(a: number, b: number) { return a * b; }
export class someClass { }
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:01:17 AM] File change detected. Starting incremental compilation...
@@ -613,6 +617,9 @@ Change:: Build logic and tests
Input::
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:01:54 AM] Found 0 errors. Watching for file changes.
@@ -848,6 +855,10 @@ export function multiply(a: number, b: number) { return a * b; }
Before running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:01:58 AM] File change detected. Starting incremental compilation...
@@ -957,6 +968,9 @@ Change:: Build logic and tests
Input::
Before running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:02:35 AM] Found 0 errors. Watching for file changes.
@@ -1194,6 +1208,10 @@ export class someClass { }
export class someClass2 { }
Before running Timeout callback:: count: 1
6: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
7: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:02:42 AM] File change detected. Starting incremental compilation...
@@ -1319,6 +1337,9 @@ Change:: Build logic and tests
Input::
Before running Timeout callback:: count: 1
7: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:03:20 AM] Found 0 errors. Watching for file changes.
@@ -496,6 +496,9 @@ export function multiply(a: number, b: number) { return a * b; }
function foo() { }
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:17 AM] File change detected. Starting incremental compilation...
@@ -526,6 +526,10 @@ Input::
export const newFileConst = 30;
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:01:26 AM] File change detected. Starting incremental compilation...
@@ -672,6 +676,9 @@ Change:: Build logic and tests
Input::
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:01:42 AM] Found 0 errors. Watching for file changes.
@@ -717,6 +724,10 @@ export const newFileConst = 30;
export class someClass2 { }
Before running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:01:46 AM] File change detected. Starting incremental compilation...
@@ -847,6 +858,9 @@ Change:: Build logic and tests
Input::
Before running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:02:05 AM] Found 0 errors. Watching for file changes.
@@ -530,6 +530,10 @@ export function multiply(a: number, b: number) { return a * b; }
export class someClass { }
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:01:27 AM] File change detected. Starting incremental compilation...
@@ -652,6 +656,9 @@ Change:: Build logic and tests
Input::
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:02:07 AM] Found 0 errors. Watching for file changes.
@@ -887,6 +894,10 @@ export function multiply(a: number, b: number) { return a * b; }
Before running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:02:11 AM] File change detected. Starting incremental compilation...
@@ -1001,6 +1012,9 @@ Change:: Build logic and tests
Input::
Before running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:02:51 AM] Found 0 errors. Watching for file changes.
@@ -1238,6 +1252,10 @@ export class someClass { }
export class someClass2 { }
Before running Timeout callback:: count: 1
6: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
7: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:02:58 AM] File change detected. Starting incremental compilation...
@@ -1368,6 +1386,9 @@ Change:: Build logic and tests
Input::
Before running Timeout callback:: count: 1
7: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:03:39 AM] Found 0 errors. Watching for file changes.
@@ -530,6 +530,9 @@ export function multiply(a: number, b: number) { return a * b; }
function foo() { }
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:27 AM] File change detected. Starting incremental compilation...
@@ -270,6 +270,9 @@ Input::
{"references":[{"path":"./project1.tsconfig.json"}],"files":[]}
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:58 AM] File change detected. Starting incremental compilation...
@@ -69,6 +69,9 @@ Input::
{"compilerOptions":{"noUnusedParameters":false}}
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:26 AM] File change detected. Starting incremental compilation...
@@ -308,6 +308,10 @@ Input::
{"compilerOptions":{"strict":true}}
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:01:12 AM] File change detected. Starting incremental compilation...
@@ -419,6 +423,9 @@ Change:: Build project 2
Input::
Before running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:01:28 AM] Project 'project2.tsconfig.json' is out of date because output 'project2.tsconfig.tsbuildinfo' is older than input 'alpha.tsconfig.json'
@@ -509,6 +516,9 @@ Input::
{"extends":"./alpha.tsconfig.json","compilerOptions":{"strict":false}}
Before running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:44 AM] File change detected. Starting incremental compilation...
@@ -601,6 +611,9 @@ Input::
{"extends":"./alpha.tsconfig.json"}
Before running Timeout callback:: count: 1
5: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:02:01 AM] File change detected. Starting incremental compilation...
@@ -690,6 +703,10 @@ Input::
{}
Before running Timeout callback:: count: 1
7: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
8: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:02:22 AM] File change detected. Starting incremental compilation...
@@ -798,6 +815,9 @@ Change:: Build project 2
Input::
Before running Timeout callback:: count: 1
8: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:02:38 AM] Project 'project2.tsconfig.json' is out of date because output 'commonFile1.js' is older than input 'alpha.tsconfig.json'
@@ -846,6 +866,9 @@ Input::
{"compilerOptions":{"strictNullChecks":true}}
Before running Timeout callback:: count: 1
9: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:02:57 AM] File change detected. Starting incremental compilation...
@@ -884,6 +907,9 @@ Input::
{"extends":["./extendsConfig1.tsconfig.json","./extendsConfig2.tsconfig.json"],"compilerOptions":{"composite":false},"files":["/a/b/other2.ts"]}
Before running Timeout callback:: count: 1
10: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:03:06 AM] File change detected. Starting incremental compilation...
@@ -950,6 +976,9 @@ Change:: Delete extendedConfigFile2 and report error
Input::
//// [/a/b/extendsConfig2.tsconfig.json] deleted
Before running Timeout callback:: count: 1
11: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:03:13 AM] File change detected. Starting incremental compilation...
@@ -2184,6 +2184,9 @@ Input::
export const pkg0 = 0;const someConst2 = 10;
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:06:55 AM] File change detected. Starting incremental compilation...
@@ -2384,6 +2387,8 @@ Change:: No change
Input::
Timeout callback:: count: 0
Immedidate callback:: count: 0
Output::
exitCode:: ExitStatus.undefined
@@ -2396,6 +2401,10 @@ Input::
export const pkg0 = 0;const someConst2 = 10;export const someConst = 10;
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:08:17 AM] File change detected. Starting incremental compilation...
@@ -2490,6 +2499,10 @@ Change:: build pkg1,pkg2,pkg3,pkg4,pkg5
Input::
Before running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
Output::
[12:08:33 AM] Project 'pkg1/tsconfig.json' is out of date because output 'pkg1/index.js' is older than input 'pkg0/tsconfig.json'
@@ -2590,6 +2603,10 @@ Change:: build pkg6,pkg7,pkg8,pkg9,pkg10
Input::
Before running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
5: timerToBuildInvalidatedProject
Output::
[12:08:53 AM] Project 'pkg6/tsconfig.json' is out of date because output 'pkg6/index.js' is older than input 'pkg0/tsconfig.json'
@@ -2690,6 +2707,10 @@ Change:: build pkg11,pkg12,pkg13,pkg14,pkg15
Input::
Before running Timeout callback:: count: 1
5: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
6: timerToBuildInvalidatedProject
Output::
[12:09:13 AM] Project 'pkg11/tsconfig.json' is out of date because output 'pkg11/index.js' is older than input 'pkg0/tsconfig.json'
@@ -2790,6 +2811,10 @@ Change:: build pkg16,pkg17,pkg18,pkg19,pkg20
Input::
Before running Timeout callback:: count: 1
6: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
7: timerToBuildInvalidatedProject
Output::
[12:09:33 AM] Project 'pkg16/tsconfig.json' is out of date because output 'pkg16/index.js' is older than input 'pkg0/tsconfig.json'
@@ -2890,6 +2915,9 @@ Change:: build pkg21,pkg22,pkg23
Input::
Before running Timeout callback:: count: 1
7: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:09:54 AM] Project 'pkg21/tsconfig.json' is out of date because output 'pkg21/index.js' is older than input 'pkg0/tsconfig.json'
@@ -2938,6 +2966,8 @@ Change:: No change
Input::
Timeout callback:: count: 0
Immedidate callback:: count: 0
Output::
exitCode:: ExitStatus.undefined
@@ -2950,6 +2980,10 @@ Input::
export const pkg0 = 0;const someConst2 = 10;export const someConst = 10;export const someConst3 = 10;
Before running Timeout callback:: count: 1
8: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
9: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:10:05 AM] File change detected. Starting incremental compilation...
@@ -3046,6 +3080,10 @@ Change:: build pkg1,pkg2,pkg3,pkg4,pkg5
Input::
Before running Timeout callback:: count: 1
9: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
10: timerToBuildInvalidatedProject
Output::
[12:10:21 AM] Project 'pkg1/tsconfig.json' is out of date because output 'pkg1/index.js' is older than input 'pkg0/tsconfig.json'
@@ -3146,6 +3184,10 @@ Change:: build pkg6,pkg7,pkg8,pkg9,pkg10
Input::
Before running Timeout callback:: count: 1
10: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
11: timerToBuildInvalidatedProject
Output::
[12:10:41 AM] Project 'pkg6/tsconfig.json' is out of date because output 'pkg6/index.js' is older than input 'pkg0/tsconfig.json'
@@ -3249,6 +3291,10 @@ Input::
export const pkg0 = 0;const someConst2 = 10;export const someConst = 10;export const someConst3 = 10;const someConst4 = 10;
Before running Timeout callback:: count: 1
12: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
13: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:11:03 AM] File change detected. Starting incremental compilation...
@@ -3390,6 +3436,10 @@ Change:: build pkg11,pkg12,pkg13,pkg14,pkg15
Input::
Before running Timeout callback:: count: 1
13: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
14: timerToBuildInvalidatedProject
Output::
[12:11:46 AM] Project 'pkg11/tsconfig.json' is out of date because output 'pkg11/index.js' is older than input 'pkg0/tsconfig.json'
@@ -3493,6 +3543,10 @@ Input::
export const pkg0 = 0;const someConst2 = 10;export const someConst = 10;export const someConst3 = 10;const someConst4 = 10;export const someConst5 = 10;
Before running Timeout callback:: count: 1
15: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
16: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:12:09 AM] File change detected. Starting incremental compilation...
@@ -3592,6 +3646,10 @@ Change:: build pkg1,pkg2,pkg3,pkg4,pkg5
Input::
Before running Timeout callback:: count: 1
16: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
17: timerToBuildInvalidatedProject
Output::
[12:12:25 AM] Project 'pkg1/tsconfig.json' is out of date because output 'pkg1/index.js' is older than input 'pkg0/tsconfig.json'
@@ -3692,6 +3750,10 @@ Change:: build pkg6,pkg7,pkg8,pkg9,pkg10
Input::
Before running Timeout callback:: count: 1
17: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
18: timerToBuildInvalidatedProject
Output::
[12:12:45 AM] Project 'pkg6/tsconfig.json' is out of date because output 'pkg6/index.js' is older than input 'pkg0/tsconfig.json'
@@ -3792,6 +3854,10 @@ Change:: build pkg11,pkg12,pkg13,pkg14,pkg15
Input::
Before running Timeout callback:: count: 1
18: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
19: timerToBuildInvalidatedProject
Output::
[12:13:05 AM] Project 'pkg11/tsconfig.json' is out of date because output 'pkg11/index.js' is older than input 'pkg0/tsconfig.json'
@@ -3892,6 +3958,10 @@ Change:: build pkg16,pkg17,pkg18,pkg19,pkg20
Input::
Before running Timeout callback:: count: 1
19: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
20: timerToBuildInvalidatedProject
Output::
[12:13:25 AM] Project 'pkg16/tsconfig.json' is out of date because output 'pkg16/index.js' is older than input 'pkg0/tsconfig.json'
@@ -3992,6 +4062,9 @@ Change:: build pkg21,pkg22,pkg23
Input::
Before running Timeout callback:: count: 1
20: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:13:45 AM] Project 'pkg21/tsconfig.json' is out of date because output 'pkg21/index.js' is older than input 'pkg0/tsconfig.json'
@@ -4040,6 +4113,8 @@ Change:: No change
Input::
Timeout callback:: count: 0
Immedidate callback:: count: 0
Output::
exitCode:: ExitStatus.undefined
@@ -324,6 +324,9 @@ Input::
export const pkg0 = 0;const someConst2 = 10;
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:15 AM] File change detected. Starting incremental compilation...
@@ -424,6 +427,8 @@ Change:: No change
Input::
Timeout callback:: count: 0
Immedidate callback:: count: 0
Output::
exitCode:: ExitStatus.undefined
@@ -436,6 +441,10 @@ Input::
export const pkg0 = 0;const someConst2 = 10;export const someConst = 10;
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:01:37 AM] File change detected. Starting incremental compilation...
@@ -530,6 +539,9 @@ Change:: build pkg1,pkg2
Input::
Before running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:01:53 AM] Project 'pkg1/tsconfig.json' is out of date because output 'pkg1/index.js' is older than input 'pkg0/tsconfig.json'
@@ -578,6 +590,8 @@ Change:: No change
Input::
Timeout callback:: count: 0
Immedidate callback:: count: 0
Output::
exitCode:: ExitStatus.undefined
@@ -510,6 +510,9 @@ Input::
export const pkg0 = 0;const someConst2 = 10;
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:49 AM] File change detected. Starting incremental compilation...
@@ -620,6 +623,8 @@ Change:: No change
Input::
Timeout callback:: count: 0
Immedidate callback:: count: 0
Output::
exitCode:: ExitStatus.undefined
@@ -632,6 +637,10 @@ Input::
export const pkg0 = 0;const someConst2 = 10;export const someConst = 10;
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:02:17 AM] File change detected. Starting incremental compilation...
@@ -726,6 +735,9 @@ Change:: build pkg1,pkg2,pkg3,pkg4
Input::
Before running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:02:33 AM] Project 'pkg1/tsconfig.json' is out of date because output 'pkg1/index.js' is older than input 'pkg0/tsconfig.json'
@@ -810,6 +822,8 @@ Change:: No change
Input::
Timeout callback:: count: 0
Immedidate callback:: count: 0
Output::
exitCode:: ExitStatus.undefined
@@ -789,6 +789,9 @@ Input::
export const pkg0 = 0;const someConst2 = 10;
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:02:40 AM] File change detected. Starting incremental compilation...
@@ -914,6 +917,8 @@ Change:: No change
Input::
Timeout callback:: count: 0
Immedidate callback:: count: 0
Output::
exitCode:: ExitStatus.undefined
@@ -926,6 +931,10 @@ Input::
export const pkg0 = 0;const someConst2 = 10;export const someConst = 10;
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:03:17 AM] File change detected. Starting incremental compilation...
@@ -1020,6 +1029,10 @@ Change:: build pkg1,pkg2,pkg3,pkg4,pkg5
Input::
Before running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
Output::
[12:03:33 AM] Project 'pkg1/tsconfig.json' is out of date because output 'pkg1/index.js' is older than input 'pkg0/tsconfig.json'
@@ -1120,6 +1133,9 @@ Change:: build pkg6,pkg7
Input::
Before running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:03:53 AM] Project 'pkg6/tsconfig.json' is out of date because output 'pkg6/index.js' is older than input 'pkg0/tsconfig.json'
@@ -1168,6 +1184,8 @@ Change:: No change
Input::
Timeout callback:: count: 0
Immedidate callback:: count: 0
Output::
exitCode:: ExitStatus.undefined
@@ -1180,6 +1198,10 @@ Input::
export const pkg0 = 0;const someConst2 = 10;export const someConst = 10;export const someConst3 = 10;
Before running Timeout callback:: count: 1
5: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
6: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:04:04 AM] File change detected. Starting incremental compilation...
@@ -1276,6 +1298,10 @@ Change:: build pkg1,pkg2,pkg3,pkg4,pkg5
Input::
Before running Timeout callback:: count: 1
6: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
7: timerToBuildInvalidatedProject
Output::
[12:04:21 AM] Project 'pkg1/tsconfig.json' is out of date because output 'pkg1/index.js' is older than input 'pkg0/tsconfig.json'
@@ -1379,6 +1405,10 @@ Input::
export const pkg0 = 0;const someConst2 = 10;export const someConst = 10;export const someConst3 = 10;const someConst4 = 10;
Before running Timeout callback:: count: 1
8: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
9: timerToBuildInvalidatedProject
Output::
>> Screen clear
[12:04:43 AM] File change detected. Starting incremental compilation...
@@ -1495,6 +1525,9 @@ Change:: build pkg6,pkg7
Input::
Before running Timeout callback:: count: 1
9: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
[12:05:11 AM] Project 'pkg6/tsconfig.json' is out of date because output 'pkg6/index.js' is older than input 'pkg0/tsconfig.json'
@@ -1543,6 +1576,8 @@ Change:: No change
Input::
Timeout callback:: count: 0
Immedidate callback:: count: 0
Output::
exitCode:: ExitStatus.undefined
@@ -288,6 +288,13 @@ export enum e { }
export function f2() { } // trailing
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:57 AM] File change detected. Starting incremental compilation...
@@ -283,6 +283,13 @@ export interface Session {
Before running Timeout callback:: count: 1
1: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
Before running Timeout callback:: count: 1
2: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:09 AM] File change detected. Starting incremental compilation...
@@ -442,6 +449,13 @@ export interface Session {
Before running Timeout callback:: count: 1
3: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
Before running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:34 AM] File change detected. Starting incremental compilation...
@@ -218,6 +218,13 @@ Input::
export const typing = 10;export const typing1 = 10;
Before running Timeout callback:: count: 1
4: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
5: timerToBuildInvalidatedProject
Before running Timeout callback:: count: 1
5: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:13 AM] File change detected. Starting incremental compilation...
@@ -320,6 +327,9 @@ Input::
{"files":[],"include":[],"references":[{"path":"./pkg0"},{"path":"./pkg1"},{"path":"./pkg2"}]}
Before running Timeout callback:: count: 1
6: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:34 AM] File change detected. Starting incremental compilation...
@@ -374,6 +384,13 @@ Input::
export const typing = 10;
Before running Timeout callback:: count: 1
9: timerToBuildInvalidatedProject
After running Timeout callback:: count: 1
10: timerToBuildInvalidatedProject
Before running Timeout callback:: count: 1
10: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:39 AM] File change detected. Starting incremental compilation...
@@ -455,6 +472,9 @@ Input::
{"files":[],"include":[],"references":[]}
Before running Timeout callback:: count: 1
11: timerToBuildInvalidatedProject
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:01:57 AM] File change detected. Starting incremental compilation...
@@ -506,6 +526,8 @@ Input::
export const typing = 10;export const typing1 = 10;
Timeout callback:: count: 0
Immedidate callback:: count: 0
Output::
exitCode:: ExitStatus.undefined
@@ -69,6 +69,9 @@ Input::
//
Before running Timeout callback:: count: 1
1: timerToUpdateProgram
After running Timeout callback:: count: 0
Output::
[12:00:19 AM] File change detected. Starting incremental compilation...
@@ -68,6 +68,9 @@ Input::
//
Before running Timeout callback:: count: 1
1: timerToUpdateProgram
After running Timeout callback:: count: 0
Output::
[12:00:19 AM] File change detected. Starting incremental compilation...
@@ -64,6 +64,9 @@ Input::
//
Before running Timeout callback:: count: 1
1: timerToUpdateProgram
After running Timeout callback:: count: 0
Output::
FileWatcher:: Triggered with /f.ts 1:: WatchInfo: /f.ts 250 undefined Source file
Scheduling update
@@ -66,6 +66,9 @@ Input::
//
Before running Timeout callback:: count: 1
1: timerToUpdateProgram
After running Timeout callback:: count: 0
Output::
FileWatcher:: Triggered with /f.ts 1:: WatchInfo: /f.ts 250 undefined Source file
Scheduling update
@@ -59,6 +59,9 @@ Input::
//
Before running Timeout callback:: count: 1
1: timerToUpdateProgram
After running Timeout callback:: count: 0
Output::
[12:00:17 AM] File change detected. Starting incremental compilation...
@@ -60,6 +60,9 @@ Input::
//
Before running Timeout callback:: count: 1
1: timerToUpdateProgram
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:17 AM] File change detected. Starting incremental compilation...
@@ -89,6 +89,9 @@ Input::
import { E2 } from "./file2"; const v: E2 = E2.V;function foo2() { return 2; }
Before running Timeout callback:: count: 1
1: timerToUpdateProgram
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:33 AM] File change detected. Starting incremental compilation...
@@ -75,6 +75,9 @@ var a = 10;
var b = 10;
Before running Timeout callback:: count: 1
4: timerToUpdateProgram
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:28 AM] File change detected. Starting incremental compilation...
@@ -65,6 +65,9 @@ var y = 2;
var z = 3;
Before running Timeout callback:: count: 1
1: timerToUpdateProgram
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:17 AM] File change detected. Starting incremental compilation...
@@ -65,6 +65,9 @@ var y = 2;
var z = 3;
Before running Timeout callback:: count: 1
1: timerToUpdateProgram
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:17 AM] File change detected. Starting incremental compilation...
@@ -109,6 +109,9 @@ Input::
export function Foo() { return 10; }export function foo2() { return 2; }
Before running Timeout callback:: count: 1
1: timerToUpdateProgram
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:29 AM] File change detected. Starting incremental compilation...
@@ -158,6 +161,9 @@ Input::
export function Foo() { return 10; }export function foo2() { return 2; }export function fooN() { return 2; }
Before running Timeout callback:: count: 1
2: timerToUpdateProgram
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:42 AM] File change detected. Starting incremental compilation...
@@ -134,6 +134,9 @@ Input::
export var T: number;export function Foo() { };
Before running Timeout callback:: count: 1
1: timerToUpdateProgram
After running Timeout callback:: count: 0
Output::
>> Screen clear
[12:00:38 AM] File change detected. Starting incremental compilation...

Some files were not shown because too many files have changed in this diff Show More