File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed
packages/tinybench-plugin Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 33 getGitDir ,
44 InstrumentHooks ,
55 mongoMeasurement ,
6+ setupCore ,
67 SetupInstrumentsRequestBody ,
78 SetupInstrumentsResponse ,
89 tryIntrospect ,
@@ -22,6 +23,7 @@ export function withCodSpeed(bench: Bench): Bench {
2223 if ( codspeedRunnerMode === "disabled" ) {
2324 return bench ;
2425 }
26+ setupCore ( ) ;
2527
2628 const rootCallingFile = getCallingFile ( ) ;
2729
Original file line number Diff line number Diff line change 22 InstrumentHooks ,
33 mongoMeasurement ,
44 optimizeFunction ,
5- setupCore ,
65 teardownCore ,
76} from "@codspeed/core" ;
87import { Bench , Fn , FnOptions } from "tinybench" ;
@@ -18,7 +17,6 @@ export function runInstrumentedBench(
1817 console . log (
1918 `[CodSpeed] running with @codspeed/tinybench v${ __VERSION__ } (instrumented mode)`
2019 ) ;
21- setupCore ( ) ;
2220
2321 for ( const task of bench . tasks ) {
2422 const uri = getTaskUri ( bench , task . name , rootCallingFile ) ;
Original file line number Diff line number Diff line change @@ -205,7 +205,7 @@ describe("Benchmark.Suite", () => {
205205 expect ( afterAll ) . toHaveBeenCalledTimes ( 2 ) ;
206206 } ) ;
207207
208- it ( "should call setupCore and teardownCore only once after run() " , async ( ) => {
208+ it ( "should call setupCore and teardownCore only once" , async ( ) => {
209209 mockCore . InstrumentHooks . isInstrumented . mockReturnValue ( true ) ;
210210 const bench = withCodSpeed ( new Bench ( ) )
211211 . add ( "RegExp" , function ( ) {
@@ -215,7 +215,7 @@ describe("Benchmark.Suite", () => {
215215 / o / . test ( "Hello World!" ) ;
216216 } ) ;
217217
218- expect ( mockCore . setupCore ) . not . toHaveBeenCalled ( ) ;
218+ expect ( mockCore . setupCore ) . toHaveBeenCalledTimes ( 1 ) ;
219219 expect ( mockCore . teardownCore ) . not . toHaveBeenCalled ( ) ;
220220
221221 await bench . run ( ) ;
You can’t perform that action at this time.
0 commit comments