test-inventory 0.7.0 → 0.9.0

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 (67) hide show
  1. package/CHANGELOG.md +180 -0
  2. package/README.md +16 -10
  3. package/dist/case-titles.d.ts +22 -0
  4. package/dist/case-titles.js +184 -0
  5. package/dist/cli.d.ts +1 -1
  6. package/dist/cli.js +5 -5
  7. package/dist/config-dependencies.js +27 -3
  8. package/dist/config-runs.d.ts +117 -3
  9. package/dist/config-runs.js +1015 -19
  10. package/dist/config.d.ts +42 -1
  11. package/dist/config.js +287 -21
  12. package/dist/dependency-hash.d.ts +13 -5
  13. package/dist/dependency-hash.js +56 -12
  14. package/dist/diagnostics.js +16 -1
  15. package/dist/extract.d.ts +2 -0
  16. package/dist/extract.js +89 -29
  17. package/dist/files.js +4 -2
  18. package/dist/filter.js +1 -0
  19. package/dist/framework-version.d.ts +13 -2
  20. package/dist/framework-version.js +207 -7
  21. package/dist/frameworks/bindings.d.ts +14 -0
  22. package/dist/frameworks/bindings.js +99 -6
  23. package/dist/frameworks/bun.d.ts +42 -0
  24. package/dist/frameworks/bun.js +272 -0
  25. package/dist/frameworks/common.d.ts +3 -1
  26. package/dist/frameworks/common.js +18 -9
  27. package/dist/frameworks/cypress.d.ts +31 -0
  28. package/dist/frameworks/cypress.js +70 -0
  29. package/dist/frameworks/jasmine.d.ts +28 -0
  30. package/dist/frameworks/jasmine.js +218 -0
  31. package/dist/frameworks/jest.d.ts +46 -0
  32. package/dist/frameworks/jest.js +442 -0
  33. package/dist/frameworks/mocha.d.ts +50 -0
  34. package/dist/frameworks/mocha.js +306 -0
  35. package/dist/frameworks/node.d.ts +30 -0
  36. package/dist/frameworks/node.js +268 -0
  37. package/dist/frameworks/playwright.d.ts +13 -0
  38. package/dist/frameworks/playwright.js +57 -0
  39. package/dist/frameworks/test-functions.d.ts +194 -0
  40. package/dist/frameworks/test-functions.js +534 -0
  41. package/dist/frameworks/vitest.d.ts +15 -62
  42. package/dist/frameworks/vitest.js +69 -389
  43. package/dist/frameworks/webdriverio.d.ts +27 -0
  44. package/dist/frameworks/webdriverio.js +37 -0
  45. package/dist/imported-values.js +15 -1
  46. package/dist/model.d.ts +9 -2
  47. package/dist/node-scripts.d.ts +6 -0
  48. package/dist/node-scripts.js +85 -0
  49. package/dist/options.d.ts +16 -3
  50. package/dist/options.js +22 -3
  51. package/dist/parse.js +17 -2
  52. package/dist/records.d.ts +8 -2
  53. package/dist/records.js +94 -22
  54. package/dist/resolve.d.ts +21 -4
  55. package/dist/resolve.js +91 -52
  56. package/dist/scan-file.d.ts +8 -0
  57. package/dist/scan-file.js +21 -3
  58. package/dist/scan.js +62 -12
  59. package/dist/toml.d.ts +13 -0
  60. package/dist/toml.js +172 -0
  61. package/dist/types.d.ts +27 -11
  62. package/dist/values.d.ts +15 -0
  63. package/dist/values.js +120 -2
  64. package/dist/yaml.d.ts +12 -0
  65. package/dist/yaml.js +148 -0
  66. package/package.json +7 -6
  67. package/schema/v1.json +30 -8
@@ -1,4 +1,7 @@
1
1
  import { type ConfigFile, type Configs, type Setting } from './config.ts';
2
+ import { type MochaInterface } from './frameworks/mocha.ts';
3
+ import type { WebdriverIOFramework } from './frameworks/webdriverio.ts';
4
+ import type { ImportMap } from './resolve.ts';
2
5
  import type { FileConfig, VitestTags } from './records.ts';
3
6
  import type { Framework, ProjectRecord } from './types.ts';
4
7
  /** What makes a file run: as a test, or as a Vitest benchmark, which plain `vitest` doesn't run. */
@@ -58,6 +61,11 @@ export declare class ConfigRuns {
58
61
  private readonly projects;
59
62
  private readonly ignoreRules;
60
63
  private readonly folderStates;
64
+ /** The project Jest runs with when no config is found up to the root. */
65
+ private jestDefaults;
66
+ private mochaDefaults;
67
+ private nodeRuns;
68
+ private bunFiles;
61
69
  /** The Vitest configs whose projects are being found, with their names, to stop at one whose projects name itself. */
62
70
  private readonly expanding;
63
71
  constructor(configs: Configs, framework: Framework, version: [number, number] | null, findsFiles: boolean);
@@ -84,6 +92,66 @@ export declare class ConfigRuns {
84
92
  about: ProjectAbout;
85
93
  runs: (file: string) => unknown;
86
94
  } | null;
95
+ /** Mocha runs one set of files, from the config it starts with, or its defaults without one. */
96
+ private placeMocha;
97
+ /**
98
+ * The files Mocha runs, as it looks them up from the root, the folder it starts in, wherever its config is: each
99
+ * `spec` entry a glob, a file, a file without its extension, or a folder whose files with one of the `extension`s it
100
+ * takes, also in folders below with `recursive`, less those `ignore` matches; and the `file` entries, loaded first.
101
+ * With globs, every file they match, less `ignore`. A timeout may be written as `'2s'`.
102
+ */
103
+ private mochaProject;
104
+ /**
105
+ * Jasmine runs one set of files, from its config. Without one it runs none, unless it is given files: Karma and
106
+ * Angular projects give it theirs from their own configs, which the scan doesn't read, so their globs decide.
107
+ */
108
+ private placeJasmine;
109
+ /**
110
+ * The files Jasmine runs: those under `spec_dir`, from the root, that a `spec_files` glob matches, less those a glob
111
+ * starting with `!` matches. With globs, every file they match, as files given to Jasmine replace `spec_files`.
112
+ */
113
+ private jasmineProject;
114
+ /**
115
+ * Cypress runs a file in its e2e project, or in its component project when the config sets up component testing.
116
+ * Without a config it runs nothing, unless it is given files.
117
+ */
118
+ private placeCypress;
119
+ /**
120
+ * Cypress's testing types as projects: `e2e`, and `component` when the config has it. Each runs the files under the
121
+ * config's folder that its `specPattern` matches, dot files left out, without those its `excludeSpecPattern` matches,
122
+ * dot files included, and those in `node_modules` unless a `specPattern` names it; component testing also leaves out
123
+ * the files e2e's `specPattern` matches. `cypress run` matches each pattern against the whole path, as globby does.
124
+ */
125
+ private cypressProjects;
126
+ /** `bun test` runs the files of `bunFilesOf`, with the settings of the `bunfig.toml` in the root, when there is one. */
127
+ private placeBun;
128
+ /**
129
+ * The files `bun test` runs: those under `[test] root`, the root by default, whose name without its extension ends
130
+ * with `.test`, `_test`, `.spec` or `_spec`, with a JavaScript or TypeScript extension, outside dot folders and
131
+ * `node_modules`, and from Bun 1.3.11 outside the folders and files a `pathIgnorePatterns` glob matches. `[test] retry`
132
+ * applies to every test, and the tests of the files a `concurrentTestGlob` glob matches run at once.
133
+ */
134
+ private bunFilesOf;
135
+ /** `node --test` runs the files its arguments name, or without any, those its default patterns match; see `nodeFiles`. */
136
+ private placeNode;
137
+ /**
138
+ * The files `node --test` runs from the root, outside dot folders and `node_modules`: those the arguments of the
139
+ * package.json script that runs it give, the `test` script first, each a glob or a path, and from Node.js 26.8 a folder
140
+ * for the default patterns inside it; without arguments, the default patterns. They take TypeScript files too from
141
+ * Node.js 22.18, which strips types by default.
142
+ */
143
+ private nodeFiles;
144
+ /** WebdriverIO runs the files of the config in the root; without one, it runs nothing, unless it is given files. */
145
+ private placeWebdriverIO;
146
+ /**
147
+ * The files `wdio` runs: those under `rootDir`, the config's folder by default, that a `specs` glob matches, also in
148
+ * the nested lists that group files into one worker, less those `exclude` leaves out. A capability's own `specs` replace the config's for it, and its `exclude` adds to the config's. Globs leave out
149
+ * dot files and folders, and one without a `/` matches a file's name at any depth. When every `exclude` entry holds a
150
+ * `/`, `\` or `*`, they are globs too; otherwise each one leaves out every file whose URL contains it. Files given
151
+ * with `--spec` replace `specs`, so scanned with globs, every file they match counts as run, less the excludes. The
152
+ * config's `mochaOpts.timeout` and `retries`, or `jasmineOpts.defaultTimeoutInterval`, apply to every test.
153
+ */
154
+ private webdriverioProject;
87
155
  private projectsOf;
88
156
  /** Vitest's `retry`: before 4.1, which reads only a count, an object is one the scan can't work out. */
89
157
  private vitestRetry;
@@ -107,16 +175,41 @@ export declare class ConfigRuns {
107
175
  /** A folder's status and the rules inside it, worked out once per project folder however many files it holds. */
108
176
  private folderState;
109
177
  private rulesIn;
178
+ /** A config for the defaults of a runner started where no config is found. */
179
+ private noConfig;
180
+ /**
181
+ * Jest's projects: the config itself, or the entries of its `projects`. A path or glob there names a folder, whose
182
+ * config is the one Jest finds from it, or a config file; an object is a project whose `rootDir` defaults to the
183
+ * config's folder. The config's own test files then count only when an entry names its folder.
184
+ */
185
+ private jestProjects;
186
+ /**
187
+ * The files a Jest project runs, as Jest's SearchSource picks them: under one of `roots`, with an extension in
188
+ * `moduleFileExtensions`, not left out by `modulePathIgnorePatterns`, matching `testMatch` or `testRegex`, and not
189
+ * `testPathIgnorePatterns`. Paths and patterns are matched with `/`, and `<rootDir>` stands for `rootDir`. `global`
190
+ * is the config Jest is started with, whose `testTimeout` applies to every project in Jest 29.
191
+ */
192
+ private jestProject;
110
193
  /**
111
194
  * The projects of a Vitest config, the one the runner starts with or, in Vitest 5, a config another lists, whose name
112
195
  * then goes around the names of its projects.
113
196
  */
197
+ /**
198
+ * A project's settings over those of its `preset` when that is a local file, as `'../../jest.preset.js'`, which Jest
199
+ * finds from `rootDir`: the project's own settings win, as Jest merges them. A preset that is a package isn't read.
200
+ */
201
+ private withPreset;
114
202
  private vitestProjects;
115
203
  /**
116
204
  * A project written in `test.projects`, which inherits the root config as each version of Vitest decides, named
117
205
  * after `index` when it has no name of its own.
118
206
  */
119
207
  private vitestEntry;
208
+ /**
209
+ * The folder an inline project runs from. Without a root of its own, every version runs it from the config's root;
210
+ * Vitest 5 also resolves its own root from there, where older versions resolve it from the config's folder.
211
+ */
212
+ private inlineRoot;
120
213
  /**
121
214
  * The projects of a config file or folder `test.projects` names: the config's own, also the projects it lists in
122
215
  * Vitest 5, or a project with Vitest's defaults for a folder without a config. Without a name, a project is named
@@ -125,15 +218,36 @@ export declare class ConfigRuns {
125
218
  private vitestPath;
126
219
  /**
127
220
  * A Vitest project, with the name Vitest gives it: its files are found from `test.dir`, else `test.root` or `root`,
128
- * else its folder. With browser mode on, each of `browser.instances` is a project of its own, named as Vitest names it.
221
+ * else its folder; with `isRoot`, `folder` is its root already. With browser mode on, each of `browser.instances` is
222
+ * a project of its own, named as Vitest names it.
129
223
  */
130
224
  private vitestProject;
131
225
  /** The files a Vitest project runs and its settings; `ownTags`, when set, in place of the tags in `settings`. */
132
226
  private vitestFiles;
133
227
  }
134
228
  /**
135
- * What the config a file uses gives it: Playwright's `forbidOnly`, read from the top level only, as Playwright reads
136
- * it, and for each test, the projects that run it and what they set; null without a config.
229
+ * What the config a file uses gives it: Playwright's `forbidOnly` or Vitest's `allowOnly`, read from the top level
230
+ * only, as the runners read them, and for each test, the projects that run it and what they set; null without a config.
137
231
  */
138
232
  export declare function fileConfig(placement: Placement, framework: Framework, version: [number, number] | null, file: string): FileConfig | null;
233
+ /**
234
+ * The interface Mocha's `ui` gives a file's tests: BDD by default, or TDD. Another one, QUnit, exports or a package,
235
+ * declares tests in a way the scan doesn't read, which is reported on the config, and the file is read as BDD.
236
+ */
237
+ export declare function mochaInterface(placement: Placement, configs: Configs): MochaInterface;
238
+ /** The interface WebdriverIO's `mochaOpts.ui` gives a file's tests, read as Mocha's `ui`. */
239
+ export declare function webdriverioInterface(placement: Placement, configs: Configs): MochaInterface | undefined;
240
+ /**
241
+ * The framework a WebdriverIO config runs the specs with: Mocha by default, or Jasmine. Cucumber runs feature files,
242
+ * which the scan doesn't read; that and a value the scan can't work out are reported on the config when `configs` is
243
+ * given, and the files are read as Mocha's.
244
+ */
245
+ export declare function webdriverioFramework(placement: Placement, configs: Configs | null): WebdriverIOFramework;
246
+ /**
247
+ * How the config a file runs with maps its imports, for its dependencies: Vite's `resolve.alias` and Vitest's
248
+ * `test.alias`, from the project and from the config file, and Jest's `moduleNameMapper`, `modulePaths` and
249
+ * `moduleDirectories` other than `node_modules`, with `<rootDir>` in them. Null for the other runners, without a
250
+ * config, or when it maps nothing.
251
+ */
252
+ export declare function importMap(placement: Placement, framework: Framework): ImportMap | null;
139
253
  export {};