test-inventory 0.12.1 → 0.12.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 +135 -0
- package/README.md +2 -1
- package/dist/ast.d.ts +7 -2
- package/dist/ast.js +43 -3
- package/dist/case-titles.d.ts +5 -11
- package/dist/case-titles.js +69 -55
- package/dist/config-runs.d.ts +19 -2
- package/dist/config-runs.js +379 -90
- package/dist/config.d.ts +0 -5
- package/dist/config.js +0 -7
- package/dist/dependency-hash.js +1 -32
- package/dist/diagnostics.js +17 -2
- package/dist/diff.d.ts +2 -45
- package/dist/extract.d.ts +13 -3
- package/dist/extract.js +837 -89
- package/dist/frameworks/bun.js +47 -24
- package/dist/frameworks/common.d.ts +4 -2
- package/dist/frameworks/common.js +10 -11
- package/dist/frameworks/jasmine-registration.d.ts +47 -0
- package/dist/frameworks/jasmine-registration.js +632 -0
- package/dist/frameworks/jasmine.d.ts +7 -1
- package/dist/frameworks/jasmine.js +65 -70
- package/dist/frameworks/jest.d.ts +2 -2
- package/dist/frameworks/jest.js +126 -51
- package/dist/frameworks/vitest.d.ts +2 -3
- package/dist/frameworks/vitest.js +80 -16
- package/dist/generator-steps.d.ts +56 -0
- package/dist/generator-steps.js +254 -0
- package/dist/model.d.ts +37 -5
- package/dist/mutation-arrays.d.ts +25 -0
- package/dist/mutation-arrays.js +229 -0
- package/dist/mutation-calls.d.ts +33 -0
- package/dist/mutation-calls.js +774 -0
- package/dist/mutation-order.d.ts +19 -0
- package/dist/mutation-order.js +55 -0
- package/dist/mutation-references.d.ts +109 -0
- package/dist/mutation-references.js +462 -0
- package/dist/mutation-returns.d.ts +13 -0
- package/dist/mutation-returns.js +71 -0
- package/dist/node-scripts.d.ts +4 -1
- package/dist/node-scripts.js +77 -11
- package/dist/options.d.ts +2 -0
- package/dist/options.js +6 -1
- package/dist/records.d.ts +5 -3
- package/dist/records.js +81 -28
- package/dist/scan-file.d.ts +18 -4
- package/dist/scan-file.js +44 -5
- package/dist/scan-source.js +2 -1
- package/dist/scan.js +30 -13
- package/dist/types.d.ts +45 -1
- package/dist/values.d.ts +72 -18
- package/dist/values.js +651 -172
- package/dist/vitest-concurrency.d.ts +16 -0
- package/dist/vitest-concurrency.js +55 -0
- package/package.json +1 -1
- package/schema/v1.json +1 -0
package/dist/config.d.ts
CHANGED
|
@@ -117,11 +117,6 @@ export declare class Configs {
|
|
|
117
117
|
inFolder(folder: string): ConfigFile | null;
|
|
118
118
|
/** Config file names, in the order the runner looks for them; Jest reads `.cts` from 30.0 and `.mts` from 30.4. */
|
|
119
119
|
private names;
|
|
120
|
-
/**
|
|
121
|
-
* The config Jest started in a folder with a package.json reads: as `jestConfigIn`, with the package.json itself,
|
|
122
|
-
* and so Jest's defaults from that folder, when it has no `jest` key.
|
|
123
|
-
*/
|
|
124
|
-
jestConfigFrom(folder: string): ConfigFile | null;
|
|
125
120
|
/**
|
|
126
121
|
* The config Jest takes in a folder: a `jest.config` file, else the `package.json` with a `jest` key, which from 30.0
|
|
127
122
|
* may be the path to the config. A `package.json` without one is a config only in the root, as Jest started there
|
package/dist/config.js
CHANGED
|
@@ -1103,13 +1103,6 @@ export class Configs {
|
|
|
1103
1103
|
return CONFIG_FILES.jest.filter((name) => (!name.endsWith('.cts') || atLeast(this.version, 30, 0)) &&
|
|
1104
1104
|
(!name.endsWith('.mts') || atLeast(this.version, 30, 4)));
|
|
1105
1105
|
}
|
|
1106
|
-
/**
|
|
1107
|
-
* The config Jest started in a folder with a package.json reads: as `jestConfigIn`, with the package.json itself,
|
|
1108
|
-
* and so Jest's defaults from that folder, when it has no `jest` key.
|
|
1109
|
-
*/
|
|
1110
|
-
jestConfigFrom(folder) {
|
|
1111
|
-
return this.jestConfigIn(folder, true);
|
|
1112
|
-
}
|
|
1113
1106
|
/**
|
|
1114
1107
|
* The config Jest takes in a folder: a `jest.config` file, else the `package.json` with a `jest` key, which from 30.0
|
|
1115
1108
|
* may be the path to the config. A `package.json` without one is a config only in the root, as Jest started there
|
package/dist/dependency-hash.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { moduleMatches, modulePatterns } from "./module-globs.js";
|
|
3
3
|
import { visitorKeys, } from 'oxc-parser';
|
|
4
|
-
import { childNodes, isFunctionNode, propertyKey, unwrap } from "./ast.js";
|
|
4
|
+
import { childNodes, isFunctionNode, isReference, propertyKey, unwrap } from "./ast.js";
|
|
5
5
|
import { exportName, parseModule } from "./frameworks/bindings.js";
|
|
6
6
|
import { destructuredNames, problem, takesWhole } from "./frameworks/common.js";
|
|
7
7
|
import { shortHash, hashNodes } from "./hash.js";
|
|
@@ -1488,37 +1488,6 @@ function combine(merged, reach) {
|
|
|
1488
1488
|
const files = [...new Set([...merged.files, ...reach.byFile.keys()])].sort();
|
|
1489
1489
|
return { files, byFile, parts };
|
|
1490
1490
|
}
|
|
1491
|
-
/** Whether an identifier refers to a binding, rather than naming a property, a label or a member. */
|
|
1492
|
-
function isReference(key, parent) {
|
|
1493
|
-
switch (parent?.type) {
|
|
1494
|
-
case 'MemberExpression':
|
|
1495
|
-
return key === 'object' || parent.computed;
|
|
1496
|
-
case 'Property':
|
|
1497
|
-
case 'MethodDefinition':
|
|
1498
|
-
case 'PropertyDefinition':
|
|
1499
|
-
case 'AccessorProperty':
|
|
1500
|
-
case 'TSPropertySignature':
|
|
1501
|
-
case 'TSMethodSignature':
|
|
1502
|
-
return key !== 'key' || parent.computed;
|
|
1503
|
-
case 'LabeledStatement':
|
|
1504
|
-
case 'BreakStatement':
|
|
1505
|
-
case 'ContinueStatement':
|
|
1506
|
-
return false;
|
|
1507
|
-
case 'TSEnumMember':
|
|
1508
|
-
case 'TSModuleDeclaration':
|
|
1509
|
-
case 'TSTypeParameter':
|
|
1510
|
-
case 'TSImportEqualsDeclaration':
|
|
1511
|
-
return key !== 'id' && key !== 'name';
|
|
1512
|
-
case 'TSQualifiedName':
|
|
1513
|
-
return key === 'left';
|
|
1514
|
-
case 'ExportSpecifier':
|
|
1515
|
-
return key === 'local';
|
|
1516
|
-
case 'MetaProperty':
|
|
1517
|
-
return false;
|
|
1518
|
-
default:
|
|
1519
|
-
return true;
|
|
1520
|
-
}
|
|
1521
|
-
}
|
|
1522
1491
|
/**
|
|
1523
1492
|
* A namespace or `import x = require()` a name refers to, or for a type test also an interface or type alias, looked
|
|
1524
1493
|
* up in the scopes around it. Imports, classes and enums are bindings `Values` already finds.
|
package/dist/diagnostics.js
CHANGED
|
@@ -14,6 +14,7 @@ export const LEVELS = {
|
|
|
14
14
|
'duplicate-id': 'error',
|
|
15
15
|
'internal-error': 'error',
|
|
16
16
|
'invalid-chain': 'error',
|
|
17
|
+
'invalid-hook': 'error',
|
|
17
18
|
'skip-without-body': 'warning',
|
|
18
19
|
'test-without-body': 'error',
|
|
19
20
|
'describe-not-called': 'error',
|
|
@@ -61,9 +62,23 @@ export const REJECTS_FILE = {
|
|
|
61
62
|
vitest: new Set(['invalid-chain', 'removed-api', 'undefined-tag']),
|
|
62
63
|
jest: new Set(['invalid-chain', 'test-without-body', 'async-describe', 'describe-throws']),
|
|
63
64
|
mocha: new Set(['invalid-chain', 'test-without-body']),
|
|
64
|
-
jasmine: new Set([
|
|
65
|
+
jasmine: new Set([
|
|
66
|
+
'invalid-chain',
|
|
67
|
+
'invalid-hook',
|
|
68
|
+
'unresolved-option',
|
|
69
|
+
'test-without-body',
|
|
70
|
+
'async-describe',
|
|
71
|
+
'describe-throws',
|
|
72
|
+
]),
|
|
65
73
|
cypress: new Set(['invalid-chain', 'test-without-body', 'describe-throws']),
|
|
66
|
-
webdriverio: new Set([
|
|
74
|
+
webdriverio: new Set([
|
|
75
|
+
'invalid-chain',
|
|
76
|
+
'invalid-hook',
|
|
77
|
+
'unresolved-option',
|
|
78
|
+
'test-without-body',
|
|
79
|
+
'async-describe',
|
|
80
|
+
'describe-throws',
|
|
81
|
+
]),
|
|
67
82
|
node: new Set(['invalid-chain', 'unresolved-option']),
|
|
68
83
|
bun: new Set(['invalid-chain', 'test-without-body']),
|
|
69
84
|
};
|
package/dist/diff.d.ts
CHANGED
|
@@ -1,48 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
export type ChangeKind = 'added' | 'removed' | 'moved' | 'renamed' | 'bodyChanged' | 'dependenciesChanged' | 'newlySkipped' | 'reEnabled' | 'stateChanged' | 'tagsChanged' | 'metadataChanged';
|
|
4
|
-
/** The evidence that two records identify the same test; null for an addition or removal. */
|
|
5
|
-
export type MatchMethod = 'id' | 'bodyHash' | 'bodyHashAndFile' | 'bodyHashAndSuite' | 'bodyHashAndDependencies';
|
|
6
|
-
/** One addition, removal or changed test. Locations and records come from the saved scans unchanged. */
|
|
7
|
-
export type TestChange = {
|
|
8
|
-
kinds: ChangeKind[];
|
|
9
|
-
/** Changed record keys, excluding locations and ids. Hashes are included only when comparable. */
|
|
10
|
-
changedFields: (keyof TestRecord)[];
|
|
11
|
-
} & ({
|
|
12
|
-
match: MatchMethod;
|
|
13
|
-
before: TestRecord;
|
|
14
|
-
after: TestRecord;
|
|
15
|
-
} | {
|
|
16
|
-
match: null;
|
|
17
|
-
before: TestRecord;
|
|
18
|
-
after: null;
|
|
19
|
-
} | {
|
|
20
|
-
match: null;
|
|
21
|
-
before: null;
|
|
22
|
-
after: TestRecord;
|
|
23
|
-
});
|
|
24
|
-
/** Tests with identical syntax-tree bodies, including trivial bodies; this does not prove they test the same thing. */
|
|
25
|
-
export interface CloneGroup {
|
|
26
|
-
bodyHash: string;
|
|
27
|
-
testIds: string[];
|
|
28
|
-
}
|
|
29
|
-
/** The deterministic comparison of two saved inventories. */
|
|
30
|
-
export interface InventoryDiff {
|
|
31
|
-
schemaVersion: 1;
|
|
32
|
-
tool: Tool;
|
|
33
|
-
framework: Framework;
|
|
34
|
-
beforeToolVersion: string;
|
|
35
|
-
afterToolVersion: string;
|
|
36
|
-
hashesComparable: boolean;
|
|
37
|
-
/** Category counts overlap; changed counts matched tests, while unchanged counts matches with no changes. */
|
|
38
|
-
summary: Record<ChangeKind | 'changed' | 'unchanged', number>;
|
|
39
|
-
changes: TestChange[];
|
|
40
|
-
clones: {
|
|
41
|
-
before: CloneGroup[];
|
|
42
|
-
after: CloneGroup[];
|
|
43
|
-
};
|
|
44
|
-
warnings: string[];
|
|
45
|
-
}
|
|
1
|
+
import type { Inventory, InventoryDiff } from './types.ts';
|
|
2
|
+
export type { ChangeKind, CloneGroup, InventoryDiff, MatchMethod, TestChange } from './types.ts';
|
|
46
3
|
/**
|
|
47
4
|
* Compares complete inventories without mutating them. Match ids first, then mutually unique body hashes, narrowing
|
|
48
5
|
* ambiguous hashes by file, suite and dependencies. Remaining ambiguities stay additions and removals. Hashes from
|
package/dist/extract.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CallExpression } from 'oxc-parser';
|
|
1
|
+
import type { CallExpression, Node } from 'oxc-parser';
|
|
2
2
|
import type { Adapter, Details, Mode, ModuleReader, ModuleSource, Problem, RunSettings, Span, StateSetting, SuiteDeclaration, TestDeclaration } from './model.ts';
|
|
3
3
|
import type { ParsedFile } from './parse.ts';
|
|
4
4
|
import { type SourceText } from './source.ts';
|
|
@@ -40,7 +40,7 @@ export interface PendingSuite {
|
|
|
40
40
|
/** The file the describe is written in. */
|
|
41
41
|
frame: Frame;
|
|
42
42
|
/** The outermost helper call in the scanned file that declares the describe; null when the file declares it. */
|
|
43
|
-
registeredBy:
|
|
43
|
+
registeredBy: Node | null;
|
|
44
44
|
/** Where the scanned file registers the describe: its own call, or the outermost helper call that declares it. */
|
|
45
45
|
order: number;
|
|
46
46
|
/** Statements of the tests and describes directly inside, left out of the describe's body hash. */
|
|
@@ -52,6 +52,8 @@ export interface PendingSuite {
|
|
|
52
52
|
caseIndex: number | null;
|
|
53
53
|
}
|
|
54
54
|
export interface PendingTest {
|
|
55
|
+
/** Line where collection stopped before this spec could register in its suite. */
|
|
56
|
+
registrationStoppedAt?: number;
|
|
55
57
|
scope: Scope;
|
|
56
58
|
/** The test whose body declares this one as a subtest; null for a test declared in the file or a describe. */
|
|
57
59
|
parent: PendingTest | null;
|
|
@@ -63,7 +65,7 @@ export interface PendingTest {
|
|
|
63
65
|
/** The file the test is written in. */
|
|
64
66
|
frame: Frame;
|
|
65
67
|
/** The outermost helper call in the scanned file that declares the test; null when the file declares it. */
|
|
66
|
-
registeredBy:
|
|
68
|
+
registeredBy: Node | null;
|
|
67
69
|
/** Where the scanned file registers the test: its own call, or the outermost helper call that declares it. */
|
|
68
70
|
order: number;
|
|
69
71
|
/** States from the declaration, then from calls in the body such as `test.skip(condition)`. */
|
|
@@ -100,6 +102,10 @@ export interface Frame {
|
|
|
100
102
|
}
|
|
101
103
|
/** How the walk lists tables and loops. */
|
|
102
104
|
export interface ExtractOptions {
|
|
105
|
+
/** Follow modules loaded while a Playwright spec registers its tests. */
|
|
106
|
+
collectImports?: boolean;
|
|
107
|
+
/** Whether this local import still needs to run in the collecting Playwright process. */
|
|
108
|
+
initializeModule?: (file: string) => boolean;
|
|
103
109
|
/** One test or describe per case of a table and per pass of a loop whose values the scan can work out. */
|
|
104
110
|
expandCases: boolean;
|
|
105
111
|
/** Vitest's `[major, minor]`, whose rules give each case its title; null for the newest rules. */
|
|
@@ -108,6 +114,9 @@ export interface ExtractOptions {
|
|
|
108
114
|
/** Reads a module a helper is imported from as a frame; null when it can't be parsed. */
|
|
109
115
|
export type OpenModule = (module: ModuleSource) => Frame | null;
|
|
110
116
|
export interface Extraction {
|
|
117
|
+
/** Line where an uncaught exception stopped Jasmine loading this spec file. */
|
|
118
|
+
registrationStoppedAt?: number;
|
|
119
|
+
unknownRegistration: boolean;
|
|
111
120
|
suites: PendingSuite[];
|
|
112
121
|
tests: PendingTest[];
|
|
113
122
|
/** Problems not tied to one test. */
|
|
@@ -131,5 +140,6 @@ export declare function anySlow(slows: NonNullable<RunSettings['slow']>[]): NonN
|
|
|
131
140
|
/** Conditions joined with `||`, adding parentheses where a part could otherwise be read differently. */
|
|
132
141
|
export declare function eitherCondition(parts: string[]): string;
|
|
133
142
|
export declare function noHooks(): HookCounts;
|
|
143
|
+
export declare function initializesLocalModule(source: string): boolean;
|
|
134
144
|
/** Walks the scanned file; `openModule` reads the modules of imported helpers that the file calls. */
|
|
135
145
|
export declare function extract(main: Frame, openModule: OpenModule, options?: ExtractOptions): Extraction;
|