test-inventory 0.10.1 → 0.10.3
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 +34 -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 +34 -16
- package/dist/frameworks/playwright.js +27 -2
- package/dist/frameworks/test-functions.d.ts +4 -0
- package/dist/frameworks/test-functions.js +60 -1
- package/dist/frameworks/vitest.js +23 -6
- package/dist/records.js +11 -3
- package/dist/toml.js +2 -0
- package/dist/types.d.ts +5 -4
- package/dist/values.js +2 -2
- 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,39 @@
|
|
|
1
1
|
# test-inventory
|
|
2
2
|
|
|
3
|
+
## 0.10.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#115](https://github.com/Huldoser/test-inventory/pull/115) [`2da89f8`](https://github.com/Huldoser/test-inventory/commit/2da89f84890e2c2ce8a87954263e6ae3f27ce5bc) - Read hooks and suite members on named node:test imports and preserve parameterized declarations chosen between Jest each factories. Avoid false Playwright file-load failures for unknown loop counts, false tests from unresolved destructured wrappers, and async-describe errors caused by awaits inside nested helper declarations. Report Vitest table factories called without their required receiver as file-load failures.
|
|
8
|
+
|
|
9
|
+
- [#115](https://github.com/Huldoser/test-inventory/pull/115) [`2da89f8`](https://github.com/Huldoser/test-inventory/commit/2da89f84890e2c2ce8a87954263e6ae3f27ce5bc) - Keep declarations when a file or imported helper calls a local function named require without arguments. The value reader no longer turns that call into an internal-error that discards the file's tests. Preserve suite, test and hook roles when members are destructured from an already-bound node:test module.
|
|
10
|
+
|
|
11
|
+
- [#115](https://github.com/Huldoser/test-inventory/pull/115) [`2da89f8`](https://github.com/Huldoser/test-inventory/commit/2da89f84890e2c2ce8a87954263e6ae3f27ce5bc) - Recognize defineConfig on Playwright's original package export, including default and CommonJS imports, instead of reporting an invalid-chain error that marks the file's tests notLoaded. Keep extended test functions distinct from the package export.
|
|
12
|
+
|
|
13
|
+
## 0.10.2
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#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.
|
|
18
|
+
Correct config inheritance and failure-scope descriptions. Add first-use guidance, concepts and troubleshooting,
|
|
19
|
+
preserve existing documentation URLs, and publish the diff schema alongside the inventory schema.
|
|
20
|
+
|
|
21
|
+
- [#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
|
|
22
|
+
compatibility notes. Prioritize essential Markdown references and distinguish illustrative excerpts from runnable
|
|
23
|
+
code by their copy controls.
|
|
24
|
+
|
|
25
|
+
- [#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.
|
|
26
|
+
|
|
27
|
+
- [#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.
|
|
28
|
+
|
|
29
|
+
- [#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.
|
|
30
|
+
|
|
31
|
+
- [#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.
|
|
32
|
+
|
|
33
|
+
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.
|
|
34
|
+
|
|
35
|
+
Validate node:test concurrency values, report unknown values, and inherit concurrency through parent tests without resetting it for null or undefined options.
|
|
36
|
+
|
|
3
37
|
## 0.10.1
|
|
4
38
|
|
|
5
39
|
### 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'];
|
|
@@ -34,6 +34,7 @@ const NODE = {
|
|
|
34
34
|
defaultImport: null,
|
|
35
35
|
required: null,
|
|
36
36
|
callable: TEST,
|
|
37
|
+
moduleMembers: new Set(['test', 'it']),
|
|
37
38
|
// Every other export of node:test on Node.js 26; the hooks are read as hooks.
|
|
38
39
|
others: new Set([
|
|
39
40
|
'after',
|
|
@@ -116,6 +117,7 @@ export class NodeAdapter extends SuiteAdapter {
|
|
|
116
117
|
const { name, options, body } = splitArguments(call.arguments, named);
|
|
117
118
|
const problems = [];
|
|
118
119
|
const fn = isFunctionNode(body) ? body : null;
|
|
120
|
+
const hashed = fn ?? namedFunction(this.file, context.scopes, body);
|
|
119
121
|
let title = { text: '<anonymous>', withoutTags: '<anonymous>', isDynamic: false };
|
|
120
122
|
// Without a name, Node.js names the test after its function, which takes the name of the variable that holds it.
|
|
121
123
|
const fnName = fn?.id?.name ?? (body?.type === 'Identifier' ? body.name : null);
|
|
@@ -145,26 +147,26 @@ export class NodeAdapter extends SuiteAdapter {
|
|
|
145
147
|
mode: null,
|
|
146
148
|
details: { tags: [], annotations: [], locks: [], meta: null, run: {} },
|
|
147
149
|
fn,
|
|
148
|
-
hashed
|
|
150
|
+
hashed,
|
|
149
151
|
isParameterized: false,
|
|
150
152
|
caseCount: null,
|
|
151
153
|
cases: null,
|
|
152
154
|
problems,
|
|
153
155
|
};
|
|
154
|
-
|
|
155
|
-
this.withOptions(base, options, line, context);
|
|
156
|
+
const refusal = options ? this.withOptions(base, options, line, context) : null;
|
|
156
157
|
// `skip` wins over `todo`, and both over `expectFailure`, however they are written.
|
|
157
158
|
base.states.sort((a, b) => PRECEDENCE.indexOf(a.state) - PRECEDENCE.indexOf(b.state));
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
159
|
+
const declared = kind === 'describe'
|
|
160
|
+
? { kind: 'describe', ...base, isShuffled: false, passesDown: null }
|
|
161
|
+
: {
|
|
162
|
+
kind: 'test',
|
|
163
|
+
...base,
|
|
164
|
+
testContext: contextName(hashed),
|
|
165
|
+
fixtures: [],
|
|
166
|
+
takesAllFixtures: false,
|
|
167
|
+
usesBench: false,
|
|
168
|
+
};
|
|
169
|
+
return refusal ? refused(call, refusal, context, () => declared) : declared;
|
|
168
170
|
}
|
|
169
171
|
/**
|
|
170
172
|
* The options object: `skip` and `todo`, each `true` or a reason, `only`, `timeout`, `concurrency`, a number above 1
|
|
@@ -174,6 +176,7 @@ export class NodeAdapter extends SuiteAdapter {
|
|
|
174
176
|
withOptions(declared, node, line, context) {
|
|
175
177
|
const options = readOptions(this.file, context.scopes, node);
|
|
176
178
|
const { problems } = declared;
|
|
179
|
+
let refusal = null;
|
|
177
180
|
problems.push(...unresolvedOptions(this.file, options, 'its states, timeout and tags are missing'));
|
|
178
181
|
const states = [
|
|
179
182
|
['skip', 'skip'],
|
|
@@ -199,14 +202,29 @@ export class NodeAdapter extends SuiteAdapter {
|
|
|
199
202
|
declared.details.run.timeout = value;
|
|
200
203
|
}
|
|
201
204
|
const concurrency = options.values.get('concurrency');
|
|
202
|
-
if (concurrency
|
|
205
|
+
if (concurrency && !concurrency.resolved.ok) {
|
|
206
|
+
problems.push(unresolvedOption(this.file, 'concurrency', concurrency.node, concurrency.resolved.importedFrom, 'its mode is not applied'));
|
|
207
|
+
}
|
|
208
|
+
else if (concurrency?.resolved.ok) {
|
|
203
209
|
const { value } = concurrency.resolved;
|
|
204
|
-
|
|
210
|
+
if (value !== null && value !== undefined) {
|
|
211
|
+
const count = typeof value === 'number' && Number.isInteger(value) && value >= 1 && value <= 0xffff_ffff;
|
|
212
|
+
if (typeof value !== 'boolean' && !count) {
|
|
213
|
+
const source = snippet(text(this.file, concurrency.node));
|
|
214
|
+
refusal = {
|
|
215
|
+
...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),
|
|
216
|
+
level: 'error',
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
else
|
|
220
|
+
declared.mode = value === true || (typeof value === 'number' && value > 1) ? 'parallel' : 'default';
|
|
221
|
+
}
|
|
205
222
|
}
|
|
206
223
|
const tags = options.values.get('tags');
|
|
207
224
|
if (tags && readsTags(this.file.version)) {
|
|
208
225
|
declared.details.tags.push(...readStrings(this.file, context.scopes, tags).values);
|
|
209
226
|
}
|
|
227
|
+
return refusal;
|
|
210
228
|
}
|
|
211
229
|
}
|
|
212
230
|
/** Whether a version is at least the given release of its line, or of a later line. */
|
|
@@ -54,6 +54,8 @@ function isPlaywrightSource(source) {
|
|
|
54
54
|
/** The names a file binds to Playwright's `test`, its namespace and `mergeTests`. */
|
|
55
55
|
class PlaywrightBindings {
|
|
56
56
|
testNames = new Set();
|
|
57
|
+
/** The package's original test function also carries exports such as defineConfig; extended tests do not. */
|
|
58
|
+
moduleTests = new Set();
|
|
57
59
|
namespaces = new Set();
|
|
58
60
|
mergeTestsNames = new Set();
|
|
59
61
|
/** The import specifiers and declarators that bind those names, to tell them from local names that shadow them. */
|
|
@@ -84,9 +86,11 @@ class PlaywrightBindings {
|
|
|
84
86
|
}
|
|
85
87
|
else if (specifier.type === 'ImportDefaultSpecifier') {
|
|
86
88
|
this.testNames.add(specifier.local.name);
|
|
89
|
+
this.moduleTests.add(specifier.local.name);
|
|
87
90
|
}
|
|
88
91
|
else if (exportName(specifier.imported) === 'test') {
|
|
89
92
|
this.testNames.add(specifier.local.name);
|
|
93
|
+
this.moduleTests.add(specifier.local.name);
|
|
90
94
|
}
|
|
91
95
|
else if (exportName(specifier.imported) === 'mergeTests') {
|
|
92
96
|
this.mergeTestsNames.add(specifier.local.name);
|
|
@@ -187,6 +191,9 @@ class PlaywrightBindings {
|
|
|
187
191
|
}
|
|
188
192
|
if (this.isTestObject(init, false)) {
|
|
189
193
|
this.testNames.add(id.name);
|
|
194
|
+
const node = unwrap(init);
|
|
195
|
+
if (node.type === 'Identifier' && this.moduleTests.has(node.name))
|
|
196
|
+
this.moduleTests.add(id.name);
|
|
190
197
|
return true;
|
|
191
198
|
}
|
|
192
199
|
return false;
|
|
@@ -197,8 +204,10 @@ class PlaywrightBindings {
|
|
|
197
204
|
if (property.type === 'RestElement' || property.value.type !== 'Identifier')
|
|
198
205
|
continue;
|
|
199
206
|
const key = propertyKey(property);
|
|
200
|
-
if (key === 'test')
|
|
207
|
+
if (key === 'test') {
|
|
201
208
|
this.testNames.add(property.value.name);
|
|
209
|
+
this.moduleTests.add(property.value.name);
|
|
210
|
+
}
|
|
202
211
|
if (key === 'mergeTests')
|
|
203
212
|
this.mergeTestsNames.add(property.value.name);
|
|
204
213
|
}
|
|
@@ -248,6 +257,12 @@ export class PlaywrightAdapter {
|
|
|
248
257
|
return null;
|
|
249
258
|
const names = links.map((link) => link.name);
|
|
250
259
|
const key = names.join('.');
|
|
260
|
+
if (key === 'defineConfig' &&
|
|
261
|
+
chain &&
|
|
262
|
+
(this.bindings.isModule(chain.base) ||
|
|
263
|
+
(chain.base.type === 'Identifier' && this.bindings.moduleTests.has(chain.base.name)))) {
|
|
264
|
+
return { kind: 'other' };
|
|
265
|
+
}
|
|
251
266
|
const addedIn = ADDED_IN.get(key);
|
|
252
267
|
if (addedIn && !atLeast(this.file.version, ...addedIn)) {
|
|
253
268
|
return this.invalid(call, names, `needs Playwright ${addedIn.join('.')} or newer`, context);
|
|
@@ -367,6 +382,8 @@ export class PlaywrightAdapter {
|
|
|
367
382
|
assumeLocal(declaration, name, links, args) {
|
|
368
383
|
if (declaration.type !== 'VariableDeclarator' || !mayHoldTestObject(declaration) || !isTestName(name))
|
|
369
384
|
return false;
|
|
385
|
+
if (declaration.id.type !== 'Identifier')
|
|
386
|
+
return false;
|
|
370
387
|
if (!this.looksLikeTest(links, args))
|
|
371
388
|
return false;
|
|
372
389
|
if (!this.assumed.has(declaration)) {
|
|
@@ -396,6 +413,14 @@ export class PlaywrightAdapter {
|
|
|
396
413
|
const destructured = boundMembers(declarator.id, name);
|
|
397
414
|
if (!destructured)
|
|
398
415
|
return null;
|
|
416
|
+
const init = declarator.init ? unwrap(declarator.init) : null;
|
|
417
|
+
if (destructured.length > 0 && TEST_MEMBERS.has(destructured[0]) && init?.type === 'Identifier') {
|
|
418
|
+
const imported = this.imports.get(init.name);
|
|
419
|
+
if (imported?.node === this.file.values.declarationOf(init.name, lookup.scopes) &&
|
|
420
|
+
!this.follow(init.name, !lookup.inBody)) {
|
|
421
|
+
return null;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
399
424
|
let members = this.aliases.get(declarator);
|
|
400
425
|
if (members === undefined) {
|
|
401
426
|
// Set first, so a variable defined through itself ends the lookup.
|
|
@@ -817,7 +842,7 @@ function containsAwait(fn) {
|
|
|
817
842
|
const visit = (node) => {
|
|
818
843
|
if (node.type === 'AwaitExpression' || (node.type === 'ForOfStatement' && node.await))
|
|
819
844
|
return true;
|
|
820
|
-
if (node !== fn && isFunctionNode(node))
|
|
845
|
+
if (node !== fn && (node.type === 'FunctionDeclaration' || isFunctionNode(node)))
|
|
821
846
|
return false;
|
|
822
847
|
return childNodes(node).some(visit);
|
|
823
848
|
};
|
|
@@ -45,6 +45,8 @@ export interface Dialect {
|
|
|
45
45
|
aliases?: ReadonlySet<string>;
|
|
46
46
|
/** What the module is when called, as `node:test`'s default export and `require()` are its `test`. */
|
|
47
47
|
callable?: Start;
|
|
48
|
+
/** Named exports that are the callable module itself, as node:test's `test` and `it`. */
|
|
49
|
+
moduleMembers?: ReadonlySet<string>;
|
|
48
50
|
/** The module's other members, which a chain on the callable module may start with and is then no test. */
|
|
49
51
|
others?: ReadonlySet<string>;
|
|
50
52
|
/** Whether the functions must be imported, as the runner sets no globals; `starts` are then exports only. */
|
|
@@ -161,6 +163,8 @@ export declare abstract class SuiteAdapter implements Adapter {
|
|
|
161
163
|
* `each` and `skipIf`, return a test function only when called, so their calls are never read through a variable.
|
|
162
164
|
*/
|
|
163
165
|
private alias;
|
|
166
|
+
/** Members taken from a bound module retain its exported kinds, rather than becoming test modifiers. */
|
|
167
|
+
private moduleAlias;
|
|
164
168
|
private aliasOf;
|
|
165
169
|
/**
|
|
166
170
|
* The test functions a value may hold, and whether it may also hold something else, as `process.env.CI` may. A test
|
|
@@ -11,7 +11,20 @@ export function shared(a, b) {
|
|
|
11
11
|
return other?.name === link.name && !link.args && !link.template && !other.args && !other.template;
|
|
12
12
|
};
|
|
13
13
|
const differs = a.links.findIndex((link, index) => !same(link, index));
|
|
14
|
-
|
|
14
|
+
const common = differs === -1 ? a.links : a.links.slice(0, differs);
|
|
15
|
+
const table = a.links.at(-1);
|
|
16
|
+
const otherTable = b.links.at(-1);
|
|
17
|
+
if (table &&
|
|
18
|
+
(table.name === 'each' || table.name === 'for') &&
|
|
19
|
+
otherTable?.name === table.name &&
|
|
20
|
+
!table.args &&
|
|
21
|
+
!table.template &&
|
|
22
|
+
!otherTable.args &&
|
|
23
|
+
!otherTable.template &&
|
|
24
|
+
!common.includes(table)) {
|
|
25
|
+
return { kind: a.kind, links: [...common, table] };
|
|
26
|
+
}
|
|
27
|
+
return { kind: a.kind, links: common };
|
|
15
28
|
}
|
|
16
29
|
function links(names) {
|
|
17
30
|
return names.map((name) => ({ name, args: null, template: null }));
|
|
@@ -189,6 +202,10 @@ export class SuiteBindings {
|
|
|
189
202
|
return (node.type === 'Identifier' && this.namespaces.has(node.name)) || this.dialect.isModule(node);
|
|
190
203
|
}
|
|
191
204
|
bindMember(imported, local) {
|
|
205
|
+
if (this.dialect.moduleMembers?.has(imported)) {
|
|
206
|
+
this.bindModule(local);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
192
209
|
const start = this.dialect.starts.get(imported);
|
|
193
210
|
const hook = this.dialect.hooks.get(imported);
|
|
194
211
|
if (start)
|
|
@@ -303,6 +320,18 @@ export class SuiteAdapter {
|
|
|
303
320
|
if (base.type === 'CallExpression' && this.dialect.isModule(base))
|
|
304
321
|
return this.member(chainLinks);
|
|
305
322
|
if (base.type === 'CallExpression') {
|
|
323
|
+
const callee = unwrap(base.callee);
|
|
324
|
+
if (callee.type === 'ConditionalExpression' || callee.type === 'LogicalExpression') {
|
|
325
|
+
const chosen = this.aliasOf(callee, lookup);
|
|
326
|
+
const last = chosen?.links.at(-1);
|
|
327
|
+
if (!chosen || !last || last.args || last.template)
|
|
328
|
+
return null;
|
|
329
|
+
return {
|
|
330
|
+
kind: chosen.kind,
|
|
331
|
+
index: 0,
|
|
332
|
+
modifiers: [...chosen.links.slice(0, -1), { ...last, args: base.arguments }],
|
|
333
|
+
};
|
|
334
|
+
}
|
|
306
335
|
const returned = this.returned(base, chainLinks, args, lookup);
|
|
307
336
|
return returned && { kind: returned.kind, index: 0, modifiers: returned.links };
|
|
308
337
|
}
|
|
@@ -326,6 +355,13 @@ export class SuiteAdapter {
|
|
|
326
355
|
// A parameter's declaration is its function: `describe('market orders', (test) => { test(...) })`.
|
|
327
356
|
if (this.suiteParameters.get(declaration) === base.name)
|
|
328
357
|
return { kind: 'test', index: 0 };
|
|
358
|
+
const moduleAlias = declaration.type === 'VariableDeclarator' ? this.moduleAlias(declaration, base.name, lookup) : null;
|
|
359
|
+
if (moduleAlias) {
|
|
360
|
+
const member = this.member([...links(moduleAlias), ...chainLinks]);
|
|
361
|
+
return member && member.index >= moduleAlias.length
|
|
362
|
+
? { ...member, index: member.index - moduleAlias.length }
|
|
363
|
+
: null;
|
|
364
|
+
}
|
|
329
365
|
const followed = this.imports.get(base.name)?.node === declaration &&
|
|
330
366
|
this.worthFollowing(base.name, chainLinks, args) &&
|
|
331
367
|
this.follow(base.name, !inBody && mayDeclareTests(base.name, chainLinks));
|
|
@@ -389,6 +425,23 @@ export class SuiteAdapter {
|
|
|
389
425
|
}
|
|
390
426
|
return alias && { kind: alias.kind, links: [...alias.links, ...links(destructured)] };
|
|
391
427
|
}
|
|
428
|
+
/** Members taken from a bound module retain its exported kinds, rather than becoming test modifiers. */
|
|
429
|
+
moduleAlias(declarator, name, lookup) {
|
|
430
|
+
if (!declarator.init)
|
|
431
|
+
return null;
|
|
432
|
+
const init = unwrap(declarator.init);
|
|
433
|
+
if (!this.bindings.isNamespace(init))
|
|
434
|
+
return null;
|
|
435
|
+
if (init.type === 'Identifier') {
|
|
436
|
+
const declaration = this.file.values.declarationOf(init.name, lookup.scopes);
|
|
437
|
+
if (declaration === null || !this.bindings.declarations.has(declaration))
|
|
438
|
+
return null;
|
|
439
|
+
}
|
|
440
|
+
let members = boundMembers(declarator.id, name);
|
|
441
|
+
while (members && this.dialect.moduleMembers?.has(members[0]))
|
|
442
|
+
members = members.slice(1);
|
|
443
|
+
return members;
|
|
444
|
+
}
|
|
392
445
|
aliasOf(expression, lookup) {
|
|
393
446
|
const functions = this.choices(expression, lookup)?.functions ?? [];
|
|
394
447
|
if (functions.length === 0)
|
|
@@ -512,6 +565,12 @@ export class SuiteAdapter {
|
|
|
512
565
|
if (callee.type !== 'Identifier')
|
|
513
566
|
return null;
|
|
514
567
|
const declaration = this.file.values.declarationOf(callee.name, context.scopes);
|
|
568
|
+
const members = declaration?.type === 'VariableDeclarator' ? this.moduleAlias(declaration, callee.name, context) : null;
|
|
569
|
+
if (members?.length === 1) {
|
|
570
|
+
const hook = this.dialect.hooks.get(members[0]);
|
|
571
|
+
if (hook)
|
|
572
|
+
return this.hook(call, hook, context);
|
|
573
|
+
}
|
|
515
574
|
const hook = declaration === null
|
|
516
575
|
? this.dialect.hooks.get(callee.name)
|
|
517
576
|
: this.bindings.declarations.has(declaration) && this.bindings.hooks.get(callee.name);
|
|
@@ -179,14 +179,31 @@ export class VitestAdapter extends SuiteAdapter {
|
|
|
179
179
|
*/
|
|
180
180
|
unboundCall(call, context) {
|
|
181
181
|
const callee = unwrap(call.callee);
|
|
182
|
-
if (callee.type
|
|
182
|
+
if (callee.type === 'CallExpression')
|
|
183
|
+
return this.unboundCall(callee, context);
|
|
184
|
+
if (callee.type === 'Identifier') {
|
|
185
|
+
const found = this.destructuredMember(callee.name, context);
|
|
186
|
+
if (found && readsItsFunction(found.kind, found.member, this.file.version)) {
|
|
187
|
+
const from = snippet(text(this.file, found.from));
|
|
188
|
+
const message = `${callee.name} is destructured from ${from}, so it loses the test object it reads, and Vitest fails the file.`;
|
|
189
|
+
return { kind: 'invalid', problem: problem('invalid-chain', call, message, callee.name) };
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (callee.type !== 'Identifier' &&
|
|
193
|
+
callee.type !== 'ConditionalExpression' &&
|
|
194
|
+
callee.type !== 'LogicalExpression' &&
|
|
195
|
+
callee.type !== 'SequenceExpression') {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
const chosen = this.testFunction(callee, context.scopes, (name, scopes) => context.returnsOf(name, scopes));
|
|
199
|
+
const member = chosen?.links.at(-1);
|
|
200
|
+
if (!chosen || !member || member.args || member.template)
|
|
183
201
|
return null;
|
|
184
|
-
|
|
185
|
-
if (!found || !readsItsFunction(found.kind, found.member, this.file.version))
|
|
202
|
+
if (!readsItsFunction(chosen.kind, member.name, this.file.version))
|
|
186
203
|
return null;
|
|
187
|
-
const
|
|
188
|
-
const message = `${
|
|
189
|
-
return { kind: 'invalid', problem: problem('invalid-chain', call, message,
|
|
204
|
+
const source = snippet(text(this.file, callee));
|
|
205
|
+
const message = `${source} is called without the test or describe function it reads as this, so Vitest fails the file.`;
|
|
206
|
+
return { kind: 'invalid', problem: problem('invalid-chain', call, message, source) };
|
|
190
207
|
}
|
|
191
208
|
chainCall(call, context) {
|
|
192
209
|
const chain = readChain(call.callee);
|
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,
|
|
@@ -642,7 +650,7 @@ class RecordBuilder {
|
|
|
642
650
|
const titles = describes.flatMap((scope) => suiteOf(scope).declaration.title?.text ?? []).reverse();
|
|
643
651
|
// In a loop, a title path that never changes is registered again on each pass.
|
|
644
652
|
const repeated = playwright &&
|
|
645
|
-
test.passes.some((passes) => passes
|
|
653
|
+
test.passes.some((passes) => passes !== null && passes > 1) &&
|
|
646
654
|
describes.every((scope) => !suiteOf(scope).declaration.title?.isDynamic);
|
|
647
655
|
if (repeated) {
|
|
648
656
|
const message = 'The test is declared in a loop with the same title on each pass, so Playwright fails to load the file and runs no tests at all.';
|
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/dist/values.js
CHANGED
|
@@ -897,7 +897,7 @@ function localRequire(expression) {
|
|
|
897
897
|
const node = unwrap(expression);
|
|
898
898
|
if (node.type !== 'CallExpression' || node.callee.type !== 'Identifier' || node.callee.name !== 'require')
|
|
899
899
|
return null;
|
|
900
|
-
const
|
|
901
|
-
const isLocal = argument
|
|
900
|
+
const argument = node.arguments.at(0);
|
|
901
|
+
const isLocal = argument?.type === 'Literal' && typeof argument.value === 'string' && /^\.\.?\//.test(argument.value);
|
|
902
902
|
return isLocal ? argument.value : null;
|
|
903
903
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "test-inventory",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
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": [
|