Skip to content

Commit

Permalink
Initialize ChartJS will all plugins unconditionally
Browse files Browse the repository at this point in the history
This is mostly for convenience. I missed initializing the benchmark, but since we always do the same thing everywhere, I suspect I can just do it unconditionally.

Signed-off-by: Stefan Marr <git@stefan-marr.de>
  • Loading branch information
smarr committed Mar 23, 2024
1 parent 1efe3f6 commit 003e04f
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/backend/compare/charts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ const marginTopWithTitle = 34;
const marginBottom = 28;
const perEntryHeight = 34;

export function initChartJS(): void {
/** Register all standard plugins. This is for convenience. */
function initChartJS(): void {
Chart.register(...registerables);
}
initChartJS();

function calculatePlotHeight(title: string | null, data: ChangeData): number {
const result = marginBottom + data.labels.length * perEntryHeight;
Expand Down
2 changes: 0 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ import {
} from './backend/rebench/results.js';
import { setTimeout } from 'node:timers/promises';
import { reportConnectionRefused } from './shared/errors.js';
import { initChartJS } from './backend/compare/charts.js';

log.info('Starting ReBenchDB Version ' + rebenchVersion);

Expand Down Expand Up @@ -218,7 +217,6 @@ async function tryToConnect(n: number): Promise<boolean> {
}

await initPerfTracker(db);
initChartJS();

log.info(`Starting server on http://localhost:${siteConfig.port}`);
app.listen(siteConfig.port);
Expand Down
2 changes: 0 additions & 2 deletions tests/backend/compare/charts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
import { robustPath } from '../../../src/backend/util.js';
import {
createCanvas,
initChartJS,
renderInlinePlot,
renderOverviewPlots
} from '../../../src/backend/compare/charts.js';
Expand All @@ -26,7 +25,6 @@ import {
} from '../../payload.js';

initJestMatchers();
initChartJS();

const outputFolder = isRequestedToUpdateExpectedData()
? robustPath('../tests/data/expected-results/charts')
Expand Down
2 changes: 0 additions & 2 deletions tests/backend/compare/compare-view.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ import {
loadCompareViewJsSomPayload,
loadCompareViewTSomPayload
} from '../../payload.js';
import { initChartJS } from '../../../src/backend/compare/charts.js';

initJestMatchers();
initChartJS();

const dataJsSOM = loadCompareViewJsSomPayload();
const dataTruffleSOM = loadCompareViewTSomPayload();
Expand Down
2 changes: 0 additions & 2 deletions tests/backend/compare/prep-data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@ import {
loadCompareViewJsSomPayload,
loadCompareViewTSomPayload
} from '../../payload.js';
import { initChartJS } from '../../../src/backend/compare/charts.js';

initJestMatchers();
initChartJS();

describe('compareStringOrNull()', () => {
it('should compare null and null', () => {
Expand Down

0 comments on commit 003e04f

Please sign in to comment.