Repository navigation
v0.7.0
Minor Changes
-
#72
cf784f0---expand-cases(library:expandCases: true) lists each case of a.eachor.fortable and each pass of a loop
whose values the scan can work out as its own record, with the title the runner gives it. Vitest's titles follow the
rules of the project's Vitest version, 3.0 to 5:%s,%d,%i,%f,%j,%o,%O,%c,%#,%$and$name,
with values quoted and cut as that version does; they match the names Vitest 3.0, 3.1, 3.2, 4.0, 4.1 and 5.0 list.
Each case's values are bound in its callback, so titles, tags and conditions built from them are worked out per case,
and anif,?:,&&,||or??that reads nothing but them registers only the branch it takes. Loops in test
and hook bodies and loops over avarare not expanded, and a file starts expansions up to 1,000 loop passes and
describe cases.
Suites and tests have a new key,caseIndex: the case's index from 0, as%#counts, ornullwithout the option. A
table that can't be expanded stays one record with a newcases-not-expandedwarning. Without the option the output
is as before, apart fromcaseIndex: nullon every suite and test. -
#72
cf784f0- Values imported from other files of the project are now worked out: a title, tag, annotation, reason, run setting or
.eachtable built from a constant, enum or default export of another module, through re-exports,export *,
import * asand JSON files, found the same way as helper functions (relative paths, tsconfigpaths,#imports,
workspace packages). Values from installed packages are still not read, and keep their diagnostic.A test in a
for...of,for...in,forEachormaploop over values the scan can work out now hascaseCount, the
number of tests the runner registers, and notest-in-loopwarning; the warning now marks a loop the scan can't
count. Values also work out arithmetic on numbers, as in30 * 1000,?:,&&,||,??, comparisons,
Object.keys(),Object.values(),Object.entries(),JSON.stringify(),String(), and a string'stoUpperCase(),
toLowerCase()andtrim()and an array'sjoin(). A skip condition that works out to a constant, such as
side === 'short'in a helper called with'buy', now sets the state it gives instead of being kept as a condition.Code after an
ifwhose branch always returns or throws, as inif (!strategy.enabled) return;in a helper, is now
under the opposite condition, so its tests haveisInConditionand a loop around them no count. A tagged-template
table is counted as Vitest splits it: outer pipes are columns, an incomplete last row is left out, and a template
without values is one case.A test whose title was its source text and is now worked out gets a new
id, once.
Patch Changes
-
#71
bf8383f- A name destructured from a test object, as inconst { describe, beforeEach } = test, is now read as that member:
beforeEach(...)is a hook,describe(...)a describe andskip(...)a skipped test, for Playwright and Vitest,
also nested, as inconst { describe: { serial } } = test. Every such name was read astestitself, so a hook got
test-without-bodyand every test of the filenotLoaded, and the tests inside a describe were left out with
nested-testwarnings. -
#71
bf8383f- When the root and the folders above it don't have the framework, its version is now read from the shallowest
package.jsonbelow the root that declares it and holds scanned files, ascode/package.jsonin a monorepo, with
that package's lockfile or installed copy first. The version wasnullthere, so the newest rules applied: Vitest
5's, which refuse a file that callsvi.mockinside a block, made every test of such a filenotLoadedin a project
on Vitest 3.