@@ -136,27 +136,20 @@ declare module 'node:test' {
136136 function test ( options ?: TestOptions , fn ?: TestFn ) : Promise < void > ;
137137 function test ( fn ?: TestFn ) : Promise < void > ;
138138 namespace test {
139- /**
140- * Shorthand for skipping a suite, same as `test([name], { skip: true }[, fn])`.
141- */
142- function skip ( name ?: string , options ?: TestOptions , fn ?: TestFn ) : void ;
143- function skip ( name ?: string , fn ?: TestFn ) : void ;
144- function skip ( options ?: TestOptions , fn ?: TestFn ) : void ;
145- function skip ( fn ?: TestFn ) : void ;
146- /**
147- * Shorthand for marking a suite as `TODO`, same as `test([name], { todo: true }[, fn])`.
148- */
149- function todo ( name ?: string , options ?: TestOptions , fn ?: TestFn ) : void ;
150- function todo ( name ?: string , fn ?: TestFn ) : void ;
151- function todo ( options ?: TestOptions , fn ?: TestFn ) : void ;
152- function todo ( fn ?: TestFn ) : void ;
153- /**
154- * Shorthand for marking a suite as `TODO`, same as `test([name], { only: true }[, fn])`.
155- */
156- function only ( name ?: string , options ?: TestOptions , fn ?: TestFn ) : void ;
157- function only ( name ?: string , fn ?: TestFn ) : void ;
158- function only ( options ?: TestOptions , fn ?: TestFn ) : void ;
159- function only ( fn ?: TestFn ) : void ;
139+ export {
140+ after ,
141+ afterEach ,
142+ before ,
143+ beforeEach ,
144+ describe ,
145+ it ,
146+ run ,
147+ mock ,
148+ test ,
149+ skip ,
150+ todo ,
151+ only
152+ } ;
160153 }
161154 /**
162155 * The `describe()` function imported from the `node:test` module. Each
@@ -187,8 +180,10 @@ declare module 'node:test' {
187180 function todo ( name ?: string , fn ?: SuiteFn ) : void ;
188181 function todo ( options ?: TestOptions , fn ?: SuiteFn ) : void ;
189182 function todo ( fn ?: SuiteFn ) : void ;
183+
190184 /**
191- * Shorthand for marking a suite as `TODO`, same as `describe([name], { only: true }[, fn])`.
185+ * Shorthand for marking a suite as `only`, same as `describe([name], { only: true }[, fn])`.
186+ * @since v18.15.0
192187 */
193188 function only ( name ?: string , options ?: TestOptions , fn ?: SuiteFn ) : void ;
194189 function only ( name ?: string , fn ?: SuiteFn ) : void ;
@@ -201,29 +196,54 @@ declare module 'node:test' {
201196 * The `it()` function is imported from the `node:test` module.
202197 * @since v18.6.0, v16.17.0
203198 */
204- function it ( name ?: string , options ?: TestOptions , fn ?: ItFn ) : void ;
205- function it ( name ?: string , fn ?: ItFn ) : void ;
206- function it ( options ?: TestOptions , fn ?: ItFn ) : void ;
207- function it ( fn ?: ItFn ) : void ;
199+ function it ( name ?: string , options ?: TestOptions , fn ?: TestFn ) : void ;
200+ function it ( name ?: string , fn ?: TestFn ) : void ;
201+ function it ( options ?: TestOptions , fn ?: TestFn ) : void ;
202+ function it ( fn ?: TestFn ) : void ;
208203 namespace it {
209204 // Shorthand for skipping a test, same as `it([name], { skip: true }[, fn])`.
210- function skip ( name ?: string , options ?: TestOptions , fn ?: ItFn ) : void ;
211- function skip ( name ?: string , fn ?: ItFn ) : void ;
212- function skip ( options ?: TestOptions , fn ?: ItFn ) : void ;
213- function skip ( fn ?: ItFn ) : void ;
205+ function skip ( name ?: string , options ?: TestOptions , fn ?: TestFn ) : void ;
206+ function skip ( name ?: string , fn ?: TestFn ) : void ;
207+ function skip ( options ?: TestOptions , fn ?: TestFn ) : void ;
208+ function skip ( fn ?: TestFn ) : void ;
214209 // Shorthand for marking a test as `TODO`, same as `it([name], { todo: true }[, fn])`.
215- function todo ( name ?: string , options ?: TestOptions , fn ?: ItFn ) : void ;
216- function todo ( name ?: string , fn ?: ItFn ) : void ;
217- function todo ( options ?: TestOptions , fn ?: ItFn ) : void ;
218- function todo ( fn ?: ItFn ) : void ;
210+ function todo ( name ?: string , options ?: TestOptions , fn ?: TestFn ) : void ;
211+ function todo ( name ?: string , fn ?: TestFn ) : void ;
212+ function todo ( options ?: TestOptions , fn ?: TestFn ) : void ;
213+ function todo ( fn ?: TestFn ) : void ;
219214 /**
220- * Shorthand for marking a suite as `TODO`, same as `it([name], { only: true }[, fn])`.
215+ * Shorthand for marking a test as `only`, same as `it([name], { only: true }[, fn])`.
216+ * @since v18.15.0
221217 */
222- function only ( name ?: string , options ?: TestOptions , fn ?: ItFn ) : void ;
223- function only ( name ?: string , fn ?: ItFn ) : void ;
224- function only ( options ?: TestOptions , fn ?: ItFn ) : void ;
225- function only ( fn ?: ItFn ) : void ;
218+ function only ( name ?: string , options ?: TestOptions , fn ?: TestFn ) : void ;
219+ function only ( name ?: string , fn ?: TestFn ) : void ;
220+ function only ( options ?: TestOptions , fn ?: TestFn ) : void ;
221+ function only ( fn ?: TestFn ) : void ;
226222 }
223+ /**
224+ * Shorthand for skipping a test, same as `test([name], { skip: true }[, fn])`.
225+ * @since v20.2.0
226+ */
227+ function skip ( name ?: string , options ?: TestOptions , fn ?: TestFn ) : void ;
228+ function skip ( name ?: string , fn ?: TestFn ) : void ;
229+ function skip ( options ?: TestOptions , fn ?: TestFn ) : void ;
230+ function skip ( fn ?: TestFn ) : void ;
231+ /**
232+ * Shorthand for marking a test as `TODO`, same as `test([name], { todo: true }[, fn])`.
233+ * @since v20.2.0
234+ */
235+ function todo ( name ?: string , options ?: TestOptions , fn ?: TestFn ) : void ;
236+ function todo ( name ?: string , fn ?: TestFn ) : void ;
237+ function todo ( options ?: TestOptions , fn ?: TestFn ) : void ;
238+ function todo ( fn ?: TestFn ) : void ;
239+ /**
240+ * Shorthand for marking a test as `only`, same as `test([name], { only: true }[, fn])`.
241+ * @since v20.2.0
242+ */
243+ function only ( name ?: string , options ?: TestOptions , fn ?: TestFn ) : void ;
244+ function only ( name ?: string , fn ?: TestFn ) : void ;
245+ function only ( options ?: TestOptions , fn ?: TestFn ) : void ;
246+ function only ( fn ?: TestFn ) : void ;
227247 /**
228248 * The type of a function under test. The first argument to this function is a
229249 * {@link TestContext} object. If the test uses callbacks, the callback function is passed as
@@ -235,11 +255,6 @@ declare module 'node:test' {
235255 * If the test uses callbacks, the callback function is passed as an argument
236256 */
237257 type SuiteFn = ( done : ( result ?: any ) => void ) => void ;
238- /**
239- * The type of a function under test.
240- * If the test uses callbacks, the callback function is passed as an argument
241- */
242- type ItFn = ( done : ( result ?: any ) => void ) => any ;
243258 interface RunOptions {
244259 /**
245260 * If a number is provided, then that many files would run in parallel.
@@ -1030,5 +1045,5 @@ declare module 'node:test' {
10301045 */
10311046 restore ( ) : void ;
10321047 }
1033- export { test as default , run , test , describe , it , before , after , beforeEach , afterEach , mock } ;
1048+ export { test as default , run , test , describe , it , before , after , beforeEach , afterEach , mock , skip , only , todo } ;
10341049}
0 commit comments