@@ -12,6 +12,46 @@ const { enableSourceMaps } = require("../../utils/typescript");
1212
1313async function readFiles ( files , { esmDecorator, config, eventBus, runnableOpts } ) {
1414 const mocha = new Mocha ( config ) ;
15+
16+ mocha . suite . on ( "pre-require" , context => {
17+ const originalDescribe = context . describe ;
18+ const originalIt = context . it ;
19+
20+ context . describe = context . context = function ( title , paramsOrFn , fn ) {
21+ if ( typeof paramsOrFn === "function" ) {
22+ return originalIt . call ( this , title , paramsOrFn ) ;
23+ } else {
24+ const suite = originalDescribe . call ( this , title , fn ) ;
25+
26+ if ( paramsOrFn ?. tag ) {
27+ suite . tag = paramsOrFn . tag . map ( title => ( { title, dynamic : false } ) ) ;
28+ }
29+
30+ return suite ;
31+ }
32+ } ;
33+
34+ context . describe . only = originalDescribe . only ;
35+ context . describe . skip = originalDescribe . skip ;
36+
37+ context . it = context . specify = function ( title , paramsOrFn , fn ) {
38+ if ( typeof paramsOrFn === "function" ) {
39+ return originalIt . call ( this , title , paramsOrFn ) ;
40+ } else {
41+ const test = originalIt . call ( this , title , fn ) ;
42+
43+ if ( paramsOrFn ?. tag ) {
44+ test . tag = paramsOrFn . tag . map ( title => ( { title, dynamic : false } ) ) ;
45+ }
46+
47+ return test ;
48+ }
49+ } ;
50+
51+ context . it . only = originalIt . only ;
52+ context . it . skip = originalIt . skip ;
53+ } ) ;
54+
1555 mocha . fullTrace ( ) ;
1656
1757 initBuildContext ( eventBus ) ;
0 commit comments