[node] does not export TestContext
type
#69488
Replies: 1 comment
-
Thanks for the discussion about "node", some useful links for everyone: Pinging the DT module owners: @microsoft, @jkomyno, @alvis, @r3nya, @btoueg, @smac89, @Touffy, @DeividasBakanas, @eyqs, @Hannes-Magnusson-CK, @hoo29, @kjin, @ajafff, @islishude, @mwiktorczyk, @mohsen1, @galkin, @parambirs, @eps1lon, @ThomasdenH, @WilcoBakker, @wwwy3y3, @samuela, @kuehlein, @bhongy, @chyzwar, @trivikr, @yoursunny, @qwelias, @ExE-Boss, @peterblazejewicz, @addaleax, @victorperin, @ZYSzys, @nodejs, @LinusU, @wafuwafu13, @mcollina, @Semigradsky. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I don't know if this has been raised before, or if it's by design. But when we're doing tests using
node:test
, it's possible to use theTestContext
type within a test like so:However, this type is never exported in the Node types, and it could be super useful especially for mocking, since global mocking using
mock.fn()
can conflict with other tests as they're not reset after each test. So, let's say you have a mock factory like:It would be extremely useful to have this type in there. Another example can be found here in a test repository I'm doing with my students (this is where we picked this). The change seems to be easy as the class is already in the
test.d.ts
file line 386. Addingexport type TestContext = TestContext
would solve it:Wanted to discuss this with the community if you think it would be a good addition.
Beta Was this translation helpful? Give feedback.
All reactions