@cplieger/deadset-ts 8.0.0-dev.15 → 8.0.0-dev.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/dist/src/analysis.js +41 -37
  2. package/dist/src/commands/read.js +6 -7
  3. package/dist/src/conformance-record.js +1 -1
  4. package/dist/src/consumers.js +3 -1
  5. package/dist/src/contract/config.generated.js +1 -1
  6. package/dist/src/contract/contract.generated.js +119 -2
  7. package/dist/src/dependencies.js +79 -48
  8. package/dist/src/entries/build-scripts.js +222 -0
  9. package/dist/src/{configuration-files.js → entries/configuration-files.js} +20 -58
  10. package/dist/src/{convention-rows.js → entries/convention-rows.js} +120 -27
  11. package/dist/src/entries/conventions.js +739 -0
  12. package/dist/src/{html-entries.js → entries/html-entries.js} +3 -3
  13. package/dist/src/{mdx-entries.js → entries/mdx-entries.js} +2 -2
  14. package/dist/src/entries/run-directories.js +77 -0
  15. package/dist/src/entries/sources.js +144 -0
  16. package/dist/src/entries/static-module.js +669 -0
  17. package/dist/src/entries/test-runners.js +684 -0
  18. package/dist/src/{workflow-steps.js → entries/workflow-steps.js} +18 -8
  19. package/dist/src/extensions.js +37 -0
  20. package/dist/src/facts.js +38 -0
  21. package/dist/src/findings/emitters.js +5 -8
  22. package/dist/src/findings/self-check.js +36 -20
  23. package/dist/src/findings-pass.js +5 -6
  24. package/dist/src/framework-lifecycle.js +1 -1
  25. package/dist/src/fs/manifest.js +15 -20
  26. package/dist/src/generated-file.js +172 -29
  27. package/dist/src/graph.js +2 -4
  28. package/dist/src/index.js +1 -1
  29. package/dist/src/injection-container.js +1 -1
  30. package/dist/src/inventory/commonjs.js +62 -17
  31. package/dist/src/inventory/enumerate.js +2 -1
  32. package/dist/src/javascript-file.js +26 -11
  33. package/dist/src/load/classify.js +28 -9
  34. package/dist/src/load/diagnostics.js +8 -1
  35. package/dist/src/load/discover.js +15 -7
  36. package/dist/src/load/plan.js +2 -2
  37. package/dist/src/load/synthesize.js +5 -5
  38. package/dist/src/load/workspace-manifests.js +1 -1
  39. package/dist/src/matrix.js +6 -13
  40. package/dist/src/outside-tests.js +1 -1
  41. package/dist/src/paths.js +16 -0
  42. package/dist/src/platform-calls.js +78 -0
  43. package/dist/src/platform-symbols.js +140 -0
  44. package/dist/src/references.js +202 -32
  45. package/dist/src/resolve.js +1 -1
  46. package/dist/src/{configured-declarations.js → roots/configured-declarations.js} +4 -4
  47. package/dist/src/{entry-point-gaps.js → roots/entry-point-gaps.js} +5 -8
  48. package/dist/src/{manifest.js → roots/manifest.js} +4 -4
  49. package/dist/src/roots/published-reach.js +412 -0
  50. package/dist/src/roots/root-set.js +489 -0
  51. package/dist/src/roots/unseen-loads.js +208 -0
  52. package/dist/src/serialization-contract.js +1 -1
  53. package/dist/src/source-files.js +5 -9
  54. package/dist/src/suppress.js +30 -32
  55. package/dist/src/test-support.js +4 -2
  56. package/dist/src/verbs/analyze.js +13 -1
  57. package/dist/src/verbs/describe.js +5 -3
  58. package/jsr.json +1 -1
  59. package/package.json +2 -2
  60. package/src/analysis.ts +75 -52
  61. package/src/automatic-types.ts +1 -1
  62. package/src/commands/read.ts +6 -8
  63. package/src/conformance-record.ts +1 -1
  64. package/src/consumers.ts +4 -0
  65. package/src/contract/config.generated.ts +1 -1
  66. package/src/contract/contract.generated.ts +138 -2
  67. package/src/dependencies.ts +96 -49
  68. package/src/entries/build-scripts.ts +292 -0
  69. package/src/{configuration-files.ts → entries/configuration-files.ts} +23 -75
  70. package/src/{convention-rows.ts → entries/convention-rows.ts} +167 -28
  71. package/src/{conventions.ts → entries/conventions.ts} +347 -522
  72. package/src/{html-entries.ts → entries/html-entries.ts} +5 -5
  73. package/src/{mdx-entries.ts → entries/mdx-entries.ts} +4 -4
  74. package/src/entries/run-directories.ts +108 -0
  75. package/src/entries/sources.ts +266 -0
  76. package/src/entries/static-module.ts +857 -0
  77. package/src/entries/test-runners.ts +868 -0
  78. package/src/{workflow-steps.ts → entries/workflow-steps.ts} +29 -11
  79. package/src/exempt.ts +3 -2
  80. package/src/extensions.ts +45 -0
  81. package/src/facts.ts +44 -0
  82. package/src/file-facts.ts +1 -1
  83. package/src/findings/emitters.ts +14 -10
  84. package/src/findings/self-check.ts +41 -22
  85. package/src/findings/visibility-narrowing.ts +1 -1
  86. package/src/findings-pass.ts +5 -12
  87. package/src/framework-lifecycle.ts +1 -1
  88. package/src/fs/manifest.ts +25 -21
  89. package/src/generated-file.ts +240 -36
  90. package/src/graph.ts +3 -5
  91. package/src/index.ts +1 -1
  92. package/src/injection-container.ts +1 -1
  93. package/src/inventory/commonjs.ts +102 -17
  94. package/src/inventory/enumerate.ts +2 -1
  95. package/src/javascript-file.ts +29 -12
  96. package/src/load/classify.ts +49 -13
  97. package/src/load/diagnostics.ts +11 -1
  98. package/src/load/discover.ts +27 -11
  99. package/src/load/plan.ts +11 -2
  100. package/src/load/synthesize.ts +6 -6
  101. package/src/load/test-globals.ts +1 -1
  102. package/src/load/workspace-manifests.ts +1 -1
  103. package/src/load/workspace-run.ts +1 -1
  104. package/src/matrix.ts +7 -14
  105. package/src/outside-tests.ts +1 -1
  106. package/src/paths.ts +18 -0
  107. package/src/platform-calls.ts +119 -0
  108. package/src/platform-symbols.ts +205 -0
  109. package/src/references.ts +281 -34
  110. package/src/report.ts +1 -1
  111. package/src/resolve.ts +1 -1
  112. package/src/{configured-declarations.ts → roots/configured-declarations.ts} +7 -7
  113. package/src/{entry-point-gaps.ts → roots/entry-point-gaps.ts} +5 -8
  114. package/src/{manifest.ts → roots/manifest.ts} +5 -5
  115. package/src/roots/published-reach.ts +481 -0
  116. package/src/{roots.ts → roots/root-set.ts} +203 -630
  117. package/src/roots/unseen-loads.ts +307 -0
  118. package/src/serialization-contract.ts +1 -1
  119. package/src/source-files.ts +5 -10
  120. package/src/suppress.ts +48 -33
  121. package/src/test-support.ts +8 -3
  122. package/src/verbs/analyze.ts +17 -4
  123. package/src/verbs/describe.ts +5 -2
  124. package/src/verbs/explain.ts +1 -1
  125. package/dist/src/build-scripts.js +0 -418
  126. package/dist/src/conventions.js +0 -907
  127. package/dist/src/entry-points.js +0 -444
  128. package/dist/src/own-body.js +0 -28
  129. package/dist/src/roots.js +0 -865
  130. package/dist/src/unseen-loads.js +0 -189
  131. package/src/build-scripts.ts +0 -536
  132. package/src/entry-points.ts +0 -584
  133. package/src/own-body.ts +0 -42
  134. package/src/unseen-loads.ts +0 -282
@@ -7,6 +7,17 @@
7
7
  * directory one of the row's moves resolves to.
8
8
  */
9
9
 
10
+ import { braced, MODULE_EXTENSIONS } from "../extensions.ts";
11
+ import {
12
+ AVA_6,
13
+ AVA_8,
14
+ JEST_29,
15
+ JEST_30,
16
+ MOCHA_10,
17
+ MOCHA_12,
18
+ type TestRunner,
19
+ } from "./test-runners.ts";
20
+
10
21
  /** A call whose first argument is the object a property is read from. */
11
22
  export interface OptionsCall {
12
23
  /** The module specifier the configuration file imports the callee from. */
@@ -17,7 +28,11 @@ export interface OptionsCall {
17
28
 
18
29
  /** One configuration property, and the configuration files it is read from. */
19
30
  export interface MoveReading {
20
- /** The property's path through nested object literals, its keys joined by `.`. */
31
+ /**
32
+ * The property's path through nested object literals, its keys joined by `.`; in a
33
+ * test-file property a `*` key stands for every element of an array and every member of
34
+ * an object, each read as an object of its own.
35
+ */
21
36
  readonly property: string;
22
37
  /** Globs naming the configuration files, matched in the manifest's directory alone. */
23
38
  readonly files: readonly string[];
@@ -79,6 +94,28 @@ export interface TestFileReading extends MoveReading {
79
94
  readonly roots: readonly string[];
80
95
  }
81
96
 
97
+ /**
98
+ * One configuration's test directory and test-file patterns, whose matching files the
99
+ * runner runs as tests. Each element of the projects property is read the same way, a
100
+ * member it does not write taken from the configuration's own.
101
+ */
102
+ export interface TestDirectoryReading {
103
+ /** Globs naming the configuration files, matched in the manifest's directory alone. */
104
+ readonly files: readonly string[];
105
+ /** The property naming the directory, read against the configuration file's directory. */
106
+ readonly directory: string;
107
+ /**
108
+ * The property naming the patterns, each matched as Playwright matches one: anywhere
109
+ * below the directory, so a pattern gains a leading `**` segment unless it starts with
110
+ * one, and without regard to case.
111
+ */
112
+ readonly match: string;
113
+ /** The pattern that holds where no object names one. */
114
+ readonly defaultMatch: string;
115
+ /** The property listing the projects. */
116
+ readonly projects: string;
117
+ }
118
+
82
119
  /** One member of the declaring `package.json` whose strings name the tool's entries. */
83
120
  export interface ManifestEntryKey {
84
121
  /** The member's path through nested objects, its keys joined by `.`, a `*` key standing for every member. */
@@ -129,6 +166,10 @@ export interface ConventionRow {
129
166
  readonly selections?: readonly MoveReading[];
130
167
  /** The properties whose strings name a file the test runner loads beside the tests, a test file. */
131
168
  readonly testFiles?: readonly TestFileReading[];
169
+ /** The configurations whose test directory and patterns name the test files the runner runs. */
170
+ readonly testDirectories?: readonly TestDirectoryReading[];
171
+ /** The reader of the files the row's test runner runs, from its configuration and the manifest's scripts. */
172
+ readonly testRunner?: TestRunner;
132
173
  /**
133
174
  * The members whose strings name a package the tool loads: the package itself, a
134
175
  * subpath of it, or the package followed by `:` and a name.
@@ -146,7 +187,7 @@ export interface ConventionRow {
146
187
 
147
188
  const SCRIPT = "{js,jsx,ts,tsx}";
148
189
  const MODULE = "{js,mjs,ts,mts}";
149
- const ANY_MODULE = "{js,mjs,cjs,ts,mts,cts}";
190
+ const ANY_MODULE = braced(MODULE_EXTENSIONS);
150
191
  const VITE_CONFIG = `vite.config.${ANY_MODULE}`;
151
192
  /** The legacy configuration files of ESLint: JSON, YAML or a CommonJS module. */
152
193
  const ESLINTRC = [".eslintrc", ".eslintrc.json", ".eslintrc.{yml,yaml}", ".eslintrc.{js,cjs}"];
@@ -195,6 +236,64 @@ const VITEST_CONFIG = `{vitest,vite}.config.${ANY_MODULE}`;
195
236
  */
196
237
  const VITEST_ROOTS = ["test.root", "root"] as const;
197
238
 
239
+ /** The members of a Vitest configuration's `test` object that name setup files. */
240
+ const VITEST_SETUP = ["setupFiles", "globalSetup"] as const;
241
+
242
+ /** Vitest's workspace files, which Vitest 4 no longer reads (https://vitest.dev/guide/workspace). */
243
+ const VITEST_WORKSPACE = `{vitest.workspace,vitest.projects}.${ANY_MODULE}`;
244
+
245
+ /**
246
+ * The Vitest row over one range: its configuration's setup files, those of each inline
247
+ * project of `test.projects`, and, where `workspace`, the workspace file with the setup
248
+ * files of each inline project it lists.
249
+ */
250
+ function vitestRow(range: string, workspace: boolean): ConventionRow {
251
+ const inline = (each: string, files: string): readonly TestFileReading[] =>
252
+ VITEST_SETUP.map((member) => ({
253
+ property: `${each}.test.${member}`,
254
+ files: [files],
255
+ roots: VITEST_ROOTS,
256
+ }));
257
+ return {
258
+ name: "vitest",
259
+ package: "vitest",
260
+ range,
261
+ entries: [
262
+ `**/{vitest,vite}.config.${ANY_MODULE}`,
263
+ `**/{vitest,vite}.config.*.${ANY_MODULE}`,
264
+ `**/{vitest,vite}.*.config.${ANY_MODULE}`,
265
+ ...(workspace ? [VITEST_WORKSPACE] : []),
266
+ ],
267
+ moves: [],
268
+ shortNames: [
269
+ {
270
+ property: "test.coverage.provider",
271
+ files: [VITEST_CONFIG],
272
+ package: "@vitest/coverage-{}",
273
+ },
274
+ ],
275
+ selections: [
276
+ { property: "test.coverage.include", files: [VITEST_CONFIG] },
277
+ { property: "test.coverage.exclude", files: [VITEST_CONFIG] },
278
+ ],
279
+ testFiles: [
280
+ ...VITEST_SETUP.map((member) => ({
281
+ property: `test.${member}`,
282
+ files: [VITEST_CONFIG],
283
+ roots: VITEST_ROOTS,
284
+ })),
285
+ ...inline("test.projects.*", VITEST_CONFIG),
286
+ ...(workspace ? inline("*", VITEST_WORKSPACE) : []),
287
+ ],
288
+ };
289
+ }
290
+
291
+ const PLAYWRIGHT_CONFIG = `playwright.config.${ANY_MODULE}`;
292
+
293
+ /** Playwright's own test-file pattern (https://playwright.dev/docs/api/class-testconfig#test-config-test-match). */
294
+ const PLAYWRIGHT_TEST_MATCH =
295
+ "**/*.{spec,test}.{js,ts,jsx,tsx,cjs,cts,cjsx,ctsx,mjs,mts,mjsx,mtsx}";
296
+
198
297
  /** The entry files of an Angular CLI project, at the workspace root or below `projects`. */
199
298
  const ANGULAR_ENTRIES = [
200
299
  "src/{main,main.server,server,polyfills,test}.ts",
@@ -305,6 +404,22 @@ export const CONVENTION_ROWS: readonly ConventionRow[] = [
305
404
  },
306
405
  ],
307
406
  },
407
+ {
408
+ name: "ava",
409
+ package: "ava",
410
+ range: ">=6.0.0 <8.0.0",
411
+ entries: [],
412
+ moves: [],
413
+ testRunner: AVA_6,
414
+ },
415
+ {
416
+ name: "ava",
417
+ package: "ava",
418
+ range: ">=8.0.0 <9.0.0",
419
+ entries: [],
420
+ moves: [],
421
+ testRunner: AVA_8,
422
+ },
308
423
  {
309
424
  name: "babel",
310
425
  package: "@babel/core",
@@ -359,6 +474,38 @@ export const CONVENTION_ROWS: readonly ConventionRow[] = [
359
474
  entries: [`{,src/}app/**/*.${SCRIPT}`],
360
475
  moves: [],
361
476
  },
477
+ {
478
+ name: "jest",
479
+ package: "jest",
480
+ range: ">=29.0.0 <30.0.0",
481
+ entries: [],
482
+ moves: [],
483
+ testRunner: JEST_29,
484
+ },
485
+ {
486
+ name: "jest",
487
+ package: "jest",
488
+ range: ">=30.0.0 <31.0.0",
489
+ entries: [],
490
+ moves: [],
491
+ testRunner: JEST_30,
492
+ },
493
+ {
494
+ name: "mocha",
495
+ package: "mocha",
496
+ range: ">=10.0.0 <12.0.0",
497
+ entries: [],
498
+ moves: [],
499
+ testRunner: MOCHA_10,
500
+ },
501
+ {
502
+ name: "mocha",
503
+ package: "mocha",
504
+ range: ">=12.0.0 <13.0.0",
505
+ entries: [],
506
+ moves: [],
507
+ testRunner: MOCHA_12,
508
+ },
362
509
  {
363
510
  name: "next",
364
511
  bundles: true,
@@ -469,6 +616,22 @@ export const CONVENTION_ROWS: readonly ConventionRow[] = [
469
616
  { key: "targets.*.source", directory: false },
470
617
  ],
471
618
  },
619
+ {
620
+ name: "playwright",
621
+ package: "@playwright/test",
622
+ range: ">=1.0.0 <2.0.0",
623
+ entries: [PLAYWRIGHT_CONFIG],
624
+ moves: [],
625
+ testDirectories: [
626
+ {
627
+ files: [PLAYWRIGHT_CONFIG],
628
+ directory: "testDir",
629
+ match: "testMatch",
630
+ defaultMatch: PLAYWRIGHT_TEST_MATCH,
631
+ projects: "projects",
632
+ },
633
+ ],
634
+ },
472
635
  {
473
636
  name: "prettier",
474
637
  package: "prettier",
@@ -825,30 +988,6 @@ export const CONVENTION_ROWS: readonly ConventionRow[] = [
825
988
  ],
826
989
  moves: [],
827
990
  },
828
- {
829
- name: "vitest",
830
- package: "vitest",
831
- range: ">=3.2.0 <6.0.0",
832
- entries: [
833
- `**/{vitest,vite}.config.${ANY_MODULE}`,
834
- `**/{vitest,vite}.config.*.${ANY_MODULE}`,
835
- `**/{vitest,vite}.*.config.${ANY_MODULE}`,
836
- ],
837
- moves: [],
838
- shortNames: [
839
- {
840
- property: "test.coverage.provider",
841
- files: [VITEST_CONFIG],
842
- package: "@vitest/coverage-{}",
843
- },
844
- ],
845
- selections: [
846
- { property: "test.coverage.include", files: [VITEST_CONFIG] },
847
- { property: "test.coverage.exclude", files: [VITEST_CONFIG] },
848
- ],
849
- testFiles: [
850
- { property: "test.setupFiles", files: [VITEST_CONFIG], roots: VITEST_ROOTS },
851
- { property: "test.globalSetup", files: [VITEST_CONFIG], roots: VITEST_ROOTS },
852
- ],
853
- },
991
+ vitestRow(">=3.2.0 <4.0.0", true),
992
+ vitestRow(">=4.0.0 <6.0.0", false),
854
993
  ];