@@ -132,21 +132,35 @@ function test(name, options, fn) {
132
132
return subtest . start ( ) ;
133
133
}
134
134
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 ) ;
138
142
if ( parent === root ) {
139
143
suite . run ( ) ;
140
144
}
145
+ return suite ;
146
+ }
147
+
148
+ function it ( name , options , fn , overrides ) {
149
+ return getParent ( ) . createSubtest ( name , options , fn , overrides ) ;
141
150
}
142
151
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 ;
146
160
}
147
161
148
162
module . exports = {
149
163
test : FunctionPrototypeBind ( test , root ) ,
150
- describe,
151
- it,
164
+ describe : enrichMethod ( describe ) ,
165
+ it : enrichMethod ( it ) ,
152
166
} ;
0 commit comments