test-inventory 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/README.md +3 -1
- package/dist/ast.d.ts +11 -0
- package/dist/ast.js +30 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +59 -12
- package/dist/extract.js +55 -10
- package/dist/files.d.ts +1 -1
- package/dist/files.js +5 -3
- package/dist/filter.d.ts +37 -0
- package/dist/filter.js +153 -0
- package/dist/frameworks/bindings.d.ts +37 -6
- package/dist/frameworks/bindings.js +213 -74
- package/dist/frameworks/common.d.ts +17 -2
- package/dist/frameworks/common.js +46 -2
- package/dist/frameworks/playwright.d.ts +24 -4
- package/dist/frameworks/playwright.js +132 -63
- package/dist/frameworks/vitest.d.ts +23 -2
- package/dist/frameworks/vitest.js +166 -84
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -0
- package/dist/json.d.ts +7 -1
- package/dist/json.js +30 -9
- package/dist/model.d.ts +41 -2
- package/dist/options.d.ts +5 -2
- package/dist/records.js +5 -3
- package/dist/resolve.js +6 -1
- package/dist/types.d.ts +17 -1
- package/package.json +2 -2
- package/schema/v1.json +1 -1
package/dist/resolve.js
CHANGED
|
@@ -267,7 +267,12 @@ function workspacePackages(directory) {
|
|
|
267
267
|
const workspaces = readJson(path.join(folder, 'package.json'))?.workspaces;
|
|
268
268
|
const fromManifest = Array.isArray(workspaces) ? workspaces : record(workspaces)?.packages;
|
|
269
269
|
const pnpm = readText(path.join(folder, 'pnpm-workspace.yaml'));
|
|
270
|
-
|
|
270
|
+
// pnpm reads only pnpm-workspace.yaml, and npm, Yarn and Bun only package.json, so a repository that moved to
|
|
271
|
+
// pnpm may still have an old list there. Packages from both are found.
|
|
272
|
+
const lists = [Array.isArray(fromManifest) ? fromManifest : null, pnpm ? pnpmWorkspacePatterns(pnpm) : null];
|
|
273
|
+
const patterns = lists.some((list) => list !== null)
|
|
274
|
+
? lists.flat().filter((item) => typeof item === 'string')
|
|
275
|
+
: null;
|
|
271
276
|
if (patterns) {
|
|
272
277
|
// Packages are inside the workspace. A pattern or a link that leads out of its folder could send the search through
|
|
273
278
|
// the whole disk, so neither is followed.
|
package/dist/types.d.ts
CHANGED
|
@@ -49,6 +49,22 @@ export interface Inventory {
|
|
|
49
49
|
tests: TestRecord[];
|
|
50
50
|
diagnostics: Diagnostic[];
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* One line of the JSON Lines output (`--format jsonl`): the inventory with each record on its own line, marked by
|
|
54
|
+
* `type`. The `inventory` line comes first, then the suites, tests and diagnostics in the order of the JSON output,
|
|
55
|
+
* and the `summary` line last.
|
|
56
|
+
*/
|
|
57
|
+
export type InventoryLine = ({
|
|
58
|
+
type: 'inventory';
|
|
59
|
+
} & Pick<Inventory, 'schemaVersion' | 'tool' | 'framework' | 'frameworkVersion'>) | ({
|
|
60
|
+
type: 'suite';
|
|
61
|
+
} & SuiteRecord) | ({
|
|
62
|
+
type: 'test';
|
|
63
|
+
} & TestRecord) | ({
|
|
64
|
+
type: 'diagnostic';
|
|
65
|
+
} & Diagnostic) | ({
|
|
66
|
+
type: 'summary';
|
|
67
|
+
} & Summary);
|
|
52
68
|
/** @inline */
|
|
53
69
|
export interface Tool {
|
|
54
70
|
name: 'test-inventory';
|
|
@@ -219,7 +235,7 @@ export interface TestRecord {
|
|
|
219
235
|
caseCount: Count | null;
|
|
220
236
|
/** Declared inside a loop, `forEach` or `map`. */
|
|
221
237
|
isInLoop: boolean;
|
|
222
|
-
/** Declared inside `if`, `?:`,
|
|
238
|
+
/** Declared inside `if`, `?:`, `&&`, `switch` or a `catch` block. */
|
|
223
239
|
isInCondition: boolean;
|
|
224
240
|
/** Declared inside a plain function. */
|
|
225
241
|
isInFunction: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "test-inventory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Test metadata from source code, not from test results.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"testing",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"lint": "eslint .",
|
|
72
72
|
"lint:fix": "eslint . --fix",
|
|
73
73
|
"format": "prettier --write . --ignore-path .gitignore --ignore-path .prettierignore --ignore-path .git/info/exclude",
|
|
74
|
-
"format:check": "
|
|
74
|
+
"format:check": "node scripts/format-check.ts",
|
|
75
75
|
"docs:api": "typedoc",
|
|
76
76
|
"docs:dev": "npm run docs:api && vitepress dev docs",
|
|
77
77
|
"docs:build": "npm run docs:api && vitepress build docs",
|
package/schema/v1.json
CHANGED
|
@@ -730,7 +730,7 @@
|
|
|
730
730
|
},
|
|
731
731
|
"isInCondition": {
|
|
732
732
|
"type": "boolean",
|
|
733
|
-
"description": "Declared inside `if`, `?:`,
|
|
733
|
+
"description": "Declared inside `if`, `?:`, `&&`, `switch` or a `catch` block."
|
|
734
734
|
},
|
|
735
735
|
"isInFunction": {
|
|
736
736
|
"type": "boolean",
|