test-inventory 0.10.1 → 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 +24 -0
- package/README.md +14 -9
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +1 -1
- package/dist/config-runs.js +12 -10
- package/dist/diagnostics.js +1 -1
- package/dist/files.js +3 -2
- package/dist/filter.d.ts +1 -1
- package/dist/frameworks/node.js +33 -16
- package/dist/records.js +10 -2
- package/dist/toml.js +2 -0
- package/dist/types.d.ts +5 -4
- package/package.json +1 -1
- package/schema/diff-v1.json +3 -2
- package/schema/v1.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
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
|
+
|
|
3
27
|
## 0.10.1
|
|
4
28
|
|
|
5
29
|
### Patch 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
|
-
|
|
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
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
package/dist/config-runs.js
CHANGED
|
@@ -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(
|
|
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 =
|
|
1061
|
+
let refusal = presetRefusal;
|
|
1062
1062
|
if (invalid !== undefined) {
|
|
1063
|
-
refusal
|
|
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
|
|
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(
|
|
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
|
-
|
|
1156
|
-
|
|
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);
|
package/dist/diagnostics.js
CHANGED
|
@@ -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/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(
|
|
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,
|
|
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
|
|
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
|
package/dist/frameworks/node.js
CHANGED
|
@@ -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
|
|
149
|
+
hashed,
|
|
149
150
|
isParameterized: false,
|
|
150
151
|
caseCount: null,
|
|
151
152
|
cases: null,
|
|
152
153
|
problems,
|
|
153
154
|
};
|
|
154
|
-
|
|
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
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
|
|
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
|
-
|
|
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. */
|
package/dist/records.js
CHANGED
|
@@ -260,6 +260,11 @@ class RecordBuilder {
|
|
|
260
260
|
}
|
|
261
261
|
const suites = extraction.suites.map((suite) => this.suite(suite));
|
|
262
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
|
+
}
|
|
263
268
|
for (const item of problems) {
|
|
264
269
|
const found = this.diagnostic(item);
|
|
265
270
|
const isSure = undefinedUses.find((use) => use.problem === item)?.isSure ?? true;
|
|
@@ -511,7 +516,10 @@ class RecordBuilder {
|
|
|
511
516
|
];
|
|
512
517
|
const tagConcurrent = this.options.config?.tags?.concurrentBeatsTags ? undefined : fromTags?.concurrent;
|
|
513
518
|
const tagMode = tagConcurrent === undefined ? null : tagConcurrent ? 'parallel' : 'default';
|
|
514
|
-
const [mode = null] = tagged([declaration.mode], [tagMode],
|
|
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);
|
|
515
523
|
const meta = {};
|
|
516
524
|
for (const values of [fromTags?.meta, ...describes.map((scope) => scope.details.meta), declaration.details.meta]) {
|
|
517
525
|
Object.assign(meta, values);
|
|
@@ -553,7 +561,7 @@ class RecordBuilder {
|
|
|
553
561
|
dependencies: dependencies.files,
|
|
554
562
|
hasUnfollowedDependencies: !dependencies.isComplete,
|
|
555
563
|
suiteId: describes.length > 0 ? this.suiteIds.get(describes[describes.length - 1]) : null,
|
|
556
|
-
parentTestId:
|
|
564
|
+
parentTestId: null,
|
|
557
565
|
suitePath,
|
|
558
566
|
relativeFilePath: this.options.relativeFilePath,
|
|
559
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
|
|
119
|
-
*
|
|
120
|
-
*
|
|
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
|
-
/**
|
|
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.
|
|
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",
|
package/schema/diff-v1.json
CHANGED
|
@@ -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": "
|
|
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
|
|
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": "
|
|
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": [
|