test-inventory 0.10.0 → 0.10.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # test-inventory
2
2
 
3
+ ## 0.10.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#103](https://github.com/Huldoser/test-inventory/pull/103) [`2e6c3bf`](https://github.com/Huldoser/test-inventory/commit/2e6c3bfb905a0db110ab8a6d51449ed03ff997b0) - Clarify declared states, conditional skips and expected failures in CLI help, API comments, recipes and CI reports.
8
+ Correct config inheritance and failure-scope descriptions. Add first-use guidance, concepts and troubleshooting,
9
+ preserve existing documentation URLs, and publish the diff schema alongside the inventory schema.
10
+
11
+ - [#104](https://github.com/Huldoser/test-inventory/pull/104) [`cf08b52`](https://github.com/Huldoser/test-inventory/commit/cf08b529fa20fb4ce389dc6be70a229a9a11cfaf) - Add a checked complete library example, a CLI/library/MCP walkthrough, compact agent guidance and feature-level
12
+ compatibility notes. Prioritize essential Markdown references and distinguish illustrative excerpts from runnable
13
+ code by their copy controls.
14
+
15
+ - [#105](https://github.com/Huldoser/test-inventory/pull/105) [`9325281`](https://github.com/Huldoser/test-inventory/commit/9325281f366435ab227da50e328b0017a7339cde) - Add focused documentation guides for each supported test framework and separate shared scanner limits from runner-specific exceptions.
16
+
17
+ - [#107](https://github.com/Huldoser/test-inventory/pull/107) [`ef35e6e`](https://github.com/Huldoser/test-inventory/commit/ef35e6e4cc4fea9e0f852a8a21c8640f75723726) - Add checked examples for Cypress component and E2E selection, WebdriverIO with Jasmine, Playwright projects and Bun case expansion to the framework guides.
18
+
19
+ - [#106](https://github.com/Huldoser/test-inventory/pull/106) [`30dc03f`](https://github.com/Huldoser/test-inventory/commit/30dc03f7e2ba00d20ef6fd4341d19cf1138970cb) - Keep skipped-test queries consistent with the first scan, add focused Vitest, Jest and Mocha examples, and link framework guides to relevant next steps.
20
+
21
+ - [#108](https://github.com/Huldoser/test-inventory/pull/108) [`7891cc0`](https://github.com/Huldoser/test-inventory/commit/7891cc086fa52503aaf8499d862ec265c36a70a3) - Read context modifiers and subtests in named node:test callbacks, retain valid parent test IDs when callbacks appear before their callers, recognize Windows patterns naming linked node:test folders, and reject TOML inline tables with missing commas.
22
+
23
+ Stop claiming that Jest runs tests when a required local preset is missing. Config-based discovery returns no files, while explicit globs retain the declarations with a file-not-run diagnostic.
24
+
25
+ Validate node:test concurrency values, report unknown values, and inherit concurrency through parent tests without resetting it for null or undefined options.
26
+
27
+ ## 0.10.1
28
+
29
+ ### Patch Changes
30
+
31
+ - [#99](https://github.com/Huldoser/test-inventory/pull/99) [`df8968d`](https://github.com/Huldoser/test-inventory/commit/df8968dc0357353913b96fadd417a266ab290b2c) - Keep Playwright declaring modifiers when functions are stored in variables or selected inline. Read logical choices with the same rules as the other runners, and classify each nested branch once to avoid exponential traversal.
32
+
33
+ Match Vite's alias merge precedence and preserve object aliases when mixed with lists. Mark imports as unfollowed when an unreadable alias entry or find could match them.
34
+
35
+ Ignore annotation and step line numbers in inventory diffs, so moving unchanged tests to another line does not report metadata changes.
36
+
37
+ - [#100](https://github.com/Huldoser/test-inventory/pull/100) [`fa10d39`](https://github.com/Huldoser/test-inventory/commit/fa10d3970046e4e99b6f175ff5dcf0eee13ccfcd) - Read locally declared describe callbacks passed by name, preserving suite placement, inherited state, lexical values and expanded table arguments. Keep suite hashes, dependencies and nested parent links complete, including when a child is written before its calling parent. Apply the existing helper traversal limits and runner callback checks to these callbacks.
38
+
3
39
  ## 0.10.0
4
40
 
5
41
  ### Minor Changes
package/README.md CHANGED
@@ -1,19 +1,24 @@
1
1
  # <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Huldoser/test-inventory/main/docs/public/logo-dark.svg"><img src="https://raw.githubusercontent.com/Huldoser/test-inventory/main/docs/public/logo-light.svg" alt="test-inventory" height="48"></picture>
2
2
 
3
- Test metadata from source code, not from test results.
3
+ List tests, their declared states and skip reasons without running the suite.
4
4
 
5
- test-inventory reads Playwright, Vitest, Jest, Mocha, Jasmine, Cypress, WebdriverIO, node:test and Bun test files and
6
- lists every test declaration as JSON: its title, file and lines, the describes around it, its tags and annotations, and
7
- whether it is active, skipped, fixme, todo, expected to fail or in a file the runner refuses to load, with the condition
8
- when the state only applies sometimes. Each test has an id that survives a move to another line and a hash of everything
9
- it runs, from its hooks and fixtures to its page objects, test data, snapshots and config, so it can also list the tests
10
- a change can affect. It parses the code and runs nothing, so it needs no browsers, no build and no runner configuration.
5
+ test-inventory reads Playwright, Vitest, Jest, Mocha, Jasmine, Cypress, WebdriverIO, node:test and Bun files and writes
6
+ JSON. Each test record includes its title, location, suite, tags, annotations and state. Conditional states keep the
7
+ condition as source text; they do not establish what happened in a particular run.
8
+
9
+ Stable ids and code hashes help compare revisions and find tests a change can affect. The scanner reads supported
10
+ runner configs and project imports without executing them. It needs no browsers, build or additional runner setup.
11
+ Check diagnostics before treating a scan as complete; [known limits](https://huldoser.github.io/test-inventory/guide/limits)
12
+ describes what static analysis can miss.
11
13
 
12
14
  Compare saved scans with `test-inventory diff old.json new.json`: additions, removals, renames and moves, changes to
13
15
  code, dependencies, state and tags, as JSON or Markdown. See [Compare inventories](https://huldoser.github.io/test-inventory/guide/diff).
14
16
 
15
17
  Documentation: [huldoser.github.io/test-inventory](https://huldoser.github.io/test-inventory/)
16
18
 
19
+ For a focused walkthrough, choose a [framework guide](https://huldoser.github.io/test-inventory/frameworks/).
20
+ Each covers its runner's scan commands, examples, syntax and limitations.
21
+
17
22
  ## Install
18
23
 
19
24
  ```sh
@@ -40,7 +45,7 @@ For this spec from a trading app's UI tests, `tests/alerts.spec.ts`:
40
45
 
41
46
  <!-- code: trading-web/tests/alerts.spec.ts -->
42
47
 
43
- ```ts
48
+ ```ts excerpt
44
49
  import { test, expect } from '../fixtures/index';
45
50
  import { isMarketClosed } from '../test-data/market-hours';
46
51
 
@@ -106,7 +111,7 @@ in Claude Code, Cursor, VS Code and other MCP clients ask it which tests a proje
106
111
  ## Limits
107
112
 
108
113
  - Config files are read as code, never run, and only in part: settings computed at run time, as from `process.env`,
109
- can't be worked out, and settings such as `workers` or `use` are not read.
114
+ can't be worked out. Settings such as `workers` and config `use` are not interpreted as test record settings.
110
115
  - Values from installed packages are not worked out; values from the project's own files are. A tag or title that
111
116
  comes from a package gets a diagnostic that names the module. A custom `test` object is followed through as many files as it takes, through relative
112
117
  paths, config and tsconfig path aliases, `#` imports in package.json and workspace packages; one that can't be followed gets
package/dist/cli.d.ts CHANGED
@@ -6,6 +6,6 @@ export interface Io {
6
6
  /** Read for `--related -`. */
7
7
  stdin?: Readable;
8
8
  }
9
- export declare const HELP = "Usage: test-inventory [glob...] [options]\n test-inventory diff old.json new.json [--format json|markdown] [--pretty] [--output file]\n\nLists the tests in the matching files as JSON, read from the source code without running them. Without globs, the\ntest files are those the runner's configs in the root and the folders below it run, or for node:test and Bun those\nnode --test and bun test run.\n\nOptions:\n --framework <name> playwright, vitest, jest, mocha, jasmine, cypress, webdriverio, node or bun\n (default: the one the project uses)\n --root <dir> project root; paths in the output are relative to it (default: current directory)\n --ignore <glob> leave out matching files; can be repeated (node_modules is always left out)\n --framework-version <x.y.z> apply the rules of this framework version instead of the one in the project\n --comments <mode> comments above tests: all, non-active or none (default: non-active)\n --expand-cases one record per case of a .each or .for table and per pass of a loop, with its title\n --state <state> keep tests in this state, such as skip or fixme; can be repeated\n --tag <tag> keep tests with this tag, such as @smoke; can be repeated\n --grep <regex> keep tests whose full name matches, ignoring case\n --only keep tests that use .only, or are inside a describe that does\n --without-reason keep tests that don't run and give no reason\n --related <file> keep tests a change to this file can affect; can be repeated; - reads files, one per\n line, from standard input, as git diff --name-only writes them\n --fields <keys> write only these keys of each test, separated by commas; id is always kept\n --format <format> json or jsonl, one record per line (default: json)\n -o, --output <file> write to a file instead of standard output\n --pretty indent the JSON\n -h, --help show this help\n -v, --version show the version\n\nExit codes: 0 when the scan finishes, even with diagnostics; 2 for invalid arguments, an output that cannot be\nwritten, or a crash. 1 is reserved for a future release.\n\nExamples:\n test-inventory \"tests/**/*.spec.ts\" --framework playwright --output inventory.json\n test-inventory \"tests/**/*.spec.ts\" --framework playwright --state skip --fields fullName,reason\n";
9
+ export declare const HELP = "Usage: test-inventory [glob...] [options]\n test-inventory diff old.json new.json [--format json|markdown] [--pretty] [--output file]\n\nLists the tests in the matching files as JSON, read from the source code without running them. Without globs, the\ntest files are those the runner's configs in the root and the folders below it run, or for node:test and Bun those\nnode --test and bun test run.\n\nOptions:\n --framework <name> playwright, vitest, jest, mocha, jasmine, cypress, webdriverio, node or bun\n (default: the one the project uses)\n --root <dir> project root; paths in the output are relative to it (default: current directory)\n --ignore <glob> leave out matching files; can be repeated (node_modules is always left out)\n --framework-version <x.y.z> apply the rules of this framework version instead of the one in the project\n --comments <mode> comments above tests: all, non-active or none (default: non-active)\n --expand-cases one record per case of a .each or .for table and per pass of a loop, with its title\n --state <state> keep tests in this state, such as skip or fixme; can be repeated\n --tag <tag> keep tests with this tag, such as @smoke; can be repeated\n --grep <regex> keep tests whose full name matches, ignoring case\n --only keep tests that use .only, or are inside a describe that does\n --without-reason keep non-active tests without a reason, excluding notLoaded\n --related <file> keep tests a change to this file can affect; can be repeated; - reads files, one per\n line, from standard input, as git diff --name-only writes them\n --fields <keys> write only these keys of each test, separated by commas; id is always kept\n --format <format> json or jsonl, one record per line (default: json)\n -o, --output <file> write to a file instead of standard output\n --pretty indent the JSON\n -h, --help show this help\n -v, --version show the version\n\nExit codes: 0 when the scan finishes, even with diagnostics; 2 for invalid arguments, an output that cannot be\nwritten, or a crash. 1 is reserved for a future release.\n\nExamples:\n test-inventory \"tests/**/*.spec.ts\" --framework playwright --output inventory.json\n test-inventory \"tests/**/*.spec.ts\" --framework playwright --state skip --fields fullName,reason\n";
10
10
  /** Runs the command line with the given arguments and streams. Resolves to the exit code. */
11
11
  export declare function run(argv: string[], io: Io): Promise<number>;
package/dist/cli.js CHANGED
@@ -30,7 +30,7 @@ Options:
30
30
  --tag <tag> keep tests with this tag, such as @smoke; can be repeated
31
31
  --grep <regex> keep tests whose full name matches, ignoring case
32
32
  --only keep tests that use .only, or are inside a describe that does
33
- --without-reason keep tests that don't run and give no reason
33
+ --without-reason keep non-active tests without a reason, excluding notLoaded
34
34
  --related <file> keep tests a change to this file can affect; can be repeated; - reads files, one per
35
35
  line, from standard input, as git diff --name-only writes them
36
36
  --fields <keys> write only these keys of each test, separated by commas; id is always kept
@@ -1030,7 +1030,7 @@ export class ConfigRuns {
1030
1030
  const rootDir = jestRootDir(written, folder);
1031
1031
  if (typeof rootDir !== 'string')
1032
1032
  return this.unknownProject(config, rootDir, 'rootDir');
1033
- const settings = this.withPreset(config, written, rootDir);
1033
+ const { settings, refusal: presetRefusal } = this.withPreset(written, rootDir);
1034
1034
  const isJest30 = this.version === null || this.version[0] >= 30;
1035
1035
  const lists = {};
1036
1036
  const defaults = [
@@ -1058,12 +1058,12 @@ export class ConfigRuns {
1058
1058
  const testRegex = lists.testRegex.map((item) => typeof item === 'string' ? regExp(item, '') : item);
1059
1059
  const invalid = lists.testRegex.find((_, index) => testRegex[index] === null);
1060
1060
  const testMatchSetting = settingAt(settings, ['testMatch']);
1061
- let refusal = null;
1061
+ let refusal = presetRefusal;
1062
1062
  if (invalid !== undefined) {
1063
- refusal = `The config's testRegex '${String(invalid)}' is not a regular expression, so Jest fails to start.`;
1063
+ refusal ??= `The config's testRegex '${String(invalid)}' is not a regular expression, so Jest fails to start.`;
1064
1064
  }
1065
1065
  else if (testRegex.length > 0 && isJestSet(testMatchSetting)) {
1066
- refusal = 'The config sets both testMatch and testRegex, which Jest refuses, so it runs no tests.';
1066
+ refusal ??= 'The config sets both testMatch and testRegex, which Jest refuses, so it runs no tests.';
1067
1067
  }
1068
1068
  const roots = lists.roots
1069
1069
  .map((item) => replaceRootDir(rootDir, item))
@@ -1145,20 +1145,22 @@ export class ConfigRuns {
1145
1145
  * A project's settings over those of its `preset` when that is a local file, as `'../../jest.preset.js'`, which Jest
1146
1146
  * finds from `rootDir`: the project's own settings win, as Jest merges them. A preset that is a package isn't read.
1147
1147
  */
1148
- withPreset(config, settings, rootDir) {
1148
+ withPreset(settings, rootDir) {
1149
1149
  const preset = settingAt(settings, ['preset']);
1150
1150
  if (preset?.kind !== 'value' || typeof preset.value !== 'string' || !isLocalPreset(preset.value))
1151
- return settings;
1151
+ return { settings, refusal: null };
1152
1152
  const target = path.resolve(rootDir, replaceRootDir(rootDir, preset.value));
1153
1153
  const file = ['', '.js', '.json', '.cjs'].map((extension) => target + extension).find(isFileAt);
1154
1154
  if (!file) {
1155
- this.configs.reportConfig(config, `The config's preset '${preset.value}' doesn't exist, so Jest fails to start.`);
1156
- return settings;
1155
+ return {
1156
+ settings,
1157
+ refusal: `The config's preset '${preset.value}' doesn't exist, so Jest fails to start.`,
1158
+ };
1157
1159
  }
1158
1160
  const base = this.configs.at(file).settings;
1159
1161
  if (base.kind !== 'object' || settings.kind !== 'object')
1160
- return settings;
1161
- return { ...settings, keys: new Map([...base.keys, ...settings.keys]) };
1162
+ return { settings, refusal: null };
1163
+ return { settings: { ...settings, keys: new Map([...base.keys, ...settings.keys]) }, refusal: null };
1162
1164
  }
1163
1165
  vitestProjects(config, container = null) {
1164
1166
  const folder = path.dirname(config.file);
@@ -1967,6 +1969,8 @@ function viteAliases(setting) {
1967
1969
  return [];
1968
1970
  return setting.items.flatMap((item) => {
1969
1971
  const find = settingAt(item, ['find']);
1972
+ if (find?.kind === 'unknown')
1973
+ return [{ find: /./, replacements: [], replacesName: false }];
1970
1974
  const replacements = stringOf(settingAt(item, ['replacement']));
1971
1975
  const name = find?.kind === 'value' && typeof find.value === 'string' ? find.value : null;
1972
1976
  const pattern = find?.kind === 'regex' ? regExp(find.source, find.flags) : null;
package/dist/config.d.ts CHANGED
@@ -50,7 +50,7 @@ export declare function settingAt(setting: Setting, keys: readonly string[]): Se
50
50
  * Vite's `mergeConfig(base, over)`: objects merge key by key, lists are joined with a single setting taken as a list
51
51
  * of one, and `null` or `undefined` keeps the other side.
52
52
  */
53
- export declare function mergeDeep(base: Setting, over: Setting): Setting;
53
+ export declare function mergeDeep(base: Setting, over: Setting, rootPath?: string): Setting;
54
54
  /** The config a scanned file uses, read once however many files use it. */
55
55
  export interface ConfigFile {
56
56
  /** The config's absolute path. */
package/dist/config.js CHANGED
@@ -232,7 +232,7 @@ function either(a, b, at) {
232
232
  * Vite's `mergeConfig(base, over)`: objects merge key by key, lists are joined with a single setting taken as a list
233
233
  * of one, and `null` or `undefined` keeps the other side.
234
234
  */
235
- export function mergeDeep(base, over) {
235
+ export function mergeDeep(base, over, rootPath = '') {
236
236
  if (isNullish(over))
237
237
  return base;
238
238
  if (isNullish(base) || over.kind === 'unknown')
@@ -249,10 +249,46 @@ export function mergeDeep(base, over) {
249
249
  const keys = new Map(base.kind === 'object' && !over.rest ? base.keys : []);
250
250
  for (const [key, value] of over.keys) {
251
251
  const existing = child(base, key);
252
- keys.set(key, existing ? mergeDeep(existing, value) : value);
252
+ keys.set(key, existing
253
+ ? key === 'alias' && (rootPath === '' || rootPath === 'resolve')
254
+ ? mergeAliases(existing, value)
255
+ : mergeDeep(existing, value, rootPath ? `${rootPath}.${key}` : key)
256
+ : value);
253
257
  }
254
258
  return { kind: 'object', keys, rest: over.rest ?? (base.kind === 'object' ? base.rest : base) };
255
259
  }
260
+ /** Vite puts overriding list aliases first and normalizes object aliases when either side is a list. */
261
+ function mergeAliases(base, over) {
262
+ if (isNullish(over))
263
+ return base;
264
+ if (isNullish(base))
265
+ return over;
266
+ if (base.kind === 'object' && over.kind === 'object') {
267
+ return {
268
+ kind: 'object',
269
+ keys: new Map([...(over.rest ? [] : base.keys), ...over.keys]),
270
+ rest: over.rest ?? base.rest,
271
+ };
272
+ }
273
+ const entries = (setting) => {
274
+ if (setting.kind === 'list')
275
+ return setting.items;
276
+ if (setting.kind !== 'object')
277
+ return [setting];
278
+ return [
279
+ ...[...setting.keys].map(([find, replacement]) => ({
280
+ kind: 'object',
281
+ keys: new Map([
282
+ ['find', { kind: 'value', value: find }],
283
+ ['replacement', replacement],
284
+ ]),
285
+ rest: null,
286
+ })),
287
+ ...(setting.rest ? [setting.rest] : []),
288
+ ];
289
+ };
290
+ return { kind: 'list', items: [...entries(over), ...entries(base)] };
291
+ }
256
292
  /** Works out a config's settings from its code, following the modules it imports them from. */
257
293
  class ConfigCode {
258
294
  /** The modules read for the config besides itself, in the order they were first followed. */
@@ -1491,11 +1491,13 @@ export function fileDependencies(graph, main, extraction, types, report, runsWit
1491
1491
  let units = suiteUnits.get(suite);
1492
1492
  if (!units) {
1493
1493
  // A describe without a callback has no tests in it.
1494
- const fn = suite.declaration.fn;
1494
+ const fn = (suite.declaration.fn ?? suite.declaration.hashed);
1495
+ // Its load code is listed separately; following a named reference would pull in sibling test bodies too.
1496
+ const callback = suite.declaration.fn ? [] : suite.call.arguments.slice(-1);
1495
1497
  units = [
1496
1498
  graph.unit(moduleOf(suite.frame), [suite.call, ...bodyNodes(fn).filter(isLoadCode)],
1497
1499
  // Offsets in another file could match these by chance.
1498
- [fn, ...suite.cuts, ...(suite.frame === main ? registered : [])], types),
1500
+ [fn, ...callback, ...suite.cuts, ...(suite.frame === main ? registered : [])], types),
1499
1501
  ...registering(suite.registeredBy),
1500
1502
  ];
1501
1503
  suiteUnits.set(suite, units);
@@ -64,7 +64,7 @@ export const REJECTS_FILE = {
64
64
  jasmine: new Set(['invalid-chain', 'test-without-body', 'async-describe', 'describe-throws']),
65
65
  cypress: new Set(['invalid-chain', 'test-without-body', 'describe-throws']),
66
66
  webdriverio: new Set(['invalid-chain', 'test-without-body', 'async-describe', 'describe-throws']),
67
- node: new Set(['invalid-chain']),
67
+ node: new Set(['invalid-chain', 'unresolved-option']),
68
68
  bun: new Set(['invalid-chain', 'test-without-body']),
69
69
  };
70
70
  export function toDiagnostic(problem, relativeFilePath, source, testId = null) {
package/dist/diff.js CHANGED
@@ -76,6 +76,10 @@ function changed(before, after, hashesComparable) {
76
76
  return false;
77
77
  if (key === 'tags')
78
78
  return stable([...before.tags].sort()) !== stable([...after.tags].sort());
79
+ if (key === 'annotations' || key === 'steps') {
80
+ const content = (test) => test[key].map((item) => Object.fromEntries(Object.entries(item).filter(([name]) => name !== 'lineStart')));
81
+ return stable(content(before)) !== stable(content(after));
82
+ }
79
83
  return stable(before[key]) !== stable(after[key]);
80
84
  })
81
85
  .sort();
package/dist/extract.js CHANGED
@@ -1300,10 +1300,7 @@ class Walker {
1300
1300
  this.declaredIn.set(test, context.declaredIn);
1301
1301
  this.cut(context.scope, call);
1302
1302
  // A function declared in the file and passed by name runs as the test body too.
1303
- const body = declaration.fn ?? declaration.hashed;
1304
- if (body) {
1305
- if (!declaration.fn)
1306
- this.walkedAtCall.add(body);
1303
+ this.withDeclarationBody(declaration, call, (body) => {
1307
1304
  this.withCase(body, args, () => {
1308
1305
  this.visitCallback(body, {
1309
1306
  ...context,
@@ -1316,7 +1313,29 @@ class Walker {
1316
1313
  helper: null,
1317
1314
  });
1318
1315
  });
1316
+ });
1317
+ }
1318
+ /** Named callbacks keep their lexical scopes and use the same traversal bounds as directly called helpers. */
1319
+ withDeclarationBody(declaration, call, walk) {
1320
+ const fn = declaration.fn ?? declaration.hashed;
1321
+ if (!fn)
1322
+ return;
1323
+ if (declaration.fn) {
1324
+ walk(fn);
1325
+ return;
1326
+ }
1327
+ this.walkedAtCall.add(fn);
1328
+ if (this.callStack.includes(fn) || this.callStack.length >= MAX_DEPTH) {
1329
+ this.report(problem('test-in-function', call, 'The named callback recurses or exceeds the helper depth limit, so its nested tests are not followed here.'));
1330
+ return;
1319
1331
  }
1332
+ if (!this.withinLimit({ fn, frame: this.frame }, call))
1333
+ return;
1334
+ const saved = this.scopes.splice(0, this.scopes.length, ...this.scopeChain(fn));
1335
+ this.callStack.push(fn);
1336
+ walk(fn);
1337
+ this.callStack.pop();
1338
+ this.scopes.splice(0, this.scopes.length, ...saved);
1320
1339
  }
1321
1340
  /** Runs `walk` with a case's arguments bound to the parameters of its callback, as the runner calls it. */
1322
1341
  withCase(fn, args, walk) {
@@ -1366,8 +1385,7 @@ class Walker {
1366
1385
  this.suites.push(suite);
1367
1386
  this.cut(context.scope, call);
1368
1387
  this.suiteFrames.set(suite, this.frame);
1369
- const { fn } = declaration;
1370
- if (fn) {
1388
+ this.withDeclarationBody(declaration, call, (fn) => {
1371
1389
  this.withCase(fn, args, () => {
1372
1390
  this.visitCallback(fn, {
1373
1391
  ...context,
@@ -1385,7 +1403,7 @@ class Walker {
1385
1403
  expandedAt: this.expandedAt(context, index === null ? null : call.start),
1386
1404
  });
1387
1405
  });
1388
- }
1406
+ });
1389
1407
  }
1390
1408
  /** The statement a call forms, such as `test(...);`, or the call itself when it is part of a larger expression. */
1391
1409
  statement(call) {
package/dist/files.js CHANGED
@@ -76,9 +76,10 @@ function namesFolder(pattern, segments, index) {
76
76
  */
77
77
  export async function findFiles(root, patterns, ignore, framework, platform = process.platform) {
78
78
  const failures = [];
79
+ const normalizedPatterns = patterns.map((pattern) => normalizePattern(pattern, platform));
79
80
  // Only files match; a folder named like a test file, such as a screenshot folder `checkout.spec.ts/`, is not expanded.
80
81
  // As in both runners, names that start with a dot match too, as in `.storybook/`.
81
- const matches = await glob(patterns.map((pattern) => normalizePattern(pattern, platform)), {
82
+ const matches = await glob(normalizedPatterns, {
82
83
  cwd: root,
83
84
  dot: true,
84
85
  ignore: ['**/node_modules/**', '**/.git/**', ...ignore.map((pattern) => normalizePattern(pattern, platform))],
@@ -121,7 +122,7 @@ export async function findFiles(root, patterns, ignore, framework, platform = pr
121
122
  diagnostics.push(fileDiagnostic('symlink-ignored', match, message));
122
123
  continue;
123
124
  }
124
- if (linked && framework === 'node' && inUnnamedLinkedFolder(root, match, patterns)) {
125
+ if (linked && framework === 'node' && inUnnamedLinkedFolder(root, match, normalizedPatterns)) {
125
126
  const message = `The file is in a linked folder, which a wildcard in a ${name} pattern does not enter.`;
126
127
  diagnostics.push(fileDiagnostic('symlink-ignored', match, message));
127
128
  continue;
package/dist/filter.d.ts CHANGED
@@ -9,7 +9,7 @@ export interface InventoryFilter {
9
9
  grep?: string;
10
10
  /** Keeps tests that use `.only`, or are inside a describe that does. */
11
11
  only?: boolean;
12
- /** Keeps tests that don't run and give no reason. Tests in a file the runner refuses are left out. */
12
+ /** Keeps non-active tests without a reason, including expected failures and conditional states; excludes notLoaded. */
13
13
  withoutReason?: boolean;
14
14
  /**
15
15
  * Keeps the tests a change to one of these files can affect: those whose `dependencies` include it, and those that
@@ -115,6 +115,7 @@ export class JasmineAdapter extends SuiteAdapter {
115
115
  // `undefined` given as the function is no function, as when none is given.
116
116
  const body = written?.type === 'Identifier' && written.name === 'undefined' ? undefined : written;
117
117
  const fn = isFunctionNode(body) ? body : null;
118
+ const callback = fn ?? namedFunction(this.file, context.scopes, body ?? undefined);
118
119
  const line = this.file.source.line(call.start);
119
120
  // A spec without a function is pending, unless it is focused: `fit` needs one.
120
121
  const isSkipped = flags.has('skip') || (kind === 'test' && body === undefined);
@@ -127,7 +128,7 @@ export class JasmineAdapter extends SuiteAdapter {
127
128
  mode: null,
128
129
  details: { tags: [], annotations: [], locks: [], meta: null, run: {} },
129
130
  fn,
130
- hashed: fn ?? namedFunction(this.file, context.scopes, body ?? undefined),
131
+ hashed: callback,
131
132
  isParameterized: false,
132
133
  caseCount: null,
133
134
  cases: null,
@@ -168,16 +169,16 @@ export class JasmineAdapter extends SuiteAdapter {
168
169
  const refusal = this.refusal('test-without-body', call, `${callee}() has no function`, context);
169
170
  return refused(call, refusal, context, () => declared);
170
171
  }
171
- if (fn?.async) {
172
- const refusal = this.refusal('async-describe', fn, 'The describe callback is async, which Jasmine refuses', context);
172
+ if (callback?.async) {
173
+ const refusal = this.refusal('async-describe', callback, 'The describe callback is async, which Jasmine refuses', context);
173
174
  return refused(call, refusal, context, () => declared);
174
175
  }
175
- if (fn && declaresNothing(fn)) {
176
- const refusal = this.refusal('describe-throws', fn, 'The describe declares no spec or describe, which Jasmine refuses', context);
176
+ if (callback && declaresNothing(callback)) {
177
+ const refusal = this.refusal('describe-throws', callback, 'The describe declares no spec or describe, which Jasmine refuses', context);
177
178
  return refused(call, refusal, context, () => declared);
178
179
  }
179
- if (fn && functionLength(fn) > 0) {
180
- const refusal = this.refusal('describe-throws', fn, 'The describe callback takes arguments, which Jasmine refuses', context);
180
+ if (callback && functionLength(callback) > 0) {
181
+ const refusal = this.refusal('describe-throws', callback, 'The describe callback takes arguments, which Jasmine refuses', context);
181
182
  return refused(call, refusal, context, () => declared);
182
183
  }
183
184
  return declared;
@@ -156,6 +156,7 @@ export class JestAdapter extends SuiteAdapter {
156
156
  const spread = args.some((arg) => arg.type === 'SpreadElement');
157
157
  const body = spread ? undefined : args.at(1);
158
158
  const fn = isFunctionNode(body) ? body : null;
159
+ const callback = fn ?? namedFunction(this.file, context.scopes, body);
159
160
  const table = links.find((link) => link.name === 'each') ?? null;
160
161
  const line = this.file.source.line(call.start);
161
162
  const declared = (given = fn) => {
@@ -166,7 +167,7 @@ export class JestAdapter extends SuiteAdapter {
166
167
  mode: flags.has('concurrent') && !flags.has('skip') ? 'parallel' : null,
167
168
  details: { tags: [], annotations: [], locks: [], meta: null, run: {} },
168
169
  fn: given,
169
- hashed: given ?? namedFunction(this.file, context.scopes, body),
170
+ hashed: given ?? callback,
170
171
  isParameterized: table !== null,
171
172
  caseCount: table ? this.caseCount(table, context, problems) : null,
172
173
  cases: table ? this.tableCases(table, title, context) : null,
@@ -211,12 +212,12 @@ export class JestAdapter extends SuiteAdapter {
211
212
  const refusal = problem('describe-throws', call, `${head}() has an empty table or one that isn't a table, so its describe throws, and Jest fails the file.`, head);
212
213
  return refused(call, refusal, context, declared);
213
214
  }
214
- if (kind === 'describe' && fn?.async) {
215
- const refusal = problem('async-describe', fn, 'The describe callback is async, and Jest throws when a describe returns a promise, so it fails the file.');
215
+ if (kind === 'describe' && callback?.async) {
216
+ const refusal = problem('async-describe', callback, 'The describe callback is async, and Jest throws when a describe returns a promise, so it fails the file.');
216
217
  return refused(call, refusal, context, declared);
217
218
  }
218
- if (kind === 'describe' && fn) {
219
- const returned = describeReturns(fn);
219
+ if (kind === 'describe' && callback) {
220
+ const returned = describeReturns(callback);
220
221
  if (returned) {
221
222
  const refusal = problem(returned === 'promise' ? 'async-describe' : 'describe-throws', call, returned === 'promise'
222
223
  ? 'The describe callback returns a promise, and Jest throws when a describe returns one, so it fails the file.'
@@ -1,7 +1,7 @@
1
1
  import { isFunctionNode, propertyName, unwrap } from "../ast.js";
2
2
  import { snippet } from "../source.js";
3
3
  import { requiredModule } from "./bindings.js";
4
- import { hookFunction, namedFunction, problem, readChain, readCount, readOptions, readReason, readStrings, readTitle, refused, text, unresolvedOptions, } from "./common.js";
4
+ import { hookFunction, namedFunction, problem, readChain, readCount, readOptions, readReason, readStrings, readTitle, refused, text, unresolvedOption, unresolvedOptions, } from "./common.js";
5
5
  import { SuiteAdapter } from "./test-functions.js";
6
6
  const MODIFIERS = new Set(['skip', 'todo', 'only', 'expectFailure']);
7
7
  const PRECEDENCE = ['skip', 'todo', 'expectedToFail'];
@@ -116,6 +116,7 @@ export class NodeAdapter extends SuiteAdapter {
116
116
  const { name, options, body } = splitArguments(call.arguments, named);
117
117
  const problems = [];
118
118
  const fn = isFunctionNode(body) ? body : null;
119
+ const hashed = fn ?? namedFunction(this.file, context.scopes, body);
119
120
  let title = { text: '<anonymous>', withoutTags: '<anonymous>', isDynamic: false };
120
121
  // Without a name, Node.js names the test after its function, which takes the name of the variable that holds it.
121
122
  const fnName = fn?.id?.name ?? (body?.type === 'Identifier' ? body.name : null);
@@ -145,26 +146,26 @@ export class NodeAdapter extends SuiteAdapter {
145
146
  mode: null,
146
147
  details: { tags: [], annotations: [], locks: [], meta: null, run: {} },
147
148
  fn,
148
- hashed: fn ?? namedFunction(this.file, context.scopes, body),
149
+ hashed,
149
150
  isParameterized: false,
150
151
  caseCount: null,
151
152
  cases: null,
152
153
  problems,
153
154
  };
154
- if (options)
155
- this.withOptions(base, options, line, context);
155
+ const refusal = options ? this.withOptions(base, options, line, context) : null;
156
156
  // `skip` wins over `todo`, and both over `expectFailure`, however they are written.
157
157
  base.states.sort((a, b) => PRECEDENCE.indexOf(a.state) - PRECEDENCE.indexOf(b.state));
158
- if (kind === 'describe')
159
- return { kind: 'describe', ...base, isShuffled: false, passesDown: null };
160
- return {
161
- kind: 'test',
162
- ...base,
163
- testContext: contextName(fn),
164
- fixtures: [],
165
- takesAllFixtures: false,
166
- usesBench: false,
167
- };
158
+ const declared = kind === 'describe'
159
+ ? { kind: 'describe', ...base, isShuffled: false, passesDown: null }
160
+ : {
161
+ kind: 'test',
162
+ ...base,
163
+ testContext: contextName(hashed),
164
+ fixtures: [],
165
+ takesAllFixtures: false,
166
+ usesBench: false,
167
+ };
168
+ return refusal ? refused(call, refusal, context, () => declared) : declared;
168
169
  }
169
170
  /**
170
171
  * The options object: `skip` and `todo`, each `true` or a reason, `only`, `timeout`, `concurrency`, a number above 1
@@ -174,6 +175,7 @@ export class NodeAdapter extends SuiteAdapter {
174
175
  withOptions(declared, node, line, context) {
175
176
  const options = readOptions(this.file, context.scopes, node);
176
177
  const { problems } = declared;
178
+ let refusal = null;
177
179
  problems.push(...unresolvedOptions(this.file, options, 'its states, timeout and tags are missing'));
178
180
  const states = [
179
181
  ['skip', 'skip'],
@@ -199,14 +201,29 @@ export class NodeAdapter extends SuiteAdapter {
199
201
  declared.details.run.timeout = value;
200
202
  }
201
203
  const concurrency = options.values.get('concurrency');
202
- if (concurrency?.resolved.ok) {
204
+ if (concurrency && !concurrency.resolved.ok) {
205
+ problems.push(unresolvedOption(this.file, 'concurrency', concurrency.node, concurrency.resolved.importedFrom, 'its mode is not applied'));
206
+ }
207
+ else if (concurrency?.resolved.ok) {
203
208
  const { value } = concurrency.resolved;
204
- declared.mode = value === true || (typeof value === 'number' && value > 1) ? 'parallel' : 'default';
209
+ if (value !== null && value !== undefined) {
210
+ const count = typeof value === 'number' && Number.isInteger(value) && value >= 1 && value <= 0xffff_ffff;
211
+ if (typeof value !== 'boolean' && !count) {
212
+ const source = snippet(text(this.file, concurrency.node));
213
+ refusal = {
214
+ ...problem('unresolved-option', concurrency.node, `Option concurrency: ${source} is not a boolean or an integer from 1 to 4294967295, so Node.js refuses the call.`, source),
215
+ level: 'error',
216
+ };
217
+ }
218
+ else
219
+ declared.mode = value === true || (typeof value === 'number' && value > 1) ? 'parallel' : 'default';
220
+ }
205
221
  }
206
222
  const tags = options.values.get('tags');
207
223
  if (tags && readsTags(this.file.version)) {
208
224
  declared.details.tags.push(...readStrings(this.file, context.scopes, tags).values);
209
225
  }
226
+ return refusal;
210
227
  }
211
228
  }
212
229
  /** Whether a version is at least the given release of its line, or of a later line. */
@@ -47,8 +47,10 @@ export declare class PlaywrightAdapter implements Adapter {
47
47
  * destructured one works as it does on the object; a test object built with a destructured `extend` is not followed.
48
48
  */
49
49
  private alias;
50
- /** The members of `test` a value holds: none for a test object, or those of a describe function. */
50
+ /** The members of `test` a value holds: none for a test object, or those of a declaring function. */
51
51
  private members;
52
+ /** Function-valued branches stay distinct until a logical fallback rules out non-functions. */
53
+ private choices;
52
54
  /** Follows the import of `name` once, and reports it once when it can't be followed and `report` is set. */
53
55
  private follow;
54
56
  /** Whether an argument is, or works out to, a string, as a title is. Spread arguments are handled before. */
@@ -22,6 +22,7 @@ const STATES = new Map([
22
22
  ['fail', 'expectedToFail'],
23
23
  ['fail.only', 'expectedToFail'],
24
24
  ]);
25
+ const TEST_DECLARATIONS = new Set(['', 'only', ...STATES.keys()]);
25
26
  /** Members of `test` that are known but don't declare or modify tests. */
26
27
  const OTHER_MEMBERS = new Set(['use', 'slow', 'setTimeout', 'extend']);
27
28
  /** Members that set how the tests run where they are called. */
@@ -118,9 +119,20 @@ class PlaywrightBindings {
118
119
  (followsCalls && this.holdsTestObject(node.name)));
119
120
  case 'MemberExpression':
120
121
  return propertyName(node) === 'test' && this.isModule(node.object);
121
- case 'ConditionalExpression':
122
- // `process.env.CI ? ciTest : test` is a test object either way.
123
- return this.isTestObject(node.consequent, followsCalls) || this.isTestObject(node.alternate, followsCalls);
122
+ case 'ConditionalExpression': {
123
+ const branches = [node.consequent, node.alternate].map((expression) => ({
124
+ expression,
125
+ isObject: this.isTestObject(expression, followsCalls),
126
+ }));
127
+ // Keep inference through unknown factories, but a known member such as describe or skip is not an object.
128
+ return (branches.some((branch) => branch.isObject) &&
129
+ branches.every(({ expression, isObject }) => {
130
+ if (isObject)
131
+ return true;
132
+ const chain = readChain(expression);
133
+ return !chain || chain.links.length === 0 || !this.isTestObject(chain.base, followsCalls);
134
+ }));
135
+ }
124
136
  case 'CallExpression': {
125
137
  const callee = unwrap(node.callee);
126
138
  if (callee.type === 'MemberExpression' && propertyName(callee) === 'extend') {
@@ -250,7 +262,7 @@ export class PlaywrightAdapter {
250
262
  if (links.some((link) => link.args ?? link.template)) {
251
263
  return this.invalid(call, names, "is not part of Playwright's API", context);
252
264
  }
253
- if (key === '' || key === 'only' || key === 'skip' || key === 'fixme' || key === 'fail' || key === 'fail.only') {
265
+ if (TEST_DECLARATIONS.has(key)) {
254
266
  return this.testCall(call, key, context);
255
267
  }
256
268
  const describe = DESCRIBES.get(key);
@@ -296,6 +308,10 @@ export class PlaywrightAdapter {
296
308
  ...members.map((name) => ({ name, args: null, template: null })),
297
309
  ...links,
298
310
  ];
311
+ if (base.type === 'ConditionalExpression' || base.type === 'LogicalExpression') {
312
+ const members = this.members(base, lookup);
313
+ return members && withMembers(members);
314
+ }
299
315
  if (base.type === 'Identifier') {
300
316
  // A local variable or parameter with the same name, such as `(test) => test.result()`, is not Playwright's.
301
317
  const declaration = this.file.values.declarationOf(base.name, scopes);
@@ -389,20 +405,43 @@ export class PlaywrightAdapter {
389
405
  }
390
406
  return members && [...members, ...destructured];
391
407
  }
392
- /** The members of `test` a value holds: none for a test object, or those of a describe function. */
408
+ /** The members of `test` a value holds: none for a test object, or those of a declaring function. */
393
409
  members(expression, lookup) {
410
+ const choices = this.choices(expression, lookup);
411
+ if (!choices || choices.mayBeOther || choices.members.length === 0)
412
+ return null;
413
+ return choices.members.slice(1).reduce(sharedMembers, choices.members[0]);
414
+ }
415
+ /** Function-valued branches stay distinct until a logical fallback rules out non-functions. */
416
+ choices(expression, lookup) {
394
417
  const node = unwrap(expression);
395
418
  if (node.type === 'ConditionalExpression') {
396
- // `IS_PLATFORM ? test.describe.serial : test.describe`: only the members both branches have apply.
397
- return sharedMembers(this.members(node.consequent, lookup), this.members(node.alternate, lookup));
419
+ const [yes, no] = [this.choices(node.consequent, lookup), this.choices(node.alternate, lookup)];
420
+ if (!yes || !no)
421
+ return null;
422
+ return { members: [...yes.members, ...no.members], mayBeOther: yes.mayBeOther || no.mayBeOther };
423
+ }
424
+ if (node.type === 'LogicalExpression') {
425
+ const [left, right] = [this.choices(node.left, lookup), this.choices(node.right, lookup)];
426
+ const isFunction = left !== null && !left.mayBeOther;
427
+ if (node.operator === '&&')
428
+ return isFunction ? right : { members: right?.members ?? [], mayBeOther: true };
429
+ if (isFunction)
430
+ return left;
431
+ return {
432
+ members: [...(left?.members ?? []), ...(right?.members ?? [])],
433
+ mayBeOther: right?.mayBeOther ?? true,
434
+ };
398
435
  }
399
436
  if (this.bindings.isTestObject(node, false))
400
- return [];
437
+ return { members: [[]], mayBeOther: false };
401
438
  const chain = readChain(node);
402
439
  if (!chain || chain.links.some((link) => link.args ?? link.template))
403
440
  return null;
404
441
  const members = this.testLinks(chain, [], lookup)?.map((link) => link.name);
405
- return members && (members.length === 0 || DESCRIBES.has(members.join('.'))) ? members : null;
442
+ return members && (TEST_DECLARATIONS.has(members.join('.')) || DESCRIBES.has(members.join('.')))
443
+ ? { members: [members], mayBeOther: false }
444
+ : null;
406
445
  }
407
446
  /** Follows the import of `name` once, and reports it once when it can't be followed and `report` is set. */
408
447
  follow(name, report) {
@@ -610,7 +649,7 @@ export class PlaywrightAdapter {
610
649
  const args = call.arguments;
611
650
  if (args.length === 0)
612
651
  return { kind: 'other' };
613
- const anonymous = isFunctionNode(args[0]);
652
+ const anonymous = isFunctionNode(args[0]) || (args.length === 1 && namedFunction(this.file, context.scopes, args[0]) !== null);
614
653
  const problems = [];
615
654
  let title = null;
616
655
  if (!anonymous) {
@@ -619,9 +658,10 @@ export class PlaywrightAdapter {
619
658
  if (read.problem)
620
659
  problems.push(read.problem);
621
660
  }
622
- const fn = anonymous ? args[0] : findFunction(args, 1);
623
- if (fn?.async && containsAwait(fn)) {
624
- problems.push(problem('async-describe', fn, 'The describe callback awaits, but Playwright does not wait for it; tests declared after the first await end up in the describe around it, or are not collected.'));
661
+ const fn = anonymous ? (isFunctionNode(args[0]) ? args[0] : null) : findFunction(args, 1);
662
+ const callback = fn ?? namedFunction(this.file, context.scopes, args.at(-1));
663
+ if (callback?.async && containsAwait(callback)) {
664
+ problems.push(problem('async-describe', callback, 'The describe callback awaits, but Playwright does not wait for it; tests declared after the first await end up in the describe around it, or are not collected.'));
625
665
  }
626
666
  const line = this.file.source.line(call.start);
627
667
  return {
@@ -634,7 +674,7 @@ export class PlaywrightAdapter {
634
674
  passesDown: null,
635
675
  details: this.details(!anonymous && args.length === 3 ? args[1] : undefined, context, problems, title?.text ?? ''),
636
676
  fn,
637
- hashed: fn,
677
+ hashed: callback,
638
678
  isParameterized: false,
639
679
  caseCount: null,
640
680
  cases: null,
package/dist/records.js CHANGED
@@ -252,8 +252,19 @@ class RecordBuilder {
252
252
  ...extraction.suites.filter((suite) => suite.declaration.isOnly).map((suite) => suite.scope.parent),
253
253
  ];
254
254
  this.focusedBelow = new Set(focusedAt.flatMap((scope) => outward(scope)));
255
+ // A named callback can place a child before its calling parent in source order.
256
+ for (const { scope, declaration } of extraction.suites) {
257
+ const parents = outward(scope).slice(1, -1).reverse();
258
+ // Mark describe ids so that a describe and test with the same title in the same place differ.
259
+ this.suiteIds.set(scope, this.id(['describe', this.describeTitles(parents), declaration.title?.withoutTags ?? '']));
260
+ }
255
261
  const suites = extraction.suites.map((suite) => this.suite(suite));
256
262
  const tests = extraction.tests.map((test) => this.test(test, suites));
263
+ // A subtest in a named callback can precede its parent's declaration in source order.
264
+ for (const [index, pending] of extraction.tests.entries()) {
265
+ if (pending.parent)
266
+ tests[index].parentTestId = this.testIds.get(pending.parent);
267
+ }
257
268
  for (const item of problems) {
258
269
  const found = this.diagnostic(item);
259
270
  const isSure = undefinedUses.find((use) => use.problem === item)?.isSure ?? true;
@@ -327,12 +338,10 @@ class RecordBuilder {
327
338
  this.forbidOnly(pending.site ?? call, pending.site ? null : call);
328
339
  const parents = outward(scope).slice(1, -1).reverse();
329
340
  const title = declaration.title;
330
- // Suite ids are marked so that a describe and a test with the same title in the same place differ.
331
- const id = this.id(['describe', this.describeTitles(parents), title?.withoutTags ?? '']);
332
- this.suiteIds.set(scope, id);
341
+ const id = this.suiteIds.get(scope);
333
342
  const chosen = chooseState(scope.states.map((setting) => ({ setting, source: 'suite' })));
334
343
  const state = chosen?.setting.state;
335
- const fn = declaration.fn;
344
+ const fn = declaration.fn ?? declaration.hashed;
336
345
  return {
337
346
  id,
338
347
  parentId: parents.length > 0 ? this.suiteIds.get(parents[parents.length - 1]) : null,
@@ -507,7 +516,10 @@ class RecordBuilder {
507
516
  ];
508
517
  const tagConcurrent = this.options.config?.tags?.concurrentBeatsTags ? undefined : fromTags?.concurrent;
509
518
  const tagMode = tagConcurrent === undefined ? null : tagConcurrent ? 'parallel' : 'default';
510
- const [mode = null] = tagged([declaration.mode], [tagMode], scopes.map((scope) => scope.mode)).filter((item) => item !== null);
519
+ const [mode = null] = tagged([declaration.mode], [tagMode], [
520
+ ...(this.options.framework === 'node' ? parents.map((parent) => parent.declaration.mode).reverse() : []),
521
+ ...scopes.map((scope) => scope.mode),
522
+ ]).filter((item) => item !== null);
511
523
  const meta = {};
512
524
  for (const values of [fromTags?.meta, ...describes.map((scope) => scope.details.meta), declaration.details.meta]) {
513
525
  Object.assign(meta, values);
@@ -549,7 +561,7 @@ class RecordBuilder {
549
561
  dependencies: dependencies.files,
550
562
  hasUnfollowedDependencies: !dependencies.isComplete,
551
563
  suiteId: describes.length > 0 ? this.suiteIds.get(describes[describes.length - 1]) : null,
552
- parentTestId: pending.parent ? this.testIds.get(pending.parent) : null,
564
+ parentTestId: null,
553
565
  suitePath,
554
566
  relativeFilePath: this.options.relativeFilePath,
555
567
  fileName: this.fileName,
package/dist/toml.js CHANGED
@@ -137,6 +137,8 @@ function readValue(reader) {
137
137
  skipBlank(reader, false);
138
138
  if (text[reader.at] === ',')
139
139
  reader.at++;
140
+ else if (text[reader.at] !== '}')
141
+ throw new TomlError('Expected "," or "}"', reader.line);
140
142
  skipBlank(reader, false);
141
143
  }
142
144
  reader.at++;
package/dist/types.d.ts CHANGED
@@ -115,9 +115,9 @@ export interface Summary {
115
115
  annotationCounts: Record<string, Count>;
116
116
  }
117
117
  /**
118
- * A runner's config that scanned files use. For Playwright and Vitest, the nearest one in a file's folder or a folder
119
- * above it, up to the root, as the runner started in that folder would; for Jest, the one at the root and the projects
120
- * it names; for the other runners, the one config they read for the whole run. Read as code, never run.
118
+ * A runner's config that scanned files use. For Playwright and Vitest, the outermost config at or above the file that
119
+ * runs it, up to the root, else the nearest; for Jest, the one at the root and the projects it names; for the other
120
+ * runners, the one config they read for the whole run. Read as code, never run.
121
121
  */
122
122
  export interface ConfigRecord {
123
123
  /** Path from the project root, with `/` separators. */
@@ -307,6 +307,7 @@ export interface TestRecord {
307
307
  /** Declared in a Vitest type test file (`*.test-d.ts`, `*.spec-d.ts`). */
308
308
  isTypeTest: boolean;
309
309
  state: TestState;
310
+ /** True only for state active; false does not establish that the test never executes. */
310
311
  isActive: boolean;
311
312
  isSkipped: boolean;
312
313
  isFixme: boolean;
@@ -350,7 +351,7 @@ export interface TestRecord {
350
351
  isSlow: boolean;
351
352
  /** Source text of the condition of the `test.slow()` that applies; null when unconditional or not slow. */
352
353
  slowCondition: string | null;
353
- /** How many times the runner retries the test when it fails; null when the file sets none. */
354
+ /** Effective retry count from the test, suite, file or config; null when absent or unknown. See retriesSource. */
354
355
  retries: Count | null;
355
356
  /**
356
357
  * Milliseconds between retries: Vitest's from the `retry` object (4.1), Jest's from `waitBeforeRetry` of
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-inventory",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "description": "Lists every Playwright, Vitest, Jest, Mocha, Jasmine, Cypress, WebdriverIO, node:test and Bun test from the source code, without running it: its state and why, tags, an id that survives a move, a hash of everything it runs, and the tests a change can affect.",
5
5
  "keywords": [
6
6
  "testing",
@@ -636,7 +636,8 @@
636
636
  "$ref": "#/definitions/TestState"
637
637
  },
638
638
  "isActive": {
639
- "type": "boolean"
639
+ "type": "boolean",
640
+ "description": "True only for state active; false does not establish that the test never executes."
640
641
  },
641
642
  "isSkipped": {
642
643
  "type": "boolean"
@@ -787,7 +788,7 @@
787
788
  "type": "null"
788
789
  }
789
790
  ],
790
- "description": "How many times the runner retries the test when it fails; null when the file sets none."
791
+ "description": "Effective retry count from the test, suite, file or config; null when absent or unknown. See retriesSource."
791
792
  },
792
793
  "retryDelay": {
793
794
  "anyOf": [
package/schema/v1.json CHANGED
@@ -274,7 +274,7 @@
274
274
  "extends",
275
275
  "projects"
276
276
  ],
277
- "description": "A runner's config that scanned files use. For Playwright and Vitest, the nearest one in a file's folder or a folder above it, up to the root, as the runner started in that folder would; for Jest, the one at the root and the projects it names; for the other runners, the one config they read for the whole run. Read as code, never run."
277
+ "description": "A runner's config that scanned files use. For Playwright and Vitest, the outermost config at or above the file that runs it, up to the root, else the nearest; for Jest, the one at the root and the projects it names; for the other runners, the one config they read for the whole run. Read as code, never run."
278
278
  },
279
279
  "ProjectRecord": {
280
280
  "type": "object",
@@ -881,7 +881,8 @@
881
881
  "$ref": "#/definitions/TestState"
882
882
  },
883
883
  "isActive": {
884
- "type": "boolean"
884
+ "type": "boolean",
885
+ "description": "True only for state active; false does not establish that the test never executes."
885
886
  },
886
887
  "isSkipped": {
887
888
  "type": "boolean"
@@ -1032,7 +1033,7 @@
1032
1033
  "type": "null"
1033
1034
  }
1034
1035
  ],
1035
- "description": "How many times the runner retries the test when it fails; null when the file sets none."
1036
+ "description": "Effective retry count from the test, suite, file or config; null when absent or unknown. See retriesSource."
1036
1037
  },
1037
1038
  "retryDelay": {
1038
1039
  "anyOf": [