File tree Expand file tree Collapse file tree 4 files changed +15
-3
lines changed
benchmark.js-plugin/benches Expand file tree Collapse file tree 4 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 1+ import { logDebug } from "@codspeed/core" ;
12import Benchmark from "benchmark" ;
23import { withCodSpeed } from ".." ;
34import parsePr from "./parsePr" ;
@@ -11,7 +12,7 @@ const LONG_BODY =
1112
1213const suite = withCodSpeed ( new Benchmark . Suite ( ) ) ;
1314
14- console . log ( `PROCESS PID: ${ process . pid } in ${ __filename } ` ) ;
15+ logDebug ( `PROCESS PID: ${ process . pid } in ${ __filename } ` ) ;
1516
1617suite
1718 . add ( "RegExp#test" , function ( ) {
Original file line number Diff line number Diff line change @@ -8,3 +8,12 @@ export function getGitDir(path: string): string | undefined {
88 } as FindupOptions ) ;
99 return dotGitPath ? dirname ( dotGitPath ) : undefined ;
1010}
11+
12+ /**
13+ * Log debug messages if the environment variable `CODSPEED_DEBUG` is set.
14+ */
15+ export function logDebug ( ...args : unknown [ ] ) {
16+ if ( process . env . CODSPEED_DEBUG ) {
17+ console . log ( ...args ) ;
18+ }
19+ }
Original file line number Diff line number Diff line change 1+ import { logDebug } from "@codspeed/core" ;
12import { Bench } from "tinybench" ;
23import { withCodSpeed } from ".." ;
34import parsePr from "./parsePr" ;
@@ -11,7 +12,7 @@ const LONG_BODY =
1112
1213const bench = withCodSpeed ( new Bench ( { time : 100 } ) ) ;
1314
14- console . log ( `PROCESS PID: ${ process . pid } in ${ __filename } ` ) ;
15+ logDebug ( `PROCESS PID: ${ process . pid } in ${ __filename } ` ) ;
1516
1617bench
1718 . add ( "switch 1" , ( ) => {
Original file line number Diff line number Diff line change 11import {
22 getGitDir ,
3+ logDebug ,
34 Measurement ,
45 optimizeFunction ,
56 setupCore ,
@@ -66,7 +67,7 @@ function patchRootSuiteWithFullFilePath(suite: Suite) {
6667
6768class CodSpeedRunner extends NodeBenchmarkRunner {
6869 async runSuite ( suite : Suite ) : Promise < void > {
69- logCodSpeed ( `PROCESS PID: ${ process . pid } in ${ __filename } ` ) ;
70+ logDebug ( `PROCESS PID: ${ process . pid } in ${ __filename } ` ) ;
7071 setupCore ( ) ;
7172
7273 patchRootSuiteWithFullFilePath ( suite ) ;
You can’t perform that action at this time.
0 commit comments