@@ -132,21 +132,35 @@ function test(name, options, fn) {
132132 return subtest . start ( ) ;
133133}
134134
135- function describe ( name , options , fn ) {
136- const parent = testResources . get ( executionAsyncId ( ) ) || setup ( root ) ;
137- const suite = parent . createSubSuite ( name , options , fn ) ;
135+ function getParent ( ) {
136+ return testResources . get ( executionAsyncId ( ) ) || setup ( root ) ;
137+ }
138+
139+ function describe ( name , options , fn , overrides ) {
140+ const parent = getParent ( ) ;
141+ const suite = parent . createSubSuite ( name , options , fn , overrides ) ;
138142 if ( parent === root ) {
139143 suite . run ( ) ;
140144 }
145+ return suite ;
146+ }
147+
148+ function it ( name , options , fn , overrides ) {
149+ return getParent ( ) . createSubtest ( name , options , fn , overrides ) ;
141150}
142151
143- function it ( name , options , fn ) {
144- const parent = testResources . get ( executionAsyncId ( ) ) || setup ( root ) ;
145- parent . createSubtest ( name , options , fn ) ;
152+ function enrichMethod ( method ) {
153+ [ 'skip' , 'only' ] . forEach ( ( keyword ) => {
154+ method [ keyword ] = function ( name , options , fn ) {
155+ return method ( name , options , fn , { [ keyword ] : true } ) ;
156+ }
157+ } ) ;
158+
159+ return method ;
146160}
147161
148162module . exports = {
149163 test : FunctionPrototypeBind ( test , root ) ,
150- describe,
151- it,
164+ describe : enrichMethod ( describe ) ,
165+ it : enrichMethod ( it ) ,
152166} ;
0 commit comments