Skip to content

Make sure order of watches in baseline is fixed instead of depending on when it was added #54313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
28 changes: 16 additions & 12 deletions src/testRunner/unittests/helpers/virtualFileSystemWithWatch.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as Harness from "../../_namespaces/Harness";
import {
arrayFrom,
clear,
clone,
combinePaths,
Expand Down Expand Up @@ -1123,20 +1124,23 @@ function diffMap<T>(
let captionAdded = false;
let baselineChanged = false;
let hasChange = false;
map?.forEach((values, key) => {
const existing = old?.get(key);
let addedKey = false;
for (const value of values) {
const hasExisting = contains(existing, value);
if (deleted && hasExisting) continue;
if (!hasExisting) hasChange = true;
if (!addedKey) {
addBaseline(`${key}:${deleted || existing ? "" : " *new*"}`);
addedKey = true;
if (map) {
for (const key of arrayFrom(map.keys()).sort(compareStringsCaseSensitive)) {
const existing = old?.get(key);
let addedKey = false;
const values = map.get(key)!;
for (const value of values) {
const hasExisting = contains(existing, value);
if (deleted && hasExisting) continue;
if (!hasExisting) hasChange = true;
if (!addedKey) {
addBaseline(`${key}:${deleted || existing ? "" : " *new*"}`);
addedKey = true;
}
addBaseline(` ${JSON.stringify(value)}${deleted || hasExisting || !existing ? "" : " *new*"}`);
}
addBaseline(` ${JSON.stringify(value)}${deleted || hasExisting || !existing ? "" : " *new*"}`);
}
});
}
if (baselineChanged) baseline.push("");
return hasChange;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ No cached semantic diagnostics in the builder::
No shapes updated in the builder::

FsWatches::
/user/username/projects/myproject/tsconfig.json: *new*
{}
/user/username/projects/myproject/a.ts: *new*
{}
/user/username/projects/myproject/b.ts: *new*
{}
/user/username/projects/myproject/tsconfig.json: *new*
{}

exitCode:: ExitStatus.undefined

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,32 +251,32 @@ PolledWatches::
{"pollingInterval":2000}

FsWatches::
/user/username/projects/demo/core/tsconfig.json: *new*
/user/username/projects/demo/animals/animal.ts: *new*
{}
/user/username/projects/demo/tsconfig-base.json: *new*
/user/username/projects/demo/animals/dog.ts: *new*
{}
/user/username/projects/demo/core/utilities.ts: *new*
/user/username/projects/demo/animals/index.ts: *new*
{}
/user/username/projects/demo/animals/tsconfig.json: *new*
{}
/user/username/projects/demo/animals/animal.ts: *new*
/user/username/projects/demo/core/tsconfig.json: *new*
{}
/user/username/projects/demo/animals/dog.ts: *new*
/user/username/projects/demo/core/utilities.ts: *new*
{}
/user/username/projects/demo/animals/index.ts: *new*
/user/username/projects/demo/tsconfig-base.json: *new*
{}
/user/username/projects/demo/tsconfig.json: *new*
{}
/user/username/projects/demo/zoo/tsconfig.json: *new*
{}
/user/username/projects/demo/zoo/zoo.ts: *new*
{}
/user/username/projects/demo/tsconfig.json: *new*
{}

FsWatchesRecursive::
/user/username/projects/demo/core: *new*
{}
/user/username/projects/demo/animals: *new*
{}
/user/username/projects/demo/core: *new*
{}
/user/username/projects/demo/zoo: *new*
{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,34 +169,34 @@ Output::


FsWatches::
/user/username/projects/demo/animals/tsconfig.json: *new*
{}
/user/username/projects/demo/tsconfig-base.json: *new*
{}
/user/username/projects/demo/animals/animal.ts: *new*
{}
/user/username/projects/demo/animals/dog.ts: *new*
{}
/user/username/projects/demo/animals/index.ts: *new*
{}
/user/username/projects/demo/zoo/tsconfig.json: *new*
{}
/user/username/projects/demo/zoo/zoo.ts: *new*
/user/username/projects/demo/animals/tsconfig.json: *new*
{}
/user/username/projects/demo/core/tsconfig.json: *new*
{}
/user/username/projects/demo/core/utilities.ts: *new*
{}
/user/username/projects/demo/tsconfig-base.json: *new*
{}
/user/username/projects/demo/tsconfig.json: *new*
{}
/user/username/projects/demo/zoo/tsconfig.json: *new*
{}
/user/username/projects/demo/zoo/zoo.ts: *new*
{}

FsWatchesRecursive::
/user/username/projects/demo/animals: *new*
{}
/user/username/projects/demo/zoo: *new*
{}
/user/username/projects/demo/core: *new*
{}
/user/username/projects/demo/zoo: *new*
{}

exitCode:: ExitStatus.undefined

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,22 +466,20 @@ Shape signatures in builder refreshed for::
/home/src/projects/project4/utils.d.ts (used version)

PolledWatches::
/home/src/projects/node_modules/@typescript/lib-webworker/package.json: *new*
{"pollingInterval":2000}
/home/src/projects/node_modules/@typescript/lib-scripthost/package.json: *new*
/home/src/projects/node_modules/@typescript/lib-dom/package.json: *new*
{"pollingInterval":2000}
/home/src/projects/node_modules/@typescript/lib-es5/package.json: *new*
{"pollingInterval":2000}
/home/src/projects/project1/typeroot1/sometype/package.json: *new*
/home/src/projects/node_modules/@typescript/lib-esnext/package.json: *new*
{"pollingInterval":2000}
/home/src/projects/node_modules/@typescript/lib-dom/package.json: *new*
/home/src/projects/node_modules/@typescript/lib-scripthost/package.json: *new*
{"pollingInterval":2000}
/home/src/projects/node_modules/@typescript/lib-esnext/package.json: *new*
/home/src/projects/node_modules/@typescript/lib-webworker/package.json: *new*
{"pollingInterval":2000}
/home/src/projects/project1/typeroot1/sometype/package.json: *new*
{"pollingInterval":2000}

FsWatches::
/home/src/projects/project1/tsconfig.json: *new*
{}
/home/src/projects/project1/core.d.ts: *new*
{}
/home/src/projects/project1/file.ts: *new*
Expand All @@ -490,26 +488,28 @@ FsWatches::
{}
/home/src/projects/project1/index.ts: *new*
{}
/home/src/projects/project1/utils.d.ts: *new*
/home/src/projects/project1/tsconfig.json: *new*
{}
/home/src/projects/project1/typeroot1/sometype/index.d.ts: *new*
{}
/home/src/projects/project2/tsconfig.json: *new*
/home/src/projects/project1/utils.d.ts: *new*
{}
/home/src/projects/project2/index.ts: *new*
{}
/home/src/projects/project2/utils.d.ts: *new*
/home/src/projects/project2/tsconfig.json: *new*
{}
/home/src/projects/project3/tsconfig.json: *new*
/home/src/projects/project2/utils.d.ts: *new*
{}
/home/src/projects/project3/index.ts: *new*
{}
/home/src/projects/project3/utils.d.ts: *new*
/home/src/projects/project3/tsconfig.json: *new*
{}
/home/src/projects/project4/tsconfig.json: *new*
/home/src/projects/project3/utils.d.ts: *new*
{}
/home/src/projects/project4/index.ts: *new*
{}
/home/src/projects/project4/tsconfig.json: *new*
{}
/home/src/projects/project4/utils.d.ts: *new*
{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,22 +477,20 @@ Shape signatures in builder refreshed for::
/home/src/projects/project4/utils.d.ts (used version)

PolledWatches::
/home/src/projects/node_modules/@typescript/lib-webworker/package.json: *new*
{"pollingInterval":2000}
/home/src/projects/node_modules/@typescript/lib-scripthost/package.json: *new*
/home/src/projects/node_modules/@typescript/lib-dom/package.json: *new*
{"pollingInterval":2000}
/home/src/projects/node_modules/@typescript/lib-es5/package.json: *new*
{"pollingInterval":2000}
/home/src/projects/project1/typeroot1/sometype/package.json: *new*
/home/src/projects/node_modules/@typescript/lib-esnext/package.json: *new*
{"pollingInterval":2000}
/home/src/projects/node_modules/@typescript/lib-dom/package.json: *new*
/home/src/projects/node_modules/@typescript/lib-scripthost/package.json: *new*
{"pollingInterval":2000}
/home/src/projects/node_modules/@typescript/lib-esnext/package.json: *new*
/home/src/projects/node_modules/@typescript/lib-webworker/package.json: *new*
{"pollingInterval":2000}
/home/src/projects/project1/typeroot1/sometype/package.json: *new*
{"pollingInterval":2000}

FsWatches::
/home/src/projects/project1/tsconfig.json: *new*
{}
/home/src/projects/project1/core.d.ts: *new*
{}
/home/src/projects/project1/file.ts: *new*
Expand All @@ -501,26 +499,28 @@ FsWatches::
{}
/home/src/projects/project1/index.ts: *new*
{}
/home/src/projects/project1/utils.d.ts: *new*
/home/src/projects/project1/tsconfig.json: *new*
{}
/home/src/projects/project1/typeroot1/sometype/index.d.ts: *new*
{}
/home/src/projects/project2/tsconfig.json: *new*
/home/src/projects/project1/utils.d.ts: *new*
{}
/home/src/projects/project2/index.ts: *new*
{}
/home/src/projects/project2/utils.d.ts: *new*
/home/src/projects/project2/tsconfig.json: *new*
{}
/home/src/projects/project3/tsconfig.json: *new*
/home/src/projects/project2/utils.d.ts: *new*
{}
/home/src/projects/project3/index.ts: *new*
{}
/home/src/projects/project3/utils.d.ts: *new*
/home/src/projects/project3/tsconfig.json: *new*
{}
/home/src/projects/project4/tsconfig.json: *new*
/home/src/projects/project3/utils.d.ts: *new*
{}
/home/src/projects/project4/index.ts: *new*
{}
/home/src/projects/project4/tsconfig.json: *new*
{}
/home/src/projects/project4/utils.d.ts: *new*
{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,26 +141,26 @@ Shape signatures in builder refreshed for::
/user/username/projects/myproject/packages/pkg1/index.ts (used version)

FsWatches::
/user/username/projects/myproject/packages/pkg2/tsconfig.json: *new*
/user/username/projects/myproject/packages/pkg1/index.ts: *new*
{}
/user/username/projects/myproject/packages/pkg1/tsconfig.json: *new*
{}
/user/username/projects/myproject/packages/pkg2/const.ts: *new*
{}
/user/username/projects/myproject/packages/pkg2/index.ts: *new*
{}
/user/username/projects/myproject/packages/pkg2/other.ts: *new*
{}
/user/username/projects/myproject/packages/pkg1/tsconfig.json: *new*
{}
/user/username/projects/myproject/packages/pkg1/index.ts: *new*
{}
/user/username/projects/myproject/packages/pkg2/package.json: *new*
{}
/user/username/projects/myproject/packages/pkg2/tsconfig.json: *new*
{}

FsWatchesRecursive::
/user/username/projects/myproject/packages/pkg2: *new*
{}
/user/username/projects/myproject/packages/pkg1: *new*
{}
/user/username/projects/myproject/packages/pkg2: *new*
{}

exitCode:: ExitStatus.undefined

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,26 +155,26 @@ PolledWatches::
{"pollingInterval":2000}

FsWatches::
/user/username/projects/myproject/packages/pkg2/tsconfig.json: *new*
/user/username/projects/myproject/packages/pkg1/index.ts: *new*
{}
/user/username/projects/myproject/packages/pkg1/package.json: *new*
{}
/user/username/projects/myproject/packages/pkg1/tsconfig.json: *new*
{}
/user/username/projects/myproject/packages/pkg2/const.cts: *new*
{}
/user/username/projects/myproject/packages/pkg2/index.ts: *new*
{}
/user/username/projects/myproject/packages/pkg2/package.json: *new*
{}
/user/username/projects/myproject/packages/pkg1/tsconfig.json: *new*
{}
/user/username/projects/myproject/packages/pkg1/index.ts: *new*
{}
/user/username/projects/myproject/packages/pkg1/package.json: *new*
/user/username/projects/myproject/packages/pkg2/tsconfig.json: *new*
{}

FsWatchesRecursive::
/user/username/projects/myproject/packages/pkg2: *new*
{}
/user/username/projects/myproject/packages/pkg1: *new*
{}
/user/username/projects/myproject/packages/pkg2: *new*
{}

exitCode:: ExitStatus.undefined

Expand Down Expand Up @@ -654,30 +654,30 @@ PolledWatches::
{"pollingInterval":2000}

FsWatches::
/user/username/projects/myproject/packages/pkg2/tsconfig.json:
{}
/user/username/projects/myproject/packages/pkg2/const.cts:
/user/username/projects/myproject/packages/pkg1/index.ts:
{}
/user/username/projects/myproject/packages/pkg2/package.json:
/user/username/projects/myproject/packages/pkg1/package.json:
{}
/user/username/projects/myproject/packages/pkg1/tsconfig.json:
{}
/user/username/projects/myproject/packages/pkg1/index.ts:
{}
/user/username/projects/myproject/packages/pkg1/package.json:
/user/username/projects/myproject/packages/pkg2/const.cts:
{}
/user/username/projects/myproject/packages/pkg2/index.cts: *new*
{}
/user/username/projects/myproject/packages/pkg2/package.json:
{}
/user/username/projects/myproject/packages/pkg2/tsconfig.json:
{}

FsWatches *deleted*::
/user/username/projects/myproject/packages/pkg2/index.ts:
{}

FsWatchesRecursive::
/user/username/projects/myproject/packages/pkg2:
{}
/user/username/projects/myproject/packages/pkg1:
{}
/user/username/projects/myproject/packages/pkg2:
{}

exitCode:: ExitStatus.undefined

Expand Down
Loading