@@ -114,41 +114,39 @@ describe('Telemetry Universal Plugin', () => {
114114
115115 // We don't want to crash if there are no bundlers to test here.
116116 // Which can happen when using --bundlers.
117- if ( expectations . length > 0 ) {
118- let cleanup : CleanupFn ;
119-
120- beforeAll ( async ( ) => {
121- const pluginConfig : Options = {
122- telemetry : {
123- enableTracing : true ,
124- endPoint : FAKE_URL ,
125- filters : [ ] ,
126- } ,
127- logLevel : 'warn' ,
128- customPlugins : ( options : Options , context : GlobalContext ) =>
129- debugFilesPlugins ( context ) ,
130- } ;
131- // This one is called at initialization, with the initial context.
132- addMetricsMocked . mockImplementation ( getAddMetricsImplem ( metrics ) ) ;
133- cleanup = await runBundlers (
134- pluginConfig ,
135- getComplexBuildOverrides ( ) ,
136- activeBundlers ,
137- ) ;
138- } ) ;
117+ if ( ! expectations . length ) {
118+ return ;
119+ }
139120
140- afterAll ( async ( ) => {
141- await cleanup ( ) ;
142- } ) ;
121+ let cleanup : CleanupFn ;
143122
144- test . each ( expectations ) (
145- '$name - $version | Should get the related metrics' ,
146- ( { name, expectedMetrics } ) => {
147- const metricNames = metrics [ name ] . map ( ( metric ) => metric . metric ) . sort ( ) ;
148- expect ( metricNames ) . toEqual ( expect . arrayContaining ( expectedMetrics ) ) ;
123+ beforeAll ( async ( ) => {
124+ const pluginConfig : Options = {
125+ telemetry : {
126+ enableTracing : true ,
127+ endPoint : FAKE_URL ,
128+ filters : [ ] ,
149129 } ,
150- ) ;
151- }
130+ logLevel : 'warn' ,
131+ customPlugins : ( options : Options , context : GlobalContext ) =>
132+ debugFilesPlugins ( context ) ,
133+ } ;
134+ // This one is called at initialization, with the initial context.
135+ addMetricsMocked . mockImplementation ( getAddMetricsImplem ( metrics ) ) ;
136+ cleanup = await runBundlers ( pluginConfig , getComplexBuildOverrides ( ) , activeBundlers ) ;
137+ } ) ;
138+
139+ afterAll ( async ( ) => {
140+ await cleanup ( ) ;
141+ } ) ;
142+
143+ test . each ( expectations ) (
144+ '$name - $version | Should get the related metrics' ,
145+ ( { name, expectedMetrics } ) => {
146+ const metricNames = metrics [ name ] . map ( ( metric ) => metric . metric ) . sort ( ) ;
147+ expect ( metricNames ) . toEqual ( expect . arrayContaining ( expectedMetrics ) ) ;
148+ } ,
149+ ) ;
152150 } ) ;
153151
154152 describe ( 'Without enableTracing' , ( ) => {
0 commit comments