Skip to content

Compared with the runners ​

For runner-specific scan commands and limitations, choose a framework guide.

The runners can list their tests too: playwright test --list --reporter=json, vitest list --json, from Jest 30.4 jest --collectTests, and mocha --dry-run. Playwright, Jest and Mocha load the files and execute top-level code and describe callbacks. Vitest 5 statically parses test files by default; earlier versions collect them by executing the files. test-inventory parses source without executing the scanned project.

Use the runner when you need the tests selected for a particular run. Use test-inventory for declared metadata, skip conditions and reasons, stable ids and code hashes across frameworks. The full comparison is below.

Collection and metadata comparison
test-inventoryplaywright test --listvitest listjest --collectTestsmocha --dry-runjasmine --reporter=…cypress run --reporter=…wdio run with a reporternode --test --test-reporter=…bun test --reporter=junit
Runs code from the test filesNoYes, top level and describesYes, or parses them in Vitest 5Yes, top level and describesYes, top level and describesYes, every specYes, every test, in a browserYes, every test, in a browserYes, every testYes, every test
Needs the runner installedNoYesYesYes, Jest 30.4 or newerYesYesYes, and its browserYes, and its browserNo, it is Node.js's ownYes
Loops and .each tablesOne record, with the number of casesOne test per iterationOne test per caseOne test per iteration, per case from 30.5One test per iterationOne spec per iterationOne test per iterationOne test per iterationOne test per iterationOne test per case
Skipped and todo testsListed, with the stateListedLeft outListed, with the stateListed as pendingListed as pendingListed as pendingListed as pendingSkipped and todo listed; a skipped describe's tests left outSkipped and todo listed; with .only, the file's others left out
Skip conditionsKept as source textEvaluated at load timeNot shownEvaluated at load timeNot shownEvaluated as specs runEvaluated as tests runEvaluated as tests runEvaluated as tests runEvaluated as tests run
TagsAs written, @smokeWithout the @, smokeNot shownNot shownNot shownNot shownNot shownNot shownNot shownNot shown
Line of each testYesYesYesNoNoNoNoNoYesYes
Stable id and body hashYesNoNoNoNoNoNoNoNoNo
One schema for every frameworkYesNoNoNoNoNoNoNoNoNo

By default the inventory keeps one record per declaration. --expand-cases expands supported tables and loops; browser and project execution counts remain separate. See counts.

Matching records with the runners' lists ​

To match a record with a runner's entry, use the file and the line range: the entry's line falls between lineStart and lineEnd. Columns differ: Playwright reports the column of the call's last name, fail in test.fail(, or of its opening parenthesis, while test-inventory and Vitest report the column where the call starts.

Vitest 5's static list ​

vitest list in Vitest 5 parses the files instead of running them, unless --no-static-parse is given. Its results differ from what the runner does: it treats any .only as applying to the whole run, lets the last modifier in a chain win, and treats runIf(true) and skipIf(false) as skipped. It also keeps escapes such as \" in names as written, drops a test or describe chained after a call, as in describe.runIf(hasBroker).skip(...), and lists a call such as testRouting('NYSE') as a test because its name starts with test. test-inventory follows what the runner does.

Jest's list ​

Jest 30.4 added --collectTests, which lists the tests without running them; from 30.5 it lists each case of a .each table. It loads the test files and calls their describe callbacks, so Jest has to be installed and the files' top-level code runs. Its entries have no line (location is null), so they match records by file and full title. jest --listTests lists only the files. Jest 29 supports --listTests but not --collectTests; listing individual test cases there requires collection through a run or a custom integration.

Mocha's list ​

Mocha 9 added --dry-run, which reports every test as passed without running it, and pending tests as pending. It loads the test files and calls their describe callbacks, so Mocha has to be installed and the files' top-level code runs. A test that calls this.skip() is reported as passed, since its body doesn't run. Mocha's reporters give no line, and the JSON reporter joins the titles with spaces, so a describe's title can't be told from the test's; entries match records by file and full title.

Jasmine's list ​

Jasmine has no way to list its specs without running them. A reporter, given with jasmine --reporter=, sees every spec as it runs, with its file and status: pending for xit, a spec without a function and pending(), excluded for the specs a fit or fdescribe leaves out, and from Jasmine 7 notApplicable. Its full names join the titles with spaces, and it gives no line, so entries match records by file and full title. Karma runs Jasmine in a browser and reports the same way.

Cypress's list ​

Cypress has no way to list its tests without running them, and runs them in a browser. A Mocha reporter, given with cypress run --reporter, sees each spec's tests as they run, with their status: pending for .skip, a test without a function and a test that this.skip() or its browser option skips. Cypress starts the reporter once per spec, and it gives no line, so entries match records by spec and full title.

WebdriverIO's list ​

WebdriverIO has no way to list its tests either, and starts a browser session for each spec file. A reporter given in the config's reporters sees each test as it runs, with test:pending for a skipped one. Its entries carry the test's title and its describe's, but no line, so they match records by spec file and full title.

node:test's list ​

node --test has no way to list its tests without running them. A reporter given with --test-reporter sees each test as it starts and ends, with its file, line and depth, and whether it was skipped, todo or expected to fail. A subtest is reported inside the test that runs it. A skipped describe, or a test skipped where it is declared, is reported as one entry, without the tests inside it, which the inventory lists as skipped. Under node --test, only applies only with --test-only; the inventory gives isOnly as written.

Bun's list ​

bun test has no way to list its tests without running them either. Its JUnit report, --reporter=junit, gives each test's file and line inside the describes around it, with <skipped/> for a skipped test and <skipped message="TODO"/> for a todo one; a .failing test that throws is a plain pass. A .only makes Bun run only the focused tests of its file, and leave the others out of the report; the inventory lists them all, with isOnly as written.

Checked in CI ​

On every pull request, CI scans the fixture projects in the repository and compares the inventory with Playwright 1.31, 1.41, 1.42, 1.63, 1.64 and 1.65, Vitest 1.6, 2.1, 3.0 and 5.1, Jest 27.5, 28.1, 29.7 and 30.5, Mocha 10.8 and 12.0, Jasmine 3.99, 4.6 and 7.0, Cypress 10.11, 11.2, 12.17, 13.17 and 16.3, WebdriverIO 7.40, 8.46, 9.33 and 10.2, node:test on Node.js 22.23, 24.22 and 26.13, and Bun 1.2.23, 1.3.14 and 1.4.4. Playwright lists the tests with --list; Vitest and Jest run them with their JSON output, and Bun with its JUnit report, which, unlike vitest list, includes skipped and todo tests; Mocha, Jasmine, node:test, Cypress, in Electron, and WebdriverIO, in headless Chrome, run them with a reporter of the repository's own that keeps each title, so that this.skip() and pending() are seen. Each test is matched by file and line, or by file and full title for Mocha, Jasmine, Cypress, WebdriverIO and Vitest before 3, which give no line, and its full title, its state and its tags are compared; Jest, Mocha, Jasmine, Cypress, WebdriverIO, node:test and Bun report no tags; node:test's subtests are matched by full title too, as their lines are inside their parent's. A state set by a condition is left out, since the runner decides it on the machine it runs on. Any difference fails the check.

The real projects that use Vitest are compared too, with Vitest's static parser, which lists their tests without an install. The scan applies the rules of the same Vitest version. Each difference must have a known cause, such as one of the parser's differences above; one without fails the check, which doesn't block a merge, since it clones the projects over the network.

Documentation for test-inventory 0.12.2. Released under the MIT License.