Skip to content

Commit d210074

Browse files
authored
Make sure order of watches in baseline is fixed instead of depending on when it was added (microsoft#54313)
1 parent d01a1c3 commit d210074

File tree

984 files changed

+14751
-14747
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

984 files changed

+14751
-14747
lines changed

src/testRunner/unittests/helpers/virtualFileSystemWithWatch.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as Harness from "../../_namespaces/Harness";
22
import {
3+
arrayFrom,
34
clear,
45
clone,
56
combinePaths,
@@ -1123,20 +1124,23 @@ function diffMap<T>(
11231124
let captionAdded = false;
11241125
let baselineChanged = false;
11251126
let hasChange = false;
1126-
map?.forEach((values, key) => {
1127-
const existing = old?.get(key);
1128-
let addedKey = false;
1129-
for (const value of values) {
1130-
const hasExisting = contains(existing, value);
1131-
if (deleted && hasExisting) continue;
1132-
if (!hasExisting) hasChange = true;
1133-
if (!addedKey) {
1134-
addBaseline(`${key}:${deleted || existing ? "" : " *new*"}`);
1135-
addedKey = true;
1127+
if (map) {
1128+
for (const key of arrayFrom(map.keys()).sort(compareStringsCaseSensitive)) {
1129+
const existing = old?.get(key);
1130+
let addedKey = false;
1131+
const values = map.get(key)!;
1132+
for (const value of values) {
1133+
const hasExisting = contains(existing, value);
1134+
if (deleted && hasExisting) continue;
1135+
if (!hasExisting) hasChange = true;
1136+
if (!addedKey) {
1137+
addBaseline(`${key}:${deleted || existing ? "" : " *new*"}`);
1138+
addedKey = true;
1139+
}
1140+
addBaseline(` ${JSON.stringify(value)}${deleted || hasExisting || !existing ? "" : " *new*"}`);
11361141
}
1137-
addBaseline(` ${JSON.stringify(value)}${deleted || hasExisting || !existing ? "" : " *new*"}`);
11381142
}
1139-
});
1143+
}
11401144
if (baselineChanged) baseline.push("");
11411145
return hasChange;
11421146

tests/baselines/reference/tsbuildWatch/configFileErrors/reports-syntax-errors-in-config-file.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ No cached semantic diagnostics in the builder::
5858
No shapes updated in the builder::
5959

6060
FsWatches::
61-
/user/username/projects/myproject/tsconfig.json: *new*
62-
{}
6361
/user/username/projects/myproject/a.ts: *new*
6462
{}
6563
/user/username/projects/myproject/b.ts: *new*
6664
{}
65+
/user/username/projects/myproject/tsconfig.json: *new*
66+
{}
6767

6868
exitCode:: ExitStatus.undefined
6969

tests/baselines/reference/tsbuildWatch/demo/updates-with-bad-reference.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -251,32 +251,32 @@ PolledWatches::
251251
{"pollingInterval":2000}
252252

253253
FsWatches::
254-
/user/username/projects/demo/core/tsconfig.json: *new*
254+
/user/username/projects/demo/animals/animal.ts: *new*
255255
{}
256-
/user/username/projects/demo/tsconfig-base.json: *new*
256+
/user/username/projects/demo/animals/dog.ts: *new*
257257
{}
258-
/user/username/projects/demo/core/utilities.ts: *new*
258+
/user/username/projects/demo/animals/index.ts: *new*
259259
{}
260260
/user/username/projects/demo/animals/tsconfig.json: *new*
261261
{}
262-
/user/username/projects/demo/animals/animal.ts: *new*
262+
/user/username/projects/demo/core/tsconfig.json: *new*
263263
{}
264-
/user/username/projects/demo/animals/dog.ts: *new*
264+
/user/username/projects/demo/core/utilities.ts: *new*
265265
{}
266-
/user/username/projects/demo/animals/index.ts: *new*
266+
/user/username/projects/demo/tsconfig-base.json: *new*
267+
{}
268+
/user/username/projects/demo/tsconfig.json: *new*
267269
{}
268270
/user/username/projects/demo/zoo/tsconfig.json: *new*
269271
{}
270272
/user/username/projects/demo/zoo/zoo.ts: *new*
271273
{}
272-
/user/username/projects/demo/tsconfig.json: *new*
273-
{}
274274

275275
FsWatchesRecursive::
276-
/user/username/projects/demo/core: *new*
277-
{}
278276
/user/username/projects/demo/animals: *new*
279277
{}
278+
/user/username/projects/demo/core: *new*
279+
{}
280280
/user/username/projects/demo/zoo: *new*
281281
{}
282282

tests/baselines/reference/tsbuildWatch/demo/updates-with-circular-reference.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,34 +169,34 @@ Output::
169169

170170

171171
FsWatches::
172-
/user/username/projects/demo/animals/tsconfig.json: *new*
173-
{}
174-
/user/username/projects/demo/tsconfig-base.json: *new*
175-
{}
176172
/user/username/projects/demo/animals/animal.ts: *new*
177173
{}
178174
/user/username/projects/demo/animals/dog.ts: *new*
179175
{}
180176
/user/username/projects/demo/animals/index.ts: *new*
181177
{}
182-
/user/username/projects/demo/zoo/tsconfig.json: *new*
183-
{}
184-
/user/username/projects/demo/zoo/zoo.ts: *new*
178+
/user/username/projects/demo/animals/tsconfig.json: *new*
185179
{}
186180
/user/username/projects/demo/core/tsconfig.json: *new*
187181
{}
188182
/user/username/projects/demo/core/utilities.ts: *new*
189183
{}
184+
/user/username/projects/demo/tsconfig-base.json: *new*
185+
{}
190186
/user/username/projects/demo/tsconfig.json: *new*
191187
{}
188+
/user/username/projects/demo/zoo/tsconfig.json: *new*
189+
{}
190+
/user/username/projects/demo/zoo/zoo.ts: *new*
191+
{}
192192

193193
FsWatchesRecursive::
194194
/user/username/projects/demo/animals: *new*
195195
{}
196-
/user/username/projects/demo/zoo: *new*
197-
{}
198196
/user/username/projects/demo/core: *new*
199197
{}
198+
/user/username/projects/demo/zoo: *new*
199+
{}
200200

201201
exitCode:: ExitStatus.undefined
202202

tests/baselines/reference/tsbuildWatch/libraryResolution/with-config-with-redirection.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -466,22 +466,20 @@ Shape signatures in builder refreshed for::
466466
/home/src/projects/project4/utils.d.ts (used version)
467467

468468
PolledWatches::
469-
/home/src/projects/node_modules/@typescript/lib-webworker/package.json: *new*
470-
{"pollingInterval":2000}
471-
/home/src/projects/node_modules/@typescript/lib-scripthost/package.json: *new*
469+
/home/src/projects/node_modules/@typescript/lib-dom/package.json: *new*
472470
{"pollingInterval":2000}
473471
/home/src/projects/node_modules/@typescript/lib-es5/package.json: *new*
474472
{"pollingInterval":2000}
475-
/home/src/projects/project1/typeroot1/sometype/package.json: *new*
473+
/home/src/projects/node_modules/@typescript/lib-esnext/package.json: *new*
476474
{"pollingInterval":2000}
477-
/home/src/projects/node_modules/@typescript/lib-dom/package.json: *new*
475+
/home/src/projects/node_modules/@typescript/lib-scripthost/package.json: *new*
478476
{"pollingInterval":2000}
479-
/home/src/projects/node_modules/@typescript/lib-esnext/package.json: *new*
477+
/home/src/projects/node_modules/@typescript/lib-webworker/package.json: *new*
478+
{"pollingInterval":2000}
479+
/home/src/projects/project1/typeroot1/sometype/package.json: *new*
480480
{"pollingInterval":2000}
481481

482482
FsWatches::
483-
/home/src/projects/project1/tsconfig.json: *new*
484-
{}
485483
/home/src/projects/project1/core.d.ts: *new*
486484
{}
487485
/home/src/projects/project1/file.ts: *new*
@@ -490,26 +488,28 @@ FsWatches::
490488
{}
491489
/home/src/projects/project1/index.ts: *new*
492490
{}
493-
/home/src/projects/project1/utils.d.ts: *new*
491+
/home/src/projects/project1/tsconfig.json: *new*
494492
{}
495493
/home/src/projects/project1/typeroot1/sometype/index.d.ts: *new*
496494
{}
497-
/home/src/projects/project2/tsconfig.json: *new*
495+
/home/src/projects/project1/utils.d.ts: *new*
498496
{}
499497
/home/src/projects/project2/index.ts: *new*
500498
{}
501-
/home/src/projects/project2/utils.d.ts: *new*
499+
/home/src/projects/project2/tsconfig.json: *new*
502500
{}
503-
/home/src/projects/project3/tsconfig.json: *new*
501+
/home/src/projects/project2/utils.d.ts: *new*
504502
{}
505503
/home/src/projects/project3/index.ts: *new*
506504
{}
507-
/home/src/projects/project3/utils.d.ts: *new*
505+
/home/src/projects/project3/tsconfig.json: *new*
508506
{}
509-
/home/src/projects/project4/tsconfig.json: *new*
507+
/home/src/projects/project3/utils.d.ts: *new*
510508
{}
511509
/home/src/projects/project4/index.ts: *new*
512510
{}
511+
/home/src/projects/project4/tsconfig.json: *new*
512+
{}
513513
/home/src/projects/project4/utils.d.ts: *new*
514514
{}
515515

tests/baselines/reference/tsbuildWatch/libraryResolution/with-config.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -477,22 +477,20 @@ Shape signatures in builder refreshed for::
477477
/home/src/projects/project4/utils.d.ts (used version)
478478

479479
PolledWatches::
480-
/home/src/projects/node_modules/@typescript/lib-webworker/package.json: *new*
481-
{"pollingInterval":2000}
482-
/home/src/projects/node_modules/@typescript/lib-scripthost/package.json: *new*
480+
/home/src/projects/node_modules/@typescript/lib-dom/package.json: *new*
483481
{"pollingInterval":2000}
484482
/home/src/projects/node_modules/@typescript/lib-es5/package.json: *new*
485483
{"pollingInterval":2000}
486-
/home/src/projects/project1/typeroot1/sometype/package.json: *new*
484+
/home/src/projects/node_modules/@typescript/lib-esnext/package.json: *new*
487485
{"pollingInterval":2000}
488-
/home/src/projects/node_modules/@typescript/lib-dom/package.json: *new*
486+
/home/src/projects/node_modules/@typescript/lib-scripthost/package.json: *new*
489487
{"pollingInterval":2000}
490-
/home/src/projects/node_modules/@typescript/lib-esnext/package.json: *new*
488+
/home/src/projects/node_modules/@typescript/lib-webworker/package.json: *new*
489+
{"pollingInterval":2000}
490+
/home/src/projects/project1/typeroot1/sometype/package.json: *new*
491491
{"pollingInterval":2000}
492492

493493
FsWatches::
494-
/home/src/projects/project1/tsconfig.json: *new*
495-
{}
496494
/home/src/projects/project1/core.d.ts: *new*
497495
{}
498496
/home/src/projects/project1/file.ts: *new*
@@ -501,26 +499,28 @@ FsWatches::
501499
{}
502500
/home/src/projects/project1/index.ts: *new*
503501
{}
504-
/home/src/projects/project1/utils.d.ts: *new*
502+
/home/src/projects/project1/tsconfig.json: *new*
505503
{}
506504
/home/src/projects/project1/typeroot1/sometype/index.d.ts: *new*
507505
{}
508-
/home/src/projects/project2/tsconfig.json: *new*
506+
/home/src/projects/project1/utils.d.ts: *new*
509507
{}
510508
/home/src/projects/project2/index.ts: *new*
511509
{}
512-
/home/src/projects/project2/utils.d.ts: *new*
510+
/home/src/projects/project2/tsconfig.json: *new*
513511
{}
514-
/home/src/projects/project3/tsconfig.json: *new*
512+
/home/src/projects/project2/utils.d.ts: *new*
515513
{}
516514
/home/src/projects/project3/index.ts: *new*
517515
{}
518-
/home/src/projects/project3/utils.d.ts: *new*
516+
/home/src/projects/project3/tsconfig.json: *new*
519517
{}
520-
/home/src/projects/project4/tsconfig.json: *new*
518+
/home/src/projects/project3/utils.d.ts: *new*
521519
{}
522520
/home/src/projects/project4/index.ts: *new*
523521
{}
522+
/home/src/projects/project4/tsconfig.json: *new*
523+
{}
524524
/home/src/projects/project4/utils.d.ts: *new*
525525
{}
526526

tests/baselines/reference/tsbuildWatch/moduleResolution/build-mode-watches-for-changes-to-package-json-main-fields.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,26 +141,26 @@ Shape signatures in builder refreshed for::
141141
/user/username/projects/myproject/packages/pkg1/index.ts (used version)
142142

143143
FsWatches::
144-
/user/username/projects/myproject/packages/pkg2/tsconfig.json: *new*
144+
/user/username/projects/myproject/packages/pkg1/index.ts: *new*
145+
{}
146+
/user/username/projects/myproject/packages/pkg1/tsconfig.json: *new*
145147
{}
146148
/user/username/projects/myproject/packages/pkg2/const.ts: *new*
147149
{}
148150
/user/username/projects/myproject/packages/pkg2/index.ts: *new*
149151
{}
150152
/user/username/projects/myproject/packages/pkg2/other.ts: *new*
151153
{}
152-
/user/username/projects/myproject/packages/pkg1/tsconfig.json: *new*
153-
{}
154-
/user/username/projects/myproject/packages/pkg1/index.ts: *new*
155-
{}
156154
/user/username/projects/myproject/packages/pkg2/package.json: *new*
157155
{}
156+
/user/username/projects/myproject/packages/pkg2/tsconfig.json: *new*
157+
{}
158158

159159
FsWatchesRecursive::
160-
/user/username/projects/myproject/packages/pkg2: *new*
161-
{}
162160
/user/username/projects/myproject/packages/pkg1: *new*
163161
{}
162+
/user/username/projects/myproject/packages/pkg2: *new*
163+
{}
164164

165165
exitCode:: ExitStatus.undefined
166166

tests/baselines/reference/tsbuildWatch/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-cts-and-mts-extensions.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -155,26 +155,26 @@ PolledWatches::
155155
{"pollingInterval":2000}
156156

157157
FsWatches::
158-
/user/username/projects/myproject/packages/pkg2/tsconfig.json: *new*
158+
/user/username/projects/myproject/packages/pkg1/index.ts: *new*
159+
{}
160+
/user/username/projects/myproject/packages/pkg1/package.json: *new*
161+
{}
162+
/user/username/projects/myproject/packages/pkg1/tsconfig.json: *new*
159163
{}
160164
/user/username/projects/myproject/packages/pkg2/const.cts: *new*
161165
{}
162166
/user/username/projects/myproject/packages/pkg2/index.ts: *new*
163167
{}
164168
/user/username/projects/myproject/packages/pkg2/package.json: *new*
165169
{}
166-
/user/username/projects/myproject/packages/pkg1/tsconfig.json: *new*
167-
{}
168-
/user/username/projects/myproject/packages/pkg1/index.ts: *new*
169-
{}
170-
/user/username/projects/myproject/packages/pkg1/package.json: *new*
170+
/user/username/projects/myproject/packages/pkg2/tsconfig.json: *new*
171171
{}
172172

173173
FsWatchesRecursive::
174-
/user/username/projects/myproject/packages/pkg2: *new*
175-
{}
176174
/user/username/projects/myproject/packages/pkg1: *new*
177175
{}
176+
/user/username/projects/myproject/packages/pkg2: *new*
177+
{}
178178

179179
exitCode:: ExitStatus.undefined
180180

@@ -654,30 +654,30 @@ PolledWatches::
654654
{"pollingInterval":2000}
655655

656656
FsWatches::
657-
/user/username/projects/myproject/packages/pkg2/tsconfig.json:
658-
{}
659-
/user/username/projects/myproject/packages/pkg2/const.cts:
657+
/user/username/projects/myproject/packages/pkg1/index.ts:
660658
{}
661-
/user/username/projects/myproject/packages/pkg2/package.json:
659+
/user/username/projects/myproject/packages/pkg1/package.json:
662660
{}
663661
/user/username/projects/myproject/packages/pkg1/tsconfig.json:
664662
{}
665-
/user/username/projects/myproject/packages/pkg1/index.ts:
666-
{}
667-
/user/username/projects/myproject/packages/pkg1/package.json:
663+
/user/username/projects/myproject/packages/pkg2/const.cts:
668664
{}
669665
/user/username/projects/myproject/packages/pkg2/index.cts: *new*
670666
{}
667+
/user/username/projects/myproject/packages/pkg2/package.json:
668+
{}
669+
/user/username/projects/myproject/packages/pkg2/tsconfig.json:
670+
{}
671671

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

676676
FsWatchesRecursive::
677-
/user/username/projects/myproject/packages/pkg2:
678-
{}
679677
/user/username/projects/myproject/packages/pkg1:
680678
{}
679+
/user/username/projects/myproject/packages/pkg2:
680+
{}
681681

682682
exitCode:: ExitStatus.undefined
683683

0 commit comments

Comments
 (0)