test-inventory 0.10.4 → 0.11.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 +106 -0
- package/README.md +6 -4
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +18 -6
- package/dist/config-runs.d.ts +30 -4
- package/dist/config-runs.js +193 -38
- package/dist/config.d.ts +7 -6
- package/dist/config.js +260 -26
- package/dist/dependency-hash.d.ts +9 -1
- package/dist/dependency-hash.js +128 -13
- package/dist/diff.js +2 -0
- package/dist/extract.js +75 -17
- package/dist/files.js +2 -1
- package/dist/filter.js +1 -0
- package/dist/framework-version.d.ts +6 -0
- package/dist/framework-version.js +37 -9
- package/dist/frameworks/bindings.d.ts +9 -0
- package/dist/frameworks/bindings.js +28 -5
- package/dist/frameworks/bun.js +2 -2
- package/dist/frameworks/common.d.ts +12 -3
- package/dist/frameworks/common.js +30 -12
- package/dist/frameworks/jasmine.js +11 -3
- package/dist/frameworks/jest.js +11 -7
- package/dist/frameworks/mocha.js +3 -3
- package/dist/frameworks/node.js +6 -4
- package/dist/frameworks/playwright.d.ts +11 -3
- package/dist/frameworks/playwright.js +101 -32
- package/dist/frameworks/test-functions.d.ts +13 -7
- package/dist/frameworks/test-functions.js +41 -27
- package/dist/frameworks/vitest.js +11 -6
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/model.d.ts +4 -1
- package/dist/node-scripts.d.ts +15 -1
- package/dist/node-scripts.js +140 -13
- package/dist/parse.d.ts +3 -0
- package/dist/parse.js +33 -0
- package/dist/records.js +7 -4
- package/dist/resolve.d.ts +3 -1
- package/dist/resolve.js +48 -15
- package/dist/run-commands.d.ts +20 -0
- package/dist/run-commands.js +107 -0
- package/dist/scan.js +15 -5
- package/dist/types.d.ts +9 -1
- package/dist/values.d.ts +21 -3
- package/dist/values.js +112 -13
- package/package.json +1 -1
- package/schema/diff-v1.json +12 -1
- package/schema/v1.json +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,111 @@
|
|
|
1
1
|
# test-inventory
|
|
2
2
|
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#139](https://github.com/Huldoser/test-inventory/pull/139) [`bf0bb70`](https://github.com/Huldoser/test-inventory/commit/bf0bb70af35ce906fcdffbd60de115c12d01752b) - Support Cypress 10.0 and newer, from 12.0, and WebdriverIO 7.0 and newer, from 8.0: comparing the fixtures with Cypress 10.11.0 and 11.2.0 and WebdriverIO 7.40.0 running them found no difference, and their test syntax is the same. Cypress before 10 kept its config in `cypress.json`, which the scan doesn't read.
|
|
8
|
+
|
|
9
|
+
- [#137](https://github.com/Huldoser/test-inventory/pull/137) [`51f3376`](https://github.com/Huldoser/test-inventory/commit/51f3376a53c39a51f95ccb4d127fc8a870399f8c) - Support Cypress 12.0 and newer, from 13.0, and WebdriverIO 8.0 and newer, from 9.0: their syntax is the same, and comparing the fixtures with Cypress 12.17.4 and WebdriverIO 8.46.0 running them found no difference. Projects on them got an `unsupported-framework-version` warning.
|
|
10
|
+
|
|
11
|
+
- [#141](https://github.com/Huldoser/test-inventory/pull/141) [`ddd192b`](https://github.com/Huldoser/test-inventory/commit/ddd192b6a4ba1e859583b55e84c02dcf0cbbd563) - Support Jasmine 3.0 and newer, from 4.0: Jasmine 3 still has about a million weekly downloads of jasmine-core, and projects on it got an `unsupported-framework-version` warning. Read from jasmine-core 3.99.1 and 4.0.0, `it`, `fit`, `xit` and `describe` check their functions the same way, and comparing the risk fixture with Jasmine 3.99.0 running it found no difference. Jasmine 3's reports give no spec file, so the comparison runs each spec file on its own.
|
|
12
|
+
|
|
13
|
+
- [#137](https://github.com/Huldoser/test-inventory/pull/137) [`51f3376`](https://github.com/Huldoser/test-inventory/commit/51f3376a53c39a51f95ccb4d127fc8a870399f8c) - Support Jest 27.0 and newer, from 29.0: about a third of the popular projects that use Jest are on 26 to 28, which the scan read with a warning that the version wasn't supported. Read from `jest-circus` 27.5 and 28.0, the chains are those of Jest 29 but for `.failing`, which is an `invalid-chain` error before Jest 28, as the call throws and Jest fails the file. Checked against Jest 27.5.1 and 28.1.3 running the settlement fixture, with `.each` case titles.
|
|
14
|
+
|
|
15
|
+
- [#142](https://github.com/Huldoser/test-inventory/pull/142) [`130da5f`](https://github.com/Huldoser/test-inventory/commit/130da5fbfef8e204e545c406d86c5e478a097da3) - Support Playwright 1.31 and newer, from 1.42: about 3.7 million weekly downloads of `@playwright/test` are on 1.31 to 1.41, and projects on them got an `unsupported-framework-version` warning. Before 1.42 the scan follows what those versions do, read from their source and checked by running them: a describe with details throws, so the file fails to load (`invalid-chain`); a test with details is listed without their tags and fails when it runs (an `invalid-chain` warning); `test.fail(title, body)`, and `test.skip()`, `fixme()` or `fail()` with details, declare no test and apply to every test in the scope (`skip-without-body`); a test without a body loads and fails when it runs (a `test-without-body` warning); and a test has only the tags of its own title, as Playwright's report gives them. Comparing the fixtures with Playwright 1.31.2, 1.34.3, 1.38.1 and 1.41.2 found no difference beyond the files that fail to load, and none on a copy whose describes have no details, except the state a describe's `test.fail()` sets, which `--list` shows only from 1.38 and a run applies in each. Playwright 1.30 and older keep the tests of a file that fails to load, so they stay unsupported.
|
|
16
|
+
|
|
17
|
+
- [#133](https://github.com/Huldoser/test-inventory/pull/133) [`0b4265d`](https://github.com/Huldoser/test-inventory/commit/0b4265d1d2d6e7ff8bf87429e97201793ab1ca67) - `--format commands` prints, in place of the inventory, a command line for each config that runs the tests kept, with the projects that run them, as `npx playwright test tests/orders/limit-orders.spec.ts --config playwright.config.ts --project chromium webkit`; with `--related`, the tests a change can affect. Each runner gets the files the way it takes them: Jest exact paths with `--runTestsByPath`, Cypress one command for each testing type, Bun paths that start with `./`. Mocha adds files named on its command line to its config's `spec`, so a `#` line above its command says that every spec the config lists runs too. `runCommands()` gives the same commands from the library.
|
|
18
|
+
|
|
19
|
+
- [#128](https://github.com/Huldoser/test-inventory/pull/128) [`5491e0d`](https://github.com/Huldoser/test-inventory/commit/5491e0d08b19e0937248f93b3e8d73d3e4fb8fc4) - Each test has `unfollowedDependencies`: the file and line of each place it reaches that the scan can't follow, as `support/venues.ts:2`, sorted, beside `hasUnfollowedDependencies`. A test that `--related` keeps for such a place now says where, so a reader or an agent can judge whether a change could be what that place loads; one dynamic import in a shared setup file or a config setting the scan can't work out often marks a whole suite. `--fields` can pick it. `diff` ignores the list, as it ignores line numbers; `hasUnfollowedDependencies` still shows a test that starts or stops reaching such code. Inventories saved by earlier versions don't have the key, so scan both revisions again with this version before comparing them.
|
|
20
|
+
|
|
21
|
+
- [#138](https://github.com/Huldoser/test-inventory/pull/138) [`6b4960a`](https://github.com/Huldoser/test-inventory/commit/6b4960a31b45618e72a92fe1a3142af806f7defb) - Support Vitest 1.0 and newer, from 3.0: Vitest 2 and 1 still have about 15 million weekly downloads, and projects on them got an `unsupported-framework-version` warning. Read from `@vitest/runner` 1.6.1, 2.0.0, 2.1.9 and 3.0.9, their chains are those of Vitest 3 but for `.for`: `test.for` came in 2.0 and `describe.for` in 3.0, and before, each is an `invalid-chain` error, as the call throws and Vitest fails the file. Compared with Vitest 1.6.1, 2.0.5 and 2.1.9 running the strategy fixture: no other difference.
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- [#140](https://github.com/Huldoser/test-inventory/pull/140) [`edea139`](https://github.com/Huldoser/test-inventory/commit/edea1396bb12aa40da143dde62aa445ccee8f15e) - Keep a backslash in a file name on Linux and macOS, where it is no folder separator: a fixture named `file \slash.js` failed the whole scan with `ENOENT`.
|
|
26
|
+
|
|
27
|
+
- [#143](https://github.com/Huldoser/test-inventory/pull/143) [`c62d7ee`](https://github.com/Huldoser/test-inventory/commit/c62d7ee8651edd281727e93ffbfe6bce36a3fa5f) - Read `test(title, checkFill, 10_000)`, a body passed by name before a timeout, as a call shaped like a test, as `test(title, () => {}, 10_000)` already was. A test object a local module exports again was followed to that module only after such a call, so when it was the file's first test through that name, it declared nothing, without a warning.
|
|
28
|
+
|
|
29
|
+
- [#127](https://github.com/Huldoser/test-inventory/pull/127) [`b32cc66`](https://github.com/Huldoser/test-inventory/commit/b32cc6682183a316c1c932494312ab4d4fd7ad74) - Follow a module loaded by a path built from string literals and the module's own folder, as `require(path.join(__dirname, 'venues', 'nasdaq.cjs'))`, `import(pathToFileURL(resolve(SUPPORT, 'venues/nyse.ts')).href)` or `import(fileURLToPath(new URL('../support/feeds.mjs', import.meta.url)))`, also through constants, instead of reporting it as worked out at run time. `__dirname`, `__filename` and `import.meta.dirname`, `filename` and `url` are read with `path.join()`, `path.resolve()` with an absolute part, `path.dirname()`, `new URL()`, `fileURLToPath()` and `pathToFileURL()`.
|
|
30
|
+
|
|
31
|
+
- [#134](https://github.com/Huldoser/test-inventory/pull/134) [`541ed66`](https://github.com/Huldoser/test-inventory/commit/541ed667f378a3dbfd9de0a61130715a8bf9ae0e) - Follow a describe function a local CommonJS module takes from its runner and exports again, as `module.exports = { describe, it }` after `const { describe, it } = require('@jest/globals')`, and one it exports under another name, as `module.exports.suite = describe`. The module was reported as exporting no test object, so `describe.skip` there didn't skip its tests and their suite was missing.
|
|
32
|
+
|
|
33
|
+
- [#123](https://github.com/Huldoser/test-inventory/pull/123) [`cea05e7`](https://github.com/Huldoser/test-inventory/commit/cea05e7b9305c708ab9d752bbc9383b52d10b463) - Read a config that calls a function it declares or imports by name from a local file, as `export default createVitestConfig('node')`, as what that function returns. Without globs, also find the files a package.json script's config runs when no config found by name runs them, or the one there can't be read. The AI SDK repository, whose packages are configured this way, now scans as 19,693 tests instead of 1,186.
|
|
34
|
+
|
|
35
|
+
- [#122](https://github.com/Huldoser/test-inventory/pull/122) [`f8f4a09`](https://github.com/Huldoser/test-inventory/commit/f8f4a0907d82a6c9444434fee321d2304d4c6c83) - Read a config factory with its parameters set from the call's arguments, their defaults and destructuring included, as `configureE2e({ port: 3002 })` or `module.exports = buildConfig(__dirname, { testRegex })`, and follow one a workspace package exports, a default or CommonJS export, or one passed on from another module. A default written with `??`, `||` or `&&`, as `options ?? {}`, is read when its left side is known.
|
|
36
|
+
|
|
37
|
+
- [#132](https://github.com/Huldoser/test-inventory/pull/132) [`ca1e007`](https://github.com/Huldoser/test-inventory/commit/ca1e007bf424c7f678a99f9e66b5b9515aab0c8a) - Follow a setup file a config names with `require.resolve('./global-setup.js')` or `import.meta.resolve('./global-setup.ts')`, also through constants and `path.join()`, as Jest's `globalSetup`, `globalTeardown`, `setupFiles` and `setupFilesAfterEnv` and Vitest's `setupFiles` and `globalSetup` often are, instead of reporting it as worked out at run time, which marked every test of the suite `hasUnfollowedDependencies`. `require.resolve()` of a package reads as the package's name, as it would written directly; a path that isn't there still can't be worked out.
|
|
38
|
+
|
|
39
|
+
- [#129](https://github.com/Huldoser/test-inventory/pull/129) [`8111fd9`](https://github.com/Huldoser/test-inventory/commit/8111fd9eeba452d764cf5d69ad54ef2e3a8a7834) - With `expandCases`, stop reporting a Playwright file as failing to load with a `duplicate-title` error when a loop's describe title mixes the loop variable with a value the scan can't work out, as ``test.describe(`${process.env.TRADING_REGION} ${desk} desk`, ...)``. Its source text was the same on every pass, so every test in the file was listed as `notLoaded`, while Playwright's titles differ and it loads the file.
|
|
40
|
+
|
|
41
|
+
- [#122](https://github.com/Huldoser/test-inventory/pull/122) [`f8f4a09`](https://github.com/Huldoser/test-inventory/commit/f8f4a0907d82a6c9444434fee321d2304d4c6c83) - Read `it.only.bind(it)` and a test function's other own Function methods, `call` and `apply`, as plain calls instead of `invalid-chain` errors saying the runner stops before it runs any test.
|
|
42
|
+
|
|
43
|
+
- [#143](https://github.com/Huldoser/test-inventory/pull/143) [`c62d7ee`](https://github.com/Huldoser/test-inventory/commit/c62d7ee8651edd281727e93ffbfe6bce36a3fa5f) - Follow a test function a local module exports again, as `module.exports = { test }` after `require('@jest/globals')` or `export { test } from 'vitest'`, when a condition or a function chooses it, as in `return open ? test : test.skip` or `(isCI ? it : it.skip)('title', fn)`. The bare name was followed to its module only in a call shaped like a test, so when it came first in such a choice, the call declared no test, without a warning. Playwright already followed it.
|
|
44
|
+
|
|
45
|
+
- [#131](https://github.com/Huldoser/test-inventory/pull/131) [`3e5435e`](https://github.com/Huldoser/test-inventory/commit/3e5435e789d9f82f4dd6908a4402e3f359dc6a58) - Report a `framework-mismatch` at the call to a helper whose test object comes from another of the project's modules that builds it from another runner's package, as `import { test } from './fixtures'` where the fixtures extend `@playwright/test`, instead of an `internal-error` for the whole file.
|
|
46
|
+
|
|
47
|
+
- [#129](https://github.com/Huldoser/test-inventory/pull/129) [`8111fd9`](https://github.com/Huldoser/test-inventory/commit/8111fd9eeba452d764cf5d69ad54ef2e3a8a7834) - Follow a helper called on the module that exports it, as `checks.validatesQuantity('buy')` after `import * as checks from './checks'` or `const checks = require('./checks')`, instead of leaving out the tests it declares without a warning.
|
|
48
|
+
|
|
49
|
+
- [#122](https://github.com/Huldoser/test-inventory/pull/122) [`f8f4a09`](https://github.com/Huldoser/test-inventory/commit/f8f4a0907d82a6c9444434fee321d2304d4c6c83) - Report another framework a helper's module imports at the helper's call only when the helper uses what it imports, instead of an error saying the scanned file imports it, as when a Bun test builds data with a function from a module of shared helpers that also imports `@playwright/test`.
|
|
50
|
+
|
|
51
|
+
- [#129](https://github.com/Huldoser/test-inventory/pull/129) [`8111fd9`](https://github.com/Huldoser/test-inventory/commit/8111fd9eeba452d764cf5d69ad54ef2e3a8a7834) - Bind a helper's rest parameter, as `...cycles` in `settlesIn('equities', 'T+1', 'T+2')`, to the arguments left, so a loop over it is counted and expanded and titles built from it are worked out. A spread argument still leaves it unknown.
|
|
52
|
+
|
|
53
|
+
- [#122](https://github.com/Huldoser/test-inventory/pull/122) [`f8f4a09`](https://github.com/Huldoser/test-inventory/commit/f8f4a0907d82a6c9444434fee321d2304d4c6c83) - Read a `var` declared in a nested block, such as a `switch` case or an `if` block, as belonging to its whole function, as JavaScript hoists it, so a local `var context` no longer reads as Mocha's `context` and reports an `invalid-chain` error, as in a canvas helper that calls `context.drawImage()`.
|
|
54
|
+
|
|
55
|
+
- [#127](https://github.com/Huldoser/test-inventory/pull/127) [`b32cc66`](https://github.com/Huldoser/test-inventory/commit/b32cc6682183a316c1c932494312ab4d4fd7ad74) - Take a package.json `imports` target in build output, as `"#src/*.js": "./build/*.js"`, from the source next to it, as `src/context/empty.ts`, as workspace packages already are, instead of reporting the import as not read when the project hasn't been built.
|
|
56
|
+
|
|
57
|
+
- [#140](https://github.com/Huldoser/test-inventory/pull/140) [`edea139`](https://github.com/Huldoser/test-inventory/commit/edea1396bb12aa40da143dde62aa445ccee8f15e) - Read an absolute Vitest `includeSource` entry that names the config's root itself, as `includeSource: [resolve(__dirname, './test')]` with `root: './test'`, as matching no file, as Vitest does, instead of failing the scan with picomatch's `TypeError`.
|
|
58
|
+
|
|
59
|
+
- [#129](https://github.com/Huldoser/test-inventory/pull/129) [`8111fd9`](https://github.com/Huldoser/test-inventory/commit/8111fd9eeba452d764cf5d69ad54ef2e3a8a7834) - Follow a test function or describe imported from a local file whatever the title of the call that uses it first, as `test(TITLES.fill, fn)` with `test` from a fixtures file, or `describe(DESK, fn)` with Vitest's `describe` re-exported by a local module. Such a call was left out, and the tests in such a describe lost it, unless an earlier call in the file wrote its title in place.
|
|
60
|
+
|
|
61
|
+
- [#126](https://github.com/Huldoser/test-inventory/pull/126) [`ec9af13`](https://github.com/Huldoser/test-inventory/commit/ec9af13d6059262a0b4b2786ec651153be6a3a15) - Without patterns, find the files Mocha runs from package.json scripts: a script that starts `mocha`, `_mocha` or `ts-mocha`, also through the coverage tools `nyc`, `c8` or `mcr`, runs the specs its command line gives, joined with the `spec` that remains, with the `.mocharc` and `mocha` key found from the script's folder, unless `--no-config` or `--no-package` leave them out, and its `--spec`, `--extension`, `--ignore`, `--file`, `--recursive` and `--ui` over the config's. Before, only a config in the root or Mocha's defaults there decided which files ran, so projects that give Mocha its files on the command line, as `mocha 'src/**/*.spec.ts'`, or keep a `.mocharc` in each package, found none.
|
|
62
|
+
|
|
63
|
+
- [#140](https://github.com/Huldoser/test-inventory/pull/140) [`edea139`](https://github.com/Huldoser/test-inventory/commit/edea1396bb12aa40da143dde62aa445ccee8f15e) - Follow an import written inside a TypeScript `declare module` block, or inside a block as the reify loader allows, for `dependencyHash`, instead of an `internal-error` for the file.
|
|
64
|
+
|
|
65
|
+
- [#120](https://github.com/Huldoser/test-inventory/pull/120) [`4e1341d`](https://github.com/Huldoser/test-inventory/commit/4e1341db047fd50e839934d8b953edff27db8253) - Read Jest configs built with next/jest's `createJestConfig(config)`, as the Next.js guide writes them, with the mocks and ignored folders next/jest adds, so their test files are found and their imports followed. Leave out a name Jest's `moduleNameMapper` maps to an installed package, such as `identity-obj-proxy`, as an imported package is, instead of reporting it as unfollowed.
|
|
66
|
+
|
|
67
|
+
- [#135](https://github.com/Huldoser/test-inventory/pull/135) [`dc581f1`](https://github.com/Huldoser/test-inventory/commit/dc581f10ad7f0ef795864631338e3d71684a1407) - `--format commands` and `runCommands()` put `[`, `]`, `*`, `?`, `{` and `}` in a node:test path in brackets, as `test/routes/[[]venue[]]/quotes.test.js`: `node --test` reads its arguments as globs, so a route folder such as `[venue]` ran another file, or none.
|
|
68
|
+
|
|
69
|
+
- [#136](https://github.com/Huldoser/test-inventory/pull/136) [`dd7e35e`](https://github.com/Huldoser/test-inventory/commit/dd7e35e50c2540eee96ed12d6d25b6beb0450064) - Without patterns, node:test files are also found through the `node --test` scripts of each `package.json` below the root, run from its folder, as a monorepo's packages run their own; before, only the root's scripts counted, and a root script that named its own files hid every package's tests.
|
|
70
|
+
|
|
71
|
+
- [#131](https://github.com/Huldoser/test-inventory/pull/131) [`3e5435e`](https://github.com/Huldoser/test-inventory/commit/3e5435e789d9f82f4dd6908a4402e3f359dc6a58) - Read the runner version from an npm 5 lockfile that records a package's tarball, as `"version": "https://registry.npmjs.org/jest/-/jest-20.0.4.tgz"`, instead of failing the scan with a `TypeError`; a locked git dependency now falls through to the version package.json declares.
|
|
72
|
+
|
|
73
|
+
- [#134](https://github.com/Huldoser/test-inventory/pull/134) [`541ed66`](https://github.com/Huldoser/test-inventory/commit/541ed667f378a3dbfd9de0a61130715a8bf9ae0e) - Work out a property of an object on its own, as `TITLES.fill` when `TITLES` also holds a function, or `fees.MINIMUM` on a module loaded with `const fees = require('./fees')` that also exports a value the scan can't work out. One such value made every property of the object unknown, so titles, tables and tags read from it kept their source text.
|
|
74
|
+
|
|
75
|
+
- [#122](https://github.com/Huldoser/test-inventory/pull/122) [`f8f4a09`](https://github.com/Huldoser/test-inventory/commit/f8f4a0907d82a6c9444434fee321d2304d4c6c83) - Follow a workspace package whose exports point to build output, as `./dist/node.js`, to its TypeScript source in the package folder, as `node.ts`, when it has no `src` folder, as n8n's shared Vitest config package does.
|
|
76
|
+
|
|
77
|
+
- [#119](https://github.com/Huldoser/test-inventory/pull/119) [`a61bef5`](https://github.com/Huldoser/test-inventory/commit/a61bef571edee2f13a367c3de4d4c7dcd256a612) - Keep Playwright test candidates from readable top-level file settings when runtime project construction prevents exact discovery. Mark incomplete discovery as an error with unknown project membership, and follow package-script configs for files without an ancestor config.
|
|
78
|
+
|
|
79
|
+
- [#122](https://github.com/Huldoser/test-inventory/pull/122) [`f8f4a09`](https://github.com/Huldoser/test-inventory/commit/f8f4a0907d82a6c9444434fee321d2304d4c6c83) - Read `playwright.chromium.launch()`, `playwright.request.newContext()` and the other `@playwright/test` exports called through a default or CommonJS import of the package as library calls, as `defineConfig` already was, instead of `invalid-chain` errors that could mark the file's tests as not loaded.
|
|
80
|
+
|
|
81
|
+
- [#129](https://github.com/Huldoser/test-inventory/pull/129) [`8111fd9`](https://github.com/Huldoser/test-inventory/commit/8111fd9eeba452d764cf5d69ad54ef2e3a8a7834) - Read Playwright's `test.skip`, `test.fixme` and `test.fail` with a body passed by name as a test, as in `test.skip('applies the short-sale rule on ' + venue, checkShortSale)`. With a title the scan couldn't work out, the call was read as `test.skip(condition, description)`: the test was missing and the other tests of its describe were listed as skipped under that condition.
|
|
82
|
+
|
|
83
|
+
- [#140](https://github.com/Huldoser/test-inventory/pull/140) [`edea139`](https://github.com/Huldoser/test-inventory/commit/edea1396bb12aa40da143dde62aa445ccee8f15e) - Read the runner version from its own entry in `pnpm-lock.yaml` when an override such as `vitest@5.0.0>happy-dom` comes first, instead of failing the scan with a `TypeError`.
|
|
84
|
+
|
|
85
|
+
- [#122](https://github.com/Huldoser/test-inventory/pull/122) [`f8f4a09`](https://github.com/Huldoser/test-inventory/commit/f8f4a0907d82a6c9444434fee321d2304d4c6c83) - Say that Cypress, WebdriverIO and Jasmine configs are read only in the root when a scan without patterns finds none there, and name the nearest folder below the root that has one, instead of saying no config is in the root or a folder below it.
|
|
86
|
+
|
|
87
|
+
- [#122](https://github.com/Huldoser/test-inventory/pull/122) [`f8f4a09`](https://github.com/Huldoser/test-inventory/commit/f8f4a0907d82a6c9444434fee321d2304d4c6c83) - Report a file that imports its test functions from another runner's built-in module, as `bun:test` in a node:test or Jest scan, or `node:test` in a Vitest, Jest, Mocha, Jasmine or Playwright scan, as a `framework-mismatch`, as for other runners' packages, instead of an `unresolved-test-import` error saying the module is not a local file. `mocha` is a mismatch in Jest, Vitest and Playwright scans too. A module the config's alias maps to a local file, as a shim of `bun:test` that Vitest runs, is followed as before.
|
|
88
|
+
|
|
89
|
+
- [#122](https://github.com/Huldoser/test-inventory/pull/122) [`f8f4a09`](https://github.com/Huldoser/test-inventory/commit/f8f4a0907d82a6c9444434fee321d2304d4c6c83) - Find the runner a package.json script starts past `xvfb-run` and `xvfb-maybe`, as browser tests start on Linux, and read Currents' `pwc` and `pwc-p` as Playwright and its `cypress-cloud` as Cypress, with the config options they pass on. A word quoted in part, as `--server-args="-screen 0 1280x1024x24"`, is now one word, as the shell reads it.
|
|
90
|
+
|
|
91
|
+
- [#122](https://github.com/Huldoser/test-inventory/pull/122) [`f8f4a09`](https://github.com/Huldoser/test-inventory/commit/f8f4a0907d82a6c9444434fee321d2304d4c6c83) - Report a test object that local files build from or re-export from another runner's module, as `@playwright/test` fixtures imported by a file a Jest config runs, as a `framework-mismatch` that names the chain, instead of an `unresolved-test-import` error saying the module is not a local file.
|
|
92
|
+
|
|
93
|
+
- [#122](https://github.com/Huldoser/test-inventory/pull/122) [`f8f4a09`](https://github.com/Huldoser/test-inventory/commit/f8f4a0907d82a6c9444434fee321d2304d4c6c83) - Report a file whose expressions nest more than 1,000 deep, as a chain of thousands of `+` or calls, as a `parse-error`, as brackets nested more than 500 deep already are, instead of an `internal-error` when the scan's walk overflows the stack. The deepest of 447,597 test files in 2,500 popular projects nests 270.
|
|
94
|
+
|
|
95
|
+
- [#143](https://github.com/Huldoser/test-inventory/pull/143) [`c62d7ee`](https://github.com/Huldoser/test-inventory/commit/c62d7ee8651edd281727e93ffbfe6bce36a3fa5f) - Tests a helper registers when it is called from a describe in a function nothing in the file calls get the `test-in-function` warning, as the tests written in that function do: the runner registers none of them until that function is called, and they were listed as if it did. A helper in the same file is listed where it is written, the same whether it comes before or after that function; before, one written after it was listed at the call without a warning, and one written before it was listed in both places. An imported helper is listed at the call, with the warning.
|
|
96
|
+
|
|
97
|
+
- [#143](https://github.com/Huldoser/test-inventory/pull/143) [`c62d7ee`](https://github.com/Huldoser/test-inventory/commit/c62d7ee8651edd281727e93ffbfe6bce36a3fa5f) - Keep a file loaded when a call the runner refuses, such as a Jest `describe.each([])`, is inside a describe in a function nothing in the file calls, or in a helper called only from such a function. A describe resets what the scan knows about the function around it, so the call was taken to run while the file loads, and every test in the file was `notLoaded`. It is still reported, as one in a helper body or under a condition is.
|
|
98
|
+
|
|
99
|
+
- [#130](https://github.com/Huldoser/test-inventory/pull/130) [`7e73c98`](https://github.com/Huldoser/test-inventory/commit/7e73c98790c12684c3a9790eef9fb931b620b06f) - Without patterns, keep candidate files for a Vitest config whose project list the scan can't read, as one built with `readdirSync`, a function in `test.projects` or Vitest 3's `test.workspace`: the files the config's own `include` and `exclude` select, with their tests' `projects` `null` and a `config-value-unknown` error that says tests may be missing, as Playwright does. Unknown file selection in Vitest discovery is now an error, as in Playwright's. The entries of a `test.exclude` the scan can read still leave files out beside a spread it can't work out, with a warning, as Jest's ignore patterns do; a `browser.enabled` it can't work out leaves the config's files listed; a Vitest 3 `test.workspace` the scan doesn't read gets a warning where `test` is written; and `workspace: undefined` counts as no workspace, as Vitest reads it.
|
|
100
|
+
|
|
101
|
+
- [#126](https://github.com/Huldoser/test-inventory/pull/126) [`ec9af13`](https://github.com/Huldoser/test-inventory/commit/ec9af13d6059262a0b4b2786ec651153be6a3a15) - Without patterns, list the files of a Vitest browser config whose instance's `browser` or `name` the scan can't work out, as `instances: [{ browser: process.env.TEST_BROWSER || 'chromium' }]`, with their tests' `projects` `null` and a warning, instead of finding no files: the instances only name the projects.
|
|
102
|
+
|
|
103
|
+
- [#127](https://github.com/Huldoser/test-inventory/pull/127) [`b32cc66`](https://github.com/Huldoser/test-inventory/commit/b32cc6682183a316c1c932494312ab4d4fd7ad74) - Follow a workspace package written in JavaScript to its files, as Node loads them: a `main` or `exports` that points to JavaScript outside build folders, as `./index.js`, and a file the package has no `exports` for, as `@lhci/utils/src/presets/all.js`. Tests that import such a package were marked `hasUnfollowedDependencies`, so `--related` kept them for a change to any file, and their `dependencyHash` did not change with the package's code. Built JavaScript with no source next to it is still not followed.
|
|
104
|
+
|
|
105
|
+
- [#122](https://github.com/Huldoser/test-inventory/pull/122) [`f8f4a09`](https://github.com/Huldoser/test-inventory/commit/f8f4a0907d82a6c9444434fee321d2304d4c6c83) - Follow an import of a file in a workspace package that has no `exports`, as `@trading/e2e/fixtures.ts`, to that file, as Node does, instead of reporting the package as not pointing to TypeScript source.
|
|
106
|
+
|
|
107
|
+
- [#121](https://github.com/Huldoser/test-inventory/pull/121) [`c9359e2`](https://github.com/Huldoser/test-inventory/commit/c9359e22235e79c2f515871aba193bf3c995abb7) - Read a test or describe whose function a wrapper call receives, as in `test('fills an order', withBroker(async () => {}))`: the tests inside such a describe were missing without a diagnostic, and such a test had a null `bodyHash`, so a diff missed edits to it, and an `expectCount` of 0. The function's parameters are the wrapper's, so they are not read as fixtures.
|
|
108
|
+
|
|
3
109
|
## 0.10.4
|
|
4
110
|
|
|
5
111
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -25,8 +25,8 @@ Each covers its runner's scan commands, examples, syntax and limitations.
|
|
|
25
25
|
npm install --save-dev test-inventory
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
Node.js 22.12 or newer, on Linux, macOS or Windows. Playwright 1.
|
|
29
|
-
Mocha 10.0 or newer, Jasmine
|
|
28
|
+
Node.js 22.12 or newer, on Linux, macOS or Windows. Playwright 1.31 or newer, Vitest 1.0 or newer, Jest 27.0 or newer,
|
|
29
|
+
Mocha 10.0 or newer, Jasmine 3.0 or newer, Cypress 10.0 or newer, WebdriverIO 7.0 or newer, node:test 22.0 or newer,
|
|
30
30
|
Bun 1.2.23 or newer.
|
|
31
31
|
|
|
32
32
|
## Command line
|
|
@@ -87,8 +87,8 @@ the first test's record includes:
|
|
|
87
87
|
|
|
88
88
|
The output also has a `summary` with counts, a record for each describe, and `diagnostics` that point at code the
|
|
89
89
|
scan could not read and values it could not work out. Filters such as `--state skip`, `--tag @smoke` and
|
|
90
|
-
`--grep "limit order"` keep only some tests, `--fields fullName,reason` keeps only some keys,
|
|
91
|
-
writes one record per line.
|
|
90
|
+
`--grep "limit order"` keep only some tests, `--fields fullName,reason` keeps only some keys, `--format jsonl`
|
|
91
|
+
writes one record per line, and `--format commands` prints the command lines that run the tests kept.
|
|
92
92
|
|
|
93
93
|
## Library
|
|
94
94
|
|
|
@@ -112,6 +112,8 @@ in Claude Code, Cursor, VS Code and other MCP clients ask it which tests a proje
|
|
|
112
112
|
|
|
113
113
|
- Config files are read as code, never run, and only in part: settings computed at run time, as from `process.env`,
|
|
114
114
|
can't be worked out. Settings such as `workers` and config `use` are not interpreted as test record settings.
|
|
115
|
+
For Playwright and Vitest project lists built at runtime, discovery keeps candidates from readable top-level file settings,
|
|
116
|
+
with `projects: null` and an error that says tests may be missing. Project overrides can include or exclude files.
|
|
115
117
|
- Values from installed packages are not worked out; values from the project's own files are. A tag or title that
|
|
116
118
|
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
|
|
117
119
|
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 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
|
|
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, jsonl, one record per line, or commands, a command line for each config that runs\n the tests kept (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 git diff --name-only main | test-inventory --related - --format commands\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
|
@@ -4,6 +4,7 @@ import { readFile } from 'node:fs/promises';
|
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { parseArgs } from 'node:util';
|
|
6
6
|
import { readFailure } from "./files.js";
|
|
7
|
+
import { runCommands } from "./run-commands.js";
|
|
7
8
|
import { checkFields, filterInventory, matcher, pickTestFields } from "./filter.js";
|
|
8
9
|
import { writeInventory, writeInventoryLines } from "./json.js";
|
|
9
10
|
import { OptionsError, toPosixPath } from "./options.js";
|
|
@@ -34,7 +35,8 @@ Options:
|
|
|
34
35
|
--related <file> keep tests a change to this file can affect; can be repeated; - reads files, one per
|
|
35
36
|
line, from standard input, as git diff --name-only writes them
|
|
36
37
|
--fields <keys> write only these keys of each test, separated by commas; id is always kept
|
|
37
|
-
--format <format> json
|
|
38
|
+
--format <format> json, jsonl, one record per line, or commands, a command line for each config that runs
|
|
39
|
+
the tests kept (default: json)
|
|
38
40
|
-o, --output <file> write to a file instead of standard output
|
|
39
41
|
--pretty indent the JSON
|
|
40
42
|
-h, --help show this help
|
|
@@ -46,6 +48,7 @@ written, or a crash. 1 is reserved for a future release.
|
|
|
46
48
|
Examples:
|
|
47
49
|
test-inventory "tests/**/*.spec.ts" --framework playwright --output inventory.json
|
|
48
50
|
test-inventory "tests/**/*.spec.ts" --framework playwright --state skip --fields fullName,reason
|
|
51
|
+
git diff --name-only main | test-inventory --related - --format commands
|
|
49
52
|
`;
|
|
50
53
|
/** CLI names for the option names in the library's errors. */
|
|
51
54
|
const FLAGS = {
|
|
@@ -61,7 +64,7 @@ const FLAGS = {
|
|
|
61
64
|
'filter.related': '--related',
|
|
62
65
|
fields: '--fields',
|
|
63
66
|
};
|
|
64
|
-
const FORMATS = ['json', 'jsonl'];
|
|
67
|
+
const FORMATS = ['json', 'jsonl', 'commands'];
|
|
65
68
|
async function writeTo(stream, chunk) {
|
|
66
69
|
if (stream.errored)
|
|
67
70
|
throw stream.errored;
|
|
@@ -227,9 +230,12 @@ export async function run(argv, io) {
|
|
|
227
230
|
}
|
|
228
231
|
const format = values.format ?? 'json';
|
|
229
232
|
if (!FORMATS.includes(format))
|
|
230
|
-
return fail('--format must be json or
|
|
231
|
-
if (format
|
|
232
|
-
return fail(
|
|
233
|
+
return fail('--format must be json, jsonl or commands.');
|
|
234
|
+
if (format !== 'json' && values.pretty)
|
|
235
|
+
return fail(`--pretty indents JSON, so it does not go with --format ${format}.`);
|
|
236
|
+
if (format === 'commands' && values.fields !== undefined) {
|
|
237
|
+
return fail('--fields picks keys of the JSON records, so it does not go with --format commands.');
|
|
238
|
+
}
|
|
233
239
|
const filter = {
|
|
234
240
|
states: values.state,
|
|
235
241
|
tags: values.tag,
|
|
@@ -284,7 +290,13 @@ export async function run(argv, io) {
|
|
|
284
290
|
try {
|
|
285
291
|
await writeOutput(io, values.output, async (output) => {
|
|
286
292
|
const write = (chunk) => writeTo(output, chunk);
|
|
287
|
-
if (format === '
|
|
293
|
+
if (format === 'commands') {
|
|
294
|
+
// A caveat is a shell comment, so the output still runs as a script.
|
|
295
|
+
for (const item of runCommands(result)) {
|
|
296
|
+
await write(`${item.caveat === null ? '' : `# ${item.caveat}\n`}${item.command}\n`);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
else if (format === 'jsonl') {
|
|
288
300
|
await writeInventoryLines(result, write);
|
|
289
301
|
}
|
|
290
302
|
else {
|
package/dist/config-runs.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ export interface Placement {
|
|
|
46
46
|
settings: Setting | null;
|
|
47
47
|
/** False when no config runs the file; null when there is no config, or one can't tell. */
|
|
48
48
|
runs: Run | false | null;
|
|
49
|
+
/** Readable top-level Playwright file settings select this candidate, but its project membership is unknown. */
|
|
50
|
+
candidate?: boolean;
|
|
49
51
|
/** The projects of the config that run the file, which a Playwright `grep` may narrow per test; null when unknown. */
|
|
50
52
|
projects: ProjectAbout[] | null;
|
|
51
53
|
/** The tags Playwright's config `tag` gives every test; null when the scan can't work them out. */
|
|
@@ -65,6 +67,8 @@ export declare class ConfigRuns {
|
|
|
65
67
|
private jestDefaults;
|
|
66
68
|
private mochaDefaults;
|
|
67
69
|
private nodeRuns;
|
|
70
|
+
/** What the `node --test` scripts of a folder's package.json run, by the folder; null for none. */
|
|
71
|
+
private readonly nodeFolders;
|
|
68
72
|
private bunFiles;
|
|
69
73
|
/** The Vitest configs whose projects are being found, with their names, to stop at one whose projects name itself. */
|
|
70
74
|
private readonly expanding;
|
|
@@ -72,6 +76,7 @@ export declare class ConfigRuns {
|
|
|
72
76
|
private readonly scriptRoutes;
|
|
73
77
|
/** The projects of a route, by its config and the folder it runs from. */
|
|
74
78
|
private readonly routeProjects;
|
|
79
|
+
private readonly candidateProjects;
|
|
75
80
|
constructor(configs: Configs, framework: Framework, version: [number, number] | null, findsFiles: boolean);
|
|
76
81
|
/**
|
|
77
82
|
* The config a file uses, as the runner started at the root would: the outermost config at or above it that runs it,
|
|
@@ -85,6 +90,10 @@ export declare class ConfigRuns {
|
|
|
85
90
|
*/
|
|
86
91
|
private place;
|
|
87
92
|
private placeByConfigs;
|
|
93
|
+
/** Retains candidates without claiming a project runs them when the runner constructs its projects at runtime. */
|
|
94
|
+
private unknownPlacement;
|
|
95
|
+
/** The files readable top-level file settings select for a project the scan can't work out; undefined for none. */
|
|
96
|
+
private candidatesOf;
|
|
88
97
|
/**
|
|
89
98
|
* The placement the first route that runs a file gives it, from the package.json scripts in its folder and those above
|
|
90
99
|
* it, nearest first; `unknown`, reported, when none runs it and one can't be read; null when none runs it.
|
|
@@ -102,6 +111,12 @@ export declare class ConfigRuns {
|
|
|
102
111
|
* defaults.
|
|
103
112
|
*/
|
|
104
113
|
private defaultConfigIn;
|
|
114
|
+
/**
|
|
115
|
+
* What Mocha started by a script reads: the config `--config` names, or the `.mocharc` file it finds from the folder
|
|
116
|
+
* up, with the nearest package.json's `mocha` key, and its command line. Null when it names a config that isn't
|
|
117
|
+
* there, which Mocha refuses.
|
|
118
|
+
*/
|
|
119
|
+
private mochaRoute;
|
|
105
120
|
/** A route's projects, as the runner started in its folder finds them; Vitest's defaults there without a config. */
|
|
106
121
|
private projectsOfRoute;
|
|
107
122
|
/**
|
|
@@ -163,12 +178,18 @@ export declare class ConfigRuns {
|
|
|
163
178
|
/** `node --test` runs the files its arguments name, or without any, those its default patterns match; see `nodeFiles`. */
|
|
164
179
|
private placeNode;
|
|
165
180
|
/**
|
|
166
|
-
* The files `node --test` runs
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
181
|
+
* The files `node --test` runs, outside dot folders and `node_modules`: from the root, and from each package below it
|
|
182
|
+
* whose scripts run it, as a monorepo's packages run their own. In each folder, those the arguments of the `test`
|
|
183
|
+
* script and the scripts it runs give, or the first script that runs it, each a glob or a path, and from Node.js 26.8
|
|
184
|
+
* a folder for the default patterns inside it; without arguments, the default patterns. The root runs the default
|
|
185
|
+
* patterns also without such a script. They take TypeScript files too from Node.js 22.18, which strips types by
|
|
186
|
+
* default.
|
|
170
187
|
*/
|
|
171
188
|
private nodeFiles;
|
|
189
|
+
/** The files the `node --test` commands of a folder's package.json scripts run from it; null without such a command. */
|
|
190
|
+
private nodeFolderFiles;
|
|
191
|
+
/** The files node:test commands started in a folder run, each command as the files it gives, from the folder. */
|
|
192
|
+
private nodeGlobs;
|
|
172
193
|
/** WebdriverIO runs the files of the config in the root; without one, it runs nothing, unless it is given files. */
|
|
173
194
|
private placeWebdriverIO;
|
|
174
195
|
/**
|
|
@@ -228,6 +249,11 @@ export declare class ConfigRuns {
|
|
|
228
249
|
*/
|
|
229
250
|
private withPreset;
|
|
230
251
|
private vitestProjects;
|
|
252
|
+
/**
|
|
253
|
+
* The files a config's own file settings select, as candidates for projects the scan can't list, which mostly narrow
|
|
254
|
+
* them; none when those settings can't be read either.
|
|
255
|
+
*/
|
|
256
|
+
private vitestCandidates;
|
|
231
257
|
/**
|
|
232
258
|
* A project written in `test.projects`, which inherits the root config as each version of Vitest decides, named
|
|
233
259
|
* after `index` when it has no name of its own.
|