@@ -10,8 +10,44 @@ const { MasterEvents } = require("../../events");
1010const { getMethodsByInterface } = require ( "./utils" ) ;
1111const { enableSourceMaps } = require ( "../../utils/typescript" ) ;
1212
13+ function getTagParser ( original ) {
14+ return function ( title , paramsOrFn , fn ) {
15+ if ( typeof paramsOrFn === "function" ) {
16+ return original . call ( this , title , paramsOrFn ) ;
17+ } else {
18+ const test = original . call ( this , title , fn ) ;
19+
20+ if ( paramsOrFn ?. tag ) {
21+ if ( Array . isArray ( paramsOrFn . tag ) ) {
22+ test . tag = paramsOrFn . tag . map ( title => ( { title, dynamic : false } ) ) ;
23+ } else {
24+ test . tag = [ { title : paramsOrFn . tag , dynamic : false } ] ;
25+ }
26+ }
27+
28+ return test ;
29+ }
30+ } ;
31+ }
32+
1333async function readFiles ( files , { esmDecorator, config, eventBus, runnableOpts } ) {
1434 const mocha = new Mocha ( config ) ;
35+
36+ mocha . suite . on ( "pre-require" , context => {
37+ const originalDescribe = context . describe ;
38+ const originalIt = context . it ;
39+
40+ context . describe = context . context = getTagParser ( originalDescribe ) ;
41+
42+ context . describe . only = originalDescribe . only ;
43+ context . describe . skip = originalDescribe . skip ;
44+
45+ context . it = context . specify = getTagParser ( originalIt ) ;
46+
47+ context . it . only = originalIt . only ;
48+ context . it . skip = originalIt . skip ;
49+ } ) ;
50+
1551 mocha . fullTrace ( ) ;
1652
1753 initBuildContext ( eventBus ) ;
0 commit comments