The defineTest and defineSnapshotTestFromFixture functions currently require an explicit testOptions when working with Typescript textfixtures, such as in this example.
However, when a transform file exports a ts or tsx parser it would be more convenient if these functions could use that, and avoid needing to write 'ts' twice across files.
Changes
When testOptions.parser is not explicitly defined, fallback to reading module.parser. This mirrors the behaviour seen in applyTransform.
Haven't updated docs, since they already describes these testUtils as making assumptions to reduce configuration. This is how I expected it to work at first reading.
Motivation
The
defineTest
anddefineSnapshotTestFromFixture
functions currently require an explicittestOptions
when working with Typescript textfixtures, such as in this example.However, when a transform file exports a ts or tsx parser it would be more convenient if these functions could use that, and avoid needing to write
'ts'
twice across files.Changes
When
testOptions.parser
is not explicitly defined, fallback to readingmodule.parser
. This mirrors the behaviour seen inapplyTransform
.Haven't updated docs, since they already describes these testUtils as making assumptions to reduce configuration. This is how I expected it to work at first reading.